Added menus to contact view + refreshed contact after edition
BIN
res/drawable-xlarge-land/bottom.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
res/drawable-xlarge-land/chat_default.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
res/drawable-xlarge-land/chat_over.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
res/drawable-xlarge-land/chat_selected.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
res/drawable-xlarge-land/contacts_default.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
res/drawable-xlarge-land/contacts_over.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
res/drawable-xlarge-land/contacts_selected.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
res/drawable-xlarge-land/dialer_address_background.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
res/drawable-xlarge-land/history_default.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
res/drawable-xlarge-land/history_over.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
res/drawable-xlarge-land/history_selected.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
res/drawable-xlarge-land/settings_default.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
res/drawable-xlarge-land/settings_over.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
res/drawable-xlarge-land/settings_selected.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
res/drawable-xlarge-land/statebar_background.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
res/drawable-xlarge/add_call__moreover.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
res/drawable-xlarge/add_call_more_default.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
res/drawable-xlarge/add_call_more_disabled.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
res/drawable-xlarge/add_contact_default.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
res/drawable-xlarge/add_contact_disabled.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
res/drawable-xlarge/add_contact_over.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
res/drawable-xlarge/backspace_default.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
res/drawable-xlarge/backspace_disabled.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
res/drawable-xlarge/backspace_over.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
res/drawable-xlarge/bottom.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
res/drawable-xlarge/call_default.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
res/drawable-xlarge/call_disabled.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
res/drawable-xlarge/call_over.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
res/drawable-xlarge/cancel_white_bg_default.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
res/drawable-xlarge/cancel_white_bg_disabled.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
res/drawable-xlarge/cancel_white_bg_over.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
res/drawable-xlarge/chat_default.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
res/drawable-xlarge/chat_over.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
res/drawable-xlarge/chat_selected.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
res/drawable-xlarge/conference_default.png
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
res/drawable-xlarge/conference_over.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
res/drawable-xlarge/contacts_default.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
res/drawable-xlarge/contacts_over.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
res/drawable-xlarge/contacts_selected.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
res/drawable-xlarge/dialer_address_background.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
BIN
res/drawable-xlarge/dialer_alt_default.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
res/drawable-xlarge/dialer_alt_over.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable-xlarge/hangup_default.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
res/drawable-xlarge/hangup_over.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
res/drawable-xlarge/history_default.png
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
res/drawable-xlarge/history_over.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
res/drawable-xlarge/history_selected.png
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
res/drawable-xlarge/micro_off_default.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
res/drawable-xlarge/micro_off_disabled.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
res/drawable-xlarge/micro_off_over.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
res/drawable-xlarge/micro_on_default.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
res/drawable-xlarge/micro_on_disabled.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
res/drawable-xlarge/micro_on_over.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
res/drawable-xlarge/options_add_default.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
res/drawable-xlarge/options_add_disabled.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
res/drawable-xlarge/options_add_over.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
res/drawable-xlarge/options_default.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
res/drawable-xlarge/options_disabled.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
res/drawable-xlarge/options_over.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
res/drawable-xlarge/options_selected.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/drawable-xlarge/options_transfer_default.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
res/drawable-xlarge/options_transfer_disabled.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
res/drawable-xlarge/options_transfer_over.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
res/drawable-xlarge/pause_off_default.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable-xlarge/pause_off_over.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
res/drawable-xlarge/pause_on_default.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
res/drawable-xlarge/pause_on_over.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
res/drawable-xlarge/settings_default.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
res/drawable-xlarge/settings_over.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
res/drawable-xlarge/settings_selected.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
res/drawable-xlarge/speaker_off_default.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/drawable-xlarge/speaker_off_disabled.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
res/drawable-xlarge/speaker_off_over.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
res/drawable-xlarge/speaker_on_default.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
res/drawable-xlarge/speaker_on_disabled.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
res/drawable-xlarge/speaker_on_over.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
res/drawable-xlarge/statebar_background.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
res/drawable-xlarge/transfer_default.png
Normal file
After Width: | Height: | Size: 8 KiB |
BIN
res/drawable-xlarge/transfer_over.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
res/drawable-xlarge/video_off_default.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
res/drawable-xlarge/video_off_disabled.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
res/drawable-xlarge/video_off_over.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
res/drawable-xlarge/video_on_default.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
res/drawable-xlarge/video_on_disabled.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
res/drawable-xlarge/video_on_over.png
Normal file
After Width: | Height: | Size: 4 KiB |
8
res/drawable/back.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/back_over" />
|
||||
<item
|
||||
android:drawable="@drawable/back_default" />
|
||||
</selector>
|
||||
|
BIN
res/drawable/back_default.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
res/drawable/back_over.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
8
res/drawable/contact_edit.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/contact_edit_over" />
|
||||
<item
|
||||
android:drawable="@drawable/contact_edit_default" />
|
||||
</selector>
|
||||
|
BIN
res/drawable/contact_edit_default.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
res/drawable/contact_edit_over.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
|
@ -6,6 +6,41 @@
|
|||
android:background="@drawable/background"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:src="@drawable/back"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/editContact"
|
||||
android:src="@drawable/chat_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/content_description_add_contact"
|
||||
android:id="@+id/newContact"
|
||||
android:src="@drawable/new_contact"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
|
||||
|
@ -81,4 +84,9 @@ public class Contact implements Serializable {
|
|||
public void setNumerosOrAddresses(List<String> numerosOrAddresses) {
|
||||
this.numerosOrAddresses = numerosOrAddresses;
|
||||
}
|
||||
|
||||
public void refresh(ContentResolver cr) {
|
||||
this.numerosOrAddresses = Compatibility.extractContactNumbersAndAddresses(id, cr);
|
||||
this.name = Compatibility.refreshContactName(cr, id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.io.InputStream;
|
|||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.ui.AvatarWithShadow;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -29,23 +30,41 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class ContactFragment extends Fragment {
|
||||
public class ContactFragment extends Fragment implements OnClickListener {
|
||||
private Contact contact;
|
||||
private ImageView back, editContact, newContact;
|
||||
private OnClickListener dialListener, chatListener;
|
||||
private LayoutInflater inflater;
|
||||
private View view;
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
contact = (Contact) getArguments().getSerializable("Contact");
|
||||
contact.setNumerosOrAddresses(Compatibility.extractContactNumbersAndAddresses(contact.getID(), getActivity().getContentResolver()));
|
||||
|
||||
View view = inflater.inflate(R.layout.contact, container, false);
|
||||
this.inflater = inflater;
|
||||
view = inflater.inflate(R.layout.contact, container, false);
|
||||
|
||||
back = (ImageView) view.findViewById(R.id.back);
|
||||
back.setOnClickListener(this);
|
||||
editContact = (ImageView) view.findViewById(R.id.editContact);
|
||||
editContact.setOnClickListener(this);
|
||||
newContact = (ImageView) view.findViewById(R.id.newContact);
|
||||
newContact.setOnClickListener(this);
|
||||
|
||||
chatListener = getChatListener();
|
||||
dialListener = getDialListener();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void displayContact(LayoutInflater inflater, View view) {
|
||||
AvatarWithShadow contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture);
|
||||
if (contact.getPhotoUri() != null) {
|
||||
InputStream input = Compatibility.getContactPictureInputStream(getActivity().getContentResolver(), contact.getID());
|
||||
|
@ -54,14 +73,11 @@ public class ContactFragment extends Fragment {
|
|||
contactPicture.setBackgroundResource(R.drawable.unknown_small);
|
||||
}
|
||||
|
||||
chatListener = getChatListener();
|
||||
dialListener = getDialListener();
|
||||
|
||||
TextView contactName = (TextView) view.findViewById(R.id.contactName);
|
||||
contactName.setText(contact.getName());
|
||||
|
||||
TableLayout controls = (TableLayout) view.findViewById(R.id.controls);
|
||||
|
||||
controls.removeAllViews();
|
||||
for (String numberOrAddress : contact.getNumerosOrAddresses()) {
|
||||
View v = inflater.inflate(R.layout.contact_control_row, null);
|
||||
|
||||
|
@ -79,8 +95,6 @@ public class ContactFragment extends Fragment {
|
|||
|
||||
controls.addView(v);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,6 +103,8 @@ public class ContactFragment extends Fragment {
|
|||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACT);
|
||||
}
|
||||
contact.refresh(getActivity().getContentResolver());
|
||||
displayContact(inflater, view);
|
||||
}
|
||||
|
||||
public OnClickListener getDialListener() {
|
||||
|
@ -108,4 +124,26 @@ public class ContactFragment extends Fragment {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
Intent intent;
|
||||
|
||||
switch (id) {
|
||||
case R.id.back:
|
||||
LinphoneActivity.instance().onBackPressed();
|
||||
break;
|
||||
|
||||
case R.id.editContact:
|
||||
intent = Compatibility.prepareEditContactIntent(Integer.parseInt(contact.getID()));
|
||||
startActivity(intent);
|
||||
break;
|
||||
|
||||
case R.id.newContact:
|
||||
intent = Compatibility.prepareAddContactIntent("", "");
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,4 +267,12 @@ public class ApiFivePlus {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String refreshContactName(ContentResolver cr, String id) {
|
||||
Cursor c = getGeneralContactCursor(cr, Data.CONTACT_ID + " = '" + id + "'", false);
|
||||
if (c.moveToFirst()) {
|
||||
return getContactDisplayName(c);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,4 +167,13 @@ public class Compatibility {
|
|||
}
|
||||
return notif;
|
||||
}
|
||||
|
||||
public static String refreshContactName(ContentResolver cr, String id) {
|
||||
if (Version.sdkAboveOrEqual(5)) {
|
||||
return ApiFivePlus.refreshContactName(cr, id);
|
||||
} else {
|
||||
//TODO
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|