summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout-xlarge-land/all_apps_tabbed.xml1
-rw-r--r--res/layout-xlarge-port/all_apps_tabbed.xml1
-rw-r--r--res/values-xlarge/config.xml4
-rw-r--r--src/com/android/launcher2/AllAppsTabbed.java30
-rw-r--r--src/com/android/launcher2/CustomizeTrayTabHost.java41
-rw-r--r--src/com/android/launcher2/Launcher.java27
-rw-r--r--src/com/android/launcher2/Workspace.java7
7 files changed, 96 insertions, 15 deletions
diff --git a/res/layout-xlarge-land/all_apps_tabbed.xml b/res/layout-xlarge-land/all_apps_tabbed.xml
index 166bec24d..39c966b0c 100644
--- a/res/layout-xlarge-land/all_apps_tabbed.xml
+++ b/res/layout-xlarge-land/all_apps_tabbed.xml
@@ -21,6 +21,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
+ android:id="@+id/all_apps_tab_bar"
android:layout_width="952dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
diff --git a/res/layout-xlarge-port/all_apps_tabbed.xml b/res/layout-xlarge-port/all_apps_tabbed.xml
index 115bdbe94..7673984b3 100644
--- a/res/layout-xlarge-port/all_apps_tabbed.xml
+++ b/res/layout-xlarge-port/all_apps_tabbed.xml
@@ -21,6 +21,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
+ android:id="@+id/all_apps_tab_bar"
android:layout_width="700dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml
index 900fbba15..90d8dc4d1 100644
--- a/res/values-xlarge/config.xml
+++ b/res/values-xlarge/config.xml
@@ -9,7 +9,7 @@
<!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
- <integer name="config_allAppsZoomInTime">1450</integer>
+ <integer name="config_allAppsZoomInTime">1211</integer>
<!-- Duration in milliseconds of the transition between tabs in the all apps/customize
tray -->
@@ -37,7 +37,7 @@
NOTE: If these are changed, the toolbar animation times below should also be. -->
<integer name="config_allAppsFadeOutTime">500</integer>
<integer name="config_customizeWorkspaceShrinkTime">800</integer>
- <integer name="config_allAppsWorkspaceShrinkTime">1450</integer>
+ <integer name="config_allAppsWorkspaceShrinkTime">1211</integer>
<integer name="config_workspaceUnshrinkTime">650</integer>
<!-- Duration in milliseconds toolbar fade in and fade out animations.
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index 47a5bf7fc..36594dd34 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -29,16 +29,19 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.TabHost;
import android.widget.TabWidget;
import android.widget.TextView;
+import android.widget.TabHost.OnTabChangeListener;
+import android.widget.TabHost.TabContentFactory;
import java.util.ArrayList;
/**
* Implements a tabbed version of AllApps2D.
*/
-public class AllAppsTabbed extends TabHost implements AllAppsView {
+public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherAnimatable {
private static final String TAG = "Launcher.AllAppsTabbed";
@@ -46,6 +49,7 @@ public class AllAppsTabbed extends TabHost implements AllAppsView {
private static final String TAG_DOWNLOADED = "DOWNLOADED";
private AllAppsPagedView mAllApps;
+ private View mTabBar;
private Context mContext;
private final LayoutInflater mInflater;
private boolean mFirstLayout = true;
@@ -64,6 +68,8 @@ public class AllAppsTabbed extends TabHost implements AllAppsView {
try {
mAllApps = (AllAppsPagedView) findViewById(R.id.all_apps_paged_view);
if (mAllApps == null) throw new Resources.NotFoundException();
+ mTabBar = findViewById(R.id.all_apps_tab_bar);
+ if (mTabBar == null) throw new Resources.NotFoundException();
} catch (Resources.NotFoundException e) {
Log.e(TAG, "Can't find necessary layout elements for AllAppsTabbed");
}
@@ -164,6 +170,28 @@ public class AllAppsTabbed extends TabHost implements AllAppsView {
}
@Override
+ public void setFastAlpha(float alpha) {
+ final ViewGroup allAppsParent = (ViewGroup) mAllApps.getParent();
+ final ViewGroup tabBarParent = (ViewGroup) mAllApps.getParent();
+ mAllApps.setFastAlpha(alpha);
+ allAppsParent.fastInvalidate();
+ mTabBar.setFastAlpha(alpha);
+ tabBarParent.fastInvalidate();
+ }
+
+ @Override
+ public void onLauncherAnimationStart() {
+ mTabBar.setLayerType(LAYER_TYPE_HARDWARE, null);
+ mAllApps.setLayerType(LAYER_TYPE_HARDWARE, null);
+ }
+
+ @Override
+ public void onLauncherAnimationEnd() {
+ mTabBar.setLayerType(LAYER_TYPE_NONE, null);
+ mAllApps.setLayerType(LAYER_TYPE_NONE, null);
+ }
+
+ @Override
public void setApps(ArrayList<ApplicationInfo> list) {
mAllApps.setApps(list);
}
diff --git a/src/com/android/launcher2/CustomizeTrayTabHost.java b/src/com/android/launcher2/CustomizeTrayTabHost.java
new file mode 100644
index 000000000..502917211
--- /dev/null
+++ b/src/com/android/launcher2/CustomizeTrayTabHost.java
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+package com.android.launcher2;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.TabHost;
+
+public class CustomizeTrayTabHost extends TabHost implements LauncherAnimatable {
+ public CustomizeTrayTabHost(Context context) {
+ super(context);
+ }
+
+ public CustomizeTrayTabHost(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void onLauncherAnimationStart() {
+ setLayerType(LAYER_TYPE_HARDWARE, null);
+ }
+
+ @Override
+ public void onLauncherAnimationEnd() {
+ setLayerType(LAYER_TYPE_NONE, null);
+ }
+}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 039e76bae..63982ba30 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2767,7 +2767,7 @@ public final class Launcher extends Activity
});
if (toAllApps) {
- toView.setAlpha(0f);
+ toView.setFastAlpha(0f);
ValueAnimator alphaAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f));
alphaAnim.addUpdateListener(new AnimatorUpdateListener() {
@@ -2781,9 +2781,8 @@ public final class Launcher extends Activity
alphaAnim.start();
}
- // Only use hardware layers in portrait mode, they don't give any gains in landscape
- if (mWorkspace.getWidth() < mWorkspace.getHeight()) {
- toView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ if (toView instanceof LauncherAnimatable) {
+ ((LauncherAnimatable) toView).onLauncherAnimationStart();
}
scaleAnim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -2793,7 +2792,7 @@ public final class Launcher extends Activity
toView.setTranslationY(0.0f);
toView.setVisibility(View.VISIBLE);
if (!toAllApps) {
- toView.setAlpha(1.0f);
+ toView.setFastAlpha(1.0f);
}
}
@Override
@@ -2801,9 +2800,11 @@ public final class Launcher extends Activity
// If we don't set the final scale values here, if this animation is cancelled
// it will have the wrong scale value and subsequent cameraPan animations will
// not fix that
- toView.setLayerType(View.LAYER_TYPE_NONE, null);
toView.setScaleX(1.0f);
toView.setScaleY(1.0f);
+ if (toView instanceof LauncherAnimatable) {
+ ((LauncherAnimatable) toView).onLauncherAnimationEnd();
+ }
}
});
@@ -2895,13 +2896,16 @@ public final class Launcher extends Activity
fromView.setFastAlpha(a * 1f + b * 0f);
}
});
-
- fromView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ if (fromView instanceof LauncherAnimatable) {
+ ((LauncherAnimatable) fromView).onLauncherAnimationStart();
+ }
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
fromView.setVisibility(View.GONE);
- fromView.setLayerType(View.LAYER_TYPE_NONE, null);
+ if (fromView instanceof LauncherAnimatable) {
+ ((LauncherAnimatable) fromView).onLauncherAnimationEnd();
+ }
}
});
@@ -3714,3 +3718,8 @@ public final class Launcher extends Activity
Log.d(TAG, "END launcher2 dump state");
}
}
+
+interface LauncherAnimatable {
+ void onLauncherAnimationStart();
+ void onLauncherAnimationEnd();
+}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 40dc98dc4..b1dd08807 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -792,7 +792,7 @@ public class Workspace extends SmoothPagedView
}
}
if (keepUpdating) {
- invalidate();
+ fastInvalidate();
}
}
@@ -1167,8 +1167,9 @@ public class Workspace extends SmoothPagedView
final long drawingTime = getDrawingTime();
for (int i = 0; i < pageCount; i++) {
final View page = (View) getChildAt(i);
-
- drawChild(canvas, page, drawingTime);
+ if (page.getVisibility() == VISIBLE && page.getAlpha() != 0f) {
+ drawChild(canvas, page, drawingTime);
+ }
}
} else {
super.dispatchDraw(canvas);