From b67bb916efd4974aa2bc8c35005b2fc81435d5e8 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 14 Oct 2020 20:43:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/main/bookshelf/books/BooksFragment.kt | 4 ++- .../app/ui/main/explore/ExploreFragment.kt | 6 ++-- .../io/legado/app/ui/main/rss/RssFragment.kt | 8 +++-- app/src/main/res/layout/fragment_rss.xml | 30 +++++++++++++++---- app/src/main/res/layout/item_rss.xml | 2 ++ app/src/main/res/values-zh-rHK/strings.xml | 2 ++ app/src/main/res/values-zh-rTW/strings.xml | 2 ++ app/src/main/res/values-zh/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 9 files changed, 48 insertions(+), 10 deletions(-) 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 216d6420c..eec10578c 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 @@ -32,7 +32,9 @@ import kotlinx.android.synthetic.main.fragment_books.* import org.jetbrains.anko.startActivity import kotlin.math.max - +/** + * 书架界面 + */ class BooksFragment : BaseFragment(R.layout.fragment_books), BaseBooksAdapter.CallBack { diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt index 610516a64..e1fb1c814 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt @@ -29,7 +29,9 @@ import kotlinx.android.synthetic.main.view_search.* import kotlinx.android.synthetic.main.view_title_bar.* import java.text.Collator - +/** + * 发现界面 + */ class ExploreFragment : VMBaseFragment(R.layout.fragment_find_book), ExploreAdapter.CallBack { override val viewModel: ExploreViewModel @@ -44,7 +46,7 @@ class ExploreFragment : VMBaseFragment(R.layout.fragment_find_ override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { setSupportToolbar(toolbar) - tv_empty_msg.text = "当前没有发现源,关注公众号[开源阅读]添加带发现的书源!" + tv_empty_msg.setText(R.string.explore_empty) initSearchView() initRecyclerView() initGroupData() diff --git a/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt b/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt index 82ccf867f..34e9f0dc5 100644 --- a/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt @@ -4,7 +4,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.view.View -import androidx.recyclerview.widget.GridLayoutManager +import androidx.core.view.isGone import io.legado.app.App import io.legado.app.R import io.legado.app.base.VMBaseFragment @@ -22,6 +22,9 @@ import io.legado.app.utils.startActivity import kotlinx.android.synthetic.main.fragment_rss.* import kotlinx.android.synthetic.main.view_title_bar.* +/** + * 订阅界面 + */ class RssFragment : VMBaseFragment(R.layout.fragment_rss), RssAdapter.CallBack { @@ -31,6 +34,7 @@ class RssFragment : VMBaseFragment(R.layout.fragment_rss), override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { setSupportToolbar(toolbar) + tv_empty_msg.setText(R.string.rss_source_empty) initRecyclerView() initData() } @@ -50,12 +54,12 @@ class RssFragment : VMBaseFragment(R.layout.fragment_rss), private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) adapter = RssAdapter(requireContext(), this) - recycler_view.layoutManager = GridLayoutManager(requireContext(), 4) recycler_view.adapter = adapter } private fun initData() { App.db.rssSourceDao().liveEnabled().observe(viewLifecycleOwner, { + tv_empty_msg.isGone = it.isNotEmpty() if (it.isEmpty()) { getViewModelOfActivity(MainViewModel::class.java).initRss() } diff --git a/app/src/main/res/layout/fragment_rss.xml b/app/src/main/res/layout/fragment_rss.xml index f1469fbd7..6d4bfdeeb 100644 --- a/app/src/main/res/layout/fragment_rss.xml +++ b/app/src/main/res/layout/fragment_rss.xml @@ -1,20 +1,40 @@ - + android:layout_height="match_parent" + android:orientation="vertical"> + android:layout_height="0dp" + app:layout_constraintTop_toBottomOf="@id/title_bar" + app:layout_constraintBottom_toBottomOf="parent" + app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" + app:spanCount="4" + tools:listitem="@layout/item_rss" /> - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_rss.xml b/app/src/main/res/layout/item_rss.xml index f3765bf58..3911221d6 100644 --- a/app/src/main/res/layout/item_rss.xml +++ b/app/src/main/res/layout/item_rss.xml @@ -1,6 +1,7 @@ @@ -24,6 +25,7 @@ android:gravity="top|center_horizontal" android:lines="2" android:ellipsize="end" + tools:text="RSS" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="@+id/iv_icon" /> diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 45d5d54bf..b107331c7 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -767,5 +767,7 @@ 分享選中書源 時間排序 全文搜索 + 关注公众号[开源阅读]获取订阅源! + 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8996f0491..f6ba89777 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -767,5 +767,7 @@ 分享選中書源 時間排序 全文搜尋 + 关注公众号[开源阅读]获取订阅源! + 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 3c473b05e..743147864 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -770,5 +770,7 @@ 切换默认主题 时间排序 全文搜索 + 关注公众号[开源阅读]获取订阅源! + 当前没有发现源,关注公众号[开源阅读]添加带发现的书源! diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ed78926eb..ad9af3df7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -773,5 +773,7 @@ Share selected sources Sort by update time Search content + 关注公众号[开源阅读]获取订阅源! + 当前没有发现源,关注公众号[开源阅读]添加带发现的书源!