添加源地址订阅功能

pull/517/head
gedoor 4 years ago
parent 6cbb9586af
commit f4394a7059
  1. 4
      app/src/main/AndroidManifest.xml
  2. 7
      app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt
  3. 37
      app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubscription.kt
  4. 2
      app/src/main/res/layout/activity_read_record.xml
  5. 21
      app/src/main/res/layout/activity_source_sub.xml
  6. 11
      app/src/main/res/menu/source_subscription.xml
  7. 1
      app/src/main/res/values-zh-rHK/strings.xml
  8. 1
      app/src/main/res/values-zh-rTW/strings.xml
  9. 1
      app/src/main/res/values-zh/strings.xml
  10. 1
      app/src/main/res/values/strings.xml

@ -171,6 +171,10 @@
<activity <activity
android:name=".ui.qrcode.QrCodeActivity" android:name=".ui.qrcode.QrCodeActivity"
android:launchMode="singleTask" /> android:launchMode="singleTask" />
<!-- 源订阅 -->
<activity
android:name=".ui.rss.subscription.SourceSubscription"
android:launchMode="singleTask" />
<!-- 书源编辑 --> <!-- 书源编辑 -->
<activity <activity
android:name=".ui.book.source.edit.BookSourceEditActivity" android:name=".ui.book.source.edit.BookSourceEditActivity"

@ -17,9 +17,11 @@ import io.legado.app.ui.rss.favorites.RssFavoritesActivity
import io.legado.app.ui.rss.source.edit.RssSourceEditActivity 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.RssSourceActivity
import io.legado.app.ui.rss.source.manage.RssSourceViewModel import io.legado.app.ui.rss.source.manage.RssSourceViewModel
import io.legado.app.ui.rss.subscription.SourceSubscription
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import io.legado.app.utils.startActivity import io.legado.app.utils.startActivity
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
/** /**
* 订阅界面 * 订阅界面
@ -55,8 +57,11 @@ class RssFragment : VMBaseFragment<RssSourceViewModel>(R.layout.fragment_rss),
binding.recyclerView.adapter = adapter binding.recyclerView.adapter = adapter
adapter.addHeaderView { adapter.addHeaderView {
ItemRssBinding.inflate(layoutInflater, it, false).apply { ItemRssBinding.inflate(layoutInflater, it, false).apply {
tvName.text = "订阅源" tvName.setText(R.string.source_subscription)
ivIcon.setImageResource(R.mipmap.ic_launcher) ivIcon.setImageResource(R.mipmap.ic_launcher)
root.onClick {
startActivity<SourceSubscription>()
}
} }
} }
} }

@ -0,0 +1,37 @@
package io.legado.app.ui.rss.subscription
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import io.legado.app.R
import io.legado.app.base.BaseActivity
import io.legado.app.databinding.ActivitySourceSubBinding
class SourceSubscription : BaseActivity<ActivitySourceSubBinding>() {
override fun getViewBinding(): ActivitySourceSubBinding {
return ActivitySourceSubBinding.inflate(layoutInflater)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
}
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.source_subscription, menu)
return super.onCompatCreateOptionsMenu(menu)
}
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_add -> editSubscription()
}
return super.onCompatOptionsItemSelected(item)
}
private fun editSubscription() {
}
}

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:orientation="vertical">
<io.legado.app.ui.widget.TitleBar <io.legado.app.ui.widget.TitleBar

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
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:title="@string/source_subscription" />
<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" />
</LinearLayout>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_add"
android:icon="@drawable/ic_add"
android:title="@string/add"
app:showAsAction="always" />
</menu>

@ -787,5 +787,6 @@
<string name="body_title">正文标题</string> <string name="body_title">正文标题</string>
<string name="show_hide">显示/隐藏</string> <string name="show_hide">显示/隐藏</string>
<string name="header_footer">页眉<![CDATA[&]]>页脚</string> <string name="header_footer">页眉<![CDATA[&]]>页脚</string>
<string name="source_subscription">源订阅</string>
</resources> </resources>

@ -788,5 +788,6 @@
<string name="body_title">正文标题</string> <string name="body_title">正文标题</string>
<string name="show_hide">显示/隐藏</string> <string name="show_hide">显示/隐藏</string>
<string name="header_footer">页眉<![CDATA[&]]>页脚</string> <string name="header_footer">页眉<![CDATA[&]]>页脚</string>
<string name="source_subscription">源订阅</string>
</resources> </resources>

@ -791,5 +791,6 @@
<string name="body_title">正文标题</string> <string name="body_title">正文标题</string>
<string name="show_hide">显示/隐藏</string> <string name="show_hide">显示/隐藏</string>
<string name="header_footer">页眉<![CDATA[&]]>页脚</string> <string name="header_footer">页眉<![CDATA[&]]>页脚</string>
<string name="source_subscription">源订阅</string>
</resources> </resources>

@ -794,5 +794,6 @@
<string name="body_title">正文标题</string> <string name="body_title">正文标题</string>
<string name="show_hide">显示/隐藏</string> <string name="show_hide">显示/隐藏</string>
<string name="header_footer">footer <![CDATA[&]]> header</string> <string name="header_footer">footer <![CDATA[&]]> header</string>
<string name="source_subscription">源订阅</string>
</resources> </resources>

Loading…
Cancel
Save