Skip to content

Commit 29ae1b8

Browse files
kufikugelcodex-corp
authored andcommitted
Settings: Show heads up at the bottom of the screen (2/2)
Due of user requests and indeed especially on hw key devices for a better workflow we add an option to show heads up notifications on the bottom instead of the top. Animation we leave as is due that if it slide from the bottom into the screen it happens to often that the user accidentaly interacts with it. If it comes from the top of the container we add, the user has enough time to realize it. Sometimes a ms can make a big difference.
1 parent 99e021c commit 29ae1b8

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

res/values/probam_strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,8 @@
13751375
<string name="heads_up_snooze_title">Snooze timer</string>
13761376
<string name="heads_up_snooze_summary">If snooze button is pressed disable heads up for <xliff:g id="number">%d</xliff:g> minutes.</string>
13771377
<string name="heads_up_snooze_disabled_summary">Snooze timer is disabled.</string>
1378+
<string name="heads_up_gravity_title">Show at the bottom</string>
1379+
<string name="heads_up_gravity_summary">Show heads up notification at the bottom of the screen</string>
13781380
<string name="heads_up_snooze_3min">3 minutes</string>
13791381
<string name="heads_up_snooze_5min">5 minutes</string>
13801382
<string name="heads_up_snooze_10min">10 minutes</string>

res/xml/heads_up_settings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
android:persistent="false"
2020
android:defaultValue="false" />
2121

22+
<CheckBoxPreference
23+
android:key="heads_up_gravity"
24+
android:title="@string/heads_up_gravity_title"
25+
android:summary="@string/heads_up_gravity_summary"
26+
android:persistent="false"
27+
android:defaultValue="false" />
28+
2229
<ListPreference
2330
android:key="heads_up_snooze_time"
2431
android:title="@string/heads_up_snooze_title"

src/com/android/settings/probam/HeadsUpSettings.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ public class HeadsUpSettings extends SettingsPreferenceFragment
3232
private static final String PREF_HEADS_UP_SNOOZE_TIME = "heads_up_snooze_time";
3333
private static final String PREF_HEADS_UP_TIME_OUT = "heads_up_time_out";
3434
private static final String PREF_HEADS_UP_SHOW_UPDATE = "heads_up_show_update";
35+
private static final String PREF_HEADS_UP_GRAVITY = "heads_up_gravity";
3536

3637
ListPreference mHeadsUpSnoozeTime;
3738
ListPreference mHeadsUpTimeOut;
3839
CheckBoxPreference mHeadsUpExpanded;
3940
CheckBoxPreference mHeadsUpShowUpdates;
41+
CheckBoxPreference mHeadsUpGravity;
4042

4143
@Override
4244
public void onCreate(Bundle savedInstanceState) {
@@ -58,6 +60,11 @@ public void onCreate(Bundle savedInstanceState) {
5860
Settings.System.HEADS_UP_SHOW_UPDATE, 0, UserHandle.USER_CURRENT) == 1);
5961
mHeadsUpShowUpdates.setOnPreferenceChangeListener(this);
6062

63+
mHeadsUpGravity = (CheckBoxPreference) findPreference(PREF_HEADS_UP_GRAVITY);
64+
mHeadsUpGravity.setChecked(Settings.System.getIntForUser(getContentResolver(),
65+
Settings.System.HEADS_UP_GRAVITY_BOTTOM, 0, UserHandle.USER_CURRENT) == 1);
66+
mHeadsUpGravity.setOnPreferenceChangeListener(this);
67+
6168
mHeadsUpSnoozeTime = (ListPreference) findPreference(PREF_HEADS_UP_SNOOZE_TIME);
6269
mHeadsUpSnoozeTime.setOnPreferenceChangeListener(this);
6370
int headsUpSnoozeTime = Settings.System.getInt(getContentResolver(),
@@ -114,6 +121,11 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
114121
Settings.System.HEADS_UP_SHOW_UPDATE,
115122
(Boolean) newValue ? 1 : 0, UserHandle.USER_CURRENT);
116123
return true;
124+
} else if (preference == mHeadsUpGravity) {
125+
Settings.System.putIntForUser(getContentResolver(),
126+
Settings.System.HEADS_UP_GRAVITY_BOTTOM,
127+
(Boolean) newValue ? 1 : 0, UserHandle.USER_CURRENT);
128+
return true;
117129
}
118130
return false;
119131
}

0 commit comments

Comments
 (0)