updating widget config screens
This commit is contained in:
parent
a5339a9520
commit
14c99a53d3
|
@ -6,14 +6,13 @@ import android.content.Intent
|
|||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.widget.SeekBar
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.helpers.MyWidgetDateProvider
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.LOWER_ALPHA
|
||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||
import kotlinx.android.synthetic.main.widget_config_date.*
|
||||
|
||||
class WidgetDateConfigureActivity : SimpleActivity() {
|
||||
|
@ -21,10 +20,7 @@ class WidgetDateConfigureActivity : SimpleActivity() {
|
|||
private var mWidgetId = 0
|
||||
private var mBgColorWithoutTransparency = 0
|
||||
private var mBgColor = 0
|
||||
private var mTextColorWithoutTransparency = 0
|
||||
private var mTextColor = 0
|
||||
private var mWeakTextColor = 0
|
||||
private var mPrimaryColor = 0
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
|
@ -33,37 +29,40 @@ class WidgetDateConfigureActivity : SimpleActivity() {
|
|||
setContentView(R.layout.widget_config_date)
|
||||
initVariables()
|
||||
|
||||
val extras = intent.extras
|
||||
if (extras != null)
|
||||
mWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID)
|
||||
val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false
|
||||
mWidgetId = intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID
|
||||
|
||||
if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID)
|
||||
if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID && !isCustomizingColors) {
|
||||
finish()
|
||||
}
|
||||
|
||||
val primaryColor = getProperPrimaryColor()
|
||||
config_save.setOnClickListener { saveConfig() }
|
||||
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||
config_text_color.setOnClickListener { pickTextColor() }
|
||||
config_bg_seekbar.setColors(mTextColor, mPrimaryColor, mPrimaryColor)
|
||||
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
||||
widget_date_label.text = Formatter.getTodayDayNumber()
|
||||
widget_month_label.text = Formatter.getCurrentMonthShort()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(config_toolbar)
|
||||
}
|
||||
|
||||
private fun initVariables() {
|
||||
mTextColorWithoutTransparency = config.widgetTextColor
|
||||
updateColors()
|
||||
|
||||
mBgColor = config.widgetBgColor
|
||||
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
|
||||
|
||||
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
|
||||
config_bg_seekbar.setOnSeekBarChangeListener(bgSeekbarChangeListener)
|
||||
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
|
||||
updateBgColor()
|
||||
updateBackgroundColor()
|
||||
config_bg_seekbar.onSeekBarChangeListener { progress ->
|
||||
mBgAlpha = progress / 100.toFloat()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
|
||||
mTextColor = config.widgetTextColor
|
||||
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
||||
mTextColor = resources.getColor(R.color.you_primary_color, theme)
|
||||
}
|
||||
|
||||
updateTextColor()
|
||||
}
|
||||
|
||||
private fun saveConfig() {
|
||||
|
@ -80,7 +79,7 @@ class WidgetDateConfigureActivity : SimpleActivity() {
|
|||
private fun storeWidgetColors() {
|
||||
config.apply {
|
||||
widgetBgColor = mBgColor
|
||||
widgetTextColor = mTextColorWithoutTransparency
|
||||
widgetTextColor = mTextColor
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +87,7 @@ class WidgetDateConfigureActivity : SimpleActivity() {
|
|||
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
mBgColorWithoutTransparency = color
|
||||
updateBgColor()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +95,8 @@ class WidgetDateConfigureActivity : SimpleActivity() {
|
|||
private fun pickTextColor() {
|
||||
ColorPickerDialog(this, mTextColor) { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
mTextColorWithoutTransparency = color
|
||||
updateColors()
|
||||
mTextColor = color
|
||||
updateTextColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,32 +108,17 @@ class WidgetDateConfigureActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateColors() {
|
||||
mTextColor = mTextColorWithoutTransparency
|
||||
mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA)
|
||||
mPrimaryColor = getProperPrimaryColor()
|
||||
|
||||
private fun updateTextColor() {
|
||||
config_text_color.setFillWithStroke(mTextColor, mTextColor)
|
||||
widget_date_label.setTextColor(mTextColor)
|
||||
widget_month_label.setTextColor(mTextColor)
|
||||
config_save.setTextColor(getProperPrimaryColor().getContrastColor())
|
||||
}
|
||||
|
||||
private fun updateBgColor() {
|
||||
private fun updateBackgroundColor() {
|
||||
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
|
||||
config_date_time_wrapper.background.applyColorFilter(mBgColor)
|
||||
config_bg_color.setFillWithStroke(mBgColor, mBgColor)
|
||||
config_save.backgroundTintList = ColorStateList.valueOf(getProperPrimaryColor())
|
||||
}
|
||||
|
||||
private val bgSeekbarChangeListener = object : SeekBar.OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
mBgAlpha = progress.toFloat() / 100.toFloat()
|
||||
updateBgColor()
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.content.res.ColorStateList
|
|||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.widget.SeekBar
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.adapters.EventListAdapter
|
||||
import com.simplemobiletools.calendar.pro.dialogs.CustomPeriodPickerDialog
|
||||
|
@ -36,9 +35,8 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
private var mWidgetId = 0
|
||||
private var mBgColorWithoutTransparency = 0
|
||||
private var mBgColor = 0
|
||||
private var mTextColorWithoutTransparency = 0
|
||||
private var mTextColor = 0
|
||||
private var selectedPeriodOption = 0
|
||||
private var mSelectedPeriodOption = 0
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
|
@ -74,27 +72,28 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
updateSelectedPeriod(config.lastUsedEventSpan)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
updateTextColors(config_list_holder)
|
||||
setupToolbar(config_toolbar)
|
||||
}
|
||||
|
||||
private fun initVariables() {
|
||||
mTextColorWithoutTransparency = config.widgetTextColor
|
||||
updateColors()
|
||||
|
||||
mBgColor = config.widgetBgColor
|
||||
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
|
||||
|
||||
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
|
||||
config_bg_seekbar.setOnSeekBarChangeListener(bgSeekbarChangeListener)
|
||||
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
|
||||
updateBgColor()
|
||||
updateBackgroundColor()
|
||||
config_bg_seekbar.onSeekBarChangeListener { progress ->
|
||||
mBgAlpha = progress / 100.toFloat()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
|
||||
mTextColor = config.widgetTextColor
|
||||
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
||||
mTextColor = resources.getColor(R.color.you_primary_color, theme)
|
||||
}
|
||||
|
||||
updateTextColor()
|
||||
}
|
||||
|
||||
private fun saveConfig() {
|
||||
val widget = Widget(null, mWidgetId, selectedPeriodOption)
|
||||
val widget = Widget(null, mWidgetId, mSelectedPeriodOption)
|
||||
ensureBackgroundThread {
|
||||
widgetsDB.insertOrUpdate(widget)
|
||||
}
|
||||
|
@ -102,7 +101,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
storeWidgetColors()
|
||||
requestWidgetUpdate()
|
||||
|
||||
config.lastUsedEventSpan = selectedPeriodOption
|
||||
config.lastUsedEventSpan = mSelectedPeriodOption
|
||||
|
||||
Intent().apply {
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId)
|
||||
|
@ -119,7 +118,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
add(WEEK_SECONDS)
|
||||
add(MONTH_SECONDS)
|
||||
add(YEAR_SECONDS)
|
||||
add(selectedPeriodOption)
|
||||
add(mSelectedPeriodOption)
|
||||
}
|
||||
|
||||
val items = ArrayList<RadioItem>(seconds.size)
|
||||
|
@ -129,7 +128,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
|
||||
var selectedIndex = 0
|
||||
seconds.forEachIndexed { index, value ->
|
||||
if (value == selectedPeriodOption) {
|
||||
if (value == mSelectedPeriodOption) {
|
||||
selectedIndex = index
|
||||
}
|
||||
}
|
||||
|
@ -149,14 +148,14 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun updateSelectedPeriod(selectedPeriod: Int) {
|
||||
selectedPeriodOption = selectedPeriod
|
||||
mSelectedPeriodOption = selectedPeriod
|
||||
when (selectedPeriod) {
|
||||
0 -> {
|
||||
selectedPeriodOption = YEAR_SECONDS
|
||||
mSelectedPeriodOption = YEAR_SECONDS
|
||||
period_picker_value.setText(R.string.within_the_next_one_year)
|
||||
}
|
||||
EVENT_PERIOD_TODAY -> period_picker_value.setText(R.string.today_only)
|
||||
else -> period_picker_value.text = getFormattedSeconds(selectedPeriodOption)
|
||||
else -> period_picker_value.text = getFormattedSeconds(mSelectedPeriodOption)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +173,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
private fun storeWidgetColors() {
|
||||
config.apply {
|
||||
widgetBgColor = mBgColor
|
||||
widgetTextColor = mTextColorWithoutTransparency
|
||||
widgetTextColor = mTextColor
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +181,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
mBgColorWithoutTransparency = color
|
||||
updateBgColor()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -190,8 +189,8 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
private fun pickTextColor() {
|
||||
ColorPickerDialog(this, mTextColor) { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
mTextColorWithoutTransparency = color
|
||||
updateColors()
|
||||
mTextColor = color
|
||||
updateTextColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,14 +202,13 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateColors() {
|
||||
mTextColor = mTextColorWithoutTransparency
|
||||
private fun updateTextColor() {
|
||||
(config_events_list.adapter as? EventListAdapter)?.updateTextColor(mTextColor)
|
||||
config_text_color.setFillWithStroke(mTextColor, mTextColor)
|
||||
config_save.setTextColor(getProperPrimaryColor().getContrastColor())
|
||||
}
|
||||
|
||||
private fun updateBgColor() {
|
||||
private fun updateBackgroundColor() {
|
||||
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
|
||||
config_events_list.background.applyColorFilter(mBgColor)
|
||||
config_bg_color.setFillWithStroke(mBgColor, mBgColor)
|
||||
|
@ -318,15 +316,4 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
|
||||
return listItems
|
||||
}
|
||||
|
||||
private val bgSeekbarChangeListener = object : SeekBar.OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
mBgAlpha = progress.toFloat() / 100.toFloat()
|
||||
updateBgColor()
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.SeekBar
|
||||
import android.widget.TextView
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.extensions.addDayEvents
|
||||
|
@ -24,6 +23,7 @@ import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar
|
|||
import com.simplemobiletools.calendar.pro.models.DayMonthly
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||
import com.simplemobiletools.commons.helpers.LOWER_ALPHA
|
||||
import kotlinx.android.synthetic.main.day_monthly_number_view.view.*
|
||||
import kotlinx.android.synthetic.main.first_row.*
|
||||
|
@ -39,12 +39,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
private var mWidgetId = 0
|
||||
private var mBgColorWithoutTransparency = 0
|
||||
private var mBgColor = 0
|
||||
private var mTextColorWithoutTransparency = 0
|
||||
private var mTextColor = 0
|
||||
private var mWeakTextColor = 0
|
||||
private var mPrimaryColor = 0
|
||||
private var mWeekendsTextColor = 0
|
||||
private var mHighlightWeekends = false
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
|
@ -53,37 +48,40 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
setContentView(R.layout.widget_config_monthly)
|
||||
initVariables()
|
||||
|
||||
val extras = intent.extras
|
||||
if (extras != null)
|
||||
mWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID)
|
||||
val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false
|
||||
mWidgetId = intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID
|
||||
|
||||
if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID)
|
||||
if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID && !isCustomizingColors) {
|
||||
finish()
|
||||
}
|
||||
|
||||
val primaryColor = getProperPrimaryColor()
|
||||
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()
|
||||
setupToolbar(config_toolbar)
|
||||
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
||||
}
|
||||
|
||||
private fun initVariables() {
|
||||
mTextColorWithoutTransparency = config.widgetTextColor
|
||||
updateColors()
|
||||
|
||||
mBgColor = config.widgetBgColor
|
||||
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
|
||||
|
||||
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
|
||||
config_bg_seekbar.setOnSeekBarChangeListener(bgSeekbarChangeListener)
|
||||
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
|
||||
updateBgColor()
|
||||
updateBackgroundColor()
|
||||
config_bg_seekbar.onSeekBarChangeListener { progress ->
|
||||
mBgAlpha = progress / 100.toFloat()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
|
||||
MonthlyCalendarImpl(this, applicationContext).updateMonthlyCalendar(DateTime().withDayOfMonth(1))
|
||||
mTextColor = config.widgetTextColor
|
||||
if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) {
|
||||
mTextColor = resources.getColor(R.color.you_primary_color, theme)
|
||||
}
|
||||
|
||||
updateTextColor()
|
||||
|
||||
MonthlyCalendarImpl(this, this).updateMonthlyCalendar(DateTime().withDayOfMonth(1))
|
||||
}
|
||||
|
||||
private fun saveConfig() {
|
||||
|
@ -100,7 +98,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
private fun storeWidgetColors() {
|
||||
config.apply {
|
||||
widgetBgColor = mBgColor
|
||||
widgetTextColor = mTextColorWithoutTransparency
|
||||
widgetTextColor = mTextColor
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +106,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
mBgColorWithoutTransparency = color
|
||||
updateBgColor()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +114,8 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
private fun pickTextColor() {
|
||||
ColorPickerDialog(this, mTextColor) { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
mTextColorWithoutTransparency = color
|
||||
updateColors()
|
||||
mTextColor = color
|
||||
updateTextColor()
|
||||
updateDays()
|
||||
}
|
||||
}
|
||||
|
@ -130,32 +128,26 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateColors() {
|
||||
mTextColor = mTextColorWithoutTransparency
|
||||
mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA)
|
||||
mPrimaryColor = getProperPrimaryColor()
|
||||
mWeekendsTextColor = config.highlightWeekendsColor
|
||||
mHighlightWeekends = config.highlightWeekends
|
||||
|
||||
private fun updateTextColor() {
|
||||
top_left_arrow.applyColorFilter(mTextColor)
|
||||
top_right_arrow.applyColorFilter(mTextColor)
|
||||
top_value.setTextColor(mTextColor)
|
||||
config_text_color.setFillWithStroke(mTextColor, mTextColor)
|
||||
updateLabels()
|
||||
config_save.backgroundTintList = ColorStateList.valueOf(getProperPrimaryColor())
|
||||
config_save.setTextColor(getProperPrimaryColor().getContrastColor())
|
||||
}
|
||||
|
||||
private fun updateBgColor() {
|
||||
private fun updateBackgroundColor() {
|
||||
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
|
||||
config_calendar.background.applyColorFilter(mBgColor)
|
||||
config_bg_color.setFillWithStroke(mBgColor, mBgColor)
|
||||
config_save.backgroundTintList = ColorStateList.valueOf(getProperPrimaryColor())
|
||||
}
|
||||
|
||||
private fun updateDays() {
|
||||
val len = mDays!!.size
|
||||
|
||||
if (applicationContext.config.showWeekNumbers) {
|
||||
if (config.showWeekNumbers) {
|
||||
week_num.setTextColor(mTextColor)
|
||||
week_num.beVisible()
|
||||
|
||||
|
@ -192,7 +184,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
textColor = textColor.adjustAlpha(LOWER_ALPHA)
|
||||
}
|
||||
|
||||
(View.inflate(applicationContext, R.layout.day_monthly_number_view, null) as RelativeLayout).apply {
|
||||
(View.inflate(this, R.layout.day_monthly_number_view, null) as RelativeLayout).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
linearLayout.addView(this)
|
||||
|
||||
|
@ -210,17 +202,6 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
}
|
||||
}
|
||||
|
||||
private val bgSeekbarChangeListener = object : SeekBar.OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
mBgAlpha = progress.toFloat() / 100.toFloat()
|
||||
updateBgColor()
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {}
|
||||
}
|
||||
|
||||
override fun updateMonthlyCalendar(context: Context, month: String, days: ArrayList<DayMonthly>, checkedEvents: Boolean, currTargetDate: DateTime) {
|
||||
runOnUiThread {
|
||||
mDays = days
|
||||
|
@ -230,10 +211,11 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
}
|
||||
|
||||
private fun updateLabels() {
|
||||
val weekendsTextColor = config.highlightWeekendsColor
|
||||
for (i in 0..6) {
|
||||
findViewById<TextView>(resources.getIdentifier("label_$i", "id", packageName)).apply {
|
||||
val textColor = if (config.highlightWeekends && isWeekend(i, config.isSundayFirst)) {
|
||||
mWeekendsTextColor
|
||||
weekendsTextColor
|
||||
} else {
|
||||
mTextColor
|
||||
}
|
||||
|
|
|
@ -6,21 +6,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/config_app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/config_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/color_primary"
|
||||
app:title="@string/app_launcher_name"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_date_time_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -5,21 +5,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/config_app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/config_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/color_primary"
|
||||
app:title="@string/app_launcher_name"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_list_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -5,21 +5,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/config_app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/config_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/color_primary"
|
||||
app:title="@string/app_launcher_name"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue