diff options
-rw-r--r-- | proguard.flags | 1 | ||||
-rw-r--r-- | res/layout-land/all_apps_sort_cling.xml | 48 | ||||
-rw-r--r-- | res/layout-port/all_apps_sort_cling.xml | 48 | ||||
-rw-r--r-- | res/layout-sw600dp/all_apps_sort_cling.xml | 46 | ||||
-rw-r--r-- | res/layout/apps_customize_pane.xml | 6 | ||||
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-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 |
9 files changed, 197 insertions, 1 deletions
diff --git a/proguard.flags b/proguard.flags index 4a27915..903cf4a 100644 --- a/proguard.flags +++ b/proguard.flags @@ -9,6 +9,7 @@ public void onClickAppMarketButton(android.view.View); public void dismissWorkspaceCling(android.view.View); public void dismissAllAppsCling(android.view.View); + public void dismissAllAppsSortCling(android.view.View); } -keep class com.cyanogenmod.trebuchet.CellLayout { diff --git a/res/layout-land/all_apps_sort_cling.xml b/res/layout-land/all_apps_sort_cling.xml new file mode 100644 index 0000000..6076a59 --- /dev/null +++ b/res/layout-land/all_apps_sort_cling.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<com.cyanogenmod.trebuchet.Cling + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" + launcher:drawIdentifier="all_apps_sort_landscape"> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginLeft="60dp" + android:layout_marginTop="50dp"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + <TextView + style="@style/ClingTitleText" + android:id="@+id/all_apps_sort_cling_title" + android:text="@string/all_apps_sort_cling_title" /> + <TextView + style="@style/ClingText" + android:id="@+id/all_apps_sort_cling_add_item" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/all_apps_sort_cling_add_item" /> + </LinearLayout> + </FrameLayout> + <Button + style="@style/ClingButton" + android:id="@+id/cling_dismiss" + android:layout_marginBottom="15dp" + android:layout_marginRight="10dp" + android:layout_gravity="bottom|right" + android:onClick="dismissAllAppsSortCling" /> +</com.cyanogenmod.trebuchet.Cling> diff --git a/res/layout-port/all_apps_sort_cling.xml b/res/layout-port/all_apps_sort_cling.xml new file mode 100644 index 0000000..b53e825 --- /dev/null +++ b/res/layout-port/all_apps_sort_cling.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<com.cyanogenmod.trebuchet.Cling + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" + launcher:drawIdentifier="all_apps_sort_portrait"> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginLeft="30dp" + android:layout_marginTop="100dp"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + <TextView + style="@style/ClingTitleText" + android:id="@+id/all_apps_sort_cling_title" + android:text="@string/all_apps_sort_cling_title" /> + <TextView + style="@style/ClingText" + android:id="@+id/all_apps_sort_cling_add_item" + android:layout_width="285dp" + android:layout_height="wrap_content" + android:text="@string/all_apps_sort_cling_add_item" /> + </LinearLayout> + </FrameLayout> + <Button + style="@style/ClingButton" + android:id="@+id/cling_dismiss" + android:layout_marginBottom="15dp" + android:layout_marginRight="10dp" + android:layout_gravity="bottom|right" + android:onClick="dismissAllAppsSortCling" /> +</com.cyanogenmod.trebuchet.Cling> diff --git a/res/layout-sw600dp/all_apps_sort_cling.xml b/res/layout-sw600dp/all_apps_sort_cling.xml new file mode 100644 index 0000000..365432b --- /dev/null +++ b/res/layout-sw600dp/all_apps_sort_cling.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<com.cyanogenmod.trebuchet.Cling + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" + launcher:drawIdentifier="all_apps_sort_large"> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginLeft="@dimen/cling_text_block_offset_x" + android:layout_marginTop="@dimen/cling_text_block_offset_y"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + <TextView + style="@style/ClingTitleText" + android:id="@+id/all_apps_sort_cling_title" + android:text="@string/all_apps_sort_cling_title" /> + <TextView + style="@style/ClingText" + android:id="@+id/all_apps_sort_cling_add_item" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/all_apps_sort_cling_add_item" /> + <Button + style="@style/ClingButton" + android:id="@+id/cling_dismiss" + android:layout_marginTop="15dp" + android:onClick="dismissAllAppsSortCling" /> + </LinearLayout> + </FrameLayout> +</com.cyanogenmod.trebuchet.Cling> diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml index f41cd34..1b338ac 100644 --- a/res/layout/apps_customize_pane.xml +++ b/res/layout/apps_customize_pane.xml @@ -90,4 +90,10 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" /> + + <include layout="@layout/all_apps_sort_cling" + android:id="@+id/all_apps_sort_cling" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="gone" /> </com.cyanogenmod.trebuchet.AppsCustomizeTabHost> diff --git a/res/values/strings.xml b/res/values/strings.xml index 3b47b80..94419f4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -247,6 +247,10 @@ s --> <string name="all_apps_cling_title">Choose some apps</string> <!-- The description of how to pick up and add an item to the workspace [CHAR_LIMIT=none] --> <string name="all_apps_cling_add_item">To add an app to your Home screen, touch & hold it.</string> + <!-- The title text for the All Apps Sort cling [CHAR_LIMIT=none] --> + <string name="all_apps_sort_cling_title">Sort your apps</string> + <!-- The description of how to pick sort apps in the drawer [CHAR_LIMIT=none] --> + <string name="all_apps_sort_cling_add_item">Touch & hold the Apps tab to select your sort mode</string> <!-- The title text for the Folder cling [CHAR_LIMIT=none] --> <string name="folder_cling_title">Organize your apps with folders</string> <!-- The description of how to move an app [CHAR_LIMIT=none] --> diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java index e114558..ad87822 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 41704a5..0913db5 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 806a0e6..1da5150 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); |