添加源地址订阅功能

pull/517/head
gedoor 4 years ago
parent baef65fb60
commit 0827afa198
  1. 3
      app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt
  2. 2
      app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubActivity.kt
  3. 29
      app/src/main/res/layout/activity_source_sub.xml
  4. 1
      app/src/main/res/values-zh-rHK/strings.xml
  5. 1
      app/src/main/res/values-zh-rTW/strings.xml
  6. 1
      app/src/main/res/values-zh/strings.xml
  7. 1
      app/src/main/res/values/strings.xml

@ -4,7 +4,6 @@ import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.core.view.isGone
import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.VMBaseFragment
@ -18,7 +17,6 @@ import io.legado.app.ui.rss.source.edit.RssSourceEditActivity
import io.legado.app.ui.rss.source.manage.RssSourceActivity
import io.legado.app.ui.rss.source.manage.RssSourceViewModel
import io.legado.app.ui.rss.subscription.SourceSubActivity
import io.legado.app.utils.getViewModel
import io.legado.app.utils.startActivity
import io.legado.app.utils.viewbindingdelegate.viewBinding
@ -69,7 +67,6 @@ class RssFragment : VMBaseFragment<RssSourceViewModel>(R.layout.fragment_rss),
private fun initData() {
App.db.rssSourceDao().liveEnabled().observe(viewLifecycleOwner, {
binding.tvEmptyMsg.isGone = it.isNotEmpty()
adapter.setItems(it)
})
}

@ -3,6 +3,7 @@ package io.legado.app.ui.rss.subscription
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.core.view.isGone
import androidx.lifecycle.LiveData
import androidx.recyclerview.widget.ItemTouchHelper
import io.legado.app.App
@ -61,6 +62,7 @@ class SourceSubActivity : BaseActivity<ActivitySourceSubBinding>(),
liveData?.removeObservers(this)
liveData = App.db.sourceSubDao().observeAll()
liveData?.observe(this) {
binding.tvEmptyMsg.isGone = it.isNotEmpty()
adapter.setItems(it)
}
}

@ -12,12 +12,31 @@
android:layout_height="wrap_content"
app:title="@string/source_subscription" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_source_sub" />
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_source_sub" />
<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"
android:text="@string/source_sub_empty_msg"
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" />
</FrameLayout>
</LinearLayout>

@ -788,5 +788,6 @@
<string name="show_hide">显示/隐藏</string>
<string name="header_footer">页眉<![CDATA[&]]>页脚</string>
<string name="source_subscription">源订阅</string>
<string name="source_sub_empty_msg">添加大佬们提供的源导入地址,添加后点击可导入源</string>
</resources>

@ -789,5 +789,6 @@
<string name="show_hide">显示/隐藏</string>
<string name="header_footer">页眉<![CDATA[&]]>页脚</string>
<string name="source_subscription">源订阅</string>
<string name="source_sub_empty_msg">添加大佬们提供的源导入地址,添加后点击可导入源</string>
</resources>

@ -792,5 +792,6 @@
<string name="show_hide">显示/隐藏</string>
<string name="header_footer">页眉<![CDATA[&]]>页脚</string>
<string name="source_subscription">源订阅</string>
<string name="source_sub_empty_msg">添加大佬们提供的源导入地址,添加后点击可导入源</string>
</resources>

@ -795,5 +795,6 @@
<string name="show_hide">显示/隐藏</string>
<string name="header_footer">footer <![CDATA[&]]> header</string>
<string name="source_subscription">源订阅</string>
<string name="source_sub_empty_msg">添加大佬们提供的源导入地址,添加后点击可导入源</string>
</resources>

Loading…
Cancel
Save