点击分组提示分组书籍数量

pull/457/head
gedoor 4 years ago
parent 9761074a95
commit f3aaba87d3
  1. 4
      app/build.gradle
  2. 1
      app/src/main/assets/updateLog.md
  3. 13
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  4. 2
      app/src/main/java/io/legado/app/help/ActivityHelp.kt
  5. 11
      app/src/main/java/io/legado/app/help/http/AjaxWebView.kt
  6. 3
      app/src/main/java/io/legado/app/help/permission/RequestManager.kt
  7. 5
      app/src/main/java/io/legado/app/lib/dialogs/AlertBuilder.kt
  8. 2
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt
  9. 4
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  10. 3
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  11. 3
      app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt
  12. 3
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt
  13. 8
      app/src/main/java/io/legado/app/ui/login/SourceLogin.kt
  14. 2
      app/src/main/java/io/legado/app/utils/ActivityExtensions.kt

@ -18,7 +18,7 @@ def version = "3." + releaseTime()
def gitCommits = Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim()) def gitCommits = Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
android { android {
compileSdkVersion 29 compileSdkVersion 30
signingConfigs { signingConfigs {
if (project.hasProperty("RELEASE_STORE_FILE")) { if (project.hasProperty("RELEASE_STORE_FILE")) {
myConfig { myConfig {
@ -34,7 +34,7 @@ android {
defaultConfig { defaultConfig {
applicationId "io.legado.app" applicationId "io.legado.app"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 30
versionCode gitCommits versionCode gitCommits
versionName version versionName version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

@ -5,6 +5,7 @@
**2020/10/25** **2020/10/25**
* 点击书籍分组可显示书籍数量 * 点击书籍分组可显示书籍数量
* 升级到SDK30
**2020/10/24** **2020/10/24**
* 修复选择错误的bug * 修复选择错误的bug

@ -100,24 +100,19 @@ abstract class BaseActivity(
} ?: super.onCreateOptionsMenu(menu) } ?: super.onCreateOptionsMenu(menu)
} }
override fun onMenuOpened(featureId: Int, menu: Menu?): Boolean { override fun onMenuOpened(featureId: Int, menu: Menu): Boolean {
menu?.let {
menu.applyOpenTint(this) menu.applyOpenTint(this)
return super.onMenuOpened(featureId, menu) return super.onMenuOpened(featureId, menu)
} }
return true
}
open fun onCompatCreateOptionsMenu(menu: Menu) = super.onCreateOptionsMenu(menu) open fun onCompatCreateOptionsMenu(menu: Menu) = super.onCreateOptionsMenu(menu)
final override fun onOptionsItemSelected(item: MenuItem?): Boolean { final override fun onOptionsItemSelected(item: MenuItem): Boolean {
item?.let { if (item.itemId == android.R.id.home) {
if (it.itemId == android.R.id.home) {
supportFinishAfterTransition() supportFinishAfterTransition()
return true return true
} }
} return onCompatOptionsItemSelected(item)
return item != null && onCompatOptionsItemSelected(item)
} }
open fun onCompatOptionsItemSelected(item: MenuItem) = super.onOptionsItemSelected(item) open fun onCompatOptionsItemSelected(item: MenuItem) = super.onOptionsItemSelected(item)

@ -104,7 +104,7 @@ object ActivityHelp : Application.ActivityLifecycleCallbacks {
remove(activity) remove(activity)
} }
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle?) { override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
} }
override fun onActivityStopped(activity: Activity) { override fun onActivityStopped(activity: Activity) {

@ -64,11 +64,12 @@ class AjaxWebView {
webView.webViewClient = HtmlWebViewClient(params, handler) webView.webViewClient = HtmlWebViewClient(params, handler)
} }
when (params.requestMethod) { when (params.requestMethod) {
RequestMethod.POST -> webView.postUrl(params.url, params.postData) RequestMethod.POST -> params.postData?.let {
RequestMethod.GET -> webView.loadUrl( webView.postUrl(params.url, it)
params.url, }
params.headerMap RequestMethod.GET -> params.headerMap?.let {
) webView.loadUrl(params.url, it)
}
} }
return webView return webView
} }

@ -1,6 +1,7 @@
package io.legado.app.help.permission package io.legado.app.help.permission
import android.os.Handler import android.os.Handler
import android.os.Looper
import java.util.* import java.util.*
internal object RequestManager : OnPermissionsResultCallback { internal object RequestManager : OnPermissionsResultCallback {
@ -8,7 +9,7 @@ internal object RequestManager : OnPermissionsResultCallback {
private var requests: Stack<Request>? = null private var requests: Stack<Request>? = null
private var request: Request? = null private var request: Request? = null
private val handler = Handler() private val handler = Handler(Looper.getMainLooper())
private val requestRunnable = Runnable { private val requestRunnable = Runnable {
request?.start() request?.start()

@ -26,6 +26,7 @@ import android.view.KeyEvent
import android.view.View import android.view.View
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
import io.legado.app.R
import org.jetbrains.anko.internals.AnkoInternals.NO_GETTER import org.jetbrains.anko.internals.AnkoInternals.NO_GETTER
import kotlin.DeprecationLevel.ERROR import kotlin.DeprecationLevel.ERROR
@ -111,7 +112,7 @@ inline fun AlertBuilder<*>.cancelButton(noinline handler: ((dialog: DialogInterf
negativeButton(android.R.string.cancel, handler) negativeButton(android.R.string.cancel, handler)
inline fun AlertBuilder<*>.yesButton(noinline handler: ((dialog: DialogInterface) -> Unit)? = null) = inline fun AlertBuilder<*>.yesButton(noinline handler: ((dialog: DialogInterface) -> Unit)? = null) =
positiveButton(android.R.string.yes, handler) positiveButton(R.string.yes, handler)
inline fun AlertBuilder<*>.noButton(noinline handler: ((dialog: DialogInterface) -> Unit)? = null) = inline fun AlertBuilder<*>.noButton(noinline handler: ((dialog: DialogInterface) -> Unit)? = null) =
negativeButton(android.R.string.no, handler) negativeButton(R.string.no, handler)

@ -1,5 +1,6 @@
package io.legado.app.ui.association package io.legado.app.ui.association
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.DialogInterface import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
@ -169,6 +170,7 @@ class ImportBookSourceActivity : VMBaseActivity<ImportBookSourceViewModel>(
tool_bar.inflateMenu(R.menu.import_source) tool_bar.inflateMenu(R.menu.import_source)
} }
@SuppressLint("InflateParams")
override fun onMenuItemClick(item: MenuItem): Boolean { override fun onMenuItemClick(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.menu_new_group -> { R.id.menu_new_group -> {

@ -114,8 +114,8 @@ class BookInfoActivity :
return super.onCompatOptionsItemSelected(item) return super.onCompatOptionsItemSelected(item)
} }
override fun onMenuOpened(featureId: Int, menu: Menu?): Boolean { override fun onMenuOpened(featureId: Int, menu: Menu): Boolean {
menu?.findItem(R.id.menu_can_update)?.isChecked = menu.findItem(R.id.menu_can_update)?.isChecked =
viewModel.bookData.value?.canUpdate ?: true viewModel.bookData.value?.canUpdate ?: true
return super.onMenuOpened(featureId, menu) return super.onMenuOpened(featureId, menu)
} }

@ -9,6 +9,7 @@ import android.graphics.drawable.ColorDrawable
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper
import android.view.* import android.view.*
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import androidx.core.view.get import androidx.core.view.get
@ -92,7 +93,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
override val scope: CoroutineScope get() = this override val scope: CoroutineScope get() = this
override val isInitFinish: Boolean get() = viewModel.isInitFinish override val isInitFinish: Boolean get() = viewModel.isInitFinish
override val isScroll: Boolean get() = page_view.isScroll override val isScroll: Boolean get() = page_view.isScroll
private val mHandler = Handler() private val mHandler = Handler(Looper.getMainLooper())
private val keepScreenRunnable: Runnable = private val keepScreenRunnable: Runnable =
Runnable { ReadBookActivityHelp.keepScreenOn(window, false) } Runnable { ReadBookActivityHelp.keepScreenOn(window, false) }
private val autoPageRunnable: Runnable = Runnable { autoPagePlus() } private val autoPageRunnable: Runnable = Runnable { autoPagePlus() }

@ -2,6 +2,7 @@ package io.legado.app.ui.book.search
import android.app.Application import android.app.Application
import android.os.Handler import android.os.Handler
import android.os.Looper
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import io.legado.app.App import io.legado.app.App
import io.legado.app.base.BaseViewModel import io.legado.app.base.BaseViewModel
@ -15,7 +16,7 @@ import kotlinx.coroutines.isActive
class SearchViewModel(application: Application) : BaseViewModel(application), class SearchViewModel(application: Application) : BaseViewModel(application),
SearchBookModel.CallBack { SearchBookModel.CallBack {
val handler = Handler() val handler = Handler(Looper.getMainLooper())
private val searchBookModel = SearchBookModel(this, this) private val searchBookModel = SearchBookModel(this, this)
var isSearchLiveData = MutableLiveData<Boolean>() var isSearchLiveData = MutableLiveData<Boolean>()
var searchBookLiveData = MutableLiveData<List<SearchBook>>() var searchBookLiveData = MutableLiveData<List<SearchBook>>()

@ -3,7 +3,6 @@ package io.legado.app.ui.book.toc
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent
import android.os.AsyncTask
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.EditText import android.widget.EditText
@ -102,12 +101,10 @@ class BookmarkFragment : VMBaseFragment<ChapterListViewModel>(R.layout.fragment_
} }
yesButton { yesButton {
editText?.text?.toString()?.let { editContent -> editText?.text?.toString()?.let { editContent ->
AsyncTask.execute {
bookmark.content = editContent bookmark.content = editContent
App.db.bookmarkDao().update(bookmark) App.db.bookmarkDao().update(bookmark)
} }
} }
}
noButton() noButton()
neutralButton(R.string.delete) { neutralButton(R.string.delete) {
App.db.bookmarkDao().delete(bookmark) App.db.bookmarkDao().delete(bookmark)

@ -55,7 +55,9 @@ class SourceLogin : BaseActivity(R.layout.activity_source_login) {
super.onPageFinished(view, url) super.onPageFinished(view, url)
} }
} }
web_view.loadUrl(loginUrl) loginUrl?.let {
web_view.loadUrl(it)
}
} }
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean { override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
@ -69,7 +71,9 @@ class SourceLogin : BaseActivity(R.layout.activity_source_login) {
if (!checking) { if (!checking) {
checking = true checking = true
title_bar.snackbar(R.string.check_host_cookie) title_bar.snackbar(R.string.check_host_cookie)
web_view.loadUrl(sourceUrl) loginUrl?.let {
web_view.loadUrl(it)
}
} }
} }
} }

Loading…
Cancel
Save