From cad80b60b15a417d447563cdab5cb10d2cc024fc Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 9 Jan 2020 11:18:13 +0800 Subject: [PATCH 1/7] up --- .../main/res/layout/item_bookshelf_grid.xml | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/app/src/main/res/layout/item_bookshelf_grid.xml b/app/src/main/res/layout/item_bookshelf_grid.xml index c36b288c5..212c160fd 100644 --- a/app/src/main/res/layout/item_bookshelf_grid.xml +++ b/app/src/main/res/layout/item_bookshelf_grid.xml @@ -49,24 +49,17 @@ tools:ignore="RtlHardcoded" /> - - - - - + app:layout_constraintBottom_toBottomOf="@id/iv_cover" + tools:ignore="RtlHardcoded" /> Date: Thu, 9 Jan 2020 11:19:05 +0800 Subject: [PATCH 2/7] up --- app/src/main/res/layout/item_bookshelf_grid.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/res/layout/item_bookshelf_grid.xml b/app/src/main/res/layout/item_bookshelf_grid.xml index 212c160fd..ca639edd4 100644 --- a/app/src/main/res/layout/item_bookshelf_grid.xml +++ b/app/src/main/res/layout/item_bookshelf_grid.xml @@ -44,7 +44,6 @@ android:layout_height="26dp" android:layout_gravity="right" android:visibility="invisible" - app:loading_color="@color/colorAccent" app:loading_width="2dp" tools:ignore="RtlHardcoded" /> From 530c9b176d14dbd856a2fe4bfb7ccc5e7f6087df Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 9 Jan 2020 11:26:29 +0800 Subject: [PATCH 3/7] up --- app/src/main/java/io/legado/app/ui/widget/BadgeView.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt b/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt index a0764724e..3a2eeed57 100644 --- a/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt @@ -77,6 +77,7 @@ class BadgeView @JvmOverloads constructor( val typedArray = context.obtainStyledAttributes(attrs, R.styleable.BadgeView) val radios = typedArray.getDimensionPixelOffset(R.styleable.BadgeView_bv_radius, 8) + typedArray.recycle() if (layoutParams !is LayoutParams) { val layoutParams = LayoutParams( From f5873c6070438909948c72e746bfe25b144b2033 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 9 Jan 2020 11:35:07 +0800 Subject: [PATCH 4/7] up --- .../main/java/io/legado/app/ui/widget/BadgeView.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt b/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt index 3a2eeed57..b644ad5fb 100644 --- a/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt @@ -108,17 +108,9 @@ class BadgeView @JvmOverloads constructor( } fun setBackground(dipRadius: Float, badgeColor: Int) { - val radius = dip2Px(dipRadius) - val radiusArray = floatArrayOf( - radius.toFloat(), - radius.toFloat(), - radius.toFloat(), - radius.toFloat(), - radius.toFloat(), - radius.toFloat(), - radius.toFloat(), - radius.toFloat() - ) + val radius = dip2Px(dipRadius).toFloat() + val radiusArray = + floatArrayOf(radius, radius, radius, radius, radius, radius, radius, radius) val roundRect = RoundRectShape(radiusArray, null, null) val bgDrawable = ShapeDrawable(roundRect) From d7a9de736c78b6df74e498d49135ab5de8869ab6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 9 Jan 2020 11:42:02 +0800 Subject: [PATCH 5/7] up --- .../io/legado/app/ui/main/MainActivity.kt | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index 571b32139..ddb8b3f10 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -16,6 +16,7 @@ import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.constant.Bus import io.legado.app.constant.PreferKey +import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.storage.Backup import io.legado.app.lib.theme.ATH import io.legado.app.service.BaseReadAloudService @@ -27,7 +28,6 @@ import io.legado.app.ui.main.my.MyFragment import io.legado.app.ui.main.rss.RssFragment import io.legado.app.utils.* import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.coroutines.launch class MainActivity : VMBaseActivity(R.layout.activity_main), BottomNavigationView.OnNavigationItemSelectedListener, @@ -116,25 +116,23 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), override fun finish() { if (!BuildConfig.DEBUG) { - launch { - backup() - super.finish() - } - } else { - super.finish() + backup() } + super.finish() } - private suspend fun backup() { - val backupPath = getPrefString(PreferKey.backupPath) - if (backupPath?.isNotEmpty() == true) { - val uri = Uri.parse(backupPath) - val doc = DocumentFile.fromTreeUri(this, uri) - if (doc?.canWrite() == true) { - Backup.backup(this@MainActivity, uri) + private fun backup() { + Coroutine.async { + val backupPath = getPrefString(PreferKey.backupPath) + if (backupPath?.isNotEmpty() == true) { + val uri = Uri.parse(backupPath) + val doc = DocumentFile.fromTreeUri(this@MainActivity, uri) + if (doc?.canWrite() == true) { + Backup.backup(this@MainActivity, uri) + } + } else { + Backup.backup(this@MainActivity, null) } - } else { - Backup.backup(this@MainActivity, null) } } From e36afc427eee4dd3ec9dec2d2d1802a93f4af1af Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 10 Jan 2020 08:13:11 +0800 Subject: [PATCH 6/7] up --- app/build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 18d4ac8ed..356d95bb4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -38,6 +38,14 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" project.ext.set("archivesBaseName", name + "_" + version) multiDexEnabled true + javaCompileOptions { + annotationProcessorOptions { + arguments = [ + "room.incremental" : "true", + "room.expandProjection": "true" + ] + } + } } buildTypes { release { From db38c6be0a83edf064e93a94560b22e5d0b7c78f Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 10 Jan 2020 08:22:07 +0800 Subject: [PATCH 7/7] up --- .../java/io/legado/app/ui/widget/font/FontSelectDialog.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt b/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt index 1fba2ce2e..a0a4170d8 100644 --- a/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt @@ -41,11 +41,11 @@ class FontSelectDialog : DialogFragment(), FontAdapter.CallBack { lateinit var job: Job private val fontFolderRequestCode = 35485 - private lateinit var adapter: FontAdapter private val fontFolder = App.INSTANCE.filesDir.absolutePath + File.separator + "Fonts" + File.separator override val coroutineContext: CoroutineContext get() = job + Main + private var adapter: FontAdapter? = null override fun onStart() { super.onStart() @@ -144,7 +144,7 @@ class FontSelectDialog : DialogFragment(), pathName.name.toLowerCase().matches(".*\\.[ot]tf".toRegex()) }?.let { withContext(Main) { - adapter.setItems(it.toList()) + adapter?.setItems(it.toList()) } } } catch (e: Exception) { @@ -161,7 +161,7 @@ class FontSelectDialog : DialogFragment(), file.listFiles { pathName -> pathName.name.toLowerCase().matches(".*\\.[ot]tf".toRegex()) }?.let { - adapter.setItems(it.toList()) + adapter?.setItems(it.toList()) } } catch (e: Exception) { toast(e.localizedMessage ?: "")