summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/AppsCustomizePagedView.java
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2014-11-10 10:35:00 -0800
committerAdnan <adnan@cyngn.com>2014-11-19 15:53:57 -0800
commitd784b52040dc1d688b5f98c186038ab188669040 (patch)
tree27d8940569edd2e0ff30d1f5f8b174551675943d /src/com/android/launcher3/AppsCustomizePagedView.java
parent5dc390cde4aa6efc41e145610bb993e4754fd440 (diff)
downloadandroid_packages_apps_Trebuchet-d784b52040dc1d688b5f98c186038ab188669040.tar.gz
android_packages_apps_Trebuchet-d784b52040dc1d688b5f98c186038ab188669040.tar.bz2
android_packages_apps_Trebuchet-d784b52040dc1d688b5f98c186038ab188669040.zip
Customizeable Dynamic Grid:
- Presets - Comfortable (+0) - Cozy (+1) - Condensed (+2) - Custom option with min, max Reordering items in the settings pane for better organization Modifying Settings Layout for readability Conflicts: res/layout/settings_pane_list_item.xml res/values/cm_strings.xml src/com/android/launcher3/DeviceProfile.java src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java Change-Id: I5c926b6ca4b2ed73c263ef34eeb368caeb7af9b5
Diffstat (limited to 'src/com/android/launcher3/AppsCustomizePagedView.java')
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java88
1 files changed, 22 insertions, 66 deletions
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index abccbb0da..61ae2894d 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -23,6 +23,7 @@ import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
@@ -191,6 +192,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
private SortMode mSortMode = SortMode.Title;
+ private int mFilterApps = FILTER_APPS_SYSTEM_FLAG | FILTER_APPS_DOWNLOADED_FLAG;
+
+ private static final int FILTER_APPS_SYSTEM_FLAG = 1;
+ private static final int FILTER_APPS_DOWNLOADED_FLAG = 2;
+
// Refs
private Launcher mLauncher;
private DragController mDragController;
@@ -1517,6 +1523,22 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
+ public void setShowSystemApps(boolean show) {
+ if (show) {
+ mFilterApps |= FILTER_APPS_SYSTEM_FLAG;
+ } else {
+ mFilterApps &= ~FILTER_APPS_DOWNLOADED_FLAG;
+ }
+ }
+
+ public boolean getShowSystemApps() {
+ return (mFilterApps & FILTER_APPS_SYSTEM_FLAG) != 0;
+ }
+
+ public boolean getShowDownloadedApps() {
+ return (mFilterApps & FILTER_APPS_DOWNLOADED_FLAG) != 0;
+ }
+
public void setApps(ArrayList<AppInfo> list) {
if (!LauncherAppState.isDisableAllApps()) {
mApps = list;
@@ -1597,72 +1619,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
- public void filterAppsWithoutInvalidate() {
- updateProtectedAppsList(mLauncher);
-
- mFilteredApps = new ArrayList<AppInfo>(mApps);
- Iterator<AppInfo> iterator = mFilteredApps.iterator();
- while (iterator.hasNext()) {
- AppInfo appInfo = iterator.next();
- boolean system = (appInfo.flags & AppInfo.DOWNLOADED_FLAG) == 0;
- if (mProtectedApps.contains(appInfo.componentName) ||
- (system && !getShowSystemApps()) ||
- (!system && !getShowDownloadedApps())) {
- iterator.remove();
- }
- }
- Collections.sort(mFilteredApps, getComparatorForSortMode());
- }
-
- public void filterApps() {
- filterAppsWithoutInvalidate();
- updatePageCountsAndInvalidateData();
- }
-
- public void filterWidgetsWithoutInvalidate() {
- updateProtectedAppsList(mLauncher);
-
- mFilteredWidgets = new ArrayList<Object>(mWidgets);
-
- Iterator<Object> iterator = mFilteredWidgets.iterator();
- while (iterator.hasNext()) {
- Object o = iterator.next();
-
- String packageName;
- if (o instanceof AppWidgetProviderInfo) {
- AppWidgetProviderInfo widgetInfo = (AppWidgetProviderInfo) o;
- if (widgetInfo.provider == null) {
- continue;
- }
- packageName = widgetInfo.provider.getPackageName();
- } else if (o instanceof ResolveInfo) {
- ResolveInfo shortcut = (ResolveInfo) o;
- packageName = shortcut.activityInfo.applicationInfo.packageName;
- } else {
- Log.w(TAG, "Unknown class in widgets list: " + o.getClass());
- continue;
- }
-
- int flags;
- try {
- flags = AppInfo.initFlags(mPackageManager.getPackageInfo(packageName, 0));
- } catch (NameNotFoundException e) {
- flags = 0;
- }
- boolean system = (flags & AppInfo.DOWNLOADED_FLAG) == 0;
- if (mProtectedPackages.contains(packageName) ||
- (system && !getShowSystemApps()) ||
- (!system && !getShowDownloadedApps())) {
- iterator.remove();
- }
- }
- }
-
- public void filterWidgets() {
- filterWidgetsWithoutInvalidate();
- updatePageCountsAndInvalidateData();
- }
-
public void reset() {
// If we have reset, then we should not continue to restore the previous state
mSaveInstanceStateItemIndex = -1;