Improve how we use/set/show the border around the remote avatar
This commit is contained in:
parent
b702e39939
commit
a1f4aa7c75
11 changed files with 66 additions and 15 deletions
|
@ -163,7 +163,7 @@ public final class LinphoneService extends Service {
|
|||
super.onStartCommand(intent, flags, startId);
|
||||
|
||||
boolean isPush = false;
|
||||
if (intent.getBooleanExtra("PushNotification", false)) {
|
||||
if (intent != null && intent.getBooleanExtra("PushNotification", false)) {
|
||||
Log.i("[Service] [Push Notification] LinphoneService started because of a push");
|
||||
isPush = true;
|
||||
}
|
||||
|
|
|
@ -1472,10 +1472,10 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
if (lContact == null) {
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(lAddress);
|
||||
contactName.setText(displayName);
|
||||
ContactAvatar.displayAvatar(displayName, mAvatarLayout, R.drawable.avatar_mask_border);
|
||||
ContactAvatar.displayAvatar(displayName, mAvatarLayout, true);
|
||||
} else {
|
||||
contactName.setText(lContact.getFullName());
|
||||
ContactAvatar.displayAvatar(lContact, mAvatarLayout, R.drawable.avatar_mask_border);
|
||||
ContactAvatar.displayAvatar(lContact, mAvatarLayout, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,13 +185,11 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
Address address = mCall.getRemoteAddress();
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||
if (contact != null) {
|
||||
ContactAvatar.displayAvatar(
|
||||
contact, findViewById(R.id.avatar_layout), R.drawable.avatar_mask_border);
|
||||
ContactAvatar.displayAvatar(contact, findViewById(R.id.avatar_layout), true);
|
||||
mName.setText(contact.getFullName());
|
||||
} else {
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(address);
|
||||
ContactAvatar.displayAvatar(
|
||||
displayName, findViewById(R.id.avatar_layout), R.drawable.avatar_mask_border);
|
||||
ContactAvatar.displayAvatar(displayName, findViewById(R.id.avatar_layout), true);
|
||||
mName.setText(displayName);
|
||||
}
|
||||
mNumber.setText(address.asStringUriOnly());
|
||||
|
|
|
@ -185,13 +185,11 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
Address address = mCall.getRemoteAddress();
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||
if (contact != null) {
|
||||
ContactAvatar.displayAvatar(
|
||||
contact, findViewById(R.id.avatar_layout), R.drawable.avatar_mask_border);
|
||||
ContactAvatar.displayAvatar(contact, findViewById(R.id.avatar_layout), true);
|
||||
mName.setText(contact.getFullName());
|
||||
} else {
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(address);
|
||||
ContactAvatar.displayAvatar(
|
||||
displayName, findViewById(R.id.avatar_layout), R.drawable.avatar_mask_border);
|
||||
ContactAvatar.displayAvatar(displayName, findViewById(R.id.avatar_layout), true);
|
||||
mName.setText(displayName);
|
||||
}
|
||||
mNumber.setText(LinphoneUtils.getDisplayableAddress(address));
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.linphone.core.tools.Log;
|
|||
class ContactAvatarHolder {
|
||||
public final ImageView contactPicture;
|
||||
public final ImageView avatarMask;
|
||||
public final ImageView avatarBorder;
|
||||
public final ImageView securityLevel;
|
||||
public final TextView generatedAvatar;
|
||||
|
||||
|
@ -42,12 +43,14 @@ class ContactAvatarHolder {
|
|||
avatarMask = v.findViewById(R.id.mask);
|
||||
securityLevel = v.findViewById(R.id.security_level);
|
||||
generatedAvatar = v.findViewById(R.id.generated_avatar);
|
||||
avatarBorder = v.findViewById(R.id.border);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
contactPicture.setVisibility(View.VISIBLE);
|
||||
generatedAvatar.setVisibility(View.VISIBLE);
|
||||
securityLevel.setVisibility(View.GONE);
|
||||
avatarBorder.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +99,8 @@ public class ContactAvatar {
|
|||
}
|
||||
}
|
||||
|
||||
public static void displayAvatar(String displayName, View v, int maskResource) {
|
||||
public static void displayAvatar(
|
||||
String displayName, View v, boolean showBorder, int maskResource) {
|
||||
if (displayName == null || v == null) return;
|
||||
|
||||
ContactAvatarHolder holder = new ContactAvatarHolder(v);
|
||||
|
@ -120,10 +124,17 @@ public class ContactAvatar {
|
|||
if (maskResource != 0) {
|
||||
holder.avatarMask.setImageResource(maskResource);
|
||||
}
|
||||
if (showBorder) {
|
||||
holder.avatarBorder.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void displayAvatar(String displayName, View v, boolean showBorder) {
|
||||
displayAvatar(displayName, v, showBorder, 0);
|
||||
}
|
||||
|
||||
public static void displayAvatar(String displayName, View v) {
|
||||
displayAvatar(displayName, v, 0);
|
||||
displayAvatar(displayName, v, false, 0);
|
||||
}
|
||||
|
||||
public static void displayAvatar(
|
||||
|
@ -132,7 +143,8 @@ public class ContactAvatar {
|
|||
setSecurityLevel(securityLevel, v);
|
||||
}
|
||||
|
||||
public static void displayAvatar(LinphoneContact contact, View v, int maskResource) {
|
||||
public static void displayAvatar(
|
||||
LinphoneContact contact, View v, boolean showBorder, int maskResource) {
|
||||
if (contact == null || v == null) return;
|
||||
|
||||
ContactAvatarHolder holder = new ContactAvatarHolder(v);
|
||||
|
@ -176,10 +188,17 @@ public class ContactAvatar {
|
|||
if (maskResource != 0) {
|
||||
holder.avatarMask.setImageResource(maskResource);
|
||||
}
|
||||
if (showBorder) {
|
||||
holder.avatarBorder.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void displayAvatar(LinphoneContact contact, View v, boolean showBorder) {
|
||||
displayAvatar(contact, v, showBorder, 0);
|
||||
}
|
||||
|
||||
public static void displayAvatar(LinphoneContact contact, View v) {
|
||||
displayAvatar(contact, v, 0);
|
||||
displayAvatar(contact, v, false, 0);
|
||||
}
|
||||
|
||||
public static void displayAvatar(
|
||||
|
|
BIN
app/src/main/res/drawable-xhdpi/avatar_border.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/avatar_border.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
|
@ -30,6 +30,15 @@
|
|||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar_mask" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/border"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar_border"
|
||||
android:tint="?attr/accentColor" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/security_level"
|
||||
android:layout_width="20dp"
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar_mask" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/border"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar_border"
|
||||
android:tint="?attr/accentColor" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/security_level"
|
||||
android:layout_width="20dp"
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar_mask" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/border"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar_border"
|
||||
android:tint="?attr/accentColor" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/security_level"
|
||||
android:layout_width="20dp"
|
||||
|
|
|
@ -31,6 +31,15 @@
|
|||
android:src="@drawable/avatar_mask"
|
||||
android:tint="?attr/accentColor50"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/border"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar_border"
|
||||
android:tint="?attr/accentColor" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/security_level"
|
||||
android:layout_width="20dp"
|
||||
|
|
Loading…
Reference in a new issue