mirror of
https://gitlab.com/xynngh/YetAnotherCallBlocker.git
synced 2025-06-05 22:19:12 +02:00
Display blacklist name in call log and info dialog
This commit is contained in:
@@ -84,9 +84,7 @@ public class CallLogItemRecyclerViewAdapter extends GenericRecyclerViewAdapter
|
|||||||
|
|
||||||
NumberInfo numberInfo = item.numberInfo;
|
NumberInfo numberInfo = item.numberInfo;
|
||||||
|
|
||||||
label.setText(numberInfo.noNumber
|
label.setText(getLabel(context, item));
|
||||||
? context.getString(R.string.no_number)
|
|
||||||
: numberInfo.name != null ? numberInfo.name : item.number);
|
|
||||||
|
|
||||||
IconAndColor iconAndColor = IconAndColor.forNumberRating(
|
IconAndColor iconAndColor = IconAndColor.forNumberRating(
|
||||||
numberInfo.rating, numberInfo.contactItem != null);
|
numberInfo.rating, numberInfo.contactItem != null);
|
||||||
@@ -126,6 +124,21 @@ public class CallLogItemRecyclerViewAdapter extends GenericRecyclerViewAdapter
|
|||||||
time.setText(timeString);
|
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) {
|
private void bindTypeIcons(CallLogItemGroup group) {
|
||||||
List<CallLogItem> items = group.getItems();
|
List<CallLogItem> items = group.getItems();
|
||||||
|
|
||||||
|
@@ -64,12 +64,23 @@ public class InfoDialogHelper {
|
|||||||
featuredNameView.setVisibility(View.GONE);
|
featuredNameView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String blacklistName = null;
|
||||||
|
|
||||||
TextView inBlacklistView = view.findViewById(R.id.in_blacklist);
|
TextView inBlacklistView = view.findViewById(R.id.in_blacklist);
|
||||||
if (numberInfo.blacklistItem != null) {
|
if (numberInfo.blacklistItem != null) {
|
||||||
inBlacklistView.setVisibility(View.VISIBLE);
|
blacklistName = numberInfo.blacklistItem.getName();
|
||||||
if (numberInfo.contactItem != null) {
|
if (numberInfo.contactItem != null) {
|
||||||
inBlacklistView.setText(R.string.info_in_blacklist_contact);
|
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),
|
ReviewsSummaryHelper.populateSummary(view.findViewById(R.id.reviews_summary),
|
||||||
|
@@ -40,6 +40,17 @@
|
|||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
tools:text="Featured company name" />
|
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
|
<include
|
||||||
layout="@layout/reviews_summary"
|
layout="@layout/reviews_summary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -53,7 +64,6 @@
|
|||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="@string/info_in_blacklist"
|
android:text="@string/info_in_blacklist"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center" />
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Reference in New Issue
Block a user