feat: 优化代码

pull/97/head
kunfei 5 years ago
parent 1ceeeca174
commit 44ce6fa9fc
  1. 2
      app/build.gradle
  2. 6
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
  3. 2
      app/src/main/java/io/legado/app/ui/explore/ExploreShowActivity.kt
  4. 2
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt
  5. 6
      app/src/main/java/io/legado/app/ui/widget/recycler/LoadMoreView.kt
  6. 4
      app/src/main/res/layout/view_load_more.xml

@ -149,7 +149,7 @@ dependencies {
implementation 'com.jayway.jsonpath:json-path:2.4.0' implementation 'com.jayway.jsonpath:json-path:2.4.0'
//JS rhino //JS rhino
implementation 'io.apisense:rhino-android:1.1.1' implementation 'com.github.gedoor:rhino-android:1.4'
//Retrofit //Retrofit
implementation 'com.squareup.okhttp3:logging-interceptor:4.1.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.1.0'

@ -22,7 +22,7 @@ import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.primaryTextColor import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.ui.book.info.BookInfoActivity import io.legado.app.ui.book.info.BookInfoActivity
import io.legado.app.ui.book.source.manage.BookSourceActivity import io.legado.app.ui.book.source.manage.BookSourceActivity
import io.legado.app.ui.widget.LoadMoreView import io.legado.app.ui.widget.recycler.LoadMoreView
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_book_search.* import kotlinx.android.synthetic.main.activity_book_search.*
import kotlinx.android.synthetic.main.view_search.* import kotlinx.android.synthetic.main.view_search.*
@ -268,12 +268,12 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
diffResult.dispatchUpdatesTo(adapter) diffResult.dispatchUpdatesTo(adapter)
} }
fun startSearch() { private fun startSearch() {
refresh_progress_bar.isAutoLoading = true refresh_progress_bar.isAutoLoading = true
fb_stop.visible() fb_stop.visible()
} }
fun searchFinally() { private fun searchFinally() {
refresh_progress_bar.isAutoLoading = false refresh_progress_bar.isAutoLoading = false
loadMoreView.startLoad() loadMoreView.startLoad()
fb_stop.invisible() fb_stop.invisible()

@ -9,7 +9,7 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.SearchBook import io.legado.app.data.entities.SearchBook
import io.legado.app.ui.book.info.BookInfoActivity import io.legado.app.ui.book.info.BookInfoActivity
import io.legado.app.ui.widget.LoadMoreView import io.legado.app.ui.widget.recycler.LoadMoreView
import io.legado.app.utils.getVerticalDivider import io.legado.app.utils.getVerticalDivider
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_explore_show.* import kotlinx.android.synthetic.main.activity_explore_show.*

@ -14,7 +14,7 @@ import io.legado.app.data.entities.RssArticle
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
import io.legado.app.ui.rss.read.ReadRssActivity import io.legado.app.ui.rss.read.ReadRssActivity
import io.legado.app.ui.rss.source.edit.RssSourceEditActivity import io.legado.app.ui.rss.source.edit.RssSourceEditActivity
import io.legado.app.ui.widget.LoadMoreView import io.legado.app.ui.widget.recycler.LoadMoreView
import io.legado.app.utils.getVerticalDivider import io.legado.app.utils.getVerticalDivider
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_rss_artivles.* import kotlinx.android.synthetic.main.activity_rss_artivles.*

@ -1,7 +1,7 @@
package io.legado.app.ui.widget package io.legado.app.ui.widget.recycler
import android.content.Context import android.content.Context
import android.view.LayoutInflater import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.FrameLayout import android.widget.FrameLayout
import io.legado.app.R import io.legado.app.R
@ -15,7 +15,7 @@ class LoadMoreView(context: Context) : FrameLayout(context) {
private set private set
init { init {
LayoutInflater.from(context).inflate(R.layout.view_load_more, this, true) View.inflate(context, R.layout.view_load_more, this)
} }
override fun onAttachedToWindow() { override fun onAttachedToWindow() {

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -28,4 +28,4 @@
tools:text="加载状态" tools:text="加载状态"
tools:visibility="visible" /> tools:visibility="visible" />
</FrameLayout> </merge>
Loading…
Cancel
Save