summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-06-23 14:55:18 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-23 14:55:18 -0700
commit845149a05acbe2ca629d9e4f8ef7e84128de1162 (patch)
tree1f75cca129eabbfeaa11e84084761b0cedfd9a12 /src/com
parentb44b52439d155f570db7d6d0b80fdd3350e35685 (diff)
parent74608b5dfc22811eb16a39056e9c2d1e6681306b (diff)
downloadandroid_packages_apps_Trebuchet-845149a05acbe2ca629d9e4f8ef7e84128de1162.tar.gz
android_packages_apps_Trebuchet-845149a05acbe2ca629d9e4f8ef7e84128de1162.tar.bz2
android_packages_apps_Trebuchet-845149a05acbe2ca629d9e4f8ef7e84128de1162.zip
Merge "Removing the old dot.dot.dot page indicators at the bottom."
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/ClippedImageView.java50
-rw-r--r--src/com/android/launcher2/FocusHelper.java88
-rw-r--r--src/com/android/launcher2/Launcher.java66
-rw-r--r--src/com/android/launcher2/Workspace.java21
4 files changed, 4 insertions, 221 deletions
diff --git a/src/com/android/launcher2/ClippedImageView.java b/src/com/android/launcher2/ClippedImageView.java
deleted file mode 100644
index 2c4380d88..000000000
--- a/src/com/android/launcher2/ClippedImageView.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2010 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.content.res.TypedArray;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.widget.ImageView;
-import com.android.launcher.R;
-
-public class ClippedImageView extends ImageView {
- private final int mZone;
-
- public ClippedImageView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public ClippedImageView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ClippedImageView, defStyle, 0);
-
- mZone = a.getDimensionPixelSize(R.styleable.ClippedImageView_ignoreZone, 0);
-
- a.recycle();
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- final int zone = mZone;
- return !(zone != 0 && (zone > 0 && event.getX() >= zone) ||
- (zone < 0 && event.getX() < getWidth() + zone)) && super.onTouchEvent(event);
-
- }
-}
diff --git a/src/com/android/launcher2/FocusHelper.java b/src/com/android/launcher2/FocusHelper.java
index 25d941b65..d45c9ac15 100644
--- a/src/com/android/launcher2/FocusHelper.java
+++ b/src/com/android/launcher2/FocusHelper.java
@@ -41,16 +41,6 @@ class ButtonBarKeyEventListener implements View.OnKeyListener {
}
/**
- * A keyboard listener we set on the indicator buttons.
- */
-class IndicatorKeyEventListener implements View.OnKeyListener {
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- return FocusHelper.handleIndicatorButtonKeyEvent(v, keyCode, event);
- }
-}
-
-/**
* A keyboard listener we set on all the dock buttons.
*/
class DockKeyEventListener implements View.OnKeyListener {
@@ -545,73 +535,6 @@ public class FocusHelper {
}
/**
- * Handles key events in the prev/next indicators.
- */
- static boolean handleIndicatorButtonKeyEvent(View v, int keyCode, KeyEvent e) {
- final ViewGroup launcher = (ViewGroup) v.getParent();
- final Workspace workspace = (Workspace) launcher.findViewById(R.id.workspace);
- final ViewGroup hotseat = (ViewGroup) launcher.findViewById(R.id.all_apps_button_cluster);
- final View previousIndicator = launcher.findViewById(R.id.previous_screen);
- final View nextIndicator = launcher.findViewById(R.id.next_screen);
- final int pageIndex = workspace.getCurrentPage();
- final int pageCount = workspace.getChildCount();
-
- final int action = e.getAction();
- final boolean handleKeyEvent = (action != KeyEvent.ACTION_UP);
- boolean wasHandled = false;
- switch (keyCode) {
- case KeyEvent.KEYCODE_DPAD_LEFT:
- if (handleKeyEvent) {
- if (v == previousIndicator) {
- if (pageIndex > 0) {
- // Snap to previous page and clear focus
- workspace.snapToPage(pageIndex - 1);
- }
- } else if (v == nextIndicator) {
- // Select the last button in the hot seat
- hotseat.getChildAt(hotseat.getChildCount() - 1).requestFocus();
- }
- }
- wasHandled = true;
- break;
- case KeyEvent.KEYCODE_DPAD_RIGHT:
- if (handleKeyEvent) {
- if (v == previousIndicator) {
- // Select the first button in the hot seat
- hotseat.getChildAt(0).requestFocus();
- } else if (v == nextIndicator) {
- if (pageIndex < (pageCount - 1)) {
- // Snap to next page and clear focus
- workspace.snapToPage(pageIndex + 1);
- }
- }
- }
- wasHandled = true;
- break;
- case KeyEvent.KEYCODE_DPAD_UP:
- if (handleKeyEvent) {
- // Select the first bubble text view in the current page of the workspace
- final CellLayout layout = (CellLayout) workspace.getChildAt(pageIndex);
- final CellLayoutChildren children = layout.getChildrenLayout();
- final View newIcon = getBubbleTextViewInDirection(layout, children, -1, 1);
- if (newIcon != null) {
- newIcon.requestFocus();
- } else {
- workspace.requestFocus();
- }
- }
- wasHandled = true;
- break;
- case KeyEvent.KEYCODE_DPAD_DOWN:
- // Do nothing
- wasHandled = true;
- break;
- default: break;
- }
- return wasHandled;
- }
-
- /**
* Handles key events in the workspace dock (bottom of the screen).
*/
static boolean handleDockButtonKeyEvent(View v, int keyCode, KeyEvent e, int orientation) {
@@ -622,8 +545,6 @@ public class FocusHelper {
final int buttonCount = parent.getChildCount();
final int pageIndex = workspace.getCurrentPage();
final int pageCount = workspace.getChildCount();
- final View previousIndicator = launcher.findViewById(R.id.previous_screen);
- final View nextIndicator = launcher.findViewById(R.id.next_screen);
// NOTE: currently we don't special case for the phone UI in different
// orientations, even though the dock is on the side in landscape mode. This
@@ -635,23 +556,22 @@ public class FocusHelper {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
if (handleKeyEvent) {
-
- // Select the previous button, otherwise select the previous page indicator
+ // Select the previous button, otherwise snap to the previous page
if (buttonIndex > 0) {
parent.getChildAt(buttonIndex - 1).requestFocus();
} else {
- previousIndicator.requestFocus();
+ workspace.snapToPage(pageIndex - 1);
}
}
wasHandled = true;
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (handleKeyEvent) {
- // Select the next button, otherwise select the next page indicator
+ // Select the next button, otherwise snap to the next page
if (buttonIndex < (buttonCount - 1)) {
parent.getChildAt(buttonIndex + 1).requestFocus();
} else {
- nextIndicator.requestFocus();
+ workspace.snapToPage(pageIndex + 1);
}
}
wasHandled = true;
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 2dfce622f..b1752a72d 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -226,10 +226,6 @@ public final class Launcher extends Activity
private static HashMap<Long, FolderInfo> sFolders = new HashMap<Long, FolderInfo>();
- // The "signpost" images along the bottom of the screen (only in some layouts)
- private ImageView mPreviousView;
- private ImageView mNextView;
-
// Hotseats (quick-launch icons next to AllApps)
private String[] mHotseatConfig = null;
private Intent[] mHotseats = null;
@@ -675,13 +671,6 @@ public final class Launcher extends Activity
@Override
protected void onPause() {
super.onPause();
- // Some launcher layouts don't have a previous and next view
- if (mPreviousView != null) {
- dismissPreview(mPreviousView);
- }
- if (mNextView != null) {
- dismissPreview(mNextView);
- }
mPaused = true;
mDragController.cancelDrag();
}
@@ -878,21 +867,6 @@ public final class Launcher extends Activity
ImageView hotseatRight = (ImageView) findViewById(R.id.hotseat_right);
hotseatRight.setContentDescription(mHotseatLabels[1]);
hotseatRight.setImageDrawable(mHotseatIcons[1]);
-
- View.OnKeyListener listener = new IndicatorKeyEventListener();
- mPreviousView = (ImageView) mDragLayer.findViewById(R.id.previous_screen);
- mPreviousView.setOnKeyListener(listener);
- mNextView = (ImageView) mDragLayer.findViewById(R.id.next_screen);
- mNextView.setOnKeyListener(listener);
-
- Drawable previous = mPreviousView.getDrawable();
- Drawable next = mNextView.getDrawable();
- mWorkspace.setIndicators(previous, next);
-
- mPreviousView.setHapticFeedbackEnabled(false);
- mPreviousView.setOnLongClickListener(this);
- mNextView.setHapticFeedbackEnabled(false);
- mNextView.setOnLongClickListener(this);
}
if (!LauncherApplication.isScreenLarge()) {
@@ -1383,15 +1357,6 @@ public final class Launcher extends Activity
unbindDesktopItems();
getContentResolver().unregisterContentObserver(mWidgetObserver);
-
- // Some launcher layouts don't have a previous and next view
- if (mPreviousView != null) {
- dismissPreview(mPreviousView);
- }
- if (mNextView != null) {
- dismissPreview(mNextView);
- }
-
unregisterReceiver(mCloseSystemDialogsReceiver);
((ViewGroup) mWorkspace.getParent()).removeAllViews();
@@ -1518,12 +1483,6 @@ public final class Launcher extends Activity
return mWorkspaceLoading || mWaitingForResult;
}
- // Is the workspace preview (brought up by long-pressing on a signpost icon) visible?
- private boolean isPreviewVisible() {
- return (mPreviousView != null && mPreviousView.getTag() != null) ||
- (mNextView != null && mNextView.getTag() != null);
- }
-
private void addItems() {
showWorkspace(true);
showAddDialog(-1, -1);
@@ -1734,9 +1693,6 @@ public final class Launcher extends Activity
} else {
closeFolder();
}
- } else if (isPreviewVisible()) {
- dismissPreview(mPreviousView);
- dismissPreview(mNextView);
} else {
mWorkspace.exitWidgetResizeMode();
@@ -2001,20 +1957,6 @@ public final class Launcher extends Activity
}
switch (v.getId()) {
- case R.id.previous_screen:
- if (mState != State.APPS_CUSTOMIZE) {
- mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
- HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- showPreviews(v);
- }
- return true;
- case R.id.next_screen:
- if (mState != State.APPS_CUSTOMIZE) {
- mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
- HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- showPreviews(v);
- }
- return true;
case R.id.all_apps_button:
if (mState != State.APPS_CUSTOMIZE) {
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
@@ -2602,12 +2544,8 @@ public final class Launcher extends Activity
if (animated) {
int duration = mSearchDeleteBar.getTransitionInDuration();
mButtonCluster.animate().alpha(1f).setDuration(duration);
- mPreviousView.animate().alpha(1f).setDuration(duration);
- mNextView.animate().alpha(1f).setDuration(duration);
} else {
mButtonCluster.setAlpha(1f);
- mPreviousView.setAlpha(1f);
- mNextView.setAlpha(1f);
}
}
}
@@ -2620,12 +2558,8 @@ public final class Launcher extends Activity
if (animated) {
int duration = mSearchDeleteBar.getTransitionOutDuration();
mButtonCluster.animate().alpha(0f).setDuration(duration);
- mPreviousView.animate().alpha(0f).setDuration(duration);
- mNextView.animate().alpha(0f).setDuration(duration);
} else {
mButtonCluster.setAlpha(0f);
- mPreviousView.setAlpha(0f);
- mNextView.setAlpha(0f);
}
}
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 005bd2730..c0439ddc9 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -158,9 +158,6 @@ public class Workspace extends SmoothPagedView
private static final int DEFAULT_CELL_COUNT_X = 4;
private static final int DEFAULT_CELL_COUNT_Y = 4;
- private Drawable mPreviousIndicator;
- private Drawable mNextIndicator;
-
// State variable that indicates whether the pages are small (ie when you're
// in all apps or customize mode)
private boolean mIsSmall = false;
@@ -681,17 +678,6 @@ public class Workspace extends SmoothPagedView
@Override
protected void notifyPageSwitchListener() {
super.notifyPageSwitchListener();
-
- if (mPreviousIndicator != null) {
- // if we know the next page, we show the indication for it right away; it looks
- // weird if the indicators are lagging
- int page = mNextPage;
- if (page == INVALID_PAGE) {
- page = mCurrentPage;
- }
- mPreviousIndicator.setLevel(page);
- mNextIndicator.setLevel(page);
- }
Launcher.setScreen(mCurrentPage);
};
@@ -3523,13 +3509,6 @@ public class Workspace extends SmoothPagedView
getChildAt(mDefaultPage).requestFocus();
}
- void setIndicators(Drawable previous, Drawable next) {
- mPreviousIndicator = previous;
- mNextIndicator = next;
- previous.setLevel(mCurrentPage);
- next.setLevel(mCurrentPage);
- }
-
@Override
public void syncPages() {
}