Skip to content

Commit 789b66b

Browse files
committed
add a toggle button for avoiding showing Whats New
1 parent 8c7cbd7 commit 789b66b

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class SettingsActivity : SimpleActivity() {
1919

2020
setupCustomizeColors()
2121
setupUseEnglish()
22+
setupAvoidWhatsNew()
2223
setupTurnFlashlightOn()
2324
setupBrightDisplay()
2425
setupStroboscope()
@@ -41,6 +42,14 @@ class SettingsActivity : SimpleActivity() {
4142
}
4243
}
4344

45+
private fun setupAvoidWhatsNew() {
46+
settings_avoid_whats_new.isChecked = config.avoidWhatsNew
47+
settings_avoid_whats_new_holder.setOnClickListener {
48+
settings_avoid_whats_new.toggle()
49+
config.avoidWhatsNew = settings_avoid_whats_new.isChecked
50+
}
51+
}
52+
4453
private fun setupTurnFlashlightOn() {
4554
settings_turn_flashlight_on.isChecked = config.turnFlashlightOn
4655
settings_turn_flashlight_on_holder.setOnClickListener {

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

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
android:layout_height="wrap_content"
1818
android:layout_marginTop="@dimen/medium_margin"
1919
android:background="?attr/selectableItemBackground"
20-
android:padding="@dimen/activity_margin">
20+
android:paddingBottom="@dimen/activity_margin"
21+
android:paddingLeft="@dimen/normal_margin"
22+
android:paddingRight="@dimen/normal_margin"
23+
android:paddingTop="@dimen/activity_margin">
2124

2225
<com.simplemobiletools.commons.views.MyTextView
2326
android:id="@+id/settings_customize_colors"
@@ -36,7 +39,10 @@
3639
android:layout_height="wrap_content"
3740
android:layout_marginTop="@dimen/medium_margin"
3841
android:background="?attr/selectableItemBackground"
39-
android:padding="@dimen/activity_margin">
42+
android:paddingBottom="@dimen/activity_margin"
43+
android:paddingLeft="@dimen/normal_margin"
44+
android:paddingRight="@dimen/normal_margin"
45+
android:paddingTop="@dimen/activity_margin">
4046

4147
<com.simplemobiletools.commons.views.MySwitchCompat
4248
android:id="@+id/settings_use_english"
@@ -50,13 +56,39 @@
5056

5157
</RelativeLayout>
5258

59+
<RelativeLayout
60+
android:id="@+id/settings_avoid_whats_new_holder"
61+
android:layout_width="match_parent"
62+
android:layout_height="wrap_content"
63+
android:layout_marginTop="@dimen/medium_margin"
64+
android:background="?attr/selectableItemBackground"
65+
android:paddingBottom="@dimen/activity_margin"
66+
android:paddingLeft="@dimen/normal_margin"
67+
android:paddingRight="@dimen/normal_margin"
68+
android:paddingTop="@dimen/activity_margin">
69+
70+
<com.simplemobiletools.commons.views.MySwitchCompat
71+
android:id="@+id/settings_avoid_whats_new"
72+
android:layout_width="match_parent"
73+
android:layout_height="wrap_content"
74+
android:background="@null"
75+
android:clickable="false"
76+
android:paddingLeft="@dimen/medium_margin"
77+
android:paddingStart="@dimen/medium_margin"
78+
android:text="@string/avoid_whats_new"/>
79+
80+
</RelativeLayout>
81+
5382
<RelativeLayout
5483
android:id="@+id/settings_turn_flashlight_on_holder"
5584
android:layout_width="match_parent"
5685
android:layout_height="wrap_content"
5786
android:layout_marginTop="@dimen/medium_margin"
5887
android:background="?attr/selectableItemBackground"
59-
android:padding="@dimen/activity_margin">
88+
android:paddingBottom="@dimen/activity_margin"
89+
android:paddingLeft="@dimen/normal_margin"
90+
android:paddingRight="@dimen/normal_margin"
91+
android:paddingTop="@dimen/activity_margin">
6092

6193
<com.simplemobiletools.commons.views.MySwitchCompat
6294
android:id="@+id/settings_turn_flashlight_on"
@@ -76,7 +108,10 @@
76108
android:layout_height="wrap_content"
77109
android:layout_marginTop="@dimen/medium_margin"
78110
android:background="?attr/selectableItemBackground"
79-
android:padding="@dimen/activity_margin">
111+
android:paddingBottom="@dimen/activity_margin"
112+
android:paddingLeft="@dimen/normal_margin"
113+
android:paddingRight="@dimen/normal_margin"
114+
android:paddingTop="@dimen/activity_margin">
80115

81116
<com.simplemobiletools.commons.views.MySwitchCompat
82117
android:id="@+id/settings_bright_display"
@@ -96,7 +131,10 @@
96131
android:layout_height="wrap_content"
97132
android:layout_marginTop="@dimen/medium_margin"
98133
android:background="?attr/selectableItemBackground"
99-
android:padding="@dimen/activity_margin">
134+
android:paddingBottom="@dimen/activity_margin"
135+
android:paddingLeft="@dimen/normal_margin"
136+
android:paddingRight="@dimen/normal_margin"
137+
android:paddingTop="@dimen/activity_margin">
100138

101139
<com.simplemobiletools.commons.views.MySwitchCompat
102140
android:id="@+id/settings_stroboscope"

0 commit comments

Comments
 (0)