mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 15:02:48 +00:00
update correct preview when setting colors, fixes #284
This commit is contained in:
parent
4af0f2d3a1
commit
800fb29f21
1 changed files with 4 additions and 2 deletions
|
@ -15,7 +15,7 @@ import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import androidx.core.view.MenuProvider
|
import androidx.core.view.MenuProvider
|
||||||
import androidx.core.view.forEachIndexed
|
import androidx.core.view.forEach
|
||||||
import androidx.core.view.get
|
import androidx.core.view.get
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.rarepebble.colorpicker.ColorPickerView
|
import com.rarepebble.colorpicker.ColorPickerView
|
||||||
|
@ -122,6 +122,7 @@ open class ColorsSettingsFragment : Fragment(R.layout.color_settings), MenuProvi
|
||||||
if (!moreColors && colorPref in colorPrefsToHideInitially && autoColor)
|
if (!moreColors && colorPref in colorPrefsToHideInitially && autoColor)
|
||||||
return@forEachIndexed
|
return@forEachIndexed
|
||||||
val csb = ColorSettingBinding.inflate(layoutInflater, binding.colorSettingsContainer, true)
|
val csb = ColorSettingBinding.inflate(layoutInflater, binding.colorSettingsContainer, true)
|
||||||
|
csb.root.tag = index
|
||||||
csb.colorSwitch.isChecked = !autoColor
|
csb.colorSwitch.isChecked = !autoColor
|
||||||
csb.colorPreview.setColorFilter(Settings.readUserColor(prefs, requireContext(), colorPrefs[index], isNight))
|
csb.colorPreview.setColorFilter(Settings.readUserColor(prefs, requireContext(), colorPrefs[index], isNight))
|
||||||
csb.colorText.text = colorPrefNames[index]
|
csb.colorText.text = colorPrefNames[index]
|
||||||
|
@ -203,7 +204,8 @@ open class ColorsSettingsFragment : Fragment(R.layout.color_settings), MenuProvi
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateColorPreviews() {
|
private fun updateColorPreviews() {
|
||||||
binding.colorSettingsContainer.forEachIndexed { index, view ->
|
binding.colorSettingsContainer.forEach { view ->
|
||||||
|
val index = view.tag as Int
|
||||||
val color = Settings.readUserColor(prefs, requireContext(), colorPrefs[index], isNight)
|
val color = Settings.readUserColor(prefs, requireContext(), colorPrefs[index], isNight)
|
||||||
view.findViewById<ImageView>(R.id.color_preview)?.setColorFilter(color)
|
view.findViewById<ImageView>(R.id.color_preview)?.setColorFilter(color)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue