mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-24 07:08:09 +00:00
Fix UI problems and linphone friend display name
This commit is contained in:
parent
72328025d2
commit
71926ccd16
18 changed files with 212 additions and 141 deletions
|
|
@ -1,22 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:background="@color/colorG"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/top_bar"
|
||||
android:background="@color/colorF"
|
||||
android:background="@color/colorC"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:visibility="visible"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/menu_name"
|
||||
android:text="@string/about"
|
||||
style="@style/font1"
|
||||
style="@style/font6"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
|
|
@ -24,70 +23,88 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/cancel"
|
||||
android:src="@drawable/dialer_back"
|
||||
android:layout_width="60dp"
|
||||
android:src="@drawable/footer_dialer"
|
||||
android:contentDescription="@string/content_description_dialer"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="12dp"
|
||||
android:padding="15dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/linphone_logo_orange"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="10dp" />
|
||||
<LinearLayout
|
||||
android:layout_below="@id/top_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:text="@string/app_name"
|
||||
style="@style/font5"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageView
|
||||
android:src="@drawable/linphone_logo"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
android:paddingTop="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_text"
|
||||
android:text="@string/about_text"
|
||||
style="@style/font9"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:text="@string/app_name"
|
||||
style="@style/font2"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_link"
|
||||
android:text="@string/about_link"
|
||||
android:autoLink="web"
|
||||
style="@style/font9"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/about_text"
|
||||
android:text="@string/about_text"
|
||||
style="@style/font9"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center">
|
||||
<TextView
|
||||
android:id="@+id/about_link"
|
||||
android:text="@string/about_link"
|
||||
android:autoLink="web"
|
||||
style="@style/font9"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/send_log"
|
||||
android:padding="10dp"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_send_log"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/reset_log"
|
||||
android:padding="10dp"
|
||||
android:layout_margin="5dp"
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_reset_log"/>
|
||||
</LinearLayout>
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center">
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/send_log"
|
||||
android:padding="10dp"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_send_log"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/reset_log"
|
||||
android:padding="10dp"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_reset_log"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/logo_orange"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_margin="30dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true" android:layout_gravity="right"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
|||
|
|
@ -3,43 +3,56 @@
|
|||
android:background="@color/colorG"
|
||||
android:layout_height="60dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_picture"
|
||||
android:src="@drawable/avatar"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"/>
|
||||
<View
|
||||
android:background="@color/colorF"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contact_name"
|
||||
style="@style/font9"
|
||||
android:singleLine="true"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|left"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="10dp"/>
|
||||
<LinearLayout
|
||||
android:padding="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_margin="2dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Chronometer
|
||||
android:id="@+id/call_timer"
|
||||
style="@style/font12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center_vertical|right"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/call_pause"
|
||||
android:src="@drawable/pause_small_default"
|
||||
android:contentDescription="@string/content_description_pause"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center_vertical"/>
|
||||
<ImageView
|
||||
android:id="@+id/contact_picture"
|
||||
android:src="@drawable/avatar"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contact_name"
|
||||
style="@style/font9"
|
||||
android:singleLine="true"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|left"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
<Chronometer
|
||||
android:id="@+id/call_timer"
|
||||
style="@style/font12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center_vertical|right"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/call_pause"
|
||||
android:src="@drawable/pause_small_default"
|
||||
android:contentDescription="@string/content_description_pause"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:padding="15dp"/>
|
||||
android:padding="12dp"/>
|
||||
|
||||
<View
|
||||
android:background="@color/colorF"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<ImageView
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
android:background="@color/colorA"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_height="30dp"
|
||||
android:gravity="center"/>
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
android:contentDescription="@string/content_description_valid"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="12dp"
|
||||
android:padding="10dp"
|
||||
android:layout_toLeftOf="@id/delete"/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
android:contentDescription="@string/content_description_valid"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="12dp"
|
||||
android:padding="10dp"
|
||||
android:layout_toLeftOf="@id/delete"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
android:id="@+id/all_calls"
|
||||
android:src="@drawable/history_all_button"
|
||||
android:contentDescription="@string/content_description_all_calls"
|
||||
android:padding="15dp"
|
||||
android:padding="12dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
android:id="@+id/missed_calls"
|
||||
android:src="@drawable/history_missed_button"
|
||||
android:contentDescription="@string/content_description_missed_calls"
|
||||
android:padding="15dp"
|
||||
android:padding="12dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@
|
|||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:src="@drawable/back_button"
|
||||
android:contentDescription="@string/content_description_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:padding="20dp"
|
||||
android:padding="15dp"
|
||||
android:adjustViewBounds="true"/>
|
||||
|
||||
<View
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@
|
|||
<ImageView
|
||||
android:id="@+id/history_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="18dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:contentDescription="@string/content_description_history"
|
||||
android:src="@drawable/footer_history"/>
|
||||
|
|
@ -141,7 +142,7 @@
|
|||
android:src="@drawable/footer_chat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:padding="18dp"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<TextView
|
||||
|
|
@ -210,7 +211,7 @@
|
|||
android:gravity="bottom"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp">
|
||||
android:layout_height="50dp">
|
||||
|
||||
|
||||
<ImageView
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/contact_name"
|
||||
style="@style/font6"
|
||||
style="@style/font2"
|
||||
android:lines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -26,11 +26,13 @@ import org.linphone.core.LinphoneCall.State;
|
|||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
|
|
@ -73,6 +75,12 @@ public class CallIncomingActivity extends Activity implements LinphoneSliderTrig
|
|||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
setContentView(R.layout.call_incoming);
|
||||
|
||||
if (getResources().getBoolean(R.bool.isTablet) && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
} else if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
|
||||
name = (TextView) findViewById(R.id.contact_name);
|
||||
number = (TextView) findViewById(R.id.contact_number);
|
||||
contactPicture = (ImageView) findViewById(R.id.contact_picture);
|
||||
|
|
@ -225,13 +233,18 @@ public class CallIncomingActivity extends Activity implements LinphoneSliderTrig
|
|||
return;
|
||||
}
|
||||
LinphoneAddress address = mCall.getRemoteAddress();
|
||||
LinphoneFriend friend = LinphoneManager.getLc().findFriendByAddress(address.asStringUriOnly());
|
||||
//Contact contact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), address);
|
||||
//if (contact != null) {
|
||||
//LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
// name.setText(contact.getName());
|
||||
//} else {
|
||||
|
||||
if(friend == null){
|
||||
name.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
//}
|
||||
} else {
|
||||
name.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
}
|
||||
number.setText(address.asStringUriOnly());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@ import org.linphone.core.LinphoneCall.State;
|
|||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
|
@ -67,6 +69,12 @@ public class CallOutgoingActivity extends Activity implements OnClickListener{
|
|||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
setContentView(R.layout.call_outgoing);
|
||||
|
||||
if (getResources().getBoolean(R.bool.isTablet) && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
} else if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
|
||||
name = (TextView) findViewById(R.id.contact_name);
|
||||
number = (TextView) findViewById(R.id.contact_number);
|
||||
contactPicture = (ImageView) findViewById(R.id.contact_picture);
|
||||
|
|
@ -141,15 +149,18 @@ public class CallOutgoingActivity extends Activity implements OnClickListener{
|
|||
}
|
||||
|
||||
LinphoneAddress address = mCall.getRemoteAddress();
|
||||
Log.w(mCall.getRemoteAddress().asStringUriOnly());
|
||||
/*Contact contact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), address);
|
||||
if (contact != null) {
|
||||
//LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
name.setText(contact.getName());
|
||||
} else {
|
||||
LinphoneFriend friend = LinphoneManager.getLc().findFriendByAddress(address.asStringUriOnly());
|
||||
//Contact contact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), address);
|
||||
//if (contact != null) {
|
||||
//LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
// name.setText(contact.getName());
|
||||
//} else {
|
||||
|
||||
}*/
|
||||
name.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
if(friend == null){
|
||||
name.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
} else {
|
||||
name.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
}
|
||||
number.setText(address.asStringUriOnly());
|
||||
Log.w(address.asStringUriOnly());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
Long time;
|
||||
|
||||
//Obiane specification
|
||||
LinphoneFriend friend = ContactsManager.getInstance().findLinphoneFriend(address);
|
||||
LinphoneFriend friend = LinphoneManager.getLc().findFriendByAddress(address.asStringUriOnly());
|
||||
|
||||
TextView lastMessageView = (TextView) view.findViewById(R.id.lastMessage);
|
||||
TextView date = (TextView) view.findViewById(R.id.date);
|
||||
|
|
@ -482,7 +482,12 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
}
|
||||
|
||||
displayName.setSelected(true); // For animation
|
||||
displayName.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
if(friend != null) {
|
||||
displayName.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
} else {
|
||||
displayName.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*if(contact != null){
|
||||
|
|
@ -510,12 +515,12 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
chatList.setItemChecked(position, b);
|
||||
if(getNbItemsChecked() == getCount()){
|
||||
if (getNbItemsChecked() == getCount()) {
|
||||
deselectAll.setVisibility(View.VISIBLE);
|
||||
selectAll.setVisibility(View.GONE);
|
||||
enabledDeleteButton(true);
|
||||
} else {
|
||||
if(getNbItemsChecked() == 0){
|
||||
if (getNbItemsChecked() == 0) {
|
||||
deselectAll.setVisibility(View.GONE);
|
||||
selectAll.setVisibility(View.VISIBLE);
|
||||
enabledDeleteButton(false);
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)) {
|
||||
searchCursor = ContactsManager.getInstance().searchFriends(search);
|
||||
indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
Log.w("Search indexer" + indexer.getSections().length);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getSearchContacts(), searchCursor));
|
||||
} else{
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
|
|
@ -241,6 +242,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
|
||||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)) {
|
||||
indexer = new AlphabetIndexer(allContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(allContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
Log.w("Contact indexer" + indexer.getSections().length);
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getAllContacts(), allContactsCursor));
|
||||
} else {
|
||||
|
|
@ -407,7 +409,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPositionForSection(int section) {
|
||||
return indexer.getPositionForSection(section);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ import android.provider.ContactsContract;
|
|||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
|
|
@ -38,6 +40,8 @@ import org.linphone.core.LinphoneProxyConfig;
|
|||
import org.linphone.mediastream.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
|
@ -595,6 +599,14 @@ public class ContactsManager {
|
|||
for(LinphoneFriend friend : LinphoneManager.getLc().getFriendList()){
|
||||
Contact contact = new Contact(friend.getRefKey(),friend.getAddress().asStringUriOnly(),LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
contactList.add(contact);
|
||||
|
||||
Collections.sort(contactList, new Comparator<Contact>() {
|
||||
@Override
|
||||
public int compare(Contact a, Contact b) {
|
||||
return a.getName().toLowerCase().compareTo(b.getName().toLowerCase());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
contactCursor = getFriendListCursor(contactList,true);
|
||||
|
|
@ -708,7 +720,6 @@ public class ContactsManager {
|
|||
public Cursor getFriendListCursor(List<Contact> contacts, boolean shouldGroupBy){
|
||||
String[] columns = new String[] { ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME };
|
||||
|
||||
|
||||
if (!shouldGroupBy) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,15 +17,13 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.app.Fragment;
|
||||
|
|
@ -73,12 +71,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
//addToContacts.setOnClickListener(this);
|
||||
|
||||
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
|
||||
contactName = (TextView) view.findViewById(R.id.contact_name);
|
||||
if (displayName == null) {
|
||||
displayName = LinphoneUtils.getUsernameFromAddress(sipUri);
|
||||
}
|
||||
|
||||
contactAddress = (TextView) view.findViewById(R.id.contact_address);
|
||||
|
||||
callDirection = (TextView) view.findViewById(R.id.direction);
|
||||
|
|
@ -92,13 +85,6 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
}
|
||||
|
||||
private void displayHistory(String status, String callTime, String callDate) {
|
||||
contactName.setText(displayName == null ? sipUri : displayName);
|
||||
if (displayName == null) {
|
||||
contactAddress.setText(LinphoneUtils.getUsernameFromAddress(sipUri));
|
||||
} else {
|
||||
contactAddress.setText(sipUri);
|
||||
}
|
||||
|
||||
time.setText(callTime == null ? "" : callTime);
|
||||
Long longDate = Long.parseLong(callDate);
|
||||
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format),false));
|
||||
|
|
@ -107,10 +93,16 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
try {
|
||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
//Obiane specification
|
||||
LinphoneFriend friend = ContactsManager.getInstance().findLinphoneFriend(lAddress);
|
||||
LinphoneFriend friend = LinphoneManager.getLc().findFriendByAddress(sipUri);
|
||||
|
||||
if(friend != null) {
|
||||
contactName.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
} else {
|
||||
contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
|
||||
}
|
||||
|
||||
contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
|
||||
contactPicture.setImageResource(R.drawable.avatar);
|
||||
contactAddress.setText(lAddress.asStringUriOnly());
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,8 +421,14 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
holder.callDirection.setImageResource(R.drawable.call_status_outgoing);
|
||||
}
|
||||
|
||||
LinphoneFriend friend = LinphoneManager.getLc().findFriendByAddress(address.asStringUriOnly());
|
||||
holder.contactPicture.setImageResource(R.drawable.avatar);
|
||||
holder.contact.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
|
||||
if(friend != null) {
|
||||
holder.contact.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
} else {
|
||||
holder.contact.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
}
|
||||
|
||||
if (isEditMode) {
|
||||
holder.select.setVisibility(View.VISIBLE);
|
||||
|
|
|
|||
|
|
@ -652,6 +652,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
mLc.setRootCA(mLinphoneRootCaFile);
|
||||
mLc.setPlayFile(mPauseSoundFile);
|
||||
mLc.setChatDatabasePath(mChatDatabaseFile);
|
||||
mLc.setRingback(mRingbackSoundFile);
|
||||
//mLc.setCallLogsDatabasePath(mCallLogDatabaseFile);
|
||||
//mLc.setCallErrorTone(Reason.NotFound, mErrorToneFile);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue