use theme colors at widget config activities too
This commit is contained in:
parent
befacff4e4
commit
49de1431a5
|
@ -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)
|
||||
|
|
|
@ -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<DayMonthly>? = 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
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
android:layout_toRightOf="@+id/config_bg_color"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<SeekBar
|
||||
<com.simplemobiletools.commons.views.MySeekBar
|
||||
android:id="@+id/config_bg_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
android:layout_toRightOf="@+id/config_bg_color"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<SeekBar
|
||||
<com.simplemobiletools.commons.views.MySeekBar
|
||||
android:id="@+id/config_bg_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -57,4 +57,5 @@
|
|||
android:text="@android:string/ok"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/big_text_size"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in New Issue