pull/423/head
gedoor 4 years ago
parent cabcbb2512
commit b67bb916ef
  1. 4
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt
  2. 6
      app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt
  3. 8
      app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt
  4. 30
      app/src/main/res/layout/fragment_rss.xml
  5. 2
      app/src/main/res/layout/item_rss.xml
  6. 2
      app/src/main/res/values-zh-rHK/strings.xml
  7. 2
      app/src/main/res/values-zh-rTW/strings.xml
  8. 2
      app/src/main/res/values-zh/strings.xml
  9. 2
      app/src/main/res/values/strings.xml

@ -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 {

@ -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<ExploreViewModel>(R.layout.fragment_find_book),
ExploreAdapter.CallBack {
override val viewModel: ExploreViewModel
@ -44,7 +46,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(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()

@ -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<RssSourceViewModel>(R.layout.fragment_rss),
RssAdapter.CallBack {
@ -31,6 +34,7 @@ class RssFragment : VMBaseFragment<RssSourceViewModel>(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<RssSourceViewModel>(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()
}

@ -1,20 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<io.legado.app.ui.widget.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:attachToActivity="false"
app:layout_constraintTop_toTopOf="parent"
app:title="@string/rss" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
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" />
</LinearLayout>
<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="gone"
app:layout_constraintTop_toBottomOf="@+id/title_bar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:text="TextView" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:padding="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -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" />

@ -767,5 +767,7 @@
<string name="share_selected_source">分享選中書源</string>
<string name="sort_by_lastUppdateTime">時間排序</string>
<string name="search_content">全文搜索</string>
<string name="rss_source_empty">关注公众号[开源阅读]获取订阅源!</string>
<string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string>
</resources>

@ -767,5 +767,7 @@
<string name="share_selected_source">分享選中書源</string>
<string name="sort_by_lastUppdateTime">時間排序</string>
<string name="search_content">全文搜尋</string>
<string name="rss_source_empty">关注公众号[开源阅读]获取订阅源!</string>
<string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string>
</resources>

@ -770,5 +770,7 @@
<string name="select_theme">切换默认主题</string>
<string name="sort_by_lastUppdateTime">时间排序</string>
<string name="search_content">全文搜索</string>
<string name="rss_source_empty">关注公众号[开源阅读]获取订阅源!</string>
<string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string>
</resources>

@ -773,5 +773,7 @@
<string name="share_selected_source">Share selected sources</string>
<string name="sort_by_lastUppdateTime">Sort by update time</string>
<string name="search_content">Search content</string>
<string name="rss_source_empty">关注公众号[开源阅读]获取订阅源!</string>
<string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string>
</resources>

Loading…
Cancel
Save