Show text when no recipes found
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
tools:ignore="UnusedAttribute">
|
tools:ignore="UnusedAttribute">
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.MainActivity"
|
android:name=".ui.activity.MainActivity"
|
||||||
|
android:windowSoftInputMode="adjustPan"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class RecipesListFragment : Fragment(R.layout.fragment_recipes_list) {
|
|||||||
collectWhenViewResumed(recipesAdapter.onPagesUpdatedFlow) {
|
collectWhenViewResumed(recipesAdapter.onPagesUpdatedFlow) {
|
||||||
logger.v { "setupRecipeAdapter: pages updated" }
|
logger.v { "setupRecipeAdapter: pages updated" }
|
||||||
binding.refresher.isRefreshing = false
|
binding.refresher.isRefreshing = false
|
||||||
|
binding.emptyListText.isVisible = recipesAdapter.itemCount == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
collectWhenViewResumed(recipesAdapter.appendPaginationEnd()) {
|
collectWhenViewResumed(recipesAdapter.appendPaginationEnd()) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -8,21 +8,40 @@
|
|||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/refresher"
|
android:id="@+id/refresher"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recipes"
|
android:id="@+id/recipes"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
tools:itemCount="0"
|
||||||
tools:listitem="@layout/view_holder_recipe" />
|
tools:listitem="@layout/view_holder_recipe" />
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/empty_list_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/fragment_recipes_list_no_recipes"
|
||||||
|
android:textAppearance="?textAppearanceDisplaySmall"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.3" />
|
||||||
|
|
||||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||||
android:id="@+id/progress"
|
android:id="@+id/progress"
|
||||||
style="@style/IndeterminateProgress"
|
style="@style/IndeterminateProgress"
|
||||||
android:layout_width="wrap_content"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -50,4 +50,5 @@
|
|||||||
<string name="menu_navigation_drawer_change_url">Сменить URL</string>
|
<string name="menu_navigation_drawer_change_url">Сменить URL</string>
|
||||||
<string name="search_recipes_hint">Найти рецепты</string>
|
<string name="search_recipes_hint">Найти рецепты</string>
|
||||||
<string name="view_toolbar_navigation_icon_content_description">Открыть меню навигации</string>
|
<string name="view_toolbar_navigation_icon_content_description">Открыть меню навигации</string>
|
||||||
|
<string name="fragment_recipes_list_no_recipes">Нет рецептов</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -53,4 +53,5 @@
|
|||||||
<string name="search_recipes_hint">Search recipes</string>
|
<string name="search_recipes_hint">Search recipes</string>
|
||||||
<string name="menu_navigation_drawer_header" translatable="false">@string/app_name</string>
|
<string name="menu_navigation_drawer_header" translatable="false">@string/app_name</string>
|
||||||
<string name="view_toolbar_navigation_icon_content_description">Open navigation drawer</string>
|
<string name="view_toolbar_navigation_icon_content_description">Open navigation drawer</string>
|
||||||
|
<string name="fragment_recipes_list_no_recipes">No recipes</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user