diff options
| author | Michael Jurka <mikejurka@google.com> | 2010-12-20 16:06:10 -0800 |
|---|---|---|
| committer | Michael Jurka <mikejurka@google.com> | 2010-12-20 16:53:26 -0800 |
| commit | b8e14479da7209ca811a753b3256fe4a0b49a873 (patch) | |
| tree | 022bdba062825d1b115b984789fd9146e76dad78 /src | |
| parent | bb6e05bca62d399c5c81a7f57d5b167fce207fee (diff) | |
| download | packages_apps_trebuchet-b8e14479da7209ca811a753b3256fe4a0b49a873.zip packages_apps_trebuchet-b8e14479da7209ca811a753b3256fe4a0b49a873.tar.gz packages_apps_trebuchet-b8e14479da7209ca811a753b3256fe4a0b49a873.tar.bz2 | |
Don't show application info icon on workspace
Change-Id: I79e59211633609f4bd13e91a6c745ff28a309e2e
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/launcher2/AllAppsPagedView.java | 20 | ||||
| -rw-r--r-- | src/com/android/launcher2/ApplicationInfoDropTarget.java | 63 | ||||
| -rw-r--r-- | src/com/android/launcher2/DeleteZone.java | 12 | ||||
| -rw-r--r-- | src/com/android/launcher2/IconDropTarget.java | 16 | ||||
| -rw-r--r-- | src/com/android/launcher2/Launcher.java | 26 | ||||
| -rw-r--r-- | src/com/android/launcher2/Workspace.java | 2 |
6 files changed, 63 insertions, 76 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java index dccc03d..5b98a15 100644 --- a/src/com/android/launcher2/AllAppsPagedView.java +++ b/src/com/android/launcher2/AllAppsPagedView.java @@ -205,18 +205,16 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All private void setupDragMode() { mLauncher.getWorkspace().shrink(Workspace.ShrinkState.BOTTOM_VISIBLE); - ApplicationInfoDropTarget infoButton = - (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button); - infoButton.setDragAndDropEnabled(false); DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone); deleteZone.setDragAndDropEnabled(false); - ApplicationInfoDropTarget allAppsInfoButton = - (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target); - allAppsInfoButton.setDragAndDropEnabled(true); DeleteZone allAppsDeleteZone = (DeleteZone) mLauncher.findViewById(R.id.all_apps_delete_zone); allAppsDeleteZone.setDragAndDropEnabled(true); + + ApplicationInfoDropTarget allAppsInfoButton = + (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target); + allAppsInfoButton.setDragAndDropEnabled(true); } private void tearDownDragMode() { @@ -225,18 +223,16 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All // deleteZone and the appInfoButton in all apps, and re-enable the instance which // live in the workspace public void run() { - ApplicationInfoDropTarget infoButton = - (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button); - infoButton.setDragAndDropEnabled(true); DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone); deleteZone.setDragAndDropEnabled(true); - ApplicationInfoDropTarget allAppsInfoButton = - (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target); - allAppsInfoButton.setDragAndDropEnabled(false); DeleteZone allAppsDeleteZone = (DeleteZone) mLauncher.findViewById(R.id.all_apps_delete_zone); allAppsDeleteZone.setDragAndDropEnabled(false); + + ApplicationInfoDropTarget allAppsInfoButton = + (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target); + allAppsInfoButton.setDragAndDropEnabled(false); } }); resetCheckedGrandchildren(); diff --git a/src/com/android/launcher2/ApplicationInfoDropTarget.java b/src/com/android/launcher2/ApplicationInfoDropTarget.java index 7c81c1a..9d421c6 100644 --- a/src/com/android/launcher2/ApplicationInfoDropTarget.java +++ b/src/com/android/launcher2/ApplicationInfoDropTarget.java @@ -39,8 +39,6 @@ public class ApplicationInfoDropTarget extends IconDropTarget { private static final int sFadeOutAnimationDuration = 100; private AnimatorSet mFadeAnimator; - private ObjectAnimator mHandleFadeAnimator; - private boolean mHandleWasVisibleOnDragStart; public ApplicationInfoDropTarget(Context context, AttributeSet attrs) { this(context, attrs, 0); @@ -62,7 +60,6 @@ public class ApplicationInfoDropTarget extends IconDropTarget { public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset, DragView dragView, Object dragInfo) { - // acceptDrop is called just before onDrop. We do the work here, rather than // in onDrop, because it allows us to reject the drop (by returning false) // so that the object being dragged isn't removed from the home screen. @@ -101,25 +98,18 @@ public class ApplicationInfoDropTarget extends IconDropTarget { Animator infoButtonAnimator = ObjectAnimator.ofFloat(this, "alpha", 0.0f, 1.0f); infoButtonAnimator.setDuration(sFadeInAnimationDuration); - if (mHandle == mLauncher.findViewById(R.id.configure_button)) { - final View divider = mLauncher.findViewById(R.id.divider_during_drag); - divider.setVisibility(VISIBLE); - Animator dividerAnimator = ObjectAnimator.ofFloat(divider, "alpha", 1.0f); - dividerAnimator.setDuration(sFadeInAnimationDuration); - mFadeAnimator.play(infoButtonAnimator).with(dividerAnimator); - } else { - mFadeAnimator.play(infoButtonAnimator); - } - mFadeAnimator.start(); + mFadeAnimator.play(infoButtonAnimator); + setVisibility(VISIBLE); - // Fade out the handle - if (mHandle != null) { - mHandleWasVisibleOnDragStart = mHandle.getVisibility() == VISIBLE; - if (mHandleFadeAnimator != null) mHandleFadeAnimator.cancel(); - mHandleFadeAnimator = ObjectAnimator.ofFloat(mHandle, "alpha", 0.0f); - mHandleFadeAnimator.setDuration(sFadeOutAnimationDuration); - mHandleFadeAnimator.addListener(new AnimatorListener() { + // Fade out the overlapping views + if (mOverlappingViews != null) { + for (View view : mOverlappingViews) { + ObjectAnimator oa = ObjectAnimator.ofFloat(view, "alpha", 0.0f); + oa.setDuration(sFadeOutAnimationDuration); + mFadeAnimator.play(oa); + } + mFadeAnimator.addListener(new AnimatorListener() { public void onAnimationStart(Animator animation) {} public void onAnimationRepeat(Animator animation) {} public void onAnimationEnd(Animator animation) { @@ -129,12 +119,14 @@ public class ApplicationInfoDropTarget extends IconDropTarget { onEndOrCancel(); } private void onEndOrCancel() { - mHandle.setVisibility(INVISIBLE); - mHandleFadeAnimator = null; + for (View view : mOverlappingViews) { + view.setVisibility(INVISIBLE); + } + mFadeAnimator = null; } }); - mHandleFadeAnimator.start(); } + mFadeAnimator.start(); } } } @@ -148,9 +140,6 @@ public class ApplicationInfoDropTarget extends IconDropTarget { mFadeAnimator = new AnimatorSet(); Animator infoButtonAnimator = ObjectAnimator.ofFloat(this, "alpha", 0.0f); infoButtonAnimator.setDuration(sFadeOutAnimationDuration); - final View divider = mLauncher.findViewById(R.id.divider_during_drag); - divider.setVisibility(VISIBLE); - Animator dividerAnimator = ObjectAnimator.ofFloat(divider, "alpha", 0.0f); mFadeAnimator.addListener(new AnimatorListener() { public void onAnimationStart(Animator animation) {} public void onAnimationRepeat(Animator animation) {} @@ -162,20 +151,20 @@ public class ApplicationInfoDropTarget extends IconDropTarget { } private void onEndOrCancel() { setVisibility(GONE); - divider.setVisibility(GONE); mFadeAnimator = null; } }); - mFadeAnimator.play(infoButtonAnimator).with(dividerAnimator); - mFadeAnimator.start(); - - // Fade in the handle - if (mHandle != null && mHandleWasVisibleOnDragStart) { - if (mHandleFadeAnimator != null) mHandleFadeAnimator.cancel(); - mHandleFadeAnimator = ObjectAnimator.ofFloat(mHandle, "alpha", 1.0f); - mHandleFadeAnimator.setDuration(sFadeInAnimationDuration); - mHandleFadeAnimator.start(); - mHandle.setVisibility(VISIBLE); + mFadeAnimator.play(infoButtonAnimator); + + // Fade in the overlapping views + if (mOverlappingViews != null) { + for (View view : mOverlappingViews) { + ObjectAnimator oa = ObjectAnimator.ofFloat(view, "alpha", 1.0f); + oa.setDuration(sFadeInAnimationDuration); + mFadeAnimator.play(oa); + view.setVisibility(VISIBLE); + } } + mFadeAnimator.start(); } } diff --git a/src/com/android/launcher2/DeleteZone.java b/src/com/android/launcher2/DeleteZone.java index 773bc6b..16061d3 100644 --- a/src/com/android/launcher2/DeleteZone.java +++ b/src/com/android/launcher2/DeleteZone.java @@ -166,8 +166,10 @@ public class DeleteZone extends IconDropTarget { createAnimations(); startAnimation(mInAnimation); - if (mHandle != null) { - mHandle.startAnimation(mHandleOutAnimation); + if (mOverlappingViews != null) { + for (View view : mOverlappingViews) { + view.startAnimation(mHandleOutAnimation); + } } setVisibility(VISIBLE); } @@ -179,8 +181,10 @@ public class DeleteZone extends IconDropTarget { mDragController.setDeleteRegion(null); if (mOutAnimation != null) startAnimation(mOutAnimation); - if (mHandleInAnimation != null && mHandle != null) { - mHandle.startAnimation(mHandleInAnimation); + if (mHandleInAnimation != null && mOverlappingViews != null) { + for (View view : mOverlappingViews) { + view.startAnimation(mHandleInAnimation); + } } setVisibility(GONE); } diff --git a/src/com/android/launcher2/IconDropTarget.java b/src/com/android/launcher2/IconDropTarget.java index ec08c1e..bfc46cf 100644 --- a/src/com/android/launcher2/IconDropTarget.java +++ b/src/com/android/launcher2/IconDropTarget.java @@ -35,8 +35,8 @@ public class IconDropTarget extends ImageView implements DropTarget, DragControl protected Launcher mLauncher; /** - * If true, this View responsible for managing its own visibility, and that of its handle. - * This is generally the case, but it will be set to false when this is part of the + * If true, this View responsible for managing its own visibility, and that of its overlapping + * views. This is generally the case, but it will be set to false when this is part of the * Contextual Action Bar. */ protected boolean mDragAndDropEnabled; @@ -44,8 +44,8 @@ public class IconDropTarget extends ImageView implements DropTarget, DragControl /** Whether this drop target is active for the current drag */ protected boolean mActive; - /** The view that this view should appear in the place of. */ - protected View mHandle = null; + /** The views that this view should appear in the place of. */ + protected View[] mOverlappingViews = null; /** The paint applied to the drag view on hover */ protected final Paint mHoverPaint = new Paint(); @@ -73,8 +73,12 @@ public class IconDropTarget extends ImageView implements DropTarget, DragControl mLauncher = launcher; } - void setHandle(View view) { - mHandle = view; + void setOverlappingView(View view) { + mOverlappingViews = new View[] { view }; + } + + void setOverlappingViews(View[] views) { + mOverlappingViews = views; } void setDragAndDropEnabled(boolean enabled) { diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 696380c..3c1c336 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -987,12 +987,16 @@ public final class Launcher extends Activity deleteZone.setLauncher(this); deleteZone.setDragController(dragController); int deleteZoneHandleId; + + final View allAppsButton = findViewById(R.id.all_apps_button); + final View divider = findViewById(R.id.divider); + final View configureButton = findViewById(R.id.configure_button); + if (LauncherApplication.isScreenXLarge()) { - deleteZoneHandleId = R.id.all_apps_button; + mDeleteZone.setOverlappingViews(new View[] { allAppsButton, divider, configureButton }); } else { - deleteZoneHandleId = R.id.all_apps_button_cluster; + deleteZone.setOverlappingView(configureButton); } - deleteZone.setHandle(findViewById(deleteZoneHandleId)); dragController.addDragListener(deleteZone); DeleteZone allAppsDeleteZone = (DeleteZone) findViewById(R.id.all_apps_delete_zone); @@ -1012,17 +1016,10 @@ public final class Launcher extends Activity allAppsInfoTarget.setDragAndDropEnabled(false); View marketButton = findViewById(R.id.market_button); if (marketButton != null) { - allAppsInfoTarget.setHandle(marketButton); + allAppsInfoTarget.setOverlappingView(marketButton); } } - ApplicationInfoDropTarget infoButton = (ApplicationInfoDropTarget)findViewById(R.id.info_button); - if (infoButton != null) { - infoButton.setLauncher(this); - infoButton.setHandle(findViewById(R.id.configure_button)); - dragController.addDragListener(infoButton); - } - dragController.setDragScoller(workspace); dragController.setScrollView(dragLayer); dragController.setMoveTarget(workspace); @@ -1030,9 +1027,6 @@ public final class Launcher extends Activity // The order here is bottom to top. dragController.addDropTarget(workspace); dragController.addDropTarget(deleteZone); - if (infoButton != null) { - dragController.addDropTarget(infoButton); - } if (allAppsInfoTarget != null) { dragController.addDropTarget(allAppsInfoTarget); } @@ -2600,7 +2594,7 @@ public final class Launcher extends Activity hideOrShowToolbarButton(true, allAppsButton, showSeq); hideOrShowToolbarButton(true, divider, showSeq); hideOrShowToolbarButton(true, configureButton, showSeq); - mDeleteZone.setHandle(allAppsButton); + mDeleteZone.setOverlappingViews(new View[] { allAppsButton, divider, configureButton }); break; case ALL_APPS: hideOrShowToolbarButton(false, configureButton, hideSeq); @@ -2613,7 +2607,7 @@ public final class Launcher extends Activity hideOrShowToolbarButton(false, searchButton, hideSeq); hideOrShowToolbarButton(false, divider, hideSeq); hideOrShowToolbarButton(false, configureButton, hideSeq); - mDeleteZone.setHandle(allAppsButton); + //mDeleteZone.setOverlappingView(configureButton); break; } } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index eaa09ac..a066a16 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -171,7 +171,7 @@ public class Workspace extends SmoothPagedView // in all apps or customize mode) private boolean mIsSmall = false; private boolean mIsInUnshrinkAnimation = false; - private AnimatorListener mShrinkAnimationListener, mUnshrinkAnimationListener; + private AnimatorListener mUnshrinkAnimationListener; enum ShrinkState { TOP, SPRING_LOADED, MIDDLE, BOTTOM_HIDDEN, BOTTOM_VISIBLE }; private ShrinkState mShrinkState; private boolean mWasSpringLoadedOnDragExit = false; |
