Added a button to directly go to the contact from the history details view
This commit is contained in:
parent
bb74f21dfb
commit
a46002d16b
4 changed files with 26 additions and 12 deletions
BIN
res/drawable-xhdpi/contact.png
Normal file
BIN
res/drawable-xhdpi/contact.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -72,8 +72,7 @@
|
|||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="5dp"/>
|
||||
android:layout_alignParentLeft="true"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mask"
|
||||
|
@ -81,8 +80,7 @@
|
|||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="5dp"/>
|
||||
android:layout_alignParentLeft="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -36,6 +36,17 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="15dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/goto_contact"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/contact"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_contacts"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="15dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
|
@ -46,13 +57,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:padding="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/avatar_layout"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
@ -88,7 +97,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
|
|
@ -36,11 +36,12 @@ import android.widget.TextView;
|
|||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
||||
private ImageView dialBack, chat, addToContacts, back;
|
||||
private ImageView dialBack, chat, addToContacts, goToContact, back;
|
||||
private View view;
|
||||
private ImageView contactPicture, callDirection;
|
||||
private TextView contactName, contactAddress, time, date;
|
||||
private String sipUri, displayName, pictureUri;
|
||||
private LinphoneContact contact;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -72,6 +73,9 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
addToContacts = (ImageView) view.findViewById(R.id.add_contact);
|
||||
addToContacts.setOnClickListener(this);
|
||||
|
||||
goToContact = (ImageView) view.findViewById(R.id.goto_contact);
|
||||
goToContact.setOnClickListener(this);
|
||||
|
||||
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
|
||||
contactName = (TextView) view.findViewById(R.id.contact_name);
|
||||
|
@ -109,15 +113,17 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
|
||||
if (lAddress != null) {
|
||||
contactAddress.setText(lAddress.asStringUriOnly());
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||
contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||
if (contact != null) {
|
||||
contactName.setText(contact.getFullName());
|
||||
LinphoneUtils.setImagePictureFromUri(view.getContext(),contactPicture,contact.getPhotoUri(),contact.getThumbnailUri());
|
||||
addToContacts.setVisibility(View.INVISIBLE);
|
||||
addToContacts.setVisibility(View.GONE);
|
||||
goToContact.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
contactName.setText(displayName == null ? LinphoneUtils.getAddressDisplayName(sipUri) : displayName);
|
||||
contactPicture.setImageResource(R.drawable.avatar);
|
||||
addToContacts.setVisibility(View.VISIBLE);
|
||||
goToContact.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
contactAddress.setText(sipUri);
|
||||
|
@ -165,6 +171,8 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
Log.e(e);
|
||||
}
|
||||
LinphoneActivity.instance().displayContactsForEdition(uri);
|
||||
} else if (id == R.id.goto_contact) {
|
||||
LinphoneActivity.instance().displayContact(contact, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue