From 49de1431a56ba29cb5301e15a8aaf51c7d4b1364 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 13 Nov 2017 22:50:21 +0100 Subject: [PATCH] use theme colors at widget config activities too --- .../activities/WidgetListConfigureActivity.kt | 23 ++++++++++++------- .../WidgetMonthlyConfigureActivity.kt | 15 ++++++++---- .../main/res/layout/widget_config_list.xml | 2 +- .../main/res/layout/widget_config_monthly.xml | 3 ++- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetListConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetListConfigureActivity.kt index 9e44f5852..81cb6b7d6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetListConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetListConfigureActivity.kt @@ -6,7 +6,6 @@ import android.content.Intent import android.content.res.Resources import android.graphics.Color import android.os.Bundle -import android.support.v7.app.AppCompatActivity import android.widget.SeekBar import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.adapters.EventListWidgetAdapterOld @@ -23,7 +22,7 @@ import kotlinx.android.synthetic.main.widget_config_list.* import org.joda.time.DateTime import java.util.* -class WidgetListConfigureActivity : AppCompatActivity() { +class WidgetListConfigureActivity : SimpleActivity() { lateinit var mRes: Resources private var mPackageName = "" @@ -57,13 +56,21 @@ class WidgetListConfigureActivity : AppCompatActivity() { config_save.setOnClickListener { saveConfig() } config_bg_color.setOnClickListener { pickBackgroundColor() } config_text_color.setOnClickListener { pickTextColor() } + + val primaryColor = config.primaryColor + config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor) + } + + override fun onResume() { + super.onResume() + window.decorView.setBackgroundColor(0) } private fun initVariables() { mRes = resources mTextColorWithoutTransparency = config.widgetTextColor - updateTextColors() + updateColors() mBgColor = config.widgetBgColor if (mBgColor == 1) { @@ -79,7 +86,7 @@ class WidgetListConfigureActivity : AppCompatActivity() { updateBgColor() } - fun saveConfig() { + private fun saveConfig() { storeWidgetColors() requestWidgetUpdate() @@ -97,17 +104,17 @@ class WidgetListConfigureActivity : AppCompatActivity() { } } - fun pickBackgroundColor() { + private fun pickBackgroundColor() { ColorPickerDialog(this, mBgColorWithoutTransparency) { mBgColorWithoutTransparency = it updateBgColor() } } - fun pickTextColor() { + private fun pickTextColor() { ColorPickerDialog(this, mTextColor) { mTextColorWithoutTransparency = it - updateTextColors() + updateColors() } } @@ -118,7 +125,7 @@ class WidgetListConfigureActivity : AppCompatActivity() { } } - private fun updateTextColors() { + private fun updateColors() { mTextColor = mTextColorWithoutTransparency mEventsAdapter?.setTextColor(mTextColor) config_text_color.setBackgroundColor(mTextColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt index 89833af77..10bfad904 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt @@ -7,7 +7,6 @@ import android.content.Intent import android.content.res.Resources import android.graphics.Color import android.os.Bundle -import android.support.v7.app.AppCompatActivity import android.widget.LinearLayout import android.widget.SeekBar import android.widget.TextView @@ -29,7 +28,7 @@ import kotlinx.android.synthetic.main.top_navigation.* import kotlinx.android.synthetic.main.widget_config_monthly.* import org.joda.time.DateTime -class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { +class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar { lateinit var mRes: Resources private var mDays: List? = null private var mPackageName = "" @@ -60,6 +59,12 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { config_save.setOnClickListener { saveConfig() } config_bg_color.setOnClickListener { pickBackgroundColor() } config_text_color.setOnClickListener { pickTextColor() } + config_bg_seekbar.setColors(mTextColor, mPrimaryColor, mPrimaryColor) + } + + override fun onResume() { + super.onResume() + window.decorView.setBackgroundColor(0) } private fun initVariables() { @@ -67,7 +72,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { mRes = resources mTextColorWithoutTransparency = config.widgetTextColor - updateTextColors() + updateColors() mBgColor = config.widgetBgColor if (mBgColor == 1) { @@ -113,7 +118,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { private fun pickTextColor() { ColorPickerDialog(this, mTextColor) { mTextColorWithoutTransparency = it - updateTextColors() + updateColors() updateDays() } } @@ -125,7 +130,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { } } - private fun updateTextColors() { + private fun updateColors() { mTextColor = mTextColorWithoutTransparency mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOW_ALPHA) mPrimaryColor = config.primaryColor diff --git a/app/src/main/res/layout/widget_config_list.xml b/app/src/main/res/layout/widget_config_list.xml index c1b4faecd..f9264128c 100644 --- a/app/src/main/res/layout/widget_config_list.xml +++ b/app/src/main/res/layout/widget_config_list.xml @@ -33,7 +33,7 @@ android:layout_toRightOf="@+id/config_bg_color" android:background="@android:color/white"> - - +