Revert "remove our custom Back and X icons from the top left menu"

This reverts commit 0063624ceb.
This commit is contained in:
tibbi 2021-11-05 16:00:23 +01:00
parent 40cbf47ade
commit eab78101dc
3 changed files with 12 additions and 8 deletions

View file

@ -180,7 +180,7 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
} }
} }
fun updateMenuItemColors(menu: Menu?, baseColor: Int = baseConfig.primaryColor) { fun updateMenuItemColors(menu: Menu?, useCrossAsBack: Boolean = false, baseColor: Int = baseConfig.primaryColor) {
if (menu == null) { if (menu == null) {
return return
} }
@ -192,6 +192,10 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
} catch (ignored: Exception) { } catch (ignored: Exception) {
} }
} }
val drawableId = if (useCrossAsBack) R.drawable.ic_cross_vector else R.drawable.ic_arrow_left_vector
val icon = resources.getColoredDrawableWithColor(drawableId, color)
supportActionBar?.setHomeAsUpIndicator(icon)
} }
private fun getCurrentAppIconColorIndex(): Int { private fun getCurrentAppIconColorIndex(): Int {

View file

@ -103,7 +103,7 @@ class CustomizationActivity : BaseSimpleActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_customization, menu) menuInflater.inflate(R.menu.menu_customization, menu)
menu.findItem(R.id.save).isVisible = hasUnsavedChanges menu.findItem(R.id.save).isVisible = hasUnsavedChanges
updateMenuItemColors(menu, curPrimaryColor) updateMenuItemColors(menu, true, curPrimaryColor)
this.menu = menu this.menu = menu
return true return true
} }
@ -216,7 +216,7 @@ class CustomizationActivity : BaseSimpleActivity() {
curNavigationBarColor = baseConfig.customNavigationBarColor curNavigationBarColor = baseConfig.customNavigationBarColor
curAppIconColor = baseConfig.customAppIconColor curAppIconColor = baseConfig.customAppIconColor
setTheme(getThemeId(curPrimaryColor)) setTheme(getThemeId(curPrimaryColor))
updateMenuItemColors(menu, curPrimaryColor) updateMenuItemColors(menu, true, curPrimaryColor)
setupColorsPickers() setupColorsPickers()
} else { } else {
baseConfig.customPrimaryColor = curPrimaryColor baseConfig.customPrimaryColor = curPrimaryColor
@ -238,7 +238,7 @@ class CustomizationActivity : BaseSimpleActivity() {
} }
setTheme(getThemeId(curPrimaryColor)) setTheme(getThemeId(curPrimaryColor))
setupColorsPickers() setupColorsPickers()
updateMenuItemColors(menu, curPrimaryColor) updateMenuItemColors(menu, true, curPrimaryColor)
} }
} else { } else {
val theme = predefinedThemes[curSelectedThemeId]!! val theme = predefinedThemes[curSelectedThemeId]!!
@ -254,7 +254,7 @@ class CustomizationActivity : BaseSimpleActivity() {
curNavigationBarColor = getThemeNavigationColor(curSelectedThemeId) curNavigationBarColor = getThemeNavigationColor(curSelectedThemeId)
setTheme(getThemeId(curPrimaryColor)) setTheme(getThemeId(curPrimaryColor))
colorChanged() colorChanged()
updateMenuItemColors(menu, curPrimaryColor) updateMenuItemColors(menu, true, curPrimaryColor)
} }
} }
@ -513,11 +513,11 @@ class CustomizationActivity : BaseSimpleActivity() {
updateColorTheme(getUpdatedTheme()) updateColorTheme(getUpdatedTheme())
setTheme(getThemeId(color)) setTheme(getThemeId(color))
} }
updateMenuItemColors(menu, color) updateMenuItemColors(menu, true, color)
} else { } else {
updateActionbarColor(curPrimaryColor) updateActionbarColor(curPrimaryColor)
setTheme(getThemeId(curPrimaryColor)) setTheme(getThemeId(curPrimaryColor))
updateMenuItemColors(menu, curPrimaryColor) updateMenuItemColors(menu, true, curPrimaryColor)
} }
} }
} }

View file

@ -76,7 +76,7 @@ class LineColorPickerDialog(val activity: BaseSimpleActivity, val color: Int, va
if (isPrimaryColorPicker) { if (isPrimaryColorPicker) {
activity.updateActionbarColor(color) activity.updateActionbarColor(color)
activity.setTheme(activity.getThemeId(color)) activity.setTheme(activity.getThemeId(color))
activity.updateMenuItemColors(menu, color) activity.updateMenuItemColors(menu, true, color)
if (!wasDimmedBackgroundRemoved) { if (!wasDimmedBackgroundRemoved) {
dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)