From f1e5e7a7cef7d2f14809db9bc33570443544c0ab Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Thu, 28 Nov 2019 14:26:36 +0000 Subject: [PATCH] 1301 create theme based dark mode --- app/src/main/AndroidManifest.xml | 2 +- .../viewmodel/SaveLanguagesAndFinish.kt | 4 +- .../fileselect_view/ZimFileSelectFragment.kt | 3 +- .../fileselect_view/effects/DeleteFiles.kt | 4 +- .../fileselect_view/effects/None.kt | 4 +- .../fileselect_view/effects/OpenFile.kt | 4 +- .../fileselect_view/effects/ShareFiles.kt | 4 +- .../effects/StartMultiSelection.kt | 6 +- .../library_view/adapter/LibraryDelegate.kt | 2 +- .../library_view/adapter/LibraryViewHolder.kt | 18 +- app/src/main/res/layout/activity_language.xml | 20 +- app/src/main/res/layout/activity_library.xml | 2 +- app/src/main/res/layout/download_item.xml | 6 +- app/src/main/res/layout/item_language.xml | 31 +- .../{library_item.xml => item_library.xml} | 69 +- app/src/main/res/layout/zim_list.xml | 15 +- app/src/main/res/layout/zim_manager.xml | 24 +- buildSrc/src/main/kotlin/Versions.kt | 5 +- core/lint-baseline.xml | 622 +++++++----------- core/src/main/AndroidManifest.xml | 2 +- .../kiwix/kiwixmobile/core/NightModeConfig.kt | 11 +- .../kiwix/kiwixmobile/core/base/SideEffect.kt | 4 +- .../core/extensions/ActivityExtensions.kt | 8 +- .../core/main/TableDrawerAdapter.java | 17 +- core/src/main/res/drawable/list_bg.xml | 7 - core/src/main/res/drawable/list_bg_light.xml | 7 - .../main/res/layout/activity_bookmarks.xml | 15 +- core/src/main/res/layout/activity_help.xml | 29 +- core/src/main/res/layout/activity_history.xml | 17 +- .../main/res/layout/activity_kiwix_error.xml | 79 +-- core/src/main/res/layout/activity_main.xml | 1 - .../src/main/res/layout/activity_zim_host.xml | 34 +- core/src/main/res/layout/bottom_toolbar.xml | 33 +- core/src/main/res/layout/credits_webview.xml | 3 +- core/src/main/res/layout/device_item.xml | 11 +- core/src/main/res/layout/dialog_add_note.xml | 48 +- core/src/main/res/layout/drawer_right.xml | 3 +- core/src/main/res/layout/header_date.xml | 6 +- core/src/main/res/layout/header_language.xml | 7 +- core/src/main/res/layout/ic_tab_switcher.xml | 7 +- core/src/main/res/layout/item_book.xml | 13 +- .../main/res/layout/item_bookmark_history.xml | 15 +- core/src/main/res/layout/item_help.xml | 14 +- core/src/main/res/layout/item_intro_1.xml | 16 +- core/src/main/res/layout/item_intro_2.xml | 16 +- .../main/res/layout/kiwix_search_widget.xml | 15 +- .../main/res/layout/main_activity_content.xml | 14 +- core/src/main/res/layout/progress_bar.xml | 14 +- core/src/main/res/layout/search.xml | 24 +- core/src/main/res/layout/section_list.xml | 7 +- core/src/main/res/layout/settings.xml | 23 +- core/src/main/res/layout/slider_dialog.xml | 11 +- .../main/res/layout/storage_select_dialog.xml | 9 +- core/src/main/res/layout/tab_switcher.xml | 10 +- core/src/main/res/layout/webview_search.xml | 10 +- core/src/main/res/values-night/color.xml | 16 + core/src/main/res/values-night/themes.xml | 9 + core/src/main/res/values-v19/styles.xml | 32 - core/src/main/res/values-v21/styles.xml | 34 - core/src/main/res/values/attrs.xml | 16 +- core/src/main/res/values/colors.xml | 33 +- core/src/main/res/values/shape.xml | 35 + core/src/main/res/values/styles.xml | 171 +---- core/src/main/res/values/themes.xml | 78 +++ core/src/main/res/values/type.xml | 76 +++ custom/src/main/AndroidManifest.xml | 2 +- .../custom/download/effects/DownloadCustom.kt | 4 +- .../download/effects/FinishAndStartMain.kt | 4 +- .../SetPreferredStorageWithMostSpace.kt | 4 +- 69 files changed, 777 insertions(+), 1142 deletions(-) rename app/src/main/res/layout/{library_item.xml => item_library.xml} (68%) delete mode 100644 core/src/main/res/drawable/list_bg.xml delete mode 100644 core/src/main/res/drawable/list_bg_light.xml create mode 100644 core/src/main/res/values-night/color.xml create mode 100644 core/src/main/res/values-night/themes.xml delete mode 100644 core/src/main/res/values-v19/styles.xml delete mode 100644 core/src/main/res/values-v21/styles.xml create mode 100644 core/src/main/res/values/shape.xml create mode 100644 core/src/main/res/values/themes.xml create mode 100644 core/src/main/res/values/type.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ac069ab61..6d682bf73 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,7 +9,7 @@ + android:theme="@style/ThemeOverlay.KiwixTheme.Launcher"> diff --git a/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/SaveLanguagesAndFinish.kt b/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/SaveLanguagesAndFinish.kt index 6e308ad24..d82369171 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/SaveLanguagesAndFinish.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/SaveLanguagesAndFinish.kt @@ -17,7 +17,7 @@ */ package org.kiwix.kiwixmobile.language.viewmodel -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import io.reactivex.Flowable import io.reactivex.schedulers.Schedulers import org.kiwix.kiwixmobile.core.dao.NewLanguagesDao @@ -29,7 +29,7 @@ data class SaveLanguagesAndFinish( val languageDao: NewLanguagesDao ) : SideEffect { - override fun invokeWith(activity: Activity) { + override fun invokeWith(activity: AppCompatActivity) { Flowable.fromCallable { languageDao.insert(languages) } .subscribeOn(Schedulers.io()) .subscribe({ diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectFragment.kt index 086311f06..6c9b02872 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectFragment.kt @@ -27,6 +27,7 @@ import android.view.ActionMode import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider @@ -111,7 +112,7 @@ class ZimFileSelectFragment : BaseFragment() { private fun sideEffects() = zimManageViewModel.sideEffects.subscribe( { - val effectResult = it.invokeWith(activity!!) + val effectResult = it.invokeWith(activity!! as AppCompatActivity) if (effectResult is ActionMode) { actionMode = effectResult } diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/DeleteFiles.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/DeleteFiles.kt index fcb8c7b65..7d80bedb4 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/DeleteFiles.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/DeleteFiles.kt @@ -18,7 +18,7 @@ package org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import org.kiwix.kiwixmobile.R import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.dao.NewBookDao @@ -38,7 +38,7 @@ class DeleteFiles(private val booksOnDiskListItem: List) : @Inject lateinit var newBookDao: NewBookDao @Inject lateinit var zimReaderContainer: ZimReaderContainer - override fun invokeWith(activity: Activity) { + override fun invokeWith(activity: AppCompatActivity) { (activity as ZimManageActivity).cachedComponent.inject(this) booksOnDiskListItem.forEach { dialogShower.show(DeleteZim(it), { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/None.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/None.kt index db25051ae..9678a01bc 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/None.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/None.kt @@ -18,10 +18,10 @@ package org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import org.kiwix.kiwixmobile.core.base.SideEffect object None : SideEffect { - override fun invokeWith(activity: Activity) { + override fun invokeWith(activity: AppCompatActivity) { } } diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/OpenFile.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/OpenFile.kt index f8e3bc284..dcb7a1e54 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/OpenFile.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/OpenFile.kt @@ -17,7 +17,7 @@ */ package org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import androidx.core.net.toUri import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.base.SideEffect @@ -29,7 +29,7 @@ import org.kiwix.kiwixmobile.main.KiwixMainActivity class OpenFile(private val bookOnDisk: BookOnDisk) : SideEffect { - override fun invokeWith(activity: Activity) { + override fun invokeWith(activity: AppCompatActivity) { val file = bookOnDisk.file if (!file.canRead()) { activity.toast(R.string.error_file_not_found) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/ShareFiles.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/ShareFiles.kt index 9a5163ad9..be9f8ba56 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/ShareFiles.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/ShareFiles.kt @@ -18,10 +18,10 @@ package org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects -import android.app.Activity import android.content.Intent import android.net.Uri import android.os.Build +import androidx.appcompat.app.AppCompatActivity import androidx.core.content.FileProvider import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.base.SideEffect @@ -29,7 +29,7 @@ import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDis class ShareFiles(private val selectedBooks: List) : SideEffect { - override fun invokeWith(activity: Activity) { + override fun invokeWith(activity: AppCompatActivity) { val selectedFileShareIntent = Intent() selectedFileShareIntent.action = Intent.ACTION_SEND_MULTIPLE selectedFileShareIntent.type = "application/octet-stream" diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/StartMultiSelection.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/StartMultiSelection.kt index 8af81ef13..efa311d1b 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/StartMultiSelection.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/StartMultiSelection.kt @@ -18,8 +18,8 @@ package org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects -import android.app.Activity -import android.view.ActionMode +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.view.ActionMode import io.reactivex.processors.PublishProcessor import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.base.SideEffect @@ -33,7 +33,7 @@ data class StartMultiSelection( val bookOnDisk: BooksOnDiskListItem.BookOnDisk, val fileSelectActions: PublishProcessor ) : SideEffect { - override fun invokeWith(activity: Activity) = + override fun invokeWith(activity: AppCompatActivity) = activity.startActionMode( R.menu.menu_zim_files_contextual, mapOf( diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/adapter/LibraryDelegate.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/adapter/LibraryDelegate.kt index 0973ee21e..1ddf7de13 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/adapter/LibraryDelegate.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/adapter/LibraryDelegate.kt @@ -38,7 +38,7 @@ sealed class LibraryDelegate> override fun createViewHolder(parent: ViewGroup) = LibraryBookViewHolder( - parent.inflate(R.layout.library_item, false), + parent.inflate(R.layout.item_library, false), bookUtils, clickAction ) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/adapter/LibraryViewHolder.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/adapter/LibraryViewHolder.kt index ea8a287fd..fa48321a2 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/adapter/LibraryViewHolder.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/adapter/LibraryViewHolder.kt @@ -20,15 +20,15 @@ package org.kiwix.kiwixmobile.zim_manager.library_view.adapter import android.view.View import kotlinx.android.synthetic.main.library_divider.divider_text -import kotlinx.android.synthetic.main.library_item.creator -import kotlinx.android.synthetic.main.library_item.date -import kotlinx.android.synthetic.main.library_item.description -import kotlinx.android.synthetic.main.library_item.favicon -import kotlinx.android.synthetic.main.library_item.fileName -import kotlinx.android.synthetic.main.library_item.language -import kotlinx.android.synthetic.main.library_item.publisher -import kotlinx.android.synthetic.main.library_item.size -import kotlinx.android.synthetic.main.library_item.title +import kotlinx.android.synthetic.main.item_library.creator +import kotlinx.android.synthetic.main.item_library.date +import kotlinx.android.synthetic.main.item_library.description +import kotlinx.android.synthetic.main.item_library.favicon +import kotlinx.android.synthetic.main.item_library.fileName +import kotlinx.android.synthetic.main.item_library.language +import kotlinx.android.synthetic.main.item_library.publisher +import kotlinx.android.synthetic.main.item_library.size +import kotlinx.android.synthetic.main.item_library.title import org.kiwix.kiwixmobile.core.CoreApp import org.kiwix.kiwixmobile.core.downloader.model.Base64String import org.kiwix.kiwixmobile.core.extensions.setBitmap diff --git a/app/src/main/res/layout/activity_language.xml b/app/src/main/res/layout/activity_language.xml index 9a32a60eb..8e59f7184 100644 --- a/app/src/main/res/layout/activity_language.xml +++ b/app/src/main/res/layout/activity_language.xml @@ -3,24 +3,18 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:fitsSystemWindows="true" - > + android:fitsSystemWindows="true"> + app:layout_constraintTop_toTopOf="parent"> - + android:layout_height="wrap_content" /> + app:layout_constraintTop_toBottomOf="@id/appbar" /> + app:layout_constraintTop_toBottomOf="@id/appbar" /> diff --git a/app/src/main/res/layout/activity_library.xml b/app/src/main/res/layout/activity_library.xml index c090982bb..20d55a105 100644 --- a/app/src/main/res/layout/activity_library.xml +++ b/app/src/main/res/layout/activity_library.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:animateLayoutChanges="true" - tools:context="org.kiwix.kiwixmobile.core.zim_manager.library_view.LibraryFragment" + tools:context="org.kiwix.kiwixmobile.zim_manager.library_view.LibraryFragment" > diff --git a/app/src/main/res/layout/item_language.xml b/app/src/main/res/layout/item_language.xml index 5f33cfa78..edfe738f0 100644 --- a/app/src/main/res/layout/item_language.xml +++ b/app/src/main/res/layout/item_language.xml @@ -3,64 +3,59 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="64dp" - > + android:layout_height="64dp"> + app:layout_constraintTop_toTopOf="parent" /> + tools:text="English" /> + tools:text="English" /> + tools:text="9 books" /> + + android:background="?selectableItemBackground" /> diff --git a/app/src/main/res/layout/library_item.xml b/app/src/main/res/layout/item_library.xml similarity index 68% rename from app/src/main/res/layout/library_item.xml rename to app/src/main/res/layout/item_library.xml index 76af38e4a..b8126d968 100644 --- a/app/src/main/res/layout/library_item.xml +++ b/app/src/main/res/layout/item_library.xml @@ -3,14 +3,14 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" - android:minHeight="?android:attr/listPreferredItemHeight" + android:background="?selectableItemBackground" + android:minHeight="?listPreferredItemHeight" android:orientation="horizontal" - android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" - > + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + tools:ignore="Overdraw"> + tools:ignore="RtlHardcoded" /> + tools:ignore="RtlHardcoded,RtlSymmetry"> + tools:text="Title" /> + tools:text="Description" /> + android:paddingTop="@dimen/dimen_medium_padding"> + android:orientation="vertical"> + tools:text="File Size" /> + tools:text="Author" /> + tools:text="Publisher" /> @@ -92,37 +85,31 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" - android:gravity="right" - android:orientation="vertical" - > + android:gravity="end" + android:orientation="vertical"> + tools:text="Date" /> + tools:text="Language" /> + tools:text="File Name" /> - - diff --git a/app/src/main/res/layout/zim_list.xml b/app/src/main/res/layout/zim_list.xml index d3d169c22..eef3c1cc9 100644 --- a/app/src/main/res/layout/zim_list.xml +++ b/app/src/main/res/layout/zim_list.xml @@ -4,29 +4,24 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?attr/listBackground" - android:orientation="vertical" - > + android:orientation="vertical"> + android:text="@string/no_files_here" + tools:ignore="MissingConstraints" /> + android:layout_height="match_parent"> + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> diff --git a/app/src/main/res/layout/zim_manager.xml b/app/src/main/res/layout/zim_manager.xml index 10591a8c4..0c1e39daa 100644 --- a/app/src/main/res/layout/zim_manager.xml +++ b/app/src/main/res/layout/zim_manager.xml @@ -5,34 +5,27 @@ android:id="@+id/zim_manager_main_activity" android:layout_width="match_parent" android:layout_height="match_parent" - android:fitsSystemWindows="true" - tools:context="org.kiwix.kiwixmobile.core.zim_manager.ZimManageActivity" - > + tools:context="org.kiwix.kiwixmobile.zim_manager.ZimManageActivity"> + android:layout_height="wrap_content"> + android:layout_height="wrap_content" + app:layout_scrollFlags="scroll|enterAlways" + app:popupTheme="@style/KiwixTheme" + app:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar" /> + app:tabMaxWidth="0dp" /> @@ -40,8 +33,7 @@ android:id="@+id/manageViewPager" android:layout_width="match_parent" android:layout_height="match_parent" - app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" - /> + app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" /> diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index fa563d979..f8b65d6f9 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,4 +1,3 @@ -import kotlin.String import org.gradle.plugin.use.PluginDependenciesSpec import org.gradle.plugin.use.PluginDependencySpec @@ -108,7 +107,7 @@ object Versions { const val kiwixlib: String = "8.1.0" - const val material: String = "1.0.0" + const val material: String = "1.1.0-beta02" const val multidex: String = "2.0.1" @@ -142,4 +141,4 @@ object Versions { */ val PluginDependenciesSpec.buildSrcVersions: PluginDependencySpec inline get() = - id("de.fayard.buildSrcVersions").version(Versions.de_fayard_buildsrcversions_gradle_plugin) + id("de.fayard.buildSrcVersions").version(Versions.de_fayard_buildsrcversions_gradle_plugin) diff --git a/core/lint-baseline.xml b/core/lint-baseline.xml index 96beead61..d1757951d 100644 --- a/core/lint-baseline.xml +++ b/core/lint-baseline.xml @@ -1,5 +1,5 @@ - + @@ -70,7 +70,7 @@ errorLine2=" ~~~~~~~~~~~"> @@ -81,7 +81,7 @@ errorLine2=" ~~~~~~~~~~~"> @@ -92,25 +92,10 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~"> - - - - - @@ -143,117 +128,117 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -264,7 +249,7 @@ errorLine2=" ~~~~~~~~~~~~~"> @@ -275,18 +260,18 @@ errorLine2=" ~~~~~~~~~~~~~"> @@ -312,17 +297,6 @@ column="5"/> - - - - - - - - - - - - @@ -477,7 +429,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -488,24 +440,13 @@ errorLine2=" ~~~~~~~~"> - - - - + message="Possible overdraw: Root element paints background `@color/black` with a theme that also paints a background (inferred theme is `@style/KiwixTheme`)" + errorLine1=" android:background="@color/black"" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> - - - - - - - - - - - - - - - - - - - - - - - - @@ -623,7 +498,7 @@ errorLine2=" ~~~~~~~~"> @@ -634,7 +509,7 @@ errorLine2=" ~~~~~~~~"> @@ -645,7 +520,7 @@ errorLine2=" ~~~~~~~~"> @@ -656,7 +531,7 @@ errorLine2=" ~~~~~~~~"> @@ -667,7 +542,7 @@ errorLine2=" ~~~~~~~~"> @@ -678,7 +553,7 @@ errorLine2=" ~~~~~~~~"> @@ -700,7 +575,7 @@ errorLine2=" ~~~~~~~~"> @@ -711,7 +586,7 @@ errorLine2=" ~~~~~~~~"> @@ -722,7 +597,7 @@ errorLine2=" ~~~~~~~~"> @@ -733,7 +608,7 @@ errorLine2=" ~~~~~~~~"> @@ -744,7 +619,7 @@ errorLine2=" ~~~~~~~~"> @@ -755,43 +630,43 @@ errorLine2=" ~~~~~~~~"> - - - - - - - - - - - - + + + + + + + + + + + + @@ -810,7 +685,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -821,7 +696,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~"> @@ -847,7 +722,7 @@ errorLine2=" ~~~~~~~~"> @@ -858,7 +733,7 @@ errorLine2=" ~~~~~~~~"> @@ -880,7 +755,7 @@ errorLine2=" ~~~~~~~~~"> @@ -891,7 +766,7 @@ errorLine2=" ~~~~~~~~~"> @@ -902,7 +777,7 @@ errorLine2=" ~~~~~~~~~"> @@ -913,7 +788,7 @@ errorLine2=" ~~~~~~~~~"> @@ -924,7 +799,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> @@ -935,7 +810,7 @@ errorLine2=" ~~~~~~~~"> @@ -946,7 +821,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> @@ -957,7 +832,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -968,7 +843,7 @@ errorLine2=" ~~~~~~~~~~~~~~"> @@ -979,7 +854,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~"> @@ -990,29 +865,7 @@ errorLine2=" ~~~~~~~~~~~~~"> - - - - - - - - @@ -1023,7 +876,7 @@ errorLine2=" ~~~~~~~~~~~~~~~"> @@ -1034,7 +887,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -1045,7 +898,7 @@ errorLine2=" ~~~~~~~~~~~~~~~"> @@ -2024,7 +1877,7 @@ errorLine2=" ~~~~~~~"> @@ -2035,7 +1888,7 @@ errorLine2=" ~~~~~~~~~~~~~"> @@ -2046,7 +1899,7 @@ errorLine2=" ~~~~~~~~~~~~~"> @@ -2057,7 +1910,7 @@ errorLine2=" ~~~~~~~"> @@ -2068,7 +1921,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -2079,7 +1932,7 @@ errorLine2=" ~~~~~~~~~~~"> @@ -2090,7 +1943,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -2101,7 +1954,7 @@ errorLine2=" ~~~~"> @@ -2112,7 +1965,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~"> @@ -2121,6 +1974,17 @@ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" errorLine1=" protected ZimReaderContainer zimReaderContainer;" errorLine2=" ~~~~~~~~~~~~~~~~~~"> + + + + @@ -2178,7 +2042,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~"> @@ -2189,7 +2053,7 @@ errorLine2=" ~~~~~~~~~~~~~~~"> @@ -2200,7 +2064,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~"> @@ -2211,7 +2075,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -2222,7 +2086,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -2233,7 +2097,7 @@ errorLine2=" ~~~~~~"> @@ -2244,7 +2108,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -2255,7 +2119,7 @@ errorLine2=" ~~~~~~~~"> @@ -2266,21 +2130,10 @@ errorLine2=" ~~~~~~"> - - - - @@ -2299,7 +2152,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -2310,7 +2163,7 @@ errorLine2=" ~~~~~~~~~~~~~"> @@ -2321,7 +2174,7 @@ errorLine2=" ~~~~~~"> @@ -2332,7 +2185,7 @@ errorLine2=" ~~~~"> @@ -2343,7 +2196,7 @@ errorLine2=" ~~~~"> @@ -2354,7 +2207,7 @@ errorLine2=" ~~~~~~"> @@ -2365,7 +2218,7 @@ errorLine2=" ~~~~~~~~~~~~~"> @@ -2376,7 +2229,7 @@ errorLine2=" ~~~~~~"> @@ -2387,7 +2240,7 @@ errorLine2=" ~~~~~~"> @@ -2398,7 +2251,7 @@ errorLine2=" ~~~~~~"> @@ -2409,7 +2262,7 @@ errorLine2=" ~~~~"> @@ -2420,7 +2273,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -2431,7 +2284,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~"> @@ -2440,6 +2293,17 @@ message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations" errorLine1=" protected StorageCalculator storageCalculator;" errorLine2=" ~~~~~~~~~~~~~~~~~"> + + + + @@ -2475,7 +2339,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~"> @@ -2486,7 +2350,7 @@ errorLine2=" ~~~~~~"> @@ -2497,7 +2361,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~"> @@ -2508,7 +2372,7 @@ errorLine2=" ~~~~~~~~~~"> @@ -2541,7 +2405,7 @@ errorLine2=" ~~~~~~~~~~~~~~~"> @@ -2552,7 +2416,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~"> @@ -2563,7 +2427,7 @@ errorLine2=" ~~~~~~~"> @@ -2574,7 +2438,7 @@ errorLine2=" ~~~~~~"> @@ -2585,7 +2449,7 @@ errorLine2=" ~~~~~~~"> @@ -2596,7 +2460,7 @@ errorLine2=" ~~~~~~"> @@ -2607,7 +2471,7 @@ errorLine2=" ~~~~~~"> @@ -2618,7 +2482,7 @@ errorLine2=" ~~~~~~~"> @@ -2629,7 +2493,7 @@ errorLine2=" ~~~~~~"> @@ -2640,7 +2504,7 @@ errorLine2=" ~~~~~~~"> @@ -2651,7 +2515,7 @@ errorLine2=" ~~~~~~~"> @@ -2662,7 +2526,7 @@ errorLine2=" ~~~~~~~"> @@ -2732,39 +2596,6 @@ column="29"/> - - - - - - - - - - - - @@ -3337,17 +3168,6 @@ column="24"/> - - - - @@ -4653,7 +4473,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -4664,7 +4484,7 @@ errorLine2=" ~~~~"> @@ -4675,7 +4495,7 @@ errorLine2=" ~~~~~~~~"> @@ -4686,7 +4506,7 @@ errorLine2=" ~~~~~~~~~~~~~~"> @@ -4697,7 +4517,7 @@ errorLine2=" ~~~~"> @@ -4708,7 +4528,7 @@ errorLine2=" ~~~~~~~~~~~~~~"> @@ -4719,7 +4539,7 @@ errorLine2=" ~~~~"> @@ -4730,7 +4550,7 @@ errorLine2=" ~~~~~~"> @@ -4741,7 +4561,7 @@ errorLine2=" ~~~~~~"> @@ -4774,7 +4594,7 @@ errorLine2=" ~~~~~~~"> @@ -4785,7 +4605,7 @@ errorLine2=" ~~~~~~"> @@ -4796,7 +4616,7 @@ errorLine2=" ~~~~~~"> @@ -4807,7 +4627,7 @@ errorLine2=" ~~~~~~"> @@ -4818,7 +4638,7 @@ errorLine2=" ~~~~~~"> @@ -4829,7 +4649,7 @@ errorLine2=" ~~~~~~"> @@ -4840,7 +4660,7 @@ errorLine2=" ~~~~~~"> @@ -4851,7 +4671,7 @@ errorLine2=" ~~~~~~"> @@ -4862,7 +4682,7 @@ errorLine2=" ~~~~~~"> @@ -4873,7 +4693,18 @@ errorLine2=" ~~~~~~~~~~~~~~~~"> + + + + @@ -5031,17 +4862,6 @@ column="29"/> - - - - @@ -5082,7 +4902,7 @@ errorLine2=" ~~~~~~~"> @@ -5093,7 +4913,7 @@ errorLine2=" ~~~~~~~"> @@ -5104,7 +4924,7 @@ errorLine2=" ~~~~~~"> @@ -5115,7 +4935,7 @@ errorLine2=" ~~~~~~"> @@ -5126,7 +4946,7 @@ errorLine2=" ~~~~~~~"> @@ -5137,7 +4957,7 @@ errorLine2=" ~~~~~~"> @@ -5148,7 +4968,7 @@ errorLine2=" ~~~~~~"> @@ -5159,7 +4979,7 @@ errorLine2=" ~~~~"> @@ -5170,7 +4990,7 @@ errorLine2=" ~~~~"> @@ -5181,7 +5001,7 @@ errorLine2=" ~~~~~~~~"> @@ -5192,7 +5012,7 @@ errorLine2=" ~~~~"> @@ -5203,7 +5023,7 @@ errorLine2=" ~~~~~~"> @@ -5214,7 +5034,7 @@ errorLine2=" ~~~~~~"> diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml index 3464e9c3f..4858a117a 100644 --- a/core/src/main/AndroidManifest.xml +++ b/core/src/main/AndroidManifest.xml @@ -21,7 +21,7 @@ android:hardwareAccelerated="true" android:label="@string/app_name" android:supportsRtl="true" - android:theme="@style/AppTheme" + android:theme="@style/KiwixTheme" android:usesCleartextTraffic="true" tools:targetApi="m"> diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/NightModeConfig.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/NightModeConfig.kt index a754b5f79..c5bd5b319 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/NightModeConfig.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/NightModeConfig.kt @@ -20,9 +20,7 @@ package org.kiwix.kiwixmobile.core import android.content.Context import android.content.res.Configuration import androidx.appcompat.app.AppCompatDelegate -import org.kiwix.kiwixmobile.core.NightModeConfig.UiMode.OFF -import org.kiwix.kiwixmobile.core.NightModeConfig.UiMode.ON -import org.kiwix.kiwixmobile.core.NightModeConfig.UiMode.NOT_SET +import org.kiwix.kiwixmobile.core.NightModeConfig.Mode.SYSTEM import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil import javax.inject.Inject @@ -36,9 +34,10 @@ class NightModeConfig @Inject constructor( } fun isNightModeActive() = - when (uiMode()) { - ON -> true - OFF, NOT_SET -> false + when (sharedPreferenceUtil.nightMode) { + Mode.ON -> true + Mode.OFF -> false + SYSTEM -> uiMode() == UiMode.ON } private fun setMode(nightMode: Mode) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/base/SideEffect.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/base/SideEffect.kt index 063dccd71..82b69f4c6 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/base/SideEffect.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/base/SideEffect.kt @@ -17,8 +17,8 @@ */ package org.kiwix.kiwixmobile.core.base -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity interface SideEffect { - fun invokeWith(activity: Activity): T + fun invokeWith(activity: AppCompatActivity): T } diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ActivityExtensions.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ActivityExtensions.kt index 113e8a21d..5506ffca5 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ActivityExtensions.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ActivityExtensions.kt @@ -20,10 +20,10 @@ package org.kiwix.kiwixmobile.core.extensions import android.app.Activity import android.content.Intent -import android.view.ActionMode -import android.view.ActionMode.Callback import android.view.Menu import android.view.MenuItem +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.view.ActionMode import androidx.fragment.app.FragmentActivity import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider @@ -32,12 +32,12 @@ import org.kiwix.kiwixmobile.core.Intents object ActivityExtensions { - fun Activity.startActionMode( + fun AppCompatActivity.startActionMode( menuId: Int, idsToClickActions: Map Any>, onDestroyAction: () -> Unit ): ActionMode? { - return startActionMode(object : Callback { + return startSupportActionMode(object : ActionMode.Callback { override fun onActionItemClicked( mode: ActionMode, item: MenuItem diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/TableDrawerAdapter.java b/core/src/main/java/org/kiwix/kiwixmobile/core/main/TableDrawerAdapter.java index 842ddbdbb..482bd0d42 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/TableDrawerAdapter.java +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/TableDrawerAdapter.java @@ -18,9 +18,7 @@ package org.kiwix.kiwixmobile.core.main; import android.content.Context; -import android.content.res.Resources; import android.graphics.Typeface; -import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -39,8 +37,6 @@ public class TableDrawerAdapter extends RecyclerView.Adapter sections; - private int primary; - private int secondary; private int selectedPosition = 0; @@ -50,8 +46,7 @@ public class TableDrawerAdapter extends RecyclerView.Adapter { updateSelection(vh.getAdapterPosition()); diff --git a/core/src/main/res/drawable/list_bg.xml b/core/src/main/res/drawable/list_bg.xml deleted file mode 100644 index c54af6c68..000000000 --- a/core/src/main/res/drawable/list_bg.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/core/src/main/res/drawable/list_bg_light.xml b/core/src/main/res/drawable/list_bg_light.xml deleted file mode 100644 index 7f8de3a8f..000000000 --- a/core/src/main/res/drawable/list_bg_light.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/core/src/main/res/layout/activity_bookmarks.xml b/core/src/main/res/layout/activity_bookmarks.xml index 329dac053..8479331fa 100644 --- a/core/src/main/res/layout/activity_bookmarks.xml +++ b/core/src/main/res/layout/activity_bookmarks.xml @@ -3,24 +3,20 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:fitsSystemWindows="true" - > + android:fitsSystemWindows="true"> + app:layout_constraintTop_toTopOf="parent"> + app:popupTheme="@style/KiwixTheme" + app:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar" /> + app:layout_constraintTop_toBottomOf="@id/appbar" /> diff --git a/core/src/main/res/layout/activity_help.xml b/core/src/main/res/layout/activity_help.xml index 00076067b..5d1c727c3 100644 --- a/core/src/main/res/layout/activity_help.xml +++ b/core/src/main/res/layout/activity_help.xml @@ -4,26 +4,21 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?attr/listBackground" android:fitsSystemWindows="true" - tools:context=".help.HelpActivity" - > + tools:context=".help.HelpActivity"> + app:layout_constraintTop_toTopOf="parent"> + android:layout_height="wrap_content" + app:popupTheme="@style/KiwixTheme" + app:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar" /> + app:layout_constraintTop_toBottomOf="@id/activity_help_appbar" + app:srcCompat="@drawable/ic_feedback_blue_24dp" /> + app:layout_constraintTop_toTopOf="@id/activity_help_feedback_image_view" /> + app:layout_constraintTop_toBottomOf="@id/activity_help_feedback_image_view" /> + app:layout_constraintTop_toBottomOf="@id/activity_help_feedback_divider" /> diff --git a/core/src/main/res/layout/activity_history.xml b/core/src/main/res/layout/activity_history.xml index 329dac053..fc2030133 100644 --- a/core/src/main/res/layout/activity_history.xml +++ b/core/src/main/res/layout/activity_history.xml @@ -3,24 +3,20 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:fitsSystemWindows="true" - > + android:fitsSystemWindows="true"> + app:layout_constraintTop_toTopOf="parent"> + android:layout_height="wrap_content" + app:popupTheme="@style/KiwixTheme" + app:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar" /> + app:layout_constraintTop_toBottomOf="@id/appbar" /> diff --git a/core/src/main/res/layout/activity_kiwix_error.xml b/core/src/main/res/layout/activity_kiwix_error.xml index 2f3d1af95..2bc553005 100644 --- a/core/src/main/res/layout/activity_kiwix_error.xml +++ b/core/src/main/res/layout/activity_kiwix_error.xml @@ -5,179 +5,166 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_dark" - tools:context=".error.ErrorActivity" - > + tools:context=".error.ErrorActivity"> + app:layout_constraintTop_toBottomOf="@+id/imageView2" />