adding some widget config screen tweaks

This commit is contained in:
tibbi 2023-01-09 16:52:26 +01:00
parent 6466245606
commit a6fb0c18fa
3 changed files with 13 additions and 32 deletions

View file

@ -70,11 +70,6 @@ class WidgetConfigureActivity : SimpleActivity() {
}
}
override fun onResume() {
super.onResume()
setupToolbar(config_toolbar)
}
private fun initVariables() {
mBgColor = config.widgetBgColor
mBgAlpha = Color.alpha(mBgColor) / 255f
@ -83,14 +78,18 @@ class WidgetConfigureActivity : SimpleActivity() {
config_bg_seekbar.apply {
progress = (mBgAlpha * 100).toInt()
onSeekBarChangeListener {
mBgAlpha = it / 100f
onSeekBarChangeListener { progress ->
mBgAlpha = progress / 100f
updateBackgroundColor()
}
}
updateBackgroundColor()
mTextColor = config.widgetTextColor
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
mTextColor = resources.getColor(R.color.you_primary_color, theme)
}
updateTextColor()
}
@ -128,6 +127,12 @@ class WidgetConfigureActivity : SimpleActivity() {
}
}
private fun updateTextColor() {
config_folder_name.setTextColor(mTextColor)
config_text_color.setFillWithStroke(mTextColor, mTextColor)
config_save.setTextColor(getProperPrimaryColor().getContrastColor())
}
private fun updateBackgroundColor() {
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
config_image_holder.background.applyColorFilter(mBgColor)
@ -135,12 +140,6 @@ class WidgetConfigureActivity : SimpleActivity() {
config_save.backgroundTintList = ColorStateList.valueOf(getProperPrimaryColor())
}
private fun updateTextColor() {
config_folder_name.setTextColor(mTextColor)
config_text_color.setFillWithStroke(mTextColor, mTextColor)
config_save.setTextColor(getProperPrimaryColor().getContrastColor())
}
private fun pickBackgroundColor() {
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
if (wasPositivePressed) {

View file

@ -1,33 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/config_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/config_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/config_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:title="@string/app_launcher_name"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="@+id/config_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:layout_margin="@dimen/activity_margin">
<RelativeLayout
android:id="@+id/folder_picker_holder"

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="actionbar_menu_icon">#454545</color>
<color name="crop_image_view_background">#BB000000</color>
<color name="circle_black_background">#66000000</color>
</resources>