diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt index 02c8d1afdc..72dd10d3f8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt @@ -23,7 +23,7 @@ class ExtensionUpdateJob : Job() { override fun onRunJob(params: Params): Result { GlobalScope.launch(Dispatchers.IO) { - val pendingUpdates = ExtensionGithubApi().checkforUpdates(context) + val pendingUpdates = ExtensionGithubApi().checkForUpdates(context) if (pendingUpdates.isNotEmpty()) { val names = pendingUpdates.map { it.name } val preferences: PreferencesHelper by injectLazy() diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt index d55c4b9357..ad7ad63ce2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt @@ -7,18 +7,16 @@ import com.github.salomonbrys.kotson.int import com.github.salomonbrys.kotson.string import com.google.gson.Gson import com.google.gson.JsonArray -import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.LoadResult import eu.kanade.tachiyomi.extension.util.ExtensionLoader import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.NetworkHelper +import eu.kanade.tachiyomi.network.await import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import eu.kanade.tachiyomi.network.await import okhttp3.Response import uy.kohesive.injekt.injectLazy -import java.lang.Exception internal class ExtensionGithubApi { @@ -34,7 +32,7 @@ internal class ExtensionGithubApi { } } - suspend fun checkforUpdates(context: Context): List { + suspend fun checkForUpdates(context: Context): List { return withContext(Dispatchers.IO) { val call = GET("$REPO_URL/index.json") val response = network.client.newCall(call).await() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomSheet.kt index 714df3bf7f..7f2a106715 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomSheet.kt @@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.catalogue.CatalogueController +import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.updateLayoutParams @@ -53,10 +54,7 @@ ExtensionAdapter.OnButtonClickListener, ext_recycler.adapter = adapter ext_recycler.addItemDecoration(ExtensionDividerItemDecoration(context)) ext_recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener) - // scrollViewWith(ext_recycler, true, ext_swipe_refresh) this.controller = controller - //ext_swipe_refresh.refreshes().subscribeUntilDestroy { - // presenter.findAvailableExtensions() presenter.onCreate() updateExtTitle() @@ -85,6 +83,9 @@ ExtensionAdapter.OnButtonClickListener, title_text.text = if (extCount == 0) context.getString(R.string.label_extensions) else resources.getQuantityString(R.plurals.extensions_updates_available, extCount, extCount) + + title_text.setTextColor(context.getResourceColor( + if (extCount == 0) R.attr.actionBarTintColor else R.attr.colorAccent)) } override fun onButtonClick(position: Int) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt index aa78084568..f5af24e88c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt @@ -316,7 +316,6 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), activity!!.theme.resolveAttribute(R.attr.actionBarTintColor, tv, true) customTitleSpinner = library_layout.inflate(R.layout.spinner_title) as ViewGroup -// (activity as MainActivity).supportActionBar?.setDisplayShowCustomEnabled(false) spinnerAdapter = SpinnerAdapter( view.context, R.layout.library_spinner_textview, @@ -331,7 +330,6 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), scrollToHeader(item.itemId) true } - //(activity as MainActivity).supportActionBar?.customView = customTitleSpinner scrollViewWith(recycler) { insets -> fast_scroller.updateLayoutParams { topMargin = insets.systemWindowInsetTop @@ -348,29 +346,15 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), activity?.toolbar?.removeSpinner() } } - /*if (type.isEnter) { - (activity as MainActivity).supportActionBar - ?.setDisplayShowCustomEnabled(router?.backstack?.lastOrNull()?.controller() == - this && spinnerAdapter?.array?.size ?: 0 > 1) - } - else if (type == ControllerChangeType.PUSH_EXIT) { - (activity as MainActivity).toolbar.menu.findItem(R.id - .action_search)?.collapseActionView() - (activity as MainActivity).supportActionBar?.setDisplayShowCustomEnabled(false) - }*/ } override fun onActivityResumed(activity: Activity) { super.onActivityResumed(activity) + if (view == null) return resetScrollingValues() resetRecyclerY() } - override fun onDestroy() { - // (activity as MainActivity).supportActionBar?.setDisplayShowCustomEnabled(false) - super.onDestroy() - } - override fun onNextLibraryUpdate(mangaMap: List, freshStart: Boolean) { val recyclerLayout = view ?: return destroyActionModeIfNeeded() @@ -393,8 +377,6 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), val isCurrentController = router?.backstack?.lastOrNull()?.controller() == this -// (activity as AppCompatActivity).supportActionBar -// ?.setDisplayShowCustomEnabled(isCurrentController && presenter.categories.size > 1) customTitleSpinner.category_title.text = presenter.categories[clamp(activeCategory, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index f21ff5ad90..e5b250c373 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -301,7 +301,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener { .SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && currentNightMode == Configuration - .UI_MODE_NIGHT_NO && preferences.theme() >= 8) + .UI_MODE_NIGHT_NO) content.systemUiVisibility = content.systemUiVisibility.or(View .SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) @@ -424,7 +424,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener { GlobalScope.launch(Dispatchers.IO) { val preferences: PreferencesHelper by injectLazy() try { - val pendingUpdates = ExtensionGithubApi().checkforUpdates(this@MainActivity) + val pendingUpdates = ExtensionGithubApi().checkForUpdates(this@MainActivity) preferences.extensionUpdatesCount().set(pendingUpdates.size) preferences.lastExtCheck().set(Date().time) } catch (e: java.lang.Exception) { } diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 099151ca1f..925f61e153 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -30,7 +30,7 @@ true - @style/Theme.ActionBar.DayNight + @style/ThemeOverlay.AppCompat.DayNight.ActionBar @style/PreferenceThemeOverlay @style/Theme.AlertDialog.DayNight @@ -44,7 +44,7 @@ @color/iconColor @color/snackbarBackground @color/textColorPrimaryInverse - @color/md_white_1000 + @color/textColorPrimary @color/badgeColor @android:color/transparent @@ -64,8 +64,6 @@ @color/purePrimary @color/purePrimary @color/colorPrimary - @color/textColorPrimary - @style/ThemeOverlay.AppCompat.DayNight.ActionBar @color/colorPrimary @color/colorPrimaryInactive @color/md_black_1000_54 @@ -80,6 +78,8 @@ @color/darkPrimaryTranslucent @color/darkPrimaryTranslucent @android:color/white + @style/ThemeOverlay.AppCompat.Dark.ActionBar + @color/md_white_1000 ?colorPrimaryDark ?colorPrimaryDark