From f7e867219cd19b1a55ea5739bc30bb949f9f9279 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 13 Jan 2020 02:35:08 -0800 Subject: [PATCH] Fixed Remove history dialog --- .../ui/recently_read/RemoveHistoryDialog.kt | 16 +++++++--------- .../ui/setting/SettingsGeneralController.kt | 14 -------------- .../tachiyomi/widget/ExtendedNavigationView.kt | 2 +- app/src/main/res/menu/extension_main.xml | 6 ------ 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RemoveHistoryDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RemoveHistoryDialog.kt index b0e1202826..e3bea08f14 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RemoveHistoryDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RemoveHistoryDialog.kt @@ -3,6 +3,8 @@ package eu.kanade.tachiyomi.ui.recently_read import android.app.Dialog import android.os.Bundle import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.checkbox.checkBoxPrompt +import com.afollestad.materialdialogs.checkbox.isCheckPromptChecked import com.afollestad.materialdialogs.customview.customView import com.bluelinelabs.conductor.Controller import eu.kanade.tachiyomi.R @@ -27,18 +29,14 @@ class RemoveHistoryDialog(bundle: Bundle? = null) : DialogController(bundle) override fun onCreateDialog(savedViewState: Bundle?): Dialog { val activity = activity!! - // Create custom view - val dialogCheckboxView = DialogCheckboxView(activity).apply { - setDescription(R.string.dialog_with_checkbox_remove_description) - setOptionDescription(R.string.dialog_with_checkbox_reset) - } - return MaterialDialog(activity) .title(R.string.action_remove) - .customView(view = dialogCheckboxView, scrollable = true) - .positiveButton(R.string.action_remove) { onPositive(dialogCheckboxView.isChecked - ()) } + .message(R.string.dialog_with_checkbox_remove_description) + .checkBoxPrompt(res = R.string.dialog_with_checkbox_reset){} .negativeButton(android.R.string.cancel) + .positiveButton(R.string.action_remove) { + onPositive(it.isCheckPromptChecked()) + } } private fun onPositive(checked: Boolean) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index 55b1767030..5a3e2fea58 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -1,27 +1,13 @@ package eu.kanade.tachiyomi.ui.setting -import android.app.Dialog -import android.os.Bundle -import android.os.Handler -import android.view.View import androidx.biometric.BiometricManager import androidx.preference.PreferenceScreen -import com.afollestad.materialdialogs.MaterialDialog import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.data.database.DatabaseHelper -import eu.kanade.tachiyomi.data.database.models.Category -import eu.kanade.tachiyomi.data.library.LibraryUpdateJob -import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.updater.UpdaterJob -import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.util.LocaleHelper import eu.kanade.tachiyomi.widget.preference.IntListPreference -import kotlinx.android.synthetic.main.pref_library_columns.view.* -import rx.Observable -import uy.kohesive.injekt.Injekt -import uy.kohesive.injekt.api.get import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsGeneralController : SettingsController() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt index bfca88684b..f34bee41c2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt @@ -191,7 +191,7 @@ open class ExtendedNavigationView @JvmOverloads constructor( * Base adapter for the navigation view. It knows how to create and render every subclass of * [Item]. */ - abstract inner class Adapter(private val items: List) : androidx.recyclerview.widget.RecyclerView.Adapter() { + abstract inner class Adapter(private val items: List) : RecyclerView.Adapter() { private val onClick = View.OnClickListener { val pos = recycler.getChildAdapterPosition(it) diff --git a/app/src/main/res/menu/extension_main.xml b/app/src/main/res/menu/extension_main.xml index ba0d5da1c1..b2e7e5d773 100644 --- a/app/src/main/res/menu/extension_main.xml +++ b/app/src/main/res/menu/extension_main.xml @@ -8,12 +8,6 @@ app:actionViewClass="androidx.appcompat.widget.SearchView" app:showAsAction="collapseActionView|ifRoom" /> - -