Add error icon on subscriptions screen (#6679)

This commit is contained in:
ByteHamster 2023-10-15 10:26:13 +02:00 committed by GitHub
parent 475e0f5128
commit 0efa91a0b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 2 deletions

View File

@ -216,6 +216,7 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
private final FrameLayout selectView; private final FrameLayout selectView;
private final CheckBox selectCheckbox; private final CheckBox selectCheckbox;
private final CardView card; private final CardView card;
private final View errorIcon;
public SubscriptionViewHolder(@NonNull View itemView) { public SubscriptionViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
@ -226,6 +227,7 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
selectView = itemView.findViewById(R.id.selectContainer); selectView = itemView.findViewById(R.id.selectContainer);
selectCheckbox = itemView.findViewById(R.id.selectCheckBox); selectCheckbox = itemView.findViewById(R.id.selectCheckBox);
card = itemView.findViewById(R.id.outerContainer); card = itemView.findViewById(R.id.outerContainer);
errorIcon = itemView.findViewById(R.id.errorIcon);
} }
public void bind(NavDrawerData.DrawerItem drawerItem) { public void bind(NavDrawerData.DrawerItem drawerItem) {
@ -249,9 +251,11 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
textAndImageCombined = feed.isLocalFeed() && feed.getImageUrl() != null textAndImageCombined = feed.isLocalFeed() && feed.getImageUrl() != null
&& feed.getImageUrl().startsWith(Feed.PREFIX_GENERATIVE_COVER); && feed.getImageUrl().startsWith(Feed.PREFIX_GENERATIVE_COVER);
coverLoader.withUri(feed.getImageUrl()); coverLoader.withUri(feed.getImageUrl());
errorIcon.setVisibility(feed.hasLastUpdateFailed() ? View.VISIBLE : View.GONE);
} else { } else {
textAndImageCombined = true; textAndImageCombined = true;
coverLoader.withResource(R.drawable.ic_tag); coverLoader.withResource(R.drawable.ic_tag);
errorIcon.setVisibility(View.GONE);
} }
if (UserPreferences.shouldShowSubscriptionTitle()) { if (UserPreferences.shouldShowSubscriptionTitle()) {
// No need for fallback title when already showing title // No need for fallback title when already showing title

View File

@ -57,6 +57,7 @@
android:layout_toStartOf="@id/txtvCount" android:layout_toStartOf="@id/txtvCount"
android:layout_toLeftOf="@id/txtvCount" android:layout_toLeftOf="@id/txtvCount"
android:visibility="gone" android:visibility="gone"
android:contentDescription="@string/refresh_failed_msg"
app:srcCompat="@drawable/ic_error" app:srcCompat="@drawable/ic_error"
app:tint="?attr/icon_red" app:tint="?attr/icon_red"
tools:text="!" /> tools:text="!" />

View File

@ -6,7 +6,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp"> android:padding="4dp"
tools:layout_width="150dp">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/outerContainer" android:id="@+id/outerContainer"
@ -70,6 +71,18 @@
android:textSize="14sp" android:textSize="14sp"
style="@style/TextPill" /> style="@style/TextPill" />
<ImageView
android:id="@+id/errorIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_alignBottom="@id/coverImage"
android:layout_margin="8dp"
android:visibility="gone"
android:contentDescription="@string/refresh_failed_msg"
app:srcCompat="@drawable/ic_error"
tools:visibility="visible" />
</RelativeLayout> </RelativeLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View File

@ -4,6 +4,9 @@
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="#FFFFFF" android:fillColor="?android:attr/colorBackground"
android:pathData="M12 1C5.9 1 1 5.9 1 12s4.9 11 11 11 11-4.9 11-11S18.1 1 12 1z" />
<path
android:fillColor="?attr/icon_red"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z" /> android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z" />
</vector> </vector>