Simplify placeholder for empty items

This commit is contained in:
Abandoned Cart 2023-04-16 21:02:08 -04:00 committed by Billy Laws
parent b82452f8f8
commit 0b453ca4ed
2 changed files with 4 additions and 8 deletions

View File

@ -294,14 +294,9 @@ class MainActivity : AppCompatActivity() {
}
private fun populateAdapter() {
binding.textTitle.text = null
binding.textTitle.visibility = View.GONE
val items = getDataItems()
binding.emptyPlaceholder.isVisible = items.isEmpty()
adapter.setItems(items)
if (items.isEmpty()) {
binding.textTitle.visibility = View.VISIBLE
binding.textTitle.text = getString(R.string.no_rom)
}
}
override fun onStart() {

View File

@ -109,18 +109,19 @@
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="8dp"
android:layout_marginVertical="8dp"
app:cardUseCompatPadding="true"
app:layout_constraintTop_toBottomOf="@id/sub_text"
app:shapeAppearance="@style/ShapeAppearance.Material3.Corner.ExtraLarge" />
<TextView
android:id="@+id/text_title"
android:id="@+id/empty_placeholder"
style="?attr/textAppearanceTitleLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginVertical="8dp"
android:text="@string/no_rom"
android:textAlignment="viewStart"
app:layout_constraintTop_toBottomOf="@id/search_bar"/>
</androidx.constraintlayout.widget.ConstraintLayout>