Merge "workspace bug fixes"

This commit is contained in:
Michael Jurka
2010-08-10 14:18:43 -07:00
committed by Android (Google) Code Review
4 changed files with 62 additions and 31 deletions
+10 -11
View File
@@ -69,6 +69,16 @@
android:onClick="onClickConfigureButton"
android:focusable="true"
android:clickable="true" />
<com.android.launcher2.DeleteZone
android:id="@+id/delete_zone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/delete_zone_padding"
android:scaleType="center"
android:src="@drawable/delete_zone_selector"
android:visibility="gone"
launcher:direction="horizontal" />
<ImageView
android:id="@+id/all_apps_button"
android:layout_width="wrap_content"
@@ -79,17 +89,6 @@
android:onClick="onClickAllAppsButton"
android:focusable="true"
android:clickable="true" />
<com.android.launcher2.DeleteZone
android:id="@+id/delete_zone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/delete_zone_padding"
android:layout_toRightOf="@id/configure_button"
android:scaleType="center"
android:src="@drawable/delete_zone_selector"
android:visibility="gone"
launcher:direction="horizontal" />
</RelativeLayout>
<TabHost
+3
View File
@@ -24,4 +24,7 @@
<!-- vertical spacing between edge of screen and mini screen thumbnails -->
<dimen name="smallScreenVerticalMargin">20dip</dimen>
<!-- padding above the delete zone -->
<dimen name="delete_zone_padding">6dip</dimen>
</resources>
+9 -2
View File
@@ -1038,9 +1038,15 @@ public final class Launcher extends Activity
!= Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
boolean allAppsVisible = isAllAppsVisible();
// TODO: Figure out the right thing to do in XLarge mode here
// in all these cases, only animate if we're already on home
if (LauncherApplication.isScreenXLarge()) {
mWorkspace.unshrink(alreadyOnHome);
}
if (!mWorkspace.isDefaultScreenShowing()) {
mWorkspace.moveToDefaultScreen(alreadyOnHome && !allAppsVisible);
// on the phone, we don't animate the change to the workspace if all apps is visible
// on xlarge screens, however, we want an animated transition
mWorkspace.moveToDefaultScreen(alreadyOnHome &&
(LauncherApplication.isScreenXLarge() || !allAppsVisible));
}
closeAllApps(alreadyOnHome && allAppsVisible);
hideCustomizationDrawer();
@@ -2409,6 +2415,7 @@ public final class Launcher extends Activity
animate = false;
}
closeAllApps(animate);
mWorkspace.unshrink(animate);
}
}
}
+40 -18
View File
@@ -1149,15 +1149,21 @@ public class Workspace extends ViewGroup
// We call this when we trigger an unshrink by clicking on the CellLayout cl
private void unshrink(CellLayout clThatWasClicked) {
if (mIsSmall) {
int newCurrentScreen = mCurrentScreen;
final int screenCount = getChildCount();
for (int i = 0; i < screenCount; i++) {
if (getChildAt(i) == clThatWasClicked) {
newCurrentScreen = i;
}
int newCurrentScreen = mCurrentScreen;
final int screenCount = getChildCount();
for (int i = 0; i < screenCount; i++) {
if (getChildAt(i) == clThatWasClicked) {
newCurrentScreen = i;
}
final int delta = (newCurrentScreen - mCurrentScreen)*getWidth();
}
unshrink(newCurrentScreen);
}
private void unshrink(int newCurrentScreen) {
if (mIsSmall) {
int delta = (newCurrentScreen - mCurrentScreen)*getWidth();
final int screenCount = getChildCount();
for (int i = 0; i < screenCount; i++) {
CellLayout cl = (CellLayout) getChildAt(i);
cl.setX(cl.getX() + delta);
@@ -1169,20 +1175,32 @@ public class Workspace extends ViewGroup
}
}
public void unshrink() {
void unshrink() {
unshrink(true);
}
void unshrink(boolean animated) {
if (mIsSmall) {
Sequencer s = new Sequencer();
final int screenCount = getChildCount();
final int duration = getResources().getInteger(R.integer.config_workspaceUnshrinkTime);
for (int i = 0; i < screenCount; i++) {
final CellLayout cl = (CellLayout)getChildAt(i);
final int duration =
getResources().getInteger(R.integer.config_workspaceUnshrinkTime);
s.playTogether(
new PropertyAnimator(duration, cl, "translationX", 0.0f),
new PropertyAnimator(duration, cl, "translationY", 0.0f),
new PropertyAnimator(duration, cl, "scaleX", 1.0f),
new PropertyAnimator(duration, cl, "scaleY", 1.0f),
new PropertyAnimator(duration, cl, "dimmedBitmapAlpha", 0.0f));
if (animated) {
s.playTogether(
new PropertyAnimator(duration, cl, "translationX", 0.0f),
new PropertyAnimator(duration, cl, "translationY", 0.0f),
new PropertyAnimator(duration, cl, "scaleX", 1.0f),
new PropertyAnimator(duration, cl, "scaleY", 1.0f),
new PropertyAnimator(duration, cl, "dimmedBitmapAlpha", 0.0f));
} else {
cl.setTranslationX(0.0f);
cl.setTranslationY(0.0f);
cl.setScaleX(1.0f);
cl.setScaleY(1.0f);
cl.setDimmedBitmapAlpha(0.0f);
}
}
s.addListener(mUnshrinkAnimationListener);
s.start();
@@ -1830,7 +1848,11 @@ public class Workspace extends ViewGroup
void moveToDefaultScreen(boolean animate) {
if (animate) {
snapToScreen(mDefaultScreen);
if (mIsSmall) {
unshrink(mDefaultScreen);
} else {
snapToScreen(mDefaultScreen);
}
} else {
setCurrentScreen(mDefaultScreen);
}