adding some widget related UI changes

This commit is contained in:
tibbi 2022-05-20 14:55:24 +02:00
parent 447e52155d
commit 40a5127d0d
4 changed files with 46 additions and 34 deletions

View File

@ -7,9 +7,7 @@ import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.widget.SeekBar import android.widget.SeekBar
import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.setFillWithStroke
import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
import com.simplemobiletools.flashlight.R import com.simplemobiletools.flashlight.R
@ -39,6 +37,9 @@ class WidgetBrightDisplayConfigureActivity : SimpleActivity() {
config_save.setOnClickListener { saveConfig() } config_save.setOnClickListener { saveConfig() }
config_widget_color.setOnClickListener { pickBackgroundColor() } config_widget_color.setOnClickListener { pickBackgroundColor() }
val primaryColor = getProperPrimaryColor()
config_widget_seekbar.setColors(getProperTextColor(), primaryColor, primaryColor)
} }
private fun initVariables() { private fun initVariables() {
@ -84,7 +85,7 @@ class WidgetBrightDisplayConfigureActivity : SimpleActivity() {
private fun updateColors() { private fun updateColors() {
mWidgetColor = mWidgetColorWithoutTransparency.adjustAlpha(mWidgetAlpha) mWidgetColor = mWidgetColorWithoutTransparency.adjustAlpha(mWidgetAlpha)
config_widget_color.setFillWithStroke(mWidgetColor, Color.BLACK) config_widget_color.setFillWithStroke(mWidgetColor, mWidgetColor)
config_image.background.mutate().applyColorFilter(mWidgetColor) config_image.background.mutate().applyColorFilter(mWidgetColor)
} }

View File

@ -7,9 +7,7 @@ import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.widget.SeekBar import android.widget.SeekBar
import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.setFillWithStroke
import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
import com.simplemobiletools.flashlight.R import com.simplemobiletools.flashlight.R
@ -40,6 +38,9 @@ class WidgetTorchConfigureActivity : SimpleActivity() {
config_save.setOnClickListener { saveConfig() } config_save.setOnClickListener { saveConfig() }
config_widget_color.setOnClickListener { pickBackgroundColor() } config_widget_color.setOnClickListener { pickBackgroundColor() }
val primaryColor = getProperPrimaryColor()
config_widget_seekbar.setColors(getProperTextColor(), primaryColor, primaryColor)
} }
private fun initVariables() { private fun initVariables() {
@ -87,7 +88,7 @@ class WidgetTorchConfigureActivity : SimpleActivity() {
private fun updateColors() { private fun updateColors() {
mWidgetColor = mWidgetColorWithoutTransparency.adjustAlpha(mWidgetAlpha) mWidgetColor = mWidgetColorWithoutTransparency.adjustAlpha(mWidgetAlpha)
config_widget_color.setFillWithStroke(mWidgetColor, Color.BLACK) config_widget_color.setFillWithStroke(mWidgetColor, mWidgetColor)
config_image.background.mutate().applyColorFilter(mWidgetColor) config_image.background.mutate().applyColorFilter(mWidgetColor)
} }

View File

@ -1,12 +1,13 @@
<?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/config_bright_display_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin" android:layout_margin="@dimen/activity_margin">
android:paddingBottom="@dimen/activity_margin">
<RelativeLayout <RelativeLayout
android:id="@+id/config_bright_display_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_above="@+id/config_widget_color" android:layout_above="@+id/config_widget_color"
@ -24,7 +25,8 @@
android:id="@+id/config_widget_color" android:id="@+id/config_widget_color"
android:layout_width="@dimen/widget_colorpicker_size" android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size" android:layout_height="@dimen/widget_colorpicker_size"
android:layout_above="@+id/config_save" /> android:layout_above="@+id/config_save"
android:layout_margin="@dimen/tiny_margin" />
<RelativeLayout <RelativeLayout
android:id="@+id/config_widget_seekbar_holder" android:id="@+id/config_widget_seekbar_holder"
@ -32,30 +34,33 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignTop="@+id/config_widget_color" android:layout_alignTop="@+id/config_widget_color"
android:layout_alignBottom="@+id/config_widget_color" android:layout_alignBottom="@+id/config_widget_color"
android:layout_toRightOf="@+id/config_widget_color" android:layout_marginStart="@dimen/medium_margin"
android:background="@android:color/white"> android:layout_toEndOf="@+id/config_widget_color"
android:background="@drawable/widget_config_seekbar_background">
<SeekBar <com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/config_widget_seekbar" android:id="@+id/config_widget_seekbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingLeft="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" /> android:paddingEnd="@dimen/activity_margin" />
</RelativeLayout> </RelativeLayout>
<Button <Button
android:id="@+id/config_save" android:id="@+id/config_save"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="@color/gradient_grey_start" android:layout_marginTop="@dimen/small_margin"
android:background="@drawable/widget_config_seekbar_background"
android:fontFamily="sans-serif-light" android:fontFamily="sans-serif-light"
android:paddingLeft="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/ok" android:text="@string/ok"
android:textColor="@color/color_primary" android:textColor="@color/dark_grey"
android:textFontWeight="400"
android:textSize="@dimen/big_text_size" /> android:textSize="@dimen/big_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,12 +1,13 @@
<?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/config_torch_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin" android:layout_margin="@dimen/activity_margin">
android:paddingBottom="@dimen/activity_margin">
<RelativeLayout <RelativeLayout
android:id="@+id/config_torch_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_above="@+id/config_widget_color" android:layout_above="@+id/config_widget_color"
@ -24,7 +25,8 @@
android:id="@+id/config_widget_color" android:id="@+id/config_widget_color"
android:layout_width="@dimen/widget_colorpicker_size" android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size" android:layout_height="@dimen/widget_colorpicker_size"
android:layout_above="@+id/config_save" /> android:layout_above="@+id/config_save"
android:layout_margin="@dimen/tiny_margin" />
<RelativeLayout <RelativeLayout
android:id="@+id/config_widget_seekbar_holder" android:id="@+id/config_widget_seekbar_holder"
@ -32,30 +34,33 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignTop="@+id/config_widget_color" android:layout_alignTop="@+id/config_widget_color"
android:layout_alignBottom="@+id/config_widget_color" android:layout_alignBottom="@+id/config_widget_color"
android:layout_toRightOf="@+id/config_widget_color" android:layout_marginStart="@dimen/medium_margin"
android:background="@android:color/white"> android:layout_toEndOf="@+id/config_widget_color"
android:background="@drawable/widget_config_seekbar_background">
<SeekBar <com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/config_widget_seekbar" android:id="@+id/config_widget_seekbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingLeft="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" /> android:paddingEnd="@dimen/activity_margin" />
</RelativeLayout> </RelativeLayout>
<Button <Button
android:id="@+id/config_save" android:id="@+id/config_save"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="@color/gradient_grey_start" android:layout_marginTop="@dimen/small_margin"
android:background="@drawable/widget_config_seekbar_background"
android:fontFamily="sans-serif-light" android:fontFamily="sans-serif-light"
android:paddingLeft="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/ok" android:text="@string/ok"
android:textColor="@color/color_primary" android:textColor="@color/dark_grey"
android:textFontWeight="400"
android:textSize="@dimen/big_text_size" /> android:textSize="@dimen/big_text_size" />
</RelativeLayout> </RelativeLayout>