Display blacklist name in call log and info dialog
This commit is contained in:
parent
69dbdbc2fd
commit
e545365c66
|
@ -84,9 +84,7 @@ public class CallLogItemRecyclerViewAdapter extends GenericRecyclerViewAdapter
|
|||
|
||||
NumberInfo numberInfo = item.numberInfo;
|
||||
|
||||
label.setText(numberInfo.noNumber
|
||||
? context.getString(R.string.no_number)
|
||||
: numberInfo.name != null ? numberInfo.name : item.number);
|
||||
label.setText(getLabel(context, item));
|
||||
|
||||
IconAndColor iconAndColor = IconAndColor.forNumberRating(
|
||||
numberInfo.rating, numberInfo.contactItem != null);
|
||||
|
@ -126,6 +124,21 @@ public class CallLogItemRecyclerViewAdapter extends GenericRecyclerViewAdapter
|
|||
time.setText(timeString);
|
||||
}
|
||||
|
||||
private String getLabel(Context context, CallLogItem item) {
|
||||
NumberInfo numberInfo = item.numberInfo;
|
||||
|
||||
if (numberInfo.noNumber) return context.getString(R.string.no_number);
|
||||
|
||||
if (numberInfo.name != null) return numberInfo.name;
|
||||
|
||||
if (numberInfo.blacklistItem != null
|
||||
&& !TextUtils.isEmpty(numberInfo.blacklistItem.getName())) {
|
||||
return numberInfo.blacklistItem.getName();
|
||||
}
|
||||
|
||||
return item.number;
|
||||
}
|
||||
|
||||
private void bindTypeIcons(CallLogItemGroup group) {
|
||||
List<CallLogItem> items = group.getItems();
|
||||
|
||||
|
|
|
@ -64,12 +64,23 @@ public class InfoDialogHelper {
|
|||
featuredNameView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
String blacklistName = null;
|
||||
|
||||
TextView inBlacklistView = view.findViewById(R.id.in_blacklist);
|
||||
if (numberInfo.blacklistItem != null) {
|
||||
inBlacklistView.setVisibility(View.VISIBLE);
|
||||
blacklistName = numberInfo.blacklistItem.getName();
|
||||
if (numberInfo.contactItem != null) {
|
||||
inBlacklistView.setText(R.string.info_in_blacklist_contact);
|
||||
}
|
||||
} else {
|
||||
inBlacklistView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
TextView blacklistNameView = view.findViewById(R.id.blacklist_name);
|
||||
if (!TextUtils.isEmpty(blacklistName)) {
|
||||
blacklistNameView.setText(blacklistName);
|
||||
} else {
|
||||
blacklistNameView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ReviewsSummaryHelper.populateSummary(view.findViewById(R.id.reviews_summary),
|
||||
|
|
|
@ -40,6 +40,17 @@
|
|||
android:textSize="20sp"
|
||||
tools:text="Featured company name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blacklist_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLines="1"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp"
|
||||
tools:text="Blacklist name" />
|
||||
|
||||
<include
|
||||
layout="@layout/reviews_summary"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -53,7 +64,6 @@
|
|||
android:layout_marginTop="6dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/info_in_blacklist"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone" />
|
||||
android:textAlignment="center" />
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue