mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix icons pack change
This commit is contained in:
@@ -232,11 +232,6 @@ class GroupFragment : DatabaseFragment(), SortDialogFragment.SortSelectionListen
|
||||
mCurrentGroup?.let { mainGroup ->
|
||||
// Thrown an exception when sort cannot be performed
|
||||
mAdapter?.rebuildList(mainGroup)
|
||||
// To visually change the elements
|
||||
if (PreferencesUtil.APPEARANCE_CHANGED) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
PreferencesUtil.APPEARANCE_CHANGED = false
|
||||
}
|
||||
}
|
||||
} catch (e:Exception) {
|
||||
Log.e(TAG, "Unable to rebuild the list", e)
|
||||
|
||||
@@ -3,12 +3,10 @@ package com.kunzisoft.keepass.activities.selection
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.room.Database
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
|
||||
import com.kunzisoft.keepass.activities.helpers.SpecialMode
|
||||
import com.kunzisoft.keepass.activities.helpers.TypeMode
|
||||
import com.kunzisoft.keepass.activities.stylish.StylishActivity
|
||||
import com.kunzisoft.keepass.model.SearchInfo
|
||||
import com.kunzisoft.keepass.settings.PreferencesUtil
|
||||
import com.kunzisoft.keepass.view.SpecialModeView
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.util.Log
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.StyleRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.kunzisoft.keepass.icons.IconPackChooser.ICONS_PACK_CHANGED
|
||||
|
||||
/**
|
||||
* Stylish Hide Activity that apply a dynamic style and sets FLAG_SECURE to prevent screenshots / from
|
||||
@@ -79,7 +80,9 @@ abstract class StylishActivity : AppCompatActivity() {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
if (customStyle && Stylish.getThemeId(this) != this.themeId) {
|
||||
if ((customStyle && Stylish.getThemeId(this) != this.themeId)
|
||||
|| ICONS_PACK_CHANGED) {
|
||||
ICONS_PACK_CHANGED = false
|
||||
Log.d(this.javaClass.name, "Theme change detected, restarting activity")
|
||||
this.recreate()
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ object IconPackChooser {
|
||||
|
||||
private var isIconPackChooserBuilt: Boolean = false
|
||||
|
||||
var ICONS_PACK_CHANGED = false
|
||||
|
||||
/**
|
||||
* Built the icon pack chooser based on imports made in *build.gradle*
|
||||
*
|
||||
@@ -93,6 +95,8 @@ object IconPackChooser {
|
||||
fun setSelectedIconPack(iconPackIdString: String?) {
|
||||
for (iconPack in iconPackList) {
|
||||
if (iconPack.id == iconPackIdString) {
|
||||
// To change list items appearance
|
||||
ICONS_PACK_CHANGED = true
|
||||
iconPackSelected = iconPack
|
||||
break
|
||||
}
|
||||
|
||||
@@ -384,9 +384,6 @@ class NestedAppSettingsFragment : NestedSettingsFragment() {
|
||||
private fun onCreateAppearancePreferences(rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.preferences_appearance, rootKey)
|
||||
|
||||
// To change list items appearance
|
||||
PreferencesUtil.APPEARANCE_CHANGED = true
|
||||
|
||||
activity?.let { activity ->
|
||||
findPreference<ListPreference>(getString(R.string.setting_style_key))?.setOnPreferenceChangeListener { _, newValue ->
|
||||
var styleEnabled = true
|
||||
|
||||
@@ -37,8 +37,6 @@ import java.util.*
|
||||
|
||||
object PreferencesUtil {
|
||||
|
||||
var APPEARANCE_CHANGED = false
|
||||
|
||||
fun saveDefaultDatabasePath(context: Context, defaultDatabaseUri: Uri?) {
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
prefs?.edit()?.apply {
|
||||
|
||||
Reference in New Issue
Block a user