summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNebojsa Cvetkovic <nebkat@gmail.com>2013-11-25 16:58:53 (GMT)
committerRajesh Yengisetty <rajesh@cyngn.com>2014-12-23 19:39:52 (GMT)
commitaed08787684b6351082c3a1bfbec2c54d365ee2b (patch)
tree83a77a98e9c87cce33e7d75f76028174726c392c
parent0b7b1db20f738fc93b423883e42ad166904b90f6 (diff)
downloadandroid_packages_apps_Trebuchet-aed08787684b6351082c3a1bfbec2c54d365ee2b.zip
android_packages_apps_Trebuchet-aed08787684b6351082c3a1bfbec2c54d365ee2b.tar.gz
android_packages_apps_Trebuchet-aed08787684b6351082c3a1bfbec2c54d365ee2b.tar.bz2
Workspace: Custom default screen
Change-Id: Ic90254f7758b9dbd4997a19474e455230355b772
-rw-r--r--res/drawable/default_screen_button.xml22
-rw-r--r--res/layout/overview_panel.xml2
-rw-r--r--res/values/cm_strings.xml3
-rw-r--r--src/com/android/launcher3/OverviewSettingsPanel.java4
-rw-r--r--src/com/android/launcher3/Workspace.java17
5 files changed, 40 insertions, 8 deletions
diff --git a/res/drawable/default_screen_button.xml b/res/drawable/default_screen_button.xml
new file mode 100644
index 0000000..5194ad8
--- /dev/null
+++ b/res/drawable/default_screen_button.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_focused="true" android:drawable="@drawable/ic_default_screen_pressed" />
+ <item android:state_pressed="true" android:drawable="@drawable/ic_default_screen_pressed" />
+ <item android:state_activated="true" android:drawable="@drawable/ic_default_screen_pressed" />
+ <item android:drawable="@drawable/ic_default_screen" />
+</selector>
diff --git a/res/layout/overview_panel.xml b/res/layout/overview_panel.xml
index 8fed477..9b0bb77 100644
--- a/res/layout/overview_panel.xml
+++ b/res/layout/overview_panel.xml
@@ -36,7 +36,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/app_icon_size"
android:layout_weight="1"
- android:src="@drawable/ic_default_screen"
+ android:src="@drawable/default_screen_button"
android:scaleType="fitCenter"
android:gravity="top"
android:paddingLeft="@dimen/overview_panel_button_spacing"
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index f724a5f..a39dca1 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -30,6 +30,9 @@
<string name="wallpaper_scroll">Scroll wallpaper</string>
+ <!-- Text for default screen button -->
+ <string name="default_screen_button_text">Default Screen</string>
+
<!-- Settings -->
<string name="preferences_title">Settings</string>
<!-- Application -->
diff --git a/src/com/android/launcher3/OverviewSettingsPanel.java b/src/com/android/launcher3/OverviewSettingsPanel.java
index 5f0c15e..2403d23 100644
--- a/src/com/android/launcher3/OverviewSettingsPanel.java
+++ b/src/com/android/launcher3/OverviewSettingsPanel.java
@@ -124,7 +124,9 @@ public class OverviewSettingsPanel {
defaultScreenButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
- mLauncher.getWorkspace().onClickDefaultScreenButton();
+ if (!mLauncher.getWorkspace().isSwitchingState()) {
+ mLauncher.getWorkspace().onClickDefaultScreenButton();
+ }
}
});
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 9d1aac2..97577a1 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -638,9 +638,6 @@ public class Workspace extends SmoothPagedView
addFullScreenPage(customScreen);
- // Ensure that the current page and default page are maintained.
- mDefaultPage = mOriginalDefaultPage + 1;
-
// Update the custom content hint
if (mRestorePage != INVALID_RESTORE_PAGE) {
mRestorePage = mRestorePage + 1;
@@ -666,9 +663,6 @@ public class Workspace extends SmoothPagedView
mCustomContentCallbacks = null;
- // Ensure that the current page and default page are maintained.
- mDefaultPage = mOriginalDefaultPage - 1;
-
// Update the custom content hint
if (mRestorePage != INVALID_RESTORE_PAGE) {
mRestorePage = mRestorePage - 1;
@@ -2134,6 +2128,10 @@ public class Workspace extends SmoothPagedView
showOutlines();
// Reordering handles its own animations, disable the automatic ones.
disableLayoutTransitions();
+
+ mLauncher.getOverviewPanel().animate()
+ .alpha(0f)
+ .start();
}
protected void onEndReordering() {
@@ -2156,6 +2154,13 @@ public class Workspace extends SmoothPagedView
// Re-enable auto layout transitions for page deletion.
enableLayoutTransitions();
+
+ // Show the default screen button
+ updateDefaultScreenButton();
+
+ mLauncher.getOverviewPanel().animate()
+ .alpha(1f)
+ .start();
}
public boolean isInOverviewMode() {