update main activity colors as needed
This commit is contained in:
parent
92ac97ded2
commit
9f4547c1f2
|
@ -1,6 +1,8 @@
|
||||||
package com.simplemobiletools.keyboard.activities
|
package com.simplemobiletools.keyboard.activities
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.graphics.drawable.LayerDrawable
|
||||||
|
import android.graphics.drawable.RippleDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
|
@ -8,6 +10,9 @@ import android.view.MenuItem
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
|
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
|
||||||
import com.simplemobiletools.commons.extensions.appLaunched
|
import com.simplemobiletools.commons.extensions.appLaunched
|
||||||
|
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||||
|
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
||||||
|
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||||
import com.simplemobiletools.commons.models.FAQItem
|
import com.simplemobiletools.commons.models.FAQItem
|
||||||
import com.simplemobiletools.keyboard.BuildConfig
|
import com.simplemobiletools.keyboard.BuildConfig
|
||||||
import com.simplemobiletools.keyboard.R
|
import com.simplemobiletools.keyboard.R
|
||||||
|
@ -37,6 +42,9 @@ class MainActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateTextColors(main_holder)
|
||||||
|
updateChangeKeyboardColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
|
@ -64,6 +72,12 @@ class MainActivity : SimpleActivity() {
|
||||||
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
|
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateChangeKeyboardColor() {
|
||||||
|
val applyBackground = resources.getDrawable(R.drawable.button_background_rounded, theme) as RippleDrawable
|
||||||
|
(applyBackground as LayerDrawable).findDrawableByLayerId(R.id.button_background_holder).applyColorFilter(getAdjustedPrimaryColor())
|
||||||
|
change_keyboard.background = applyBackground
|
||||||
|
}
|
||||||
|
|
||||||
private fun isKeyboardEnabled(): Boolean {
|
private fun isKeyboardEnabled(): Boolean {
|
||||||
val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
val enabledKeyboards = inputMethodManager.enabledInputMethodList
|
val enabledKeyboards = inputMethodManager.enabledInputMethodList
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/main_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue