summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2011-12-30 18:58:41 +0000
committernebkat <nebkat@teamhacksung.org>2011-12-31 10:15:28 +0000
commit991185b60879af6f84736918f8616e28a67eeeac (patch)
tree61c03e72e59fad84c88948629a77af08d20693f9
parent291324116b7ac4d4348643d93e432c20768125ea (diff)
downloadandroid_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
-rw-r--r--proguard.flags1
-rw-r--r--res/layout-land/all_apps_sort_cling.xml48
-rw-r--r--res/layout-port/all_apps_sort_cling.xml48
-rw-r--r--res/layout-sw600dp/all_apps_sort_cling.xml46
-rw-r--r--res/layout/apps_customize_pane.xml6
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java6
-rw-r--r--src/com/cyanogenmod/trebuchet/Cling.java23
-rw-r--r--src/com/cyanogenmod/trebuchet/Launcher.java16
9 files changed, 197 insertions, 1 deletions
diff --git a/proguard.flags b/proguard.flags
index 04fca06bd..06fa84684 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -10,6 +10,7 @@
public void onClickOverflowMenuButton(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 000000000..6076a59a5
--- /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 000000000..b53e82589
--- /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 000000000..365432b57
--- /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 272ed2896..80d372fc1 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -96,4 +96,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 f8ed8476c..19a08435c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -241,6 +241,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 &amp; 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 &amp; 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 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);