OSDN Git Service

ADWLauncher for IS01
[gb-231r1-is01/GB_2.3_IS01.git] / packages / apps / ADWLauncher / src / com / android / launcher / catalogue / AppCatalogueFilter.java
diff --git a/packages/apps/ADWLauncher/src/com/android/launcher/catalogue/AppCatalogueFilter.java b/packages/apps/ADWLauncher/src/com/android/launcher/catalogue/AppCatalogueFilter.java
new file mode 100644 (file)
index 0000000..4ee6f96
--- /dev/null
@@ -0,0 +1,45 @@
+package com.android.launcher.catalogue;
+
+import android.content.SharedPreferences;
+
+public class AppCatalogueFilter {
+
+       private AppCatalogueFilters.Catalogue mCatalogue;
+
+       public AppCatalogueFilter() {
+               this(AppGroupAdapter.APP_GROUP_ALL);
+       }
+
+       public AppCatalogueFilter(int index) {
+               setCurrentGroupIndex(index);
+       }
+
+       public boolean checkAppInGroup(String className) {
+               boolean result = true;
+               if (mCatalogue != null) {
+                       final SharedPreferences prefs = mCatalogue.getPreferences();
+                       if (prefs != null)
+                               result = prefs.getBoolean(className, false);
+               }
+               return result;
+       }
+
+       public boolean isUserGroup() {
+               return mCatalogue != null;
+       }
+
+       public int getCurrentFilterIndex() {
+               if (mCatalogue != null)
+                       return mCatalogue.getIndex();
+               else
+                       return AppGroupAdapter.APP_GROUP_ALL;
+       }
+
+       public synchronized void setCurrentGroupIndex(int index) {
+               if (index != getCurrentFilterIndex()) {
+                       mCatalogue = AppCatalogueFilters.getInstance().getCatalogue(index);
+               }
+       }
+
+
+}