Skip to content

Commit

Permalink
CFibers - Swipe to Float for notifications and recents [2/2]
Browse files Browse the repository at this point in the history
Change-Id: Iea7c361ef0055bc54e7507f762e705d5c5c54658
Signed-off-by: Stefano Mura [STELIX PippoX3] <[email protected]>
  • Loading branch information
STELIX committed Oct 30, 2014
1 parent 1f3d44f commit 27a9086
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 6 deletions.
15 changes: 14 additions & 1 deletion res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@
<string name="clear_button_top_right">In alto a destra</string>
<string name="clear_button_bottom_left">In basso a sinistra</string>
<string name="clear_button_bottom_right">In basso a destra</string>

<!-- Recents Swipe in Floating Mode -->
<string name="recents_swipe_floating_title">Lancia recente in fluttuante</string>
<string name="recents_swipe_floating_ask">Chiedi dopo</string>
<string name="recents_swipe_floating_yes">Si</string>
<string name="recents_swipe_floating_no">No</string>

<!-- Status Bar Notifications Swipe in Floating Mode -->
<string name="status_bar_notification_swipe_floating_title">Lancia Notifica in fluttuante</string>
<string name="status_bar_notification_swipe_floating_ask">Chiedi dopo</string>
<string name="status_bar_notification_swipe_floating_yes">Si</string>
<string name="status_bar_notification_swipe_floating_no">No</string>

<string name="ram_circle_title">Cerchio della RAM</string>
<string name="ram_bar">Barra della RAM</string>
<string name="ram_bar_note_title">Note</string>
Expand Down Expand Up @@ -994,7 +1007,7 @@
<string name="heads_up_time_out_8sec">8 secondi</string>
<string name="heads_up_time_out_10sec">10 secondi</string>
<string name="heads_up_time_out_never">Mai</string>
<string name="heads_up_exclude_from_lock_screen">Disabilita nella schermata di blocco</string>
<string name="heads_up_exclude_from_lock_screen">Disabilita nella lockscreen</string>
<string name="heads_up_bg_color_title">Colore sfondo</string>
<string name="heads_up_text_color_title">Colore testo</string>

Expand Down
26 changes: 26 additions & 0 deletions res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,32 @@
<item>10000</item>
</string-array>

<!-- Swipe Recents to launch in floating mode -->
<string-array name="recents_swipe_floating_entries" translatable="false">
<item>@string/recents_swipe_floating_yes</item>
<item>@string/recents_swipe_floating_no</item>
<item>@string/recents_swipe_floating_ask</item>
</string-array>

<string-array name="recents_swipe_floating_values" translatable="false">
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>

<!-- Swipe Status Bar Notifications to launch in floating mode -->
<string-array name="status_bar_notification_swipe_floating_entries" translatable="false">
<item>@string/status_bar_notification_swipe_floating_yes</item>
<item>@string/status_bar_notification_swipe_floating_no</item>
<item>@string/status_bar_notification_swipe_floating_ask</item>
</string-array>

<string-array name="status_bar_notification_swipe_floating_values" translatable="false">
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>

<!-- Network Traffic Display States -->
<string-array name="show_network_traffic_state_entries" translatable="false">
<item>@string/show_network_traffic_disable</item>
Expand Down
12 changes: 12 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,18 @@
<!-- RAM circle -->
<string name="ram_circle_title">RAM circle</string>

<!-- Recents Swipe in Floating Mode -->
<string name="recents_swipe_floating_title">Launch recent in floating</string>
<string name="recents_swipe_floating_ask">Ask later</string>
<string name="recents_swipe_floating_yes">Yes</string>
<string name="recents_swipe_floating_no">No</string>

<!-- Status Bar Notifications Swipe in Floating Mode -->
<string name="status_bar_notification_swipe_floating_title">Launch SB Notifications in floating</string>
<string name="status_bar_notification_swipe_floating_ask">Ask later</string>
<string name="status_bar_notification_swipe_floating_yes">Yes</string>
<string name="status_bar_notification_swipe_floating_no">No</string>

<!-- Recents Ram Bar -->
<string name="ram_bar">RAM bar</string>
<string name="ram_bar_note_title">Note</string>
Expand Down
5 changes: 0 additions & 5 deletions res/xml/sb_general_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
android:dependency="custom_system_icon_color"
android:defaultValue="0xFFFFFFFF" />

<PreferenceScreen
android:key="heads_up"
android:title="@string/heads_up_title"
android:fragment="com.carbon.fibers.fragments.sb.HeadsUpSettings" />

<com.carbon.fibers.preference.SystemSettingCheckBoxPreference
android:key="double_tap_sleep_gesture"
android:title="@string/status_bar_double_tap_to_sleep_title" />
Expand Down
13 changes: 13 additions & 0 deletions res/xml/sb_notification_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@
android:entryValues="@array/notification_hide_labels_values"
android:persistent="false" />


<PreferenceScreen
android:key="heads_up"
android:title="@string/heads_up_title"
android:fragment="com.carbon.fibers.fragments.sb.HeadsUpSettings" />

<ListPreference
android:key="status_bar_notification_swipe_floating"
android:title="@string/status_bar_notification_swipe_floating_title"
android:dialogTitle="@string/status_bar_notification_swipe_floating_title"
android:entries="@array/status_bar_notification_swipe_floating_entries"
android:entryValues="@array/status_bar_notification_swipe_floating_values" />

<com.carbon.fibers.fragments.sb.CustomCarrier
android:key="notification_custom_carrier_label"
android:title="@string/notification_custom_carrier_label_title"
Expand Down
7 changes: 7 additions & 0 deletions res/xml/ui_recents_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@
android:entries="@array/ram_circle_entries"
android:entryValues="@array/ram_circle_values" />

<ListPreference
android:key="recents_swipe_floating"
android:title="@string/recents_swipe_floating_title"
android:dialogTitle="@string/recents_swipe_floating_title"
android:entries="@array/recents_swipe_floating_entries"
android:entryValues="@array/recents_swipe_floating_values" />

</PreferenceScreen>
17 changes: 17 additions & 0 deletions src/com/carbon/fibers/fragments/sb/NotificationDrawer.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public class NotificationDrawer extends SettingsPreferenceFragment implements
private static final String UI_COLLAPSE_BEHAVIOUR = "notification_drawer_collapse_on_dismiss";
private static final String PREF_NOTIFICATION_HIDE_LABELS = "notification_hide_labels";

private static final String STATUS_BAR_NOTIFICATION_SWIPE_FLOATING = "status_bar_notification_swipe_floating";

private ListPreference mCollapseOnDismiss;
private ListPreference mStatusBarNotificationSwipeFloating;

ListPreference mHideLabels;

Expand All @@ -49,6 +52,13 @@ public void onCreate(Bundle savedInstanceState) {
mHideLabels.setOnPreferenceChangeListener(this);
updateHideNotificationLabelsSummary(hideCarrier);

mStatusBarNotificationSwipeFloating = (ListPreference) findPreference(STATUS_BAR_NOTIFICATION_SWIPE_FLOATING);
int StatusBarNotificationSwipeFloatingStatus = Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.STATUS_BAR_NOTIFICATION_SWIPE_FLOATING, 0);
mStatusBarNotificationSwipeFloating.setValue(String.valueOf(StatusBarNotificationSwipeFloatingStatus));
mStatusBarNotificationSwipeFloating.setSummary(mStatusBarNotificationSwipeFloating.getEntry());
mStatusBarNotificationSwipeFloating.setOnPreferenceChangeListener(this);

/* Tablet case in handled in PhoneStatusBar
if (!DeviceUtils.isPhone(getActivity())
|| !DeviceUtils.deviceSupportsMobileData(getActivity())) {
Expand Down Expand Up @@ -80,6 +90,13 @@ public boolean onPreferenceChange(Preference preference, Object objValue) {
hideLabels);
updateHideNotificationLabelsSummary(hideLabels);
return true;
} else if (preference == mStatusBarNotificationSwipeFloating) {
int value = Integer.valueOf((String) objValue);
int index = mStatusBarNotificationSwipeFloating.findIndexOfValue((String) objValue);
Settings.System.putInt(getActivity().getContentResolver(),
Settings.System.STATUS_BAR_NOTIFICATION_SWIPE_FLOATING, value);
mStatusBarNotificationSwipeFloating.setSummary(mStatusBarNotificationSwipeFloating.getEntries()[index]);
return true;
}
return false;
}
Expand Down
16 changes: 16 additions & 0 deletions src/com/carbon/fibers/fragments/ui/RecentsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ public class RecentsPanel extends SettingsPreferenceFragment implements

private static final String CLEAR_RECENTS_BUTTON = "clear_recents_button";
private static final String RAM_CIRCLE = "ram_circle";
private static final String RECENTS_SWIPE_FLOATING = "recents_swipe_floating";

private ListPreference mClearAllButton;
private ListPreference mRamCircle;
private ListPreference mRecentsSwipeFloating;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand All @@ -56,6 +58,13 @@ public void onCreate(Bundle savedInstanceState) {
mRamCircle.setValue(String.valueOf(circleStatus));
mRamCircle.setSummary(mRamCircle.getEntry());
mRamCircle.setOnPreferenceChangeListener(this);

mRecentsSwipeFloating = (ListPreference) findPreference(RECENTS_SWIPE_FLOATING);
int RecentsSwipeFloatingStatus = Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.RECENTS_SWIPE_FLOATING, 0);
mRecentsSwipeFloating.setValue(String.valueOf(RecentsSwipeFloatingStatus));
mRecentsSwipeFloating.setSummary(mRecentsSwipeFloating.getEntry());
mRecentsSwipeFloating.setOnPreferenceChangeListener(this);
}

public boolean onPreferenceChange(Preference preference, Object objValue) {
Expand All @@ -73,6 +82,13 @@ public boolean onPreferenceChange(Preference preference, Object objValue) {
Settings.System.RAM_CIRCLE, value);
mRamCircle.setSummary(mRamCircle.getEntries()[index]);
return true;
} else if (preference == mRecentsSwipeFloating) {
int value = Integer.valueOf((String) objValue);
int index = mRecentsSwipeFloating.findIndexOfValue((String) objValue);
Settings.System.putInt(getActivity().getContentResolver(),
Settings.System.RECENTS_SWIPE_FLOATING, value);
mRecentsSwipeFloating.setSummary(mRecentsSwipeFloating.getEntries()[index]);
return true;
}
return false;
}
Expand Down

0 comments on commit 27a9086

Please sign in to comment.