diff options
author | nebkat <nebkat@teamhacksung.org> | 2011-12-30 18:58:41 +0000 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-08-13 14:23:50 +0100 |
commit | 634cf792741753dc5d8a91972bdac30b29cc404e (patch) | |
tree | 1a0f8a0c2c47380ef46665c0980151b2f0bc596d /src | |
parent | 652dd873e6744ea19d3bb2593e683ca68367e8e8 (diff) | |
download | android_packages_apps_Trebuchet-634cf792741753dc5d8a91972bdac30b29cc404e.tar.gz android_packages_apps_Trebuchet-634cf792741753dc5d8a91972bdac30b29cc404e.tar.bz2 android_packages_apps_Trebuchet-634cf792741753dc5d8a91972bdac30b29cc404e.zip |
AppsCustomize: Apps Sort Mode Cling
Change-Id: I07a08afb1f249f226693e935ad7ebc017f9c79b0
Diffstat (limited to 'src')
-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 e114558ec..ad87822dd 100644 --- a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java +++ b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java @@ -276,6 +276,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // Cling private boolean mHasShownAllAppsCling; + private boolean mHasShownAllAppsSortCling; private int mClingFocusedX; private int mClingFocusedY; @@ -571,6 +572,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } void showAllAppsCling() { + Cling allAppsCling = (Cling) getTabHost().findViewById(R.id.all_apps_cling); if (!mHasShownAllAppsCling && isDataReady()) { mHasShownAllAppsCling = true; // Calculate the position for the cling punch through @@ -582,6 +584,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen offset[0]; pos[1] += offset[1]; mLauncher.showFirstRunAllAppsCling(pos); + } else if (!mHasShownAllAppsSortCling && isDataReady() && + 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 41704a5ba..0913db5ce 100644 --- a/src/com/cyanogenmod/trebuchet/Cling.java +++ b/src/com/cyanogenmod/trebuchet/Cling.java @@ -40,6 +40,7 @@ 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"; @@ -51,9 +52,12 @@ public class Cling extends FrameLayout { private static String ALLAPPS_LANDSCAPE = "all_apps_landscape"; private static String ALLAPPS_LARGE = "all_apps_large"; + 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 FOLDER_LARGE = "folder_large"; + private static String ALLAPPS_SORT_LARGE = "all_apps_sort_large"; private Launcher mLauncher; private boolean mIsInitialized; @@ -66,6 +70,7 @@ public class Cling extends FrameLayout { private int mButtonBarHeight; private float mRevealRadius; private int[] mPositionData; + private boolean mDismissed; private Paint mErasePaint; @@ -89,6 +94,7 @@ public class Cling extends FrameLayout { if (!mIsInitialized) { mLauncher = l; mPositionData = positionData; + mDismissed = false; Resources r = getContext().getResources(); @@ -108,6 +114,14 @@ public class Cling extends FrameLayout { } } + void dismiss() { + mDismissed = true; + } + + boolean isDismissed() { + return mDismissed; + } + void cleanup() { mBackground = null; mPunchThroughGraphic = null; @@ -124,6 +138,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); @@ -173,7 +191,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[] positions = getPunchThroughPositions(); for (int i = 0; i < positions.length; i += 2) { diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index 806a0e68c..1da5150a6 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -1949,6 +1949,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) { @@ -3656,6 +3657,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() { @@ -3718,6 +3720,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 if (isClingsEnabled() && @@ -3743,6 +3755,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); |