From ba2758c0a314c93086f4097e8bc3548282638ef3 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 3 Jan 2023 21:28:40 +0100 Subject: [PATCH] feat: Display the source error in the sources list. --- .../android/adapters/SourcesListAdapter.kt | 8 +++ .../src/main/res/layout/source_list_item.xml | 56 ++++++++++++++----- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/SourcesListAdapter.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/SourcesListAdapter.kt index cffb8e7..4bf3436 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/SourcesListAdapter.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/SourcesListAdapter.kt @@ -4,6 +4,7 @@ import android.app.Activity import android.content.Context import android.content.Intent import android.view.LayoutInflater +import android.view.View import android.view.ViewGroup import android.widget.Button import android.widget.Toast @@ -60,6 +61,13 @@ class SourcesListAdapter( c.circularBitmapDrawable(itm.getIcon(repository.baseUrl), binding.itemImage) } + if (itm.error.isNotBlank()) { + binding.errorText.visibility = View.VISIBLE + binding.errorText.text = itm.error + } else { + binding.errorText.visibility = View.GONE + } + binding.sourceTitle.text = itm.title.getHtmlDecoded() } diff --git a/androidApp/src/main/res/layout/source_list_item.xml b/androidApp/src/main/res/layout/source_list_item.xml index 1671514..a948332 100644 --- a/androidApp/src/main/res/layout/source_list_item.xml +++ b/androidApp/src/main/res/layout/source_list_item.xml @@ -3,18 +3,40 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="48dp" + android:layout_height="wrap_content" android:orientation="vertical"> +