feat: Display the source error in the sources list.
This commit is contained in:
parent
c718b966a1
commit
ba2758c0a3
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/deleteBtn"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/ic_remove_circle_outline_black_24dp"
|
||||
android:backgroundTint="?android:textColorSecondary"
|
||||
android:contentDescription="@string/remove_source"
|
||||
android:elevation="4dp"
|
||||
app:iconSize="34dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/itemImage"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:importantForAccessibility="no"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sourceTitle"
|
||||
@ -25,26 +47,30 @@
|
||||
android:gravity="start"
|
||||
android:maxLines="1"
|
||||
android:textAlignment="textStart"
|
||||
android:textSize="13sp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/errorText"
|
||||
app:layout_constraintEnd_toStartOf="@+id/deleteBtn"
|
||||
app:layout_constraintStart_toEndOf="@+id/itemImage"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="source title" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/deleteBtn"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@drawable/ic_remove_circle_outline_black_24dp"
|
||||
android:backgroundTint="?android:textColorSecondary"
|
||||
android:elevation="4dp"
|
||||
android:contentDescription="@string/remove_source"
|
||||
<TextView
|
||||
android:id="@+id/errorText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/red"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/itemImage"
|
||||
tools:text="Test"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user