summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2014-08-14 12:57:28 -0700
committerAdam Cohen <adamcohen@google.com>2014-08-14 13:15:32 -0700
commita00673c7d9f3fcfc81a6e1c6aa7b831951331e84 (patch)
tree3ee6a8e89c1dad5b19914da79ae77199699aff33
parent63f1ec00fbbd109130d1e476371dbc9a87bb544d (diff)
downloadandroid_packages_apps_Trebuchet-a00673c7d9f3fcfc81a6e1c6aa7b831951331e84.tar.gz
android_packages_apps_Trebuchet-a00673c7d9f3fcfc81a6e1c6aa7b831951331e84.tar.bz2
android_packages_apps_Trebuchet-a00673c7d9f3fcfc81a6e1c6aa7b831951331e84.zip
Fix issues with the new widget layout
-> use first layout instead of first measure to determine size -> fix issue where we were doubly accounting for padding of AppsCustomizePagedView -> show page backgrounds by default, hide fake page by default -> stripping some dead code related to the market button and all apps cling Change-Id: I787bdf1092c821b780670098fb219a8a68914bc8
-rw-r--r--res/drawable-hdpi/quantum_panel_dark.9.pngbin713 -> 646 bytes
-rw-r--r--res/drawable-mdpi/quantum_panel_dark.9.pngbin494 -> 449 bytes
-rw-r--r--res/drawable-xhdpi/quantum_panel_dark.9.pngbin951 -> 894 bytes
-rw-r--r--res/drawable-xxhdpi/quantum_panel_dark.9.pngbin1425 -> 1366 bytes
-rw-r--r--res/layout/apps_customize_pane.xml10
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java48
-rw-r--r--src/com/android/launcher3/FocusHelper.java45
-rw-r--r--src/com/android/launcher3/Launcher.java72
8 files changed, 9 insertions, 166 deletions
diff --git a/res/drawable-hdpi/quantum_panel_dark.9.png b/res/drawable-hdpi/quantum_panel_dark.9.png
index 057efd157..abaf23026 100644
--- a/res/drawable-hdpi/quantum_panel_dark.9.png
+++ b/res/drawable-hdpi/quantum_panel_dark.9.png
Binary files differ
diff --git a/res/drawable-mdpi/quantum_panel_dark.9.png b/res/drawable-mdpi/quantum_panel_dark.9.png
index 7837e4808..7728a7268 100644
--- a/res/drawable-mdpi/quantum_panel_dark.9.png
+++ b/res/drawable-mdpi/quantum_panel_dark.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/quantum_panel_dark.9.png b/res/drawable-xhdpi/quantum_panel_dark.9.png
index 8944a8f98..4c1868b55 100644
--- a/res/drawable-xhdpi/quantum_panel_dark.9.png
+++ b/res/drawable-xhdpi/quantum_panel_dark.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/quantum_panel_dark.9.png b/res/drawable-xxhdpi/quantum_panel_dark.9.png
index b74f1a65c..17ba0f116 100644
--- a/res/drawable-xxhdpi/quantum_panel_dark.9.png
+++ b/res/drawable-xxhdpi/quantum_panel_dark.9.png
Binary files differ
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index b1ba8d103..c2d399e29 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -40,6 +40,7 @@
android:id="@+id/fake_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:visibility="invisible"
android:clipToPadding="false" />
</FrameLayout>
<com.android.launcher3.AppsCustomizePagedView
@@ -60,13 +61,4 @@
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
-
- <include
- android:id="@+id/market_button"
- layout="@layout/market_button"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="end"
- android:visibility="gone"/>
-
</com.android.launcher3.AppsCustomizeTabHost>
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 2e81b9326..787bf96d2 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -214,7 +214,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int mWidgetLoadingId = -1;
PendingAddWidgetInfo mCreateWidgetInfo = null;
private boolean mDraggingWidget = false;
- boolean mPageBackgroundsVisible;
+ boolean mPageBackgroundsVisible = true;
private Toast mWidgetInstructionToast;
@@ -376,52 +376,19 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mWidgetSpacingLayout.measure(widthSpec, heightSpec);
final boolean hostIsTransitioning = getTabHost().isInTransition();
-
- // Restore the page
int page = getPageForComponent(mSaveInstanceStateItemIndex);
invalidatePageData(Math.max(0, page), hostIsTransitioning);
-
- // Show All Apps cling if we are finished transitioning, otherwise, we will try again when
- // the transition completes in AppsCustomizeTabHost (otherwise the wrong offsets will be
- // returned while animating)
- if (!hostIsTransitioning) {
- post(new Runnable() {
- @Override
- public void run() {
- showAllAppsCling();
- }
- });
- }
}
- void showAllAppsCling() {
- if (!mHasShownAllAppsCling && isDataReady()) {
- mHasShownAllAppsCling = true;
- // Calculate the position for the cling punch through
- int[] offset = new int[2];
- int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY);
- mLauncher.getDragLayer().getLocationInDragLayer(this, offset);
- // PagedViews are centered horizontally but top aligned
- // Note we have to shift the items up now that Launcher sits under the status bar
- pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 +
- offset[0];
- pos[1] += offset[1] - mLauncher.getDragLayer().getPaddingTop();
- }
- }
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- int width = MeasureSpec.getSize(widthMeasureSpec);
- int height = MeasureSpec.getSize(heightMeasureSpec);
if (!isDataReady()) {
if ((LauncherAppState.isDisableAllApps() || !mApps.isEmpty()) && !mWidgets.isEmpty()) {
setDataIsReady();
- setMeasuredDimension(width, height);
- onDataReady(width, height);
+ onDataReady(getMeasuredWidth(), getMeasuredHeight());
}
}
-
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
public void onPackagesUpdated(ArrayList<Object> widgetsAndShortcuts) {
@@ -1179,11 +1146,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Calculate the dimensions of each cell we are giving to each widget
final ArrayList<Object> items = new ArrayList<Object>();
- int contentWidth = mContentWidth - getPaddingLeft() - getPaddingRight()
- - layout.getPaddingLeft() - layout.getPaddingRight();
+ int contentWidth = mContentWidth - layout.getPaddingLeft() - layout.getPaddingRight();
final int cellWidth = contentWidth / mWidgetCountX;
- int contentHeight = mContentHeight - getPaddingTop() - getPaddingBottom()
- - layout.getPaddingTop() - layout.getPaddingBottom();
+ int contentHeight = mContentHeight - layout.getPaddingTop() - layout.getPaddingBottom();
+
final int cellHeight = contentHeight / mWidgetCountY;
// Prepare the set of widgets to load previews for in the background
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java
index b1250ceea..df5e0fc33 100644
--- a/src/com/android/launcher3/FocusHelper.java
+++ b/src/com/android/launcher3/FocusHelper.java
@@ -57,16 +57,6 @@ class HotseatIconKeyEventListener implements View.OnKeyListener {
}
}
-/**
- * A keyboard listener we set on the last tab button in AppsCustomize to jump to then
- * market icon and vice versa.
- */
-class AppsCustomizeTabKeyEventListener implements View.OnKeyListener {
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- return FocusHelper.handleAppsCustomizeTabKeyEvent(v, keyCode, event);
- }
-}
-
public class FocusHelper {
/**
* Private helper to get the parent TabHost in the view hiearchy.
@@ -80,41 +70,6 @@ public class FocusHelper {
}
/**
- * Handles key events in a AppsCustomize tab between the last tab view and the shop button.
- */
- static boolean handleAppsCustomizeTabKeyEvent(View v, int keyCode, KeyEvent e) {
- final AppsCustomizeTabHost tabHost = findTabHostParent(v);
- final ViewGroup contents = tabHost.getContent();
- final View shop = tabHost.findViewById(R.id.market_button);
-
- final int action = e.getAction();
- final boolean handleKeyEvent = (action != KeyEvent.ACTION_UP);
- boolean wasHandled = false;
- switch (keyCode) {
- case KeyEvent.KEYCODE_DPAD_RIGHT:
- if (handleKeyEvent) {
- // Select the shop button if we aren't on it
- if (v != shop) {
- shop.requestFocus();
- }
- }
- wasHandled = true;
- break;
- case KeyEvent.KEYCODE_DPAD_DOWN:
- if (handleKeyEvent) {
- // Select the content view (down is handled by the tab key handler otherwise)
- if (v == shop) {
- contents.requestFocus();
- wasHandled = true;
- }
- }
- break;
- default: break;
- }
- return wasHandled;
- }
-
- /**
* Returns the Viewgroup containing page contents for the page at the index specified.
*/
private static ViewGroup getAppsCustomizePage(ViewGroup container, int index) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 31482f77e..8995856a4 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -329,10 +329,6 @@ public class Launcher extends Activity
// External icons saved in case of resource changes, orientation, etc.
private static Drawable.ConstantState[] sGlobalSearchIcon = new Drawable.ConstantState[2];
private static Drawable.ConstantState[] sVoiceSearchIcon = new Drawable.ConstantState[2];
- private static Drawable.ConstantState[] sAppMarketIcon = new Drawable.ConstantState[2];
-
- private Intent mAppMarketIntent = null;
- private static final boolean DISABLE_MARKET_BUTTON = true;
private Drawable mWorkspaceBackgroundDrawable;
@@ -557,11 +553,7 @@ public class Launcher extends Activity
boolean voiceVisible = false;
// If we have a saved version of these external icons, we load them up immediately
int coi = getCurrentOrientationIndexForGlobalIcons();
- if (sGlobalSearchIcon[coi] == null || sVoiceSearchIcon[coi] == null ||
- sAppMarketIcon[coi] == null) {
- if (!DISABLE_MARKET_BUTTON) {
- updateAppMarketIcon();
- }
+ if (sGlobalSearchIcon[coi] == null || sVoiceSearchIcon[coi] == null) {
searchVisible = updateGlobalSearchIcon();
voiceVisible = updateVoiceSearchIcon(searchVisible);
}
@@ -573,9 +565,6 @@ public class Launcher extends Activity
updateVoiceSearchIcon(sVoiceSearchIcon[coi]);
voiceVisible = true;
}
- if (!DISABLE_MARKET_BUTTON && sAppMarketIcon[coi] != null) {
- updateAppMarketIcon(sAppMarketIcon[coi]);
- }
if (mSearchDropTargetBar != null) {
mSearchDropTargetBar.onSearchPackagesChanged(searchVisible, voiceVisible);
}
@@ -1753,11 +1742,6 @@ public class Launcher extends Activity
}
});
}
- // When Launcher comes back to foreground, a different Activity might be responsible for
- // the app market intent, so refresh the icon
- if (!DISABLE_MARKET_BUTTON) {
- updateAppMarketIcon();
- }
clearTypedText();
}
}
@@ -2739,16 +2723,6 @@ public class Launcher extends Activity
return mHapticFeedbackTouchListener;
}
- public void onClickAppMarketButton(View v) {
- if (!DISABLE_MARKET_BUTTON) {
- if (mAppMarketIntent != null) {
- startActivitySafely(v, mAppMarketIntent, "app market");
- } else {
- Log.e(TAG, "Invalid app market intent.");
- }
- }
- }
-
public void onDragStarted(View view) {}
/**
@@ -4008,44 +3982,6 @@ public class Launcher extends Activity
public void disableVoiceButtonProxy(boolean disabled) {
updateVoiceButtonProxyVisible(disabled);
}
- /**
- * Sets the app market icon
- */
- private void updateAppMarketIcon() {
- if (!DISABLE_MARKET_BUTTON) {
- final View marketButton = findViewById(R.id.market_button);
- Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_MARKET);
- // Find the app market activity by resolving an intent.
- // (If multiple app markets are installed, it will return the ResolverActivity.)
- ComponentName activityName = intent.resolveActivity(getPackageManager());
- if (activityName != null) {
- int coi = getCurrentOrientationIndexForGlobalIcons();
- mAppMarketIntent = intent;
- sAppMarketIcon[coi] = updateTextButtonWithIconFromExternalActivity(
- R.id.market_button, activityName, R.drawable.ic_launcher_market_holo,
- TOOLBAR_ICON_METADATA_NAME);
- marketButton.setVisibility(View.VISIBLE);
- } else {
- // We should hide and disable the view so that we don't try and restore the visibility
- // of it when we swap between drag & normal states from IconDropTarget subclasses.
- marketButton.setVisibility(View.GONE);
- marketButton.setEnabled(false);
- }
- }
- }
-
- private void updateAppMarketIcon(Drawable.ConstantState d) {
- if (!DISABLE_MARKET_BUTTON) {
- // Ensure that the new drawable we are creating has the approprate toolbar icon bounds
- Resources r = getResources();
- Drawable marketIconDrawable = d.newDrawable(r);
- int w = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_width);
- int h = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_height);
- marketIconDrawable.setBounds(0, 0, w, h);
-
- updateTextButtonWithDrawable(R.id.market_button, marketIconDrawable);
- }
- }
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
@@ -4553,12 +4489,6 @@ public class Launcher extends Activity
mWorkspace.restoreInstanceStateForRemainingPages();
- // Update the market app icon as necessary (the other icons will be managed in response to
- // package changes in bindSearchablesChanged()
- if (!DISABLE_MARKET_BUTTON) {
- updateAppMarketIcon();
- }
-
setWorkspaceLoading(false);
sendLoadingCompleteBroadcastIfNecessary();