updating Settings design

This commit is contained in:
tibbi 2022-12-25 19:06:58 +01:00
parent 89a538098c
commit d8200ebe79
2 changed files with 190 additions and 259 deletions

View File

@ -17,8 +17,12 @@ import kotlin.system.exitProcess
class SettingsActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings)
updateMaterialActivityViews(settings_coordinator, settings_holder)
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
}
override fun onResume() {
@ -40,41 +44,25 @@ class SettingsActivity : SimpleActivity() {
updateTextColors(settings_holder)
arrayOf(
settings_color_customization_label,
settings_color_customization_section_label,
settings_general_settings_label,
settings_alarm_tab_label,
settings_timer_tab_label,
).forEach {
it.setTextColor(getProperPrimaryColor())
}
arrayOf(
settings_color_customization_holder,
settings_general_settings_holder,
settings_alarm_tab_holder,
settings_timer_tab_holder,
).forEach {
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
}
}
private fun setupPurchaseThankYou() {
settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled())
// make sure the corners at ripple fit the stroke rounded corners
if (settings_purchase_thank_you_holder.isGone()) {
settings_use_english_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme)
settings_language_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme)
}
settings_purchase_thank_you_holder.setOnClickListener {
launchPurchaseThankYouIntent()
}
}
private fun setupCustomizeColors() {
settings_customize_colors_label.text = getCustomizeColorsString()
settings_customize_colors_holder.setOnClickListener {
settings_color_customization_label.text = getCustomizeColorsString()
settings_color_customization_holder.setOnClickListener {
handleCustomizeColorsClick()
}
}
@ -92,11 +80,6 @@ class SettingsActivity : SimpleActivity() {
private fun setupLanguage() {
settings_language.text = Locale.getDefault().displayLanguage
settings_language_holder.beVisibleIf(isTiramisuPlus())
if (settings_use_english_holder.isGone() && settings_language_holder.isGone() && settings_purchase_thank_you_holder.isGone()) {
settings_prevent_phone_from_sleeping_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme)
}
settings_language_holder.setOnClickListener {
launchChangeAppLanguageIntent()
}
@ -131,25 +114,13 @@ class SettingsActivity : SimpleActivity() {
private fun setupUseSameSnooze() {
settings_snooze_time_holder.beVisibleIf(config.useSameSnooze)
settings_use_same_snooze.isChecked = config.useSameSnooze
checkSnoozeButtonBackgrounds()
settings_use_same_snooze_holder.setOnClickListener {
settings_use_same_snooze.toggle()
config.useSameSnooze = settings_use_same_snooze.isChecked
settings_snooze_time_holder.beVisibleIf(config.useSameSnooze)
checkSnoozeButtonBackgrounds()
}
}
private fun checkSnoozeButtonBackgrounds() {
val backgroundId = if (settings_use_same_snooze.isChecked) {
R.drawable.ripple_background
} else {
R.drawable.ripple_bottom_corners
}
settings_use_same_snooze_holder.background = resources.getDrawable(backgroundId, theme)
}
private fun setupSnoozeTime() {
updateSnoozeText()
settings_snooze_time_holder.setOnClickListener {
@ -191,7 +162,7 @@ class SettingsActivity : SimpleActivity() {
}
private fun setupCustomizeWidgetColors() {
settings_customize_widget_colors_holder.setOnClickListener {
settings_widget_color_customization_holder.setOnClickListener {
Intent(this, WidgetDigitalConfigureActivity::class.java).apply {
putExtra(IS_CUSTOMIZING_COLORS, true)
startActivity(this)

View File

@ -6,29 +6,21 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/settings_app_bar_layout"
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/settings_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/settings_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:layout_scrollFlags="scroll|enterAlways"
app:title="@string/settings"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:title="@string/settings"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
<androidx.core.widget.NestedScrollView
android:id="@+id/settings_scrollview"
android:id="@+id/settings_nested_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
android:fillViewport="true"
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:scrollbars="none">
<LinearLayout
android:id="@+id/settings_holder"
@ -37,52 +29,49 @@
android:orientation="vertical">
<TextView
android:id="@+id/settings_color_customization_label"
android:id="@+id/settings_color_customization_section_label"
style="@style/SettingsSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/color_customization" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/settings_color_customization_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
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">
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_customize_colors_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_color_customization_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ripple_top_corners">
android:text="@string/customize_colors"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_customize_colors_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/customize_colors" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/settings_widget_color_customization_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_customize_widget_colors_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_widget_color_customization_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ripple_bottom_corners">
android:text="@string/customize_widget_colors"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_customize_widget_colors_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/customize_widget_colors" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</LinearLayout>
<include
android:id="@+id/settings_color_customization_divider"
layout="@layout/divider" />
<TextView
android:id="@+id/settings_general_settings_label"
@ -91,102 +80,92 @@
android:layout_height="wrap_content"
android:text="@string/general_settings" />
<LinearLayout
android:id="@+id/settings_general_settings_holder"
<RelativeLayout
android:id="@+id/settings_purchase_thank_you_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
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">
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_purchase_thank_you_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_purchase_thank_you_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/purchase_simple_thank_you" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_use_english_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_use_english"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_top_corners">
android:text="@string/use_english_language" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_purchase_thank_you_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/purchase_simple_thank_you" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_language_holder"
style="@style/SettingsHolderTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_use_english_holder"
style="@style/SettingsHolderCheckboxStyle"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_language_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/language" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_language"
style="@style/SettingsTextValueStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_language_label"
tools:text="English" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_prevent_phone_from_sleeping_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_prevent_phone_from_sleeping"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:text="@string/prevent_phone_from_sleeping" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_use_english"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/use_english_language" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_sunday_first_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_language_holder"
style="@style/SettingsHolderTextViewStyle"
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_sunday_first"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:text="@string/sunday_first" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_language_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/language" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_language"
style="@style/SettingsTextValueStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_language_label"
tools:text="English" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_prevent_phone_from_sleeping_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_prevent_phone_from_sleeping"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/prevent_phone_from_sleeping" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_sunday_first_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_bottom_corners">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_sunday_first"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sunday_first" />
</RelativeLayout>
</LinearLayout>
<include
android:id="@+id/settings_general_settings_divider"
layout="@layout/divider" />
<TextView
android:id="@+id/settings_alarm_tab_label"
@ -195,94 +174,85 @@
android:layout_height="wrap_content"
android:text="@string/alarm_tab" />
<LinearLayout
android:id="@+id/settings_alarm_tab_holder"
<RelativeLayout
android:id="@+id/settings_alarm_max_reminder_holder"
style="@style/SettingsHolderTextViewStyle"
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">
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_alarm_max_reminder_holder"
style="@style/SettingsHolderTextViewStyle"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_alarm_max_reminder_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/max_reminder_duration" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_alarm_max_reminder"
style="@style/SettingsTextValueStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_top_corners">
android:layout_below="@+id/settings_alarm_max_reminder_label"
tools:text="5 minutes" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_alarm_max_reminder_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/max_reminder_duration" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_alarm_max_reminder"
style="@style/SettingsTextValueStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_alarm_max_reminder_label"
tools:text="5 minutes" />
<RelativeLayout
android:id="@+id/settings_increase_volume_gradually_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_increase_volume_gradually_holder"
style="@style/SettingsHolderCheckboxStyle"
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_increase_volume_gradually"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:text="@string/increase_volume_gradually" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_increase_volume_gradually"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/increase_volume_gradually" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_use_same_snooze_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_use_same_snooze_holder"
style="@style/SettingsHolderCheckboxStyle"
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_use_same_snooze"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:text="@string/use_same_snooze" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_use_same_snooze"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/use_same_snooze" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_snooze_time_holder"
style="@style/SettingsHolderTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_snooze_time_holder"
style="@style/SettingsHolderTextViewStyle"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_snooze_time_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/snooze_time" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_snooze_time"
style="@style/SettingsTextValueStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_bottom_corners">
android:layout_below="@+id/settings_snooze_time_label"
tools:text="10 minutes" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_snooze_time_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/snooze_time" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_snooze_time"
style="@style/SettingsTextValueStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_snooze_time_label"
tools:text="10 minutes" />
</RelativeLayout>
</LinearLayout>
<include
android:id="@+id/settings_alarm_tab_divider"
layout="@layout/divider" />
<TextView
android:id="@+id/settings_timer_tab_label"
@ -291,38 +261,28 @@
android:layout_height="wrap_content"
android:text="@string/timer_tab" />
<LinearLayout
android:id="@+id/settings_timer_tab_holder"
<RelativeLayout
android:id="@+id/settings_timer_max_reminder_holder"
style="@style/SettingsHolderTextViewStyle"
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">
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_timer_max_reminder_holder"
style="@style/SettingsHolderTextViewStyle"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_timer_max_reminder_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/max_reminder_duration" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_timer_max_reminder"
style="@style/SettingsTextValueStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_all_corners">
android:layout_below="@+id/settings_timer_max_reminder_label"
tools:text="1 minute" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_timer_max_reminder_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/max_reminder_duration" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_timer_max_reminder"
style="@style/SettingsTextValueStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_timer_max_reminder_label"
tools:text="1 minute" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>