feat: 优化

pull/219/head
kunfei 5 years ago
parent 1b92320975
commit 8e486e77f6
  1. 1
      app/src/main/assets/updateLog.md
  2. 1
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  3. 9
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt
  4. 3
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
  5. 9
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt
  6. 5
      app/src/main/res/menu/book_source_sel.xml
  7. 9
      app/src/main/res/menu/rss_source_sel.xml

@ -5,6 +5,7 @@
**2020/05/10** **2020/05/10**
* 添加识别rss分组中的频道信息,在菜单中可以切换频道 from yangyxd * 添加识别rss分组中的频道信息,在菜单中可以切换频道 from yangyxd
* 书源添加批量置顶
**2020/05/04** **2020/05/04**
* 优化txt文件目录解析 * 优化txt文件目录解析

@ -203,6 +203,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
R.id.menu_disable_explore -> viewModel.disableSelectExplore(adapter.getSelection()) R.id.menu_disable_explore -> viewModel.disableSelectExplore(adapter.getSelection())
R.id.menu_export_selection -> FilePicker.selectFolder(this, exportRequestCode) R.id.menu_export_selection -> FilePicker.selectFolder(this, exportRequestCode)
R.id.menu_check_source -> CheckSource.start(this, adapter.getSelection()) R.id.menu_check_source -> CheckSource.start(this, adapter.getSelection())
R.id.menu_top_sel -> viewModel.topSource(*adapter.getSelection().toTypedArray())
} }
return true return true
} }

@ -19,10 +19,13 @@ import java.io.File
class BookSourceViewModel(application: Application) : BaseViewModel(application) { class BookSourceViewModel(application: Application) : BaseViewModel(application) {
fun topSource(bookSource: BookSource) { fun topSource(vararg sources: BookSource) {
execute { execute {
bookSource.customOrder = App.db.bookSourceDao().minOrder - 1 val minOrder = App.db.bookSourceDao().minOrder - 1
App.db.bookSourceDao().insert(bookSource) sources.forEachIndexed { index, bookSource ->
bookSource.customOrder = minOrder - index
}
App.db.bookSourceDao().update(*sources)
} }
} }

@ -106,8 +106,7 @@ class RssSourceActivity : VMBaseActivity<RssSourceViewModel>(R.layout.activity_r
R.id.menu_disable_selection -> viewModel.disableSelection(adapter.getSelection()) R.id.menu_disable_selection -> viewModel.disableSelection(adapter.getSelection())
R.id.menu_del_selection -> viewModel.delSelection(adapter.getSelection()) R.id.menu_del_selection -> viewModel.delSelection(adapter.getSelection())
R.id.menu_export_selection -> FilePicker.selectFolder(this, exportRequestCode) R.id.menu_export_selection -> FilePicker.selectFolder(this, exportRequestCode)
R.id.menu_check_source -> { R.id.menu_top_sel -> viewModel.topSource(*adapter.getSelection().toTypedArray())
}
} }
return true return true
} }

@ -17,10 +17,13 @@ import java.io.File
class RssSourceViewModel(application: Application) : BaseViewModel(application) { class RssSourceViewModel(application: Application) : BaseViewModel(application) {
fun topSource(rssSource: RssSource) { fun topSource(vararg sources: RssSource) {
execute { execute {
rssSource.customOrder = App.db.rssSourceDao().minOrder - 1 val minOrder = App.db.rssSourceDao().minOrder - 1
App.db.rssSourceDao().insert(rssSource) sources.forEachIndexed { index, rssSource ->
rssSource.customOrder = minOrder - index
}
App.db.rssSourceDao().update(*sources)
} }
} }

@ -22,6 +22,11 @@
android:title="@string/disable_explore" android:title="@string/disable_explore"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/menu_top_sel"
android:title="@string/to_top"
app:showAsAction="never" />
<item <item
android:id="@+id/menu_export_selection" android:id="@+id/menu_export_selection"
android:title="@string/export_selection" android:title="@string/export_selection"

@ -13,14 +13,13 @@
app:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/menu_export_selection" android:id="@+id/menu_top_sel"
android:title="@string/export_selection" android:title="@string/to_top"
app:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/menu_check_source" android:id="@+id/menu_export_selection"
android:icon="@drawable/ic_check_source" android:title="@string/export_selection"
android:title="@string/check_select_source"
app:showAsAction="never" /> app:showAsAction="never" />
</menu> </menu>

Loading…
Cancel
Save