redesigning the app settings
This commit is contained in:
parent
8125a6ef06
commit
7b8a2de649
|
@ -63,9 +63,9 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:0828fecd09'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:c457573200'
|
||||
|
||||
kapt "androidx.room:room-compiler:2.4.3"
|
||||
implementation "androidx.room:room-runtime:2.4.3"
|
||||
annotationProcessor "androidx.room:room-compiler:2.4.3"
|
||||
kapt "androidx.room:room-compiler:2.5.0"
|
||||
implementation "androidx.room:room-runtime:2.5.0"
|
||||
annotationProcessor "androidx.room:room-compiler:2.5.0"
|
||||
}
|
||||
|
|
|
@ -77,7 +77,6 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
showTransparentNavigation = true
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
|
|
@ -15,14 +15,19 @@ 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, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
|
||||
setupOptionsMenu()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(settings_toolbar, NavigationIcon.Arrow)
|
||||
refreshMenuItems()
|
||||
|
||||
setupPurchaseThankYou()
|
||||
setupCustomizeColors()
|
||||
|
@ -31,44 +36,38 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupManageHiddenIcons()
|
||||
updateTextColors(settings_holder)
|
||||
|
||||
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 setupOptionsMenu() {
|
||||
settings_toolbar.setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.about -> launchAbout()
|
||||
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
|
||||
else -> return@setOnMenuItemClickListener false
|
||||
}
|
||||
return@setOnMenuItemClickListener true
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
private fun refreshMenuItems() {
|
||||
settings_toolbar.menu.apply {
|
||||
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupPurchaseThankYou() {
|
||||
settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled())
|
||||
settings_purchase_thank_you_holder.setOnClickListener {
|
||||
launchPurchaseThankYouIntent()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupCustomizeColors() {
|
||||
settings_customize_colors_holder.setOnClickListener {
|
||||
settings_color_customization_label.text = getCustomizeColorsString()
|
||||
settings_color_customization_holder.setOnClickListener {
|
||||
startCustomizationActivity()
|
||||
}
|
||||
}
|
||||
|
@ -92,12 +91,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun setupManageHiddenIcons() {
|
||||
if (settings_purchase_thank_you_holder.isGone() && settings_use_english_holder.isGone() && settings_language_holder.isGone()) {
|
||||
settings_manage_hidden_icons_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme)
|
||||
} else {
|
||||
settings_manage_hidden_icons_holder.background = resources.getDrawable(R.drawable.ripple_bottom_corners, theme)
|
||||
}
|
||||
|
||||
settings_manage_hidden_icons_holder.setOnClickListener {
|
||||
startActivity(Intent(this, HiddenIconsActivity::class.java))
|
||||
}
|
||||
|
|
|
@ -6,30 +6,22 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/settings_app_bar_layout"
|
||||
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:menu="@menu/menu_settings"
|
||||
app:title="@string/settings"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/settings_nested_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="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"
|
||||
|
@ -38,36 +30,32 @@
|
|||
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"
|
||||
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_customize_colors_holder"
|
||||
style="@style/SettingsHolderTextViewOneLinerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ripple_all_corners">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/settings_customize_colors_label"
|
||||
android:id="@+id/settings_color_customization_label"
|
||||
style="@style/SettingsTextLabelStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/customize_colors" />
|
||||
android:text="@string/customize_colors"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/settings_color_customization_divider"
|
||||
layout="@layout/divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_general_settings_label"
|
||||
|
@ -76,14 +64,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/general_settings" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/settings_general_settings_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_purchase_thank_you_holder"
|
||||
style="@style/SettingsHolderTextViewOneLinerStyle"
|
||||
|
@ -156,6 +136,5 @@
|
|||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -2,10 +2,14 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="AppCompatResource">
|
||||
tools:ignore="AppCompatResource,AlwaysShowAction">
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:icon="@drawable/ic_info_vector"
|
||||
android:title="@string/about"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/more_apps_from_us"
|
||||
android:title="@string/more_apps_from_us"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
|
|
Loading…
Reference in New Issue