always use shadow at the widget text
This commit is contained in:
parent
96068665dc
commit
ee09b59cda
8 changed files with 14 additions and 161 deletions
|
@ -35,7 +35,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupVibrate()
|
||||
setupTimerMaxReminder()
|
||||
setupIncreaseVolumeGradually()
|
||||
setupUseTextShadow()
|
||||
setupCustomizeWidgetColors()
|
||||
updateTextColors(settings_holder)
|
||||
|
||||
|
@ -46,7 +45,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
settings_alarm_tab_label,
|
||||
settings_stopwatch_tab_label,
|
||||
settings_timer_tab_label,
|
||||
settings_widgets_label
|
||||
).forEach {
|
||||
it.setTextColor(getProperPrimaryColor())
|
||||
}
|
||||
|
@ -58,7 +56,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
settings_alarm_tab_holder,
|
||||
settings_stopwatch_tab_holder,
|
||||
settings_timer_tab_holder,
|
||||
settings_widgets_holder
|
||||
).forEach {
|
||||
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
|
||||
}
|
||||
|
@ -200,15 +197,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupUseTextShadow() {
|
||||
settings_use_text_shadow.isChecked = config.useTextShadow
|
||||
settings_use_text_shadow_holder.setOnClickListener {
|
||||
settings_use_text_shadow.toggle()
|
||||
config.useTextShadow = settings_use_text_shadow.isChecked
|
||||
updateWidgets()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateSnoozeText() {
|
||||
settings_snooze_time.text = formatMinutesToTimeString(config.snoozeTime)
|
||||
}
|
||||
|
|
|
@ -73,11 +73,8 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() {
|
|||
val calendar = Calendar.getInstance()
|
||||
config_time.text = getFormattedTime(getPassedSeconds(), false, false).toString()
|
||||
config_date.text = getFormattedDate(calendar)
|
||||
|
||||
if (config.useTextShadow) {
|
||||
config_time.setShadowLayer(1f, 0f, 1f, Color.BLACK)
|
||||
config_date.setShadowLayer(1f, 0f, 1f, Color.BLACK)
|
||||
}
|
||||
config_time.setShadowLayer(1f, 0f, 1f, Color.BLACK)
|
||||
config_date.setShadowLayer(1f, 0f, 1f, Color.BLACK)
|
||||
}
|
||||
|
||||
private fun saveConfig() {
|
||||
|
|
|
@ -66,10 +66,6 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getInt(ALARM_MAX_REMINDER_SECS, DEFAULT_MAX_ALARM_REMINDER_SECS)
|
||||
set(alarmMaxReminderSecs) = prefs.edit().putInt(ALARM_MAX_REMINDER_SECS, alarmMaxReminderSecs).apply()
|
||||
|
||||
var useTextShadow: Boolean
|
||||
get() = prefs.getBoolean(USE_TEXT_SHADOW, true)
|
||||
set(useTextShadow) = prefs.edit().putBoolean(USE_TEXT_SHADOW, useTextShadow).apply()
|
||||
|
||||
var increaseVolumeGradually: Boolean
|
||||
get() = prefs.getBoolean(INCREASE_VOLUME_GRADUALLY, true)
|
||||
set(increaseVolumeGradually) = prefs.edit().putBoolean(INCREASE_VOLUME_GRADUALLY, increaseVolumeGradually).apply()
|
||||
|
|
|
@ -21,7 +21,6 @@ const val TIMER_MAX_REMINDER_SECS = "timer_max_reminder_secs"
|
|||
const val ALARM_MAX_REMINDER_SECS = "alarm_max_reminder_secs"
|
||||
const val ALARM_LAST_CONFIG = "alarm_last_config"
|
||||
const val TIMER_LAST_CONFIG = "timer_last_config"
|
||||
const val USE_TEXT_SHADOW = "use_text_shadow"
|
||||
const val INCREASE_VOLUME_GRADUALLY = "increase_volume_gradually"
|
||||
const val ALARMS_SORT_BY = "alarms_sort_by"
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class MyWidgetDateTimeProvider : AppWidgetProvider() {
|
|||
private fun performUpdate(context: Context) {
|
||||
val appWidgetManager = AppWidgetManager.getInstance(context) ?: return
|
||||
appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach {
|
||||
RemoteViews(context.packageName, getProperLayout(context)).apply {
|
||||
RemoteViews(context.packageName, R.layout.widget_date_time).apply {
|
||||
updateTexts(context, this)
|
||||
updateColors(context, this)
|
||||
setupAppOpenIntent(context, this)
|
||||
|
@ -40,12 +40,6 @@ class MyWidgetDateTimeProvider : AppWidgetProvider() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getProperLayout(context: Context) = if (context.config.useTextShadow) {
|
||||
R.layout.widget_date_time_with_shadow
|
||||
} else {
|
||||
R.layout.widget_date_time
|
||||
}
|
||||
|
||||
private fun updateTexts(context: Context, views: RemoteViews) {
|
||||
val timeText = context.getFormattedTime(getPassedSeconds(), false, false).toString()
|
||||
val nextAlarm = getFormattedNextAlarm(context)
|
||||
|
@ -67,12 +61,8 @@ class MyWidgetDateTimeProvider : AppWidgetProvider() {
|
|||
setTextColor(R.id.widget_date, widgetTextColor)
|
||||
setTextColor(R.id.widget_next_alarm, widgetTextColor)
|
||||
|
||||
if (context.config.useTextShadow) {
|
||||
val bitmap = getMultiplyColoredBitmap(R.drawable.ic_clock_shadowed, widgetTextColor, context)
|
||||
setImageViewBitmap(R.id.widget_next_alarm_image, bitmap)
|
||||
} else {
|
||||
setImageViewBitmap(R.id.widget_next_alarm_image, context.resources.getColoredBitmap(R.drawable.ic_alarm_vector, widgetTextColor))
|
||||
}
|
||||
val bitmap = getMultiplyColoredBitmap(R.drawable.ic_clock_shadowed, widgetTextColor, context)
|
||||
setImageViewBitmap(R.id.widget_next_alarm_image, bitmap)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -354,37 +354,5 @@
|
|||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_widgets_label"
|
||||
style="@style/SettingsSectionLabelStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/widgets" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/settings_widgets_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/medium_margin"
|
||||
android:background="@drawable/section_holder_stroke"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_use_text_shadow_holder"
|
||||
style="@style/SettingsHolderCheckboxStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ripple_all_corners">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
android:id="@+id/settings_use_text_shadow"
|
||||
style="@style/SettingsCheckboxStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/use_text_shadow" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="00:00" />
|
||||
|
||||
|
@ -50,6 +53,9 @@
|
|||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="Mon, 1 January" />
|
||||
|
||||
|
@ -77,6 +83,9 @@
|
|||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="@dimen/small_margin"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="Tue, 18:30" />
|
||||
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="@drawable/widget_round_background" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/widget_date_time_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/small_margin"
|
||||
android:paddingRight="@dimen/small_margin"
|
||||
android:paddingBottom="@dimen/small_margin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:autoSizeMaxTextSize="300sp"
|
||||
android:autoSizeMinTextSize="2sp"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="00:00" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:autoSizeMinTextSize="2sp"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="Mon, 1 January" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/widget_alarm_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_next_alarm_image"
|
||||
android:layout_width="@dimen/widget_alarm_icon_size"
|
||||
android:layout_height="@dimen/widget_alarm_icon_size"
|
||||
android:layout_alignTop="@+id/widget_next_alarm"
|
||||
android:layout_alignBottom="@+id/widget_next_alarm"
|
||||
android:src="@drawable/ic_alarm_vector" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_next_alarm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toEndOf="@+id/widget_next_alarm_image"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="@dimen/small_margin"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="Tue, 18:30" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
Loading…
Reference in a new issue