minor code cleanup

This commit is contained in:
tibbi 2023-01-09 16:49:38 +01:00
parent d522de1c42
commit b378f768be
6 changed files with 30 additions and 26 deletions

View File

@ -47,15 +47,18 @@ class WidgetDateConfigureActivity : SimpleActivity() {
private fun initVariables() {
mBgColor = config.widgetBgColor
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
mBgAlpha = Color.alpha(mBgColor) / 255f
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
updateBackgroundColor()
config_bg_seekbar.onSeekBarChangeListener { progress ->
mBgAlpha = progress / 100.toFloat()
updateBackgroundColor()
config_bg_seekbar.apply {
progress = (mBgAlpha * 100).toInt()
onSeekBarChangeListener { progress ->
mBgAlpha = progress / 100f
updateBackgroundColor()
}
}
updateBackgroundColor()
mTextColor = config.widgetTextColor
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {

View File

@ -74,15 +74,18 @@ class WidgetListConfigureActivity : SimpleActivity() {
private fun initVariables() {
mBgColor = config.widgetBgColor
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
mBgAlpha = Color.alpha(mBgColor) / 255f
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
updateBackgroundColor()
config_bg_seekbar.onSeekBarChangeListener { progress ->
mBgAlpha = progress / 100.toFloat()
updateBackgroundColor()
config_bg_seekbar.apply {
progress = (mBgAlpha * 100).toInt()
onSeekBarChangeListener { progress ->
mBgAlpha = progress / 100f
updateBackgroundColor()
}
}
updateBackgroundColor()
mTextColor = config.widgetTextColor
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {

View File

@ -64,15 +64,18 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
private fun initVariables() {
mBgColor = config.widgetBgColor
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
mBgAlpha = Color.alpha(mBgColor) / 255f
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
updateBackgroundColor()
config_bg_seekbar.onSeekBarChangeListener { progress ->
mBgAlpha = progress / 100.toFloat()
updateBackgroundColor()
config_bg_seekbar.apply {
progress = (mBgAlpha * 100).toInt()
onSeekBarChangeListener { progress ->
mBgAlpha = progress / 100f
updateBackgroundColor()
}
}
updateBackgroundColor()
mTextColor = config.widgetTextColor
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {

View File

@ -1,6 +1,5 @@
<?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"
@ -11,8 +10,7 @@
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/config_date_time_wrapper"

View File

@ -10,8 +10,7 @@
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/period_picker_holder"

View File

@ -1,6 +1,5 @@
<?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"
android:id="@+id/config_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -10,8 +9,7 @@
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">
<include
android:id="@+id/config_calendar"