diff options
author | nebkat <nebkat@teamhacksung.org> | 2011-12-30 18:58:41 +0000 |
---|---|---|
committer | nebkat <nebkat@teamhacksung.org> | 2011-12-31 10:15:28 +0000 |
commit | 991185b60879af6f84736918f8616e28a67eeeac (patch) | |
tree | 61c03e72e59fad84c88948629a77af08d20693f9 /src/com/cyanogenmod/trebuchet | |
parent | 291324116b7ac4d4348643d93e432c20768125ea (diff) | |
download | android_packages_apps_Trebuchet-991185b60879af6f84736918f8616e28a67eeeac.tar.gz android_packages_apps_Trebuchet-991185b60879af6f84736918f8616e28a67eeeac.tar.bz2 android_packages_apps_Trebuchet-991185b60879af6f84736918f8616e28a67eeeac.zip |
AppsCustomize: Apps Sort Mode Cling
Change-Id: I07a08afb1f249f226693e935ad7ebc017f9c79b0
Diffstat (limited to 'src/com/cyanogenmod/trebuchet')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java | 6 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Cling.java | 23 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 16 |
3 files changed, 44 insertions, 1 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java index 0eb48b9dd..82ad7d044 100644 --- a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java +++ b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java @@ -192,6 +192,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // Cling private boolean mHasShownAllAppsCling; + private boolean mHasShownAllAppsSortCling; private int mClingFocusedX; private int mClingFocusedY; @@ -470,6 +471,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } void showAllAppsCling() { + Cling allAppsCling = (Cling) getTabHost().findViewById(R.id.all_apps_cling); if (!mHasShownAllAppsCling && isDataReady() && testDataReady()) { mHasShownAllAppsCling = true; // Calculate the position for the cling punch through @@ -481,6 +483,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen offset[0]; pos[1] += offset[1]; mLauncher.showFirstRunAllAppsCling(pos); + } else if (!mHasShownAllAppsSortCling && isDataReady() && testDataReady() && + allAppsCling != null && allAppsCling.isDismissed()) { + mHasShownAllAppsSortCling = true; + mLauncher.showFirstRunAllAppsSortCling(); } } diff --git a/src/com/cyanogenmod/trebuchet/Cling.java b/src/com/cyanogenmod/trebuchet/Cling.java index 9d13ad85c..82ba3f4af 100644 --- a/src/com/cyanogenmod/trebuchet/Cling.java +++ b/src/com/cyanogenmod/trebuchet/Cling.java @@ -29,17 +29,21 @@ public class Cling extends FrameLayout { static final String WORKSPACE_CLING_DISMISSED_KEY = "cling.workspace.dismissed"; static final String ALLAPPS_CLING_DISMISSED_KEY = "cling.allapps.dismissed"; + static final String ALLAPPS_SORT_CLING_DISMISSED_KEY = "cling.allappssort.dismissed"; static final String FOLDER_CLING_DISMISSED_KEY = "cling.folder.dismissed"; private static String WORKSPACE_PORTRAIT = "workspace_portrait"; private static String WORKSPACE_LANDSCAPE = "workspace_landscape"; private static String ALLAPPS_PORTRAIT = "all_apps_portrait"; private static String ALLAPPS_LANDSCAPE = "all_apps_landscape"; + private static String ALLAPPS_SORT_PORTRAIT = "all_apps_sort_portrait"; + private static String ALLAPPS_SORT_LANDSCAPE = "all_apps_sort_landscape"; private static String FOLDER_PORTRAIT = "folder_portrait"; private static String FOLDER_LANDSCAPE = "folder_landscape"; private static String WORKSPACE_LARGE = "workspace_large"; private static String FOLDER_LARGE = "folder_large"; private static String ALLAPPS_LARGE = "all_apps_large"; + private static String ALLAPPS_SORT_LARGE = "all_apps_sort_large"; private Launcher mLauncher; private boolean mIsInitialized; @@ -52,6 +56,7 @@ public class Cling extends FrameLayout { private int mButtonBarHeight; private float mRevealRadius; private int[] mPositionData; + private boolean mDismissed; private Paint mErasePaint; @@ -75,6 +80,7 @@ public class Cling extends FrameLayout { if (!mIsInitialized) { mLauncher = l; mPositionData = positionData; + mDismissed = false; Resources r = getContext().getResources(); mPunchThroughGraphic = r.getDrawable(R.drawable.cling); @@ -93,6 +99,14 @@ public class Cling extends FrameLayout { } } + void dismiss() { + mDismissed = true; + } + + boolean isDismissed() { + return mDismissed; + } + void cleanup() { mBackground = null; mPunchThroughGraphic = null; @@ -105,6 +119,10 @@ public class Cling extends FrameLayout { return new int[]{getMeasuredWidth() / 2, getMeasuredHeight() - (mButtonBarHeight / 2)}; } else if (mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)) { return new int[]{getMeasuredWidth() - (mButtonBarHeight / 2), getMeasuredHeight() / 2}; + } else if (mDrawIdentifier.equals(ALLAPPS_SORT_PORTRAIT) || + mDrawIdentifier.equals(ALLAPPS_SORT_LANDSCAPE) || + mDrawIdentifier.equals(ALLAPPS_SORT_LARGE)) { + return new int[]{mButtonBarHeight / 2, mButtonBarHeight / 2}; } else if (mDrawIdentifier.equals(WORKSPACE_LARGE)) { final float scale = LauncherApplication.getScreenDensity(); final int cornerXOffset = (int) (scale * 15); @@ -125,7 +143,10 @@ public class Cling extends FrameLayout { mDrawIdentifier.equals(WORKSPACE_LARGE) || mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || - mDrawIdentifier.equals(ALLAPPS_LARGE)) { + mDrawIdentifier.equals(ALLAPPS_LARGE) || + mDrawIdentifier.equals(ALLAPPS_SORT_PORTRAIT) || + mDrawIdentifier.equals(ALLAPPS_SORT_LANDSCAPE) || + mDrawIdentifier.equals(ALLAPPS_SORT_LARGE)) { int[] pos = getPunchThroughPosition(); double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) + Math.pow(event.getY() - pos[1], 2)); diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index 0a137dafc..033eaf139 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -1737,6 +1737,7 @@ public final class Launcher extends Activity public void onLongClickAppsTab(View v) { final PopupMenu popupMenu = new PopupMenu(this, v); final Menu menu = popupMenu.getMenu(); + dismissAllAppsSortCling(null); popupMenu.inflate(R.menu.apps_tab); AppsCustomizePagedView.SortMode sortMode = mAppsCustomizeContent.getSortMode(); if (sortMode == AppsCustomizePagedView.SortMode.Title) { @@ -3250,6 +3251,7 @@ public final class Launcher extends Activity } private void dismissCling(final Cling cling, final String flag, int duration) { if (cling != null) { + cling.dismiss(); ObjectAnimator anim = ObjectAnimator.ofFloat(cling, "alpha", 0f); anim.setDuration(duration); anim.addListener(new AnimatorListenerAdapter() { @@ -3298,6 +3300,16 @@ public final class Launcher extends Activity removeCling(R.id.all_apps_cling); } } + public void showFirstRunAllAppsSortCling() { + // Enable the clings only if they have not been dismissed before + SharedPreferences prefs = + getSharedPreferences(PreferencesProvider.PREFERENCES_KEY, Context.MODE_PRIVATE); + if (isClingsEnabled() && !prefs.getBoolean(Cling.ALLAPPS_SORT_CLING_DISMISSED_KEY, false)) { + initCling(R.id.all_apps_sort_cling, null, true, 0); + } else { + removeCling(R.id.all_apps_sort_cling); + } + } public Cling showFirstRunFoldersCling() { // Enable the clings only if they have not been dismissed before SharedPreferences prefs = @@ -3325,6 +3337,10 @@ public final class Launcher extends Activity Cling cling = (Cling) findViewById(R.id.all_apps_cling); dismissCling(cling, Cling.ALLAPPS_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION); } + public void dismissAllAppsSortCling(View v) { + Cling cling = (Cling) findViewById(R.id.all_apps_sort_cling); + dismissCling(cling, Cling.ALLAPPS_SORT_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION); + } public void dismissFolderCling(View v) { Cling cling = (Cling) findViewById(R.id.folder_cling); dismissCling(cling, Cling.FOLDER_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION); |