kunfei 4 years ago
parent
commit
0e38e82a47

+ 2 - 0
app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt

@@ -3,6 +3,7 @@ package io.legado.app.ui.book.remote
 import android.annotation.SuppressLint
 import android.os.Bundle
 import androidx.activity.viewModels
+import androidx.core.view.isGone
 import androidx.recyclerview.widget.LinearLayoutManager
 import io.legado.app.R
 import io.legado.app.base.VMBaseActivity
@@ -40,6 +41,7 @@ class RemoteBookActivity : VMBaseActivity<ActivityRemoteBookBinding,RemoteBookVi
         launch {
             viewModel.dataFlow.conflate().collect { remoteBooks ->
                 binding.refreshProgressBar.isAutoLoading = false
+                binding.tvEmptyMsg.isGone = remoteBooks.isEmpty()
                 adapter.setItems(remoteBooks)
             }
         }

+ 25 - 15
app/src/main/res/layout/activity_remote_book.xml

@@ -2,25 +2,21 @@
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    xmlns:tools="http://schemas.android.com/tools">
 
     <io.legado.app.ui.widget.TitleBar
-        android:id="@+id/titleBar"
+        android:id="@+id/title_bar"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         app:layout_constraintTop_toTopOf="parent"
         app:title="远程书籍" />
 
-<!--    <io.legado.app.ui.widget.anima.RefreshProgressBar-->
-<!--        android:id="@+id/refresh_progress_bar"-->
-<!--        android:layout_width="match_parent"-->
-<!--        android:layout_height="2dp"-->
-<!--        app:layout_constraintTop_toBottomOf="@id/lay_top" />-->
     <io.legado.app.ui.widget.anima.RefreshProgressBar
         android:id="@+id/refresh_progress_bar"
         android:layout_width="match_parent"
         android:layout_height="2dp"
-        app:layout_constraintTop_toBottomOf="@id/titleBar" />
+        app:layout_constraintTop_toBottomOf="@id/title_bar" />
 
     <io.legado.app.ui.widget.dynamiclayout.DynamicFrameLayout
         android:id="@+id/content_view"
@@ -36,11 +32,25 @@
 
     </io.legado.app.ui.widget.dynamiclayout.DynamicFrameLayout>
 
-<!--    <io.legado.app.ui.widget.SelectActionBar-->
-<!--        android:id="@+id/select_action_bar"-->
-<!--        android:layout_width="match_parent"-->
-<!--        android:layout_height="wrap_content"-->
-<!--        app:layout_constraintBottom_toBottomOf="parent"-->
-<!--        app:layout_constraintTop_toBottomOf="@id/content_view"-->
-<!--        />-->
+    <!--    <io.legado.app.ui.widget.SelectActionBar-->
+    <!--        android:id="@+id/select_action_bar"-->
+    <!--        android:layout_width="match_parent"-->
+    <!--        android:layout_height="wrap_content"-->
+    <!--        app:layout_constraintBottom_toBottomOf="parent"-->
+    <!--        app:layout_constraintTop_toBottomOf="@id/content_view"-->
+    <!--        />-->
+
+    <TextView
+        android:id="@+id/tv_empty_msg"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_margin="16dp"
+        android:gravity="center"
+        android:visibility="visible"
+        android:text="webDav book文件夹为空"
+        app:layout_constraintTop_toBottomOf="@+id/title_bar"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        tools:text="Empty" />
 </androidx.constraintlayout.widget.ConstraintLayout>