Add a circlular memory indicator to the recent panel view (2/2)
Modifications:
It allows to be toggled on/off as well as setting a custom location.
Colors are not solid, they have an alpha channel to provide
transparency, this way it doesnt interfer much with the recents
panel view.
Screenshot:
http://goo.gl/Th7g0j
Frameworks Part:
https://gerrit.omnirom.org/#/c/3008/
Change-Id: If02666e084abe689a83afde3da33ccbdaa6c337a
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index 27718e5..ac33759 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -257,7 +257,7 @@
<string name="ad_pocket_mode_always">Always</string>
<string name="bars_and_menus_category_recent_panel_title" >Recents view</string>
- <!-- Recents clear all -->
+ <!-- Recents clear all -->
<string name="show_recent_clear_all_button_title">Clear all button</string>
<string name="show_recent_clear_all_button_summary">Show clear all button within the recent applications view</string>
<string name="recent_clear_all_button_location_title">Clear all button position</string>
@@ -267,6 +267,12 @@
<string name="recent_clear_all_button_location_bottom_left">Bottom left</string>
<string name="recent_clear_all_button_location_bottom_right">Bottom right</string>
+ <!-- Memory Indicator -->
+ <string name="show_recents_memory_indicator_title">Memory indicator</string>
+ <string name="show_recents_memory_indicator_summary">Show a memory indicator within the recent applications view</string>
+ <string name="recents_memory_indicator_location_title">Memory indicator position</string>
+ <string name="recents_memory_indicator_location_summary">Choose position of the memory indicator</string>
+
<!-- Contextual Notification Panel Header -->
<string name="notification_drawer_category_title">Notification drawer</string>
<string name="custom_statusbar_header_title">Contextual notification panel header</string>
diff --git a/res/xml/more_interface_settings.xml b/res/xml/more_interface_settings.xml
index d071b80..f035aca 100644
--- a/res/xml/more_interface_settings.xml
+++ b/res/xml/more_interface_settings.xml
@@ -39,4 +39,20 @@
android:entryValues="@array/recent_clear_all_button_location_values"
android:defaultValue="2"
android:dependency="recent_menu_clear_all" />
+
+ <CheckBoxPreference
+ android:key="show_recents_memory_indicator"
+ android:title="@string/show_recents_memory_indicator_title"
+ android:summary="@string/show_recents_memory_indicator_summary"
+ android:defaultValue="false" />
+
+ <ListPreference
+ android:key="recents_memory_indicator_location"
+ android:title="@string/recents_memory_indicator_location_title"
+ android:summary="@string/recents_memory_indicator_location_summary"
+ android:entries="@array/recent_clear_all_button_location_entries"
+ android:entryValues="@array/recent_clear_all_button_location_values"
+ android:defaultValue="1"
+ android:dependency="show_recents_memory_indicator" />
+
</PreferenceScreen>
diff --git a/src/org/omnirom/omnigears/interfacesettings/MoreInterfaceSettings.java b/src/org/omnirom/omnigears/interfacesettings/MoreInterfaceSettings.java
index 5ac0d98..6ce63ac 100644
--- a/src/org/omnirom/omnigears/interfacesettings/MoreInterfaceSettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/MoreInterfaceSettings.java
@@ -39,9 +39,14 @@
private static final String RECENT_MENU_CLEAR_ALL = "recent_menu_clear_all";
private static final String RECENT_MENU_CLEAR_ALL_LOCATION = "recent_menu_clear_all_location";
+ private static final String SHOW_RECENTS_MEMORY_INDICATOR = "show_recents_memory_indicator";
+ private static final String RECENTS_MEMORY_INDICATOR_LOCATION =
+ "recents_memory_indicator_location";
private CheckBoxPreference mRecentClearAll;
private ListPreference mRecentClearAllPosition;
+ private CheckBoxPreference mShowRecentsMemoryIndicator;
+ private ListPreference mRecentsMemoryIndicatorPosition;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -53,14 +58,28 @@
mRecentClearAll = (CheckBoxPreference) prefSet.findPreference(RECENT_MENU_CLEAR_ALL);
mRecentClearAll.setChecked(Settings.System.getInt(resolver,
- Settings.System.SHOW_CLEAR_RECENTS_BUTTON, 1) == 1);
+ Settings.System.SHOW_CLEAR_RECENTS_BUTTON, 0) == 1);
mRecentClearAll.setOnPreferenceChangeListener(this);
mRecentClearAllPosition = (ListPreference) prefSet.findPreference(RECENT_MENU_CLEAR_ALL_LOCATION);
String recentClearAllPosition = Settings.System.getString(resolver, Settings.System.CLEAR_RECENTS_BUTTON_LOCATION);
if (recentClearAllPosition != null) {
- mRecentClearAllPosition.setValue(recentClearAllPosition);
+ mRecentClearAllPosition.setValue(recentClearAllPosition);
}
mRecentClearAllPosition.setOnPreferenceChangeListener(this);
+
+ mShowRecentsMemoryIndicator = (CheckBoxPreference)
+ prefSet.findPreference(SHOW_RECENTS_MEMORY_INDICATOR);
+ mShowRecentsMemoryIndicator.setChecked(Settings.System.getInt(resolver,
+ Settings.System.SHOW_RECENTS_MEMORY_INDICATOR, 0) == 1);
+ mShowRecentsMemoryIndicator.setOnPreferenceChangeListener(this);
+ mRecentsMemoryIndicatorPosition = (ListPreference) prefSet
+ .findPreference(RECENTS_MEMORY_INDICATOR_LOCATION);
+ String recentsMemoryIndicatorPosition = Settings.System.getString(
+ resolver, Settings.System.RECENTS_MEMORY_INDICATOR_LOCATION);
+ if (recentsMemoryIndicatorPosition != null) {
+ mRecentsMemoryIndicatorPosition.setValue(recentsMemoryIndicatorPosition);
+ }
+ mRecentsMemoryIndicatorPosition.setOnPreferenceChangeListener(this);
}
@Override
@@ -76,6 +95,14 @@
} else if (preference == mRecentClearAllPosition) {
String value = (String) objValue;
Settings.System.putString(resolver, Settings.System.CLEAR_RECENTS_BUTTON_LOCATION, value);
+ } else if (preference == mShowRecentsMemoryIndicator) {
+ boolean value = (Boolean) objValue;
+ Settings.System.putInt(
+ resolver, Settings.System.SHOW_RECENTS_MEMORY_INDICATOR, value ? 1 : 0);
+ } else if (preference == mRecentsMemoryIndicatorPosition) {
+ String value = (String) objValue;
+ Settings.System.putString(
+ resolver, Settings.System.RECENTS_MEMORY_INDICATOR_LOCATION, value);
} else {
return false;
}