Skip to content

Commit

Permalink
Fix dropdown text color
Browse files Browse the repository at this point in the history
  • Loading branch information
wilco375 committed Mar 12, 2021
1 parent 827d9fe commit 69b2c29
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.wilco375.roosternotification.activity

import android.content.SharedPreferences
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.TextView
import androidx.appcompat.app.AppCompatDelegate
import com.wilco375.roosternotification.R
import com.wilco375.roosternotification.general.Utils
Expand All @@ -15,6 +17,7 @@ import kotlinx.android.synthetic.main.content_settings.*
import java.util.*
import kotlin.collections.ArrayList


class SettingsActivity : CAppCompatActivity() {

lateinit var sp: SharedPreferences
Expand Down Expand Up @@ -111,6 +114,11 @@ class SettingsActivity : CAppCompatActivity() {

themeColorSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(adapterView: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (Utils.isNightModeEnabled(this@SettingsActivity)) {
(adapterView?.getChildAt(0) as TextView?)?.setTextColor(Color.WHITE)
} else {
(adapterView?.getChildAt(0) as TextView?)?.setTextColor(Color.BLACK)
}
if (currentColor != colors[position]) {
currentColor = colors[position]
sp.edit().putString("theme_color", colors[position]).apply()
Expand Down

0 comments on commit 69b2c29

Please sign in to comment.