diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt index c0004de15..9482e32fe 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt @@ -2,6 +2,7 @@ package io.legado.app.ui.main.bookshelf.books import android.os.Bundle import android.view.View +import androidx.core.view.isGone import androidx.lifecycle.LiveData import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.GridLayoutManager @@ -23,8 +24,12 @@ import io.legado.app.ui.audio.AudioPlayActivity import io.legado.app.ui.book.info.BookInfoActivity import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.main.MainViewModel -import io.legado.app.utils.* +import io.legado.app.utils.getPrefInt +import io.legado.app.utils.getViewModelOfActivity +import io.legado.app.utils.observeEvent +import io.legado.app.utils.startActivity import kotlinx.android.synthetic.main.fragment_books.* +import kotlinx.android.synthetic.main.view_empty.* import org.jetbrains.anko.startActivity import kotlin.math.max @@ -55,6 +60,7 @@ class BooksFragment : BaseFragment(R.layout.fragment_books), position = it.getInt("position", 0) groupId = it.getLong("groupId", -1) } + tv_empty_msg.setText(R.string.bookshelf_empty) initRecyclerView() upRecyclerData() } @@ -104,6 +110,7 @@ class BooksFragment : BaseFragment(R.layout.fragment_books), else -> App.db.bookDao().observeByGroup(groupId) } bookshelfLiveData?.observe(this, { list -> + vw_empty.isGone = list.isNotEmpty() val books = when (getPrefInt(PreferKey.bookshelfSort)) { 1 -> list.sortedByDescending { it.latestChapterTime } 2 -> list.sortedBy { it.name } diff --git a/app/src/main/res/layout/fragment_books.xml b/app/src/main/res/layout/fragment_books.xml index 30f8ce74c..76a26a844 100644 --- a/app/src/main/res/layout/fragment_books.xml +++ b/app/src/main/res/layout/fragment_books.xml @@ -1,12 +1,23 @@ - + android:layout_height="match_parent" + xmlns:tools="http://schemas.android.com/tools"> - + android:layout_height="match_parent"> + + + + + + + + - \ No newline at end of file diff --git a/app/src/main/res/layout/view_empty.xml b/app/src/main/res/layout/view_empty.xml new file mode 100644 index 000000000..96eb611dd --- /dev/null +++ b/app/src/main/res/layout/view_empty.xml @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_no_book.xml b/app/src/main/res/layout/view_no_book.xml deleted file mode 100644 index 77d9ef65f..000000000 --- a/app/src/main/res/layout/view_no_book.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 7fb96aa3c..45d5d54bf 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -45,7 +45,7 @@ 最近閲讀 最後閲讀 更新日誌 - 書架還空着,快去添加吧! + 書架還空著,先去搜索書籍或從發現裏添加吧!\n如果初次使用請先關註公眾號[開源閱讀]獲取書源! 搜尋 下載 列表 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 2cfe6ff7a..8996f0491 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -45,7 +45,7 @@ 最近閱讀 最後閱讀 更新日誌 - 書架還空著,先去添加吧! + 書架還空著,先去搜索書籍或從發現裏添加吧!\n如果初次使用請先關註公眾號[開源閱讀]獲取書源! 搜尋 下載 列表 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index d9a62c811..3c473b05e 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -47,7 +47,7 @@ 最近阅读 最后阅读 更新日志 - 书架还空着,先去添加吧! + 书架还空着,先去搜索书籍或从发现里添加吧!\n如果初次使用请先关注公众号[开源阅读]获取书源! 搜索 下载 列表 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9186d4e20..ed78926eb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -48,7 +48,7 @@ Recent reading Last reading What\'s new - Still empty,please add it first. + The bookshelf is still empty. Search for books or add them from discovery! \n if you use it for the first time, please pay attention to the public account [开源阅读] to get the book source! Search Download List