mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
use theme colors at widget config activities too
This commit is contained in:
@@ -6,7 +6,6 @@ import android.content.Intent
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v7.app.AppCompatActivity
|
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.adapters.EventListWidgetAdapterOld
|
import com.simplemobiletools.calendar.adapters.EventListWidgetAdapterOld
|
||||||
@@ -23,7 +22,7 @@ import kotlinx.android.synthetic.main.widget_config_list.*
|
|||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class WidgetListConfigureActivity : AppCompatActivity() {
|
class WidgetListConfigureActivity : SimpleActivity() {
|
||||||
lateinit var mRes: Resources
|
lateinit var mRes: Resources
|
||||||
private var mPackageName = ""
|
private var mPackageName = ""
|
||||||
|
|
||||||
@@ -57,13 +56,21 @@ class WidgetListConfigureActivity : AppCompatActivity() {
|
|||||||
config_save.setOnClickListener { saveConfig() }
|
config_save.setOnClickListener { saveConfig() }
|
||||||
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||||
config_text_color.setOnClickListener { pickTextColor() }
|
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() {
|
private fun initVariables() {
|
||||||
mRes = resources
|
mRes = resources
|
||||||
|
|
||||||
mTextColorWithoutTransparency = config.widgetTextColor
|
mTextColorWithoutTransparency = config.widgetTextColor
|
||||||
updateTextColors()
|
updateColors()
|
||||||
|
|
||||||
mBgColor = config.widgetBgColor
|
mBgColor = config.widgetBgColor
|
||||||
if (mBgColor == 1) {
|
if (mBgColor == 1) {
|
||||||
@@ -79,7 +86,7 @@ class WidgetListConfigureActivity : AppCompatActivity() {
|
|||||||
updateBgColor()
|
updateBgColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveConfig() {
|
private fun saveConfig() {
|
||||||
storeWidgetColors()
|
storeWidgetColors()
|
||||||
requestWidgetUpdate()
|
requestWidgetUpdate()
|
||||||
|
|
||||||
@@ -97,17 +104,17 @@ class WidgetListConfigureActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pickBackgroundColor() {
|
private fun pickBackgroundColor() {
|
||||||
ColorPickerDialog(this, mBgColorWithoutTransparency) {
|
ColorPickerDialog(this, mBgColorWithoutTransparency) {
|
||||||
mBgColorWithoutTransparency = it
|
mBgColorWithoutTransparency = it
|
||||||
updateBgColor()
|
updateBgColor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pickTextColor() {
|
private fun pickTextColor() {
|
||||||
ColorPickerDialog(this, mTextColor) {
|
ColorPickerDialog(this, mTextColor) {
|
||||||
mTextColorWithoutTransparency = it
|
mTextColorWithoutTransparency = it
|
||||||
updateTextColors()
|
updateColors()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +125,7 @@ class WidgetListConfigureActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTextColors() {
|
private fun updateColors() {
|
||||||
mTextColor = mTextColorWithoutTransparency
|
mTextColor = mTextColorWithoutTransparency
|
||||||
mEventsAdapter?.setTextColor(mTextColor)
|
mEventsAdapter?.setTextColor(mTextColor)
|
||||||
config_text_color.setBackgroundColor(mTextColor)
|
config_text_color.setBackgroundColor(mTextColor)
|
||||||
|
@@ -7,7 +7,6 @@ import android.content.Intent
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v7.app.AppCompatActivity
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
@@ -29,7 +28,7 @@ import kotlinx.android.synthetic.main.top_navigation.*
|
|||||||
import kotlinx.android.synthetic.main.widget_config_monthly.*
|
import kotlinx.android.synthetic.main.widget_config_monthly.*
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
||||||
lateinit var mRes: Resources
|
lateinit var mRes: Resources
|
||||||
private var mDays: List<DayMonthly>? = null
|
private var mDays: List<DayMonthly>? = null
|
||||||
private var mPackageName = ""
|
private var mPackageName = ""
|
||||||
@@ -60,6 +59,12 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
|||||||
config_save.setOnClickListener { saveConfig() }
|
config_save.setOnClickListener { saveConfig() }
|
||||||
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||||
config_text_color.setOnClickListener { pickTextColor() }
|
config_text_color.setOnClickListener { pickTextColor() }
|
||||||
|
config_bg_seekbar.setColors(mTextColor, mPrimaryColor, mPrimaryColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
window.decorView.setBackgroundColor(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initVariables() {
|
private fun initVariables() {
|
||||||
@@ -67,7 +72,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
|||||||
mRes = resources
|
mRes = resources
|
||||||
|
|
||||||
mTextColorWithoutTransparency = config.widgetTextColor
|
mTextColorWithoutTransparency = config.widgetTextColor
|
||||||
updateTextColors()
|
updateColors()
|
||||||
|
|
||||||
mBgColor = config.widgetBgColor
|
mBgColor = config.widgetBgColor
|
||||||
if (mBgColor == 1) {
|
if (mBgColor == 1) {
|
||||||
@@ -113,7 +118,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
|||||||
private fun pickTextColor() {
|
private fun pickTextColor() {
|
||||||
ColorPickerDialog(this, mTextColor) {
|
ColorPickerDialog(this, mTextColor) {
|
||||||
mTextColorWithoutTransparency = it
|
mTextColorWithoutTransparency = it
|
||||||
updateTextColors()
|
updateColors()
|
||||||
updateDays()
|
updateDays()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +130,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTextColors() {
|
private fun updateColors() {
|
||||||
mTextColor = mTextColorWithoutTransparency
|
mTextColor = mTextColorWithoutTransparency
|
||||||
mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOW_ALPHA)
|
mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOW_ALPHA)
|
||||||
mPrimaryColor = config.primaryColor
|
mPrimaryColor = config.primaryColor
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
android:layout_toRightOf="@+id/config_bg_color"
|
android:layout_toRightOf="@+id/config_bg_color"
|
||||||
android:background="@android:color/white">
|
android:background="@android:color/white">
|
||||||
|
|
||||||
<SeekBar
|
<com.simplemobiletools.commons.views.MySeekBar
|
||||||
android:id="@+id/config_bg_seekbar"
|
android:id="@+id/config_bg_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
android:layout_toRightOf="@+id/config_bg_color"
|
android:layout_toRightOf="@+id/config_bg_color"
|
||||||
android:background="@android:color/white">
|
android:background="@android:color/white">
|
||||||
|
|
||||||
<SeekBar
|
<com.simplemobiletools.commons.views.MySeekBar
|
||||||
android:id="@+id/config_bg_seekbar"
|
android:id="@+id/config_bg_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -57,4 +57,5 @@
|
|||||||
android:text="@android:string/ok"
|
android:text="@android:string/ok"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="@dimen/big_text_size"/>
|
android:textSize="@dimen/big_text_size"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Reference in New Issue
Block a user