Use the searching text to specify load state

This commit is contained in:
Abandoned Cart 2023-04-22 05:51:42 -04:00 committed by Billy Laws
parent 30aee55122
commit 178dbea801
2 changed files with 10 additions and 5 deletions

View File

@ -263,13 +263,20 @@ class MainActivity : AppCompatActivity() {
} }
private fun loadRoms(loadFromFile : Boolean) { private fun loadRoms(loadFromFile : Boolean) {
if (!loadFromFile) {
binding.romPlaceholder.isVisible = true
binding.romPlaceholder.text = getString(R.string.searching_roms)
}
viewModel.loadRoms(this, loadFromFile, Uri.parse(appSettings.searchLocation), EmulationSettings.global.systemLanguage) viewModel.loadRoms(this, loadFromFile, Uri.parse(appSettings.searchLocation), EmulationSettings.global.systemLanguage)
appSettings.refreshRequired = false appSettings.refreshRequired = false
} }
private fun populateAdapter() { private fun populateAdapter() {
val items = getAppItems() val items = getAppItems()
binding.emptyPlaceholder.isVisible = items.isEmpty() if (items.isEmpty())
binding.romPlaceholder.text = getString(R.string.no_rom)
else
binding.romPlaceholder.isVisible = false
adapter.setItems(items) adapter.setItems(items)
} }

View File

@ -115,13 +115,12 @@
app:shapeAppearance="@style/ShapeAppearance.Material3.Corner.ExtraLarge" /> app:shapeAppearance="@style/ShapeAppearance.Material3.Corner.ExtraLarge" />
<TextView <TextView
android:id="@+id/empty_placeholder" android:id="@+id/rom_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:text="@string/searching_roms"
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>
@ -132,7 +131,6 @@
android:id="@+id/swipe_refresh_layout" android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="-8dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView