Skip to content

Commit f823315

Browse files
committed
redesigning some screens
1 parent b96e268 commit f823315

File tree

5 files changed

+66
-103
lines changed

5 files changed

+66
-103
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ android {
6262
}
6363

6464
dependencies {
65-
implementation 'com.github.SimpleMobileTools:Simple-Commons:31cb0b37cf'
65+
implementation 'com.github.SimpleMobileTools:Simple-Commons:a6032f9c07'
6666
implementation 'org.greenrobot:eventbus:3.3.1'
6767
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
6868
}

app/src/main/kotlin/com/simplemobiletools/flashlight/activities/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,16 @@ class MainActivity : SimpleActivity() {
3939
private var reTurnFlashlightOn = true
4040

4141
override fun onCreate(savedInstanceState: Bundle?) {
42+
isMaterialActivity = true
4243
super.onCreate(savedInstanceState)
4344
setContentView(R.layout.activity_main)
4445
appLaunched(BuildConfig.APPLICATION_ID)
4546
setupOptionsMenu()
4647
refreshMenuItems()
4748

49+
updateMaterialActivityViews(main_coordinator, main_holder)
50+
setupMaterialScrollListener(main_nested_scrollview, main_toolbar)
51+
4852
mBus = EventBus.getDefault()
4953
changeIconColor(getContrastColor(), stroboscope_btn)
5054

app/src/main/kotlin/com/simplemobiletools/flashlight/activities/SettingsActivity.kt

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ import kotlin.system.exitProcess
1414

1515
class SettingsActivity : SimpleActivity() {
1616
override fun onCreate(savedInstanceState: Bundle?) {
17+
isMaterialActivity = true
1718
super.onCreate(savedInstanceState)
1819
setContentView(R.layout.activity_settings)
20+
21+
updateMaterialActivityViews(settings_coordinator, settings_holder)
22+
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
1923
}
2024

2125
override fun onResume() {
@@ -34,38 +38,27 @@ class SettingsActivity : SimpleActivity() {
3438
setupForcePortrait()
3539
updateTextColors(settings_holder)
3640

37-
arrayOf(settings_color_customization_label, settings_general_settings_label).forEach {
41+
arrayOf(settings_color_customization_section_label, settings_general_settings_label).forEach {
3842
it.setTextColor(getProperPrimaryColor())
3943
}
40-
41-
arrayOf(settings_color_customization_holder, settings_general_settings_holder).forEach {
42-
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
43-
}
4444
}
4545

4646
private fun setupPurchaseThankYou() {
4747
settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled())
48-
49-
// make sure the corners at ripple fit the stroke rounded corners
50-
if (settings_purchase_thank_you_holder.isGone()) {
51-
settings_use_english_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme)
52-
settings_language_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme)
53-
}
54-
5548
settings_purchase_thank_you_holder.setOnClickListener {
5649
launchPurchaseThankYouIntent()
5750
}
5851
}
5952

6053
private fun setupCustomizeColors() {
61-
settings_customize_colors_label.text = getCustomizeColorsString()
62-
settings_customize_colors_holder.setOnClickListener {
54+
settings_color_customization_label.text = getCustomizeColorsString()
55+
settings_color_customization_holder.setOnClickListener {
6356
handleCustomizeColorsClick()
6457
}
6558
}
6659

6760
private fun setupCustomizeWidgetColors() {
68-
settings_customize_widget_colors_holder.setOnClickListener {
61+
settings_widget_color_customization_holder.setOnClickListener {
6962
Intent(this, WidgetTorchConfigureActivity::class.java).apply {
7063
putExtra(IS_CUSTOMIZING_COLORS, true)
7164
startActivity(this)
@@ -86,11 +79,6 @@ class SettingsActivity : SimpleActivity() {
8679
private fun setupLanguage() {
8780
settings_language.text = Locale.getDefault().displayLanguage
8881
settings_language_holder.beVisibleIf(isTiramisuPlus())
89-
90-
if (settings_use_english_holder.isGone() && settings_language_holder.isGone() && settings_purchase_thank_you_holder.isGone()) {
91-
settings_turn_flashlight_on_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme)
92-
}
93-
9482
settings_language_holder.setOnClickListener {
9583
launchChangeAppLanguageIntent()
9684
}

app/src/main/res/layout/activity_main.xml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,21 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent">
77

8-
<com.google.android.material.appbar.AppBarLayout
9-
android:id="@+id/main_app_bar_layout"
8+
<com.google.android.material.appbar.MaterialToolbar
9+
android:id="@+id/main_toolbar"
1010
android:layout_width="match_parent"
11-
android:layout_height="wrap_content">
12-
13-
<com.google.android.material.appbar.MaterialToolbar
14-
android:id="@+id/main_toolbar"
15-
android:layout_width="match_parent"
16-
android:layout_height="?attr/actionBarSize"
17-
android:background="@color/color_primary"
18-
app:menu="@menu/menu"
19-
app:title="@string/app_launcher_name"
20-
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
21-
22-
</com.google.android.material.appbar.AppBarLayout>
11+
android:layout_height="?attr/actionBarSize"
12+
android:background="@color/color_primary"
13+
app:menu="@menu/menu"
14+
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
2315

2416
<androidx.core.widget.NestedScrollView
25-
android:id="@+id/main_scrollview"
17+
android:id="@+id/main_nested_scrollview"
2618
android:layout_width="match_parent"
2719
android:layout_height="match_parent"
20+
android:layout_marginTop="?attr/actionBarSize"
2821
android:fillViewport="true"
29-
android:scrollbars="none"
30-
app:layout_behavior="@string/appbar_scrolling_view_behavior">
22+
android:scrollbars="none">
3123

3224
<androidx.constraintlayout.widget.ConstraintLayout
3325
android:id="@+id/main_holder"

app/src/main/res/layout/activity_settings.xml

Lines changed: 44 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,21 @@
66
android:layout_width="match_parent"
77
android:layout_height="match_parent">
88

9-
<com.google.android.material.appbar.AppBarLayout
10-
android:id="@+id/settings_app_bar_layout"
9+
<com.google.android.material.appbar.MaterialToolbar
10+
android:id="@+id/settings_toolbar"
1111
android:layout_width="match_parent"
12-
android:layout_height="wrap_content">
13-
14-
<com.google.android.material.appbar.MaterialToolbar
15-
android:id="@+id/settings_toolbar"
16-
android:layout_width="match_parent"
17-
android:layout_height="?attr/actionBarSize"
18-
android:background="@color/color_primary"
19-
app:layout_scrollFlags="scroll|enterAlways"
20-
app:title="@string/settings"
21-
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
22-
23-
</com.google.android.material.appbar.AppBarLayout>
12+
android:layout_height="?attr/actionBarSize"
13+
android:background="@color/color_primary"
14+
app:title="@string/settings"
15+
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
2416

2517
<androidx.core.widget.NestedScrollView
2618
android:id="@+id/settings_nested_scrollview"
2719
android:layout_width="match_parent"
2820
android:layout_height="match_parent"
21+
android:layout_marginTop="?attr/actionBarSize"
2922
android:fillViewport="true"
30-
android:scrollbars="none"
31-
app:layout_behavior="@string/appbar_scrolling_view_behavior">
23+
android:scrollbars="none">
3224

3325
<LinearLayout
3426
android:id="@+id/settings_holder"
@@ -37,52 +29,49 @@
3729
android:orientation="vertical">
3830

3931
<TextView
40-
android:id="@+id/settings_color_customization_label"
32+
android:id="@+id/settings_color_customization_section_label"
4133
style="@style/SettingsSectionLabelStyle"
4234
android:layout_width="match_parent"
4335
android:layout_height="wrap_content"
4436
android:text="@string/color_customization" />
4537

46-
<LinearLayout
38+
<androidx.constraintlayout.widget.ConstraintLayout
4739
android:id="@+id/settings_color_customization_holder"
40+
style="@style/SettingsHolderTextViewOneLinerStyle"
4841
android:layout_width="match_parent"
49-
android:layout_height="wrap_content"
50-
android:layout_margin="@dimen/medium_margin"
51-
android:background="@drawable/section_holder_stroke"
52-
android:orientation="vertical">
42+
android:layout_height="wrap_content">
5343

54-
<RelativeLayout
55-
android:id="@+id/settings_customize_colors_holder"
56-
style="@style/SettingsHolderTextViewOneLinerStyle"
57-
android:layout_width="match_parent"
44+
<com.simplemobiletools.commons.views.MyTextView
45+
android:id="@+id/settings_color_customization_label"
46+
style="@style/SettingsTextLabelStyle"
47+
android:layout_width="wrap_content"
5848
android:layout_height="wrap_content"
59-
android:background="@drawable/ripple_top_corners">
49+
android:text="@string/customize_colors"
50+
app:layout_constraintStart_toStartOf="parent"
51+
app:layout_constraintTop_toTopOf="parent" />
6052

61-
<com.simplemobiletools.commons.views.MyTextView
62-
android:id="@+id/settings_customize_colors_label"
63-
style="@style/SettingsTextLabelStyle"
64-
android:layout_width="wrap_content"
65-
android:layout_height="wrap_content"
66-
android:text="@string/customize_colors" />
53+
</androidx.constraintlayout.widget.ConstraintLayout>
6754

68-
</RelativeLayout>
55+
<androidx.constraintlayout.widget.ConstraintLayout
56+
android:id="@+id/settings_widget_color_customization_holder"
57+
style="@style/SettingsHolderTextViewOneLinerStyle"
58+
android:layout_width="match_parent"
59+
android:layout_height="wrap_content">
6960

70-
<RelativeLayout
71-
android:id="@+id/settings_customize_widget_colors_holder"
72-
style="@style/SettingsHolderTextViewStyle"
73-
android:layout_width="match_parent"
61+
<com.simplemobiletools.commons.views.MyTextView
62+
android:id="@+id/settings_widget_color_customization_label"
63+
style="@style/SettingsTextLabelStyle"
64+
android:layout_width="wrap_content"
7465
android:layout_height="wrap_content"
75-
android:background="@drawable/ripple_bottom_corners">
66+
android:text="@string/customize_widget_colors"
67+
app:layout_constraintStart_toStartOf="parent"
68+
app:layout_constraintTop_toTopOf="parent" />
7669

77-
<com.simplemobiletools.commons.views.MyTextView
78-
android:id="@+id/settings_customize_widget_colors_label"
79-
style="@style/SettingsTextLabelStyle"
80-
android:layout_width="wrap_content"
81-
android:layout_height="wrap_content"
82-
android:text="@string/customize_widget_colors" />
70+
</androidx.constraintlayout.widget.ConstraintLayout>
8371

84-
</RelativeLayout>
85-
</LinearLayout>
72+
<include
73+
android:id="@+id/settings_color_customization_divider"
74+
layout="@layout/divider" />
8675

8776
<TextView
8877
android:id="@+id/settings_general_settings_label"
@@ -95,16 +84,13 @@
9584
android:id="@+id/settings_general_settings_holder"
9685
android:layout_width="match_parent"
9786
android:layout_height="wrap_content"
98-
android:layout_margin="@dimen/medium_margin"
99-
android:background="@drawable/section_holder_stroke"
10087
android:orientation="vertical">
10188

10289
<RelativeLayout
10390
android:id="@+id/settings_purchase_thank_you_holder"
10491
style="@style/SettingsHolderTextViewStyle"
10592
android:layout_width="match_parent"
106-
android:layout_height="wrap_content"
107-
android:background="@drawable/ripple_top_corners">
93+
android:layout_height="wrap_content">
10894

10995
<com.simplemobiletools.commons.views.MyTextView
11096
android:id="@+id/settings_purchase_thank_you"
@@ -119,8 +105,7 @@
119105
android:id="@+id/settings_use_english_holder"
120106
style="@style/SettingsHolderCheckboxStyle"
121107
android:layout_width="match_parent"
122-
android:layout_height="wrap_content"
123-
android:background="@drawable/ripple_background">
108+
android:layout_height="wrap_content">
124109

125110
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
126111
android:id="@+id/settings_use_english"
@@ -135,8 +120,7 @@
135120
android:id="@+id/settings_language_holder"
136121
style="@style/SettingsHolderTextViewStyle"
137122
android:layout_width="match_parent"
138-
android:layout_height="wrap_content"
139-
android:background="@drawable/ripple_background">
123+
android:layout_height="wrap_content">
140124

141125
<com.simplemobiletools.commons.views.MyTextView
142126
android:id="@+id/settings_language_label"
@@ -159,8 +143,7 @@
159143
android:id="@+id/settings_turn_flashlight_on_holder"
160144
style="@style/SettingsHolderCheckboxStyle"
161145
android:layout_width="match_parent"
162-
android:layout_height="wrap_content"
163-
android:background="@drawable/ripple_background">
146+
android:layout_height="wrap_content">
164147

165148
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
166149
android:id="@+id/settings_turn_flashlight_on"
@@ -175,8 +158,7 @@
175158
android:id="@+id/settings_force_portrait_holder"
176159
style="@style/SettingsHolderCheckboxStyle"
177160
android:layout_width="match_parent"
178-
android:layout_height="wrap_content"
179-
android:background="@drawable/ripple_background">
161+
android:layout_height="wrap_content">
180162

181163
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
182164
android:id="@+id/settings_force_portrait"
@@ -191,8 +173,7 @@
191173
android:id="@+id/settings_bright_display_holder"
192174
style="@style/SettingsHolderCheckboxStyle"
193175
android:layout_width="match_parent"
194-
android:layout_height="wrap_content"
195-
android:background="@drawable/ripple_background">
176+
android:layout_height="wrap_content">
196177

197178
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
198179
android:id="@+id/settings_bright_display"
@@ -207,8 +188,7 @@
207188
android:id="@+id/settings_sos_holder"
208189
style="@style/SettingsHolderCheckboxStyle"
209190
android:layout_width="match_parent"
210-
android:layout_height="wrap_content"
211-
android:background="@drawable/ripple_background">
191+
android:layout_height="wrap_content">
212192

213193
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
214194
android:id="@+id/settings_sos"
@@ -223,8 +203,7 @@
223203
android:id="@+id/settings_stroboscope_holder"
224204
style="@style/SettingsHolderCheckboxStyle"
225205
android:layout_width="match_parent"
226-
android:layout_height="wrap_content"
227-
android:background="@drawable/ripple_bottom_corners">
206+
android:layout_height="wrap_content">
228207

229208
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
230209
android:id="@+id/settings_stroboscope"

0 commit comments

Comments
 (0)