redesigning the widget config and settings screen

This commit is contained in:
tibbi 2022-12-27 19:46:39 +01:00
parent 5806cc6dac
commit 5479e49a58
5 changed files with 146 additions and 200 deletions

View file

@ -21,9 +21,14 @@ import java.util.*
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, true)
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
}
override fun onResume() {
@ -41,38 +46,27 @@ class SettingsActivity : SimpleActivity() {
setupManageExcludedFolders()
updateTextColors(settings_nested_scrollview)
arrayOf(settings_color_customization_label, settings_general_settings_label).forEach {
arrayOf(settings_color_customization_section_label, settings_general_settings_label).forEach {
it.setTextColor(getProperPrimaryColor())
}
arrayOf(settings_color_customization_holder, settings_general_settings_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()
}
}
private fun setupCustomizeWidgetColors() {
settings_customize_widget_colors_holder.setOnClickListener {
settings_widget_color_customization_holder.setOnClickListener {
Intent(this, WidgetConfigureActivity::class.java).apply {
putExtra(IS_CUSTOMIZING_COLORS, true)
startActivity(this)
@ -93,11 +87,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_swap_prev_next_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme)
}
settings_language_holder.setOnClickListener {
launchChangeAppLanguageIntent()
}

View file

@ -69,7 +69,6 @@ class WidgetConfigureActivity : SimpleActivity() {
override fun onResume() {
super.onResume()
setupToolbar(config_toolbar)
if (mFeatureLockedDialog != null && isOrWasThankYouInstalled()) {
mFeatureLockedDialog?.dismissDialog()
}
@ -88,6 +87,9 @@ class WidgetConfigureActivity : SimpleActivity() {
}
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()
}

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_nested_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
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,142 +80,126 @@
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"
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"
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_swap_prev_next_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_swap_prev_next"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:text="@string/swap_prev_next" />
<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_show_filename_holder"
style="@style/SettingsHolderTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_language_holder"
style="@style/SettingsHolderTextViewStyle"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_show_filename_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:text="@string/show_filename" />
<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_swap_prev_next_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_show_filename"
style="@style/SettingsTextValueStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:layout_below="@+id/settings_show_filename_label"
tools:text="@string/title_is_not_available" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_swap_prev_next"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/swap_prev_next" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_manage_shown_tabs_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/settings_show_filename_holder"
style="@style/SettingsHolderTextViewStyle"
android:layout_width="match_parent"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_shown_tabs_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:text="@string/manage_shown_tabs" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_show_filename_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_filename" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_show_filename"
style="@style/SettingsTextValueStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_show_filename_label"
tools:text="@string/title_is_not_available" />
<RelativeLayout
android:id="@+id/settings_manage_excluded_folders_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_manage_shown_tabs_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_excluded_folders"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
android:text="@string/manage_excluded_folders" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_shown_tabs_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/manage_shown_tabs" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_manage_excluded_folders_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_bottom_corners">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_excluded_folders"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/manage_excluded_folders" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -1,33 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/config_coordinator"
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_relative"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:layout_margin="@dimen/activity_margin">
<include
android:id="@+id/config_player"

View file

@ -43,12 +43,12 @@
android:id="@+id/more_apps_from_us"
android:icon="@drawable/ic_google_play_vector"
android:title="@string/more_apps_from_us"
app:showAsAction="ifRoom" />
app:showAsAction="always" />
<item
android:id="@+id/settings"
android:icon="@drawable/ic_settings_cog_vector"
android:title="@string/settings"
app:showAsAction="always" />
app:showAsAction="ifRoom" />
<item
android:id="@+id/about"
android:icon="@drawable/ic_info_vector"