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() { private fun populateAdapter() {
binding.textTitle.text = null
binding.textTitle.visibility = View.GONE
val items = getDataItems() val items = getDataItems()
binding.emptyPlaceholder.isVisible = items.isEmpty()
adapter.setItems(items) adapter.setItems(items)
if (items.isEmpty()) {
binding.textTitle.visibility = View.VISIBLE
binding.textTitle.text = getString(R.string.no_rom)
}
} }
override fun onStart() { override fun onStart() {

View File

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