pull/37/head
kunfei 5 years ago
parent 118f779eaa
commit a6b9992c7f
  1. 26
      app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt
  2. 9
      app/src/main/res/drawable/ic_star.xml
  3. 13
      app/src/main/res/menu/main_rss.xml
  4. 28
      app/src/main/res/menu/rss_source.xml
  5. 1
      app/src/main/res/values/strings.xml

@ -1,22 +1,15 @@
package io.legado.app.ui.main.rss
import android.os.Bundle
import android.util.Log
import android.view.Gravity
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.EditText
import android.widget.LinearLayout
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.GridLayoutManager
import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.BaseFragment
import io.legado.app.data.entities.RssSource
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.cancelButton
import io.legado.app.lib.dialogs.yesButton
import io.legado.app.lib.theme.ATH
import io.legado.app.ui.rss.article.RssArticlesActivity
import io.legado.app.ui.rss.source.manage.RssSourceActivity
@ -43,24 +36,7 @@ class RssFragment : BaseFragment(R.layout.fragment_rss),
super.onCompatOptionsItemSelected(item)
when (item.itemId) {
R.id.menu_rss_config -> startActivity<RssSourceActivity>()
R.id.menu_rss_add -> {
alert {
title = "快速添加并预览"
val layout = LinearLayout(activity)
val urlEdit = EditText(activity)
urlEdit.hint = "输入RSS地址"
urlEdit.width = 800
layout.gravity = Gravity.CENTER
layout.addView(urlEdit)
customView = layout
cancelButton{
Log.i("RSS","Quick Add URL cancel")
}
yesButton{
Log.i("RSS","Quick Add URL: ${urlEdit.text}")
startActivity<RssArticlesActivity>("url" to urlEdit.text.toString().trim())
}
}.show()
R.id.menu_rss_star -> {
}
}
}

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z" />
</vector>

@ -1,16 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
<menu xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_rss_add"
android:title="@string/add"
android:icon="@drawable/ic_add"
android:id="@+id/menu_rss_star"
android:title="@string/store_up"
android:icon="@drawable/ic_star"
app:showAsAction="always" />
<item
android:id="@+id/menu_rss_config"
android:title="@string/setting"
android:icon="@drawable/ic_settings"
app:showAsAction="always" />
app:showAsAction="always"
tools:ignore="AlwaysShowAction" />
</menu>

@ -54,34 +54,6 @@
android:id="@+id/menu_group_manage"
android:title="@string/group_manage" />
<item
android:id="@+id/action_sort"
android:title="@string/sort">
<menu>
<group
android:id="@+id/menu_group_sort"
android:checkableBehavior="single" />
<item
android:id="@+id/sort_manual"
android:checkable="true"
android:title="@string/sort_manual" />
<item
android:id="@+id/sort_auto"
android:checkable="true"
android:title="@string/sort_auto" />
<item
android:id="@+id/sort_pin_yin"
android:checkable="true"
android:title="@string/sort_pin_yin" />
</menu>
</item>
<group android:id="@+id/source_group">
</group>

@ -34,6 +34,7 @@
<string name="enable">启用</string>
<string name="replace_purify_search">替换净化-搜索</string>
<string name="bookshelf">书架</string>
<string name="store_up">收藏</string>
<string name="rss">订阅</string>
<string name="all">全部</string>
<string name="recent_reading">最近阅读</string>

Loading…
Cancel
Save