summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/apps_customize_bg.pngbin0 -> 108 bytes
-rw-r--r--res/drawable-hdpi/widget_info_bg.9.pngbin0 -> 168 bytes
-rw-r--r--res/drawable-mdpi/apps_customize_bg.pngbin0 -> 108 bytes
-rw-r--r--res/drawable-mdpi/widget_info_bg.9.pngbin0 -> 178 bytes
-rw-r--r--res/drawable-nodpi/all_apps_bg_gradient.9.pngbin2946 -> 0 bytes
-rw-r--r--res/layout/apps_customize_pane.xml1
-rw-r--r--res/layout/apps_customize_widget.xml87
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java18
-rw-r--r--src/com/android/launcher2/AppsCustomizeTabHost.java17
-rw-r--r--src/com/android/launcher2/PagedViewGridLayout.java10
-rw-r--r--src/com/android/launcher2/PagedViewWidget.java13
-rw-r--r--src/com/android/launcher2/Workspace.java9
12 files changed, 83 insertions, 72 deletions
diff --git a/res/drawable-hdpi/apps_customize_bg.png b/res/drawable-hdpi/apps_customize_bg.png
new file mode 100644
index 000000000..81768d71e
--- /dev/null
+++ b/res/drawable-hdpi/apps_customize_bg.png
Binary files differ
diff --git a/res/drawable-hdpi/widget_info_bg.9.png b/res/drawable-hdpi/widget_info_bg.9.png
new file mode 100644
index 000000000..217b35cb4
--- /dev/null
+++ b/res/drawable-hdpi/widget_info_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/apps_customize_bg.png b/res/drawable-mdpi/apps_customize_bg.png
new file mode 100644
index 000000000..81768d71e
--- /dev/null
+++ b/res/drawable-mdpi/apps_customize_bg.png
Binary files differ
diff --git a/res/drawable-mdpi/widget_info_bg.9.png b/res/drawable-mdpi/widget_info_bg.9.png
new file mode 100644
index 000000000..7fd1c20e0
--- /dev/null
+++ b/res/drawable-mdpi/widget_info_bg.9.png
Binary files differ
diff --git a/res/drawable-nodpi/all_apps_bg_gradient.9.png b/res/drawable-nodpi/all_apps_bg_gradient.9.png
deleted file mode 100644
index 3f4b5b58c..000000000
--- a/res/drawable-nodpi/all_apps_bg_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 1b8be80a8..8361d168c 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -23,6 +23,7 @@
<!-- The layout_width of the tab bar gets overriden to align the content
with the text in the tabs in AppsCustomizeTabHost. -->
<FrameLayout
+ android:id="@+id/tabs_container"
android:layout_width="wrap_content"
android:layout_height="@dimen/qsb_bar_height"
android:layout_gravity="center_horizontal">
diff --git a/res/layout/apps_customize_widget.xml b/res/layout/apps_customize_widget.xml
index 38973b564..44f6ae1b7 100644
--- a/res/layout/apps_customize_widget.xml
+++ b/res/layout/apps_customize_widget.xml
@@ -28,58 +28,53 @@
android:background="@drawable/focusable_view_bg"
android:focusable="true">
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="4dp"
+ android:orientation="vertical"
+ android:background="@drawable/widget_info_bg">
+ <!-- The name of the widget. -->
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/widget_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:gravity="left|bottom"
+
+ android:textColor="#FFBBBBBB"
+ android:textSize="14sp"
+ android:shadowColor="#FF000000"
+ android:shadowDx="0.0"
+ android:shadowDy="1.0"
+ android:shadowRadius="1.0"
+
+ android:maxLines="2"
+ android:fadingEdge="horizontal" />
+
+ <!-- The original dimensions of the widget (can't be the same text as above due to different
+ style. -->
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/widget_dims"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:gravity="left|bottom"
+
+ android:textColor="#FF999999"
+ android:textSize="12sp"
+ android:shadowColor="#99000000"
+ android:shadowDx="0.0"
+ android:shadowDy="1.0"
+ android:shadowRadius="1.0" />
+ </LinearLayout>
+
<!-- The icon of the widget. -->
<ImageView
android:id="@+id/widget_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
- android:paddingBottom="5dp"
android:adjustViewBounds="true"
android:scaleType="fitStart" />
-
- <!-- The divider image.
- This view is removed in PagedViewWidget.java in the Phone UI. -->
- <ImageView
- android:id="@+id/divider"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingTop="10dp"
- android:paddingBottom="10dp"
- android:src="@drawable/widget_divider" />
-
- <!-- The name of the widget. -->
- <TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/widget_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:gravity="left|bottom"
-
- android:textColor="#FFFFFFFF"
- android:textSize="14sp"
- android:shadowColor="#FF000000"
- android:shadowDx="0.0"
- android:shadowDy="1.0"
- android:shadowRadius="1.0"
-
- android:maxLines="2"
- android:fadingEdge="horizontal" />
-
- <!-- The original dimensions of the widget (can't be the same text as above due to different
- style. -->
- <TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/widget_dims"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:gravity="left|bottom"
-
- android:textColor="#FF999999"
- android:textSize="14sp"
- android:shadowColor="#99000000"
- android:shadowDx="0.0"
- android:shadowDy="1.0"
- android:shadowRadius="1.0" />
</com.android.launcher2.PagedViewWidget>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index da6e7de3b..fd8678d13 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -43,6 +43,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
+import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@@ -237,7 +238,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
* This differs from isDataReady as this is the test done if isDataReady is not set.
*/
private boolean testDataReady() {
- return !mApps.isEmpty() && !mWidgets.isEmpty();
+ // We only do this test once, and we default to the Applications page, so we only really
+ // have to wait for there to be apps.
+ return !mApps.isEmpty();
}
protected void onDataReady(int width, int height) {
@@ -512,7 +515,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// expected page width, so we can actually optimize by hiding all the TextView-based
// children that are expensive to measure, and let that happen naturally later.
setVisibilityOnChildren(layout, View.GONE);
- int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
+ int widthSpec = MeasureSpec.makeMeasureSpec(getPageContentWidth(), MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
layout.setMinimumWidth(getPageContentWidth());
layout.measure(widthSpec, heightSpec);
@@ -892,10 +895,13 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Layout each widget
int ix = i % mWidgetCountX;
int iy = i / mWidgetCountX;
- PagedViewGridLayout.LayoutParams lp = new PagedViewGridLayout.LayoutParams(cellWidth,
- cellHeight);
- lp.leftMargin = (ix * cellWidth) + (ix * mWidgetWidthGap);
- lp.topMargin = (iy * cellHeight) + (iy * mWidgetHeightGap);
+ GridLayout.LayoutParams lp = new GridLayout.LayoutParams(
+ new GridLayout.Group(iy, 1, GridLayout.LEFT),
+ new GridLayout.Group(ix, 1, GridLayout.TOP));
+ lp.width = cellWidth;
+ lp.height = cellHeight;
+ if (ix > 0) lp.leftMargin = mWidgetWidthGap;
+ if (iy > 0) lp.topMargin = mWidgetHeightGap;
layout.addView(widget, lp);
}
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 87c154b47..587a3eb5f 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -39,9 +39,11 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
private static final String APPS_TAB_TAG = "APPS";
private static final String WIDGETS_TAB_TAG = "WIDGETS";
+ private static final int sTabBarFadeInDuration = 150;
private final LayoutInflater mLayoutInflater;
private ViewGroup mTabs;
+ private ViewGroup mTabsContainer;
private AppsCustomizePagedView mAppsCustomizePane;
public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
@@ -67,10 +69,12 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
// Setup the tab host
setup();
+ final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
final TabWidget tabs = (TabWidget) findViewById(com.android.internal.R.id.tabs);
final AppsCustomizePagedView appsCustomizePane = (AppsCustomizePagedView)
findViewById(R.id.apps_customize_pane_content);
mTabs = tabs;
+ mTabsContainer = tabsContainer;
mAppsCustomizePane = appsCustomizePane;
if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();
@@ -98,6 +102,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
lastTab.setOnKeyListener(keyListener);
View shopButton = findViewById(R.id.market_button);
shopButton.setOnKeyListener(keyListener);
+
+ // Hide the tab bar until we measure
+ mTabsContainer.setAlpha(0f);
}
@Override
@@ -107,9 +114,15 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
// Set the width of the tab list to the content width
if (remeasureTabWidth) {
- mTabs.getLayoutParams().width = mAppsCustomizePane.getPageContentWidth();
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ int contentWidth = mAppsCustomizePane.getPageContentWidth();
+ if (contentWidth > 0) {
+ // Set the width and show the tab bar (if we have a loading graphic, we can switch
+ // it off here)
+ mTabs.getLayoutParams().width = contentWidth;
+ mTabsContainer.animate().alpha(1f).setDuration(sTabBarFadeInDuration);
+ }
}
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
diff --git a/src/com/android/launcher2/PagedViewGridLayout.java b/src/com/android/launcher2/PagedViewGridLayout.java
index c6d39fd5f..a2ab7634c 100644
--- a/src/com/android/launcher2/PagedViewGridLayout.java
+++ b/src/com/android/launcher2/PagedViewGridLayout.java
@@ -19,14 +19,13 @@ package com.android.launcher2;
import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
-import android.view.View.MeasureSpec;
import android.widget.FrameLayout;
-import android.widget.LinearLayout;
+import android.widget.GridLayout;
/**
* The grid based layout used strictly for the widget/wallpaper tab of the AppsCustomize pane
*/
-public class PagedViewGridLayout extends FrameLayout implements Page {
+public class PagedViewGridLayout extends GridLayout implements Page {
static final String TAG = "PagedViewGridLayout";
private int mCellCountX;
@@ -36,6 +35,7 @@ public class PagedViewGridLayout extends FrameLayout implements Page {
super(context, null, 0);
mCellCountX = cellCountX;
mCellCountY = cellCountY;
+ setColumnCount(mCellCountX);
}
int getCellCountX() {
@@ -50,9 +50,9 @@ public class PagedViewGridLayout extends FrameLayout implements Page {
// offset of each page to scroll to before it updates the actual size of each page
// (which can change depending on the content if the contents aren't a fixed size).
// We work around this by having a minimum size on each widget page).
- int widthSpecSize = Math.max(getSuggestedMinimumWidth(),
+ int widthSpecSize = Math.min(getSuggestedMinimumWidth(),
MeasureSpec.getSize(widthMeasureSpec));
- int widthSpecMode = MeasureSpec.AT_MOST;
+ int widthSpecMode = MeasureSpec.EXACTLY;
super.onMeasure(MeasureSpec.makeMeasureSpec(widthSpecSize, widthSpecMode),
heightMeasureSpec);
}
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index d6f665691..365965d13 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -112,11 +112,6 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
final TextView dims = (TextView) findViewById(R.id.widget_dims);
dims.setText(String.format(mDimensionsFormatString, cellSpan[0], cellSpan[1]));
dims.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
-
- // Hide the divider in the Phone UI.
- if (!LauncherApplication.isScreenLarge()) {
- findViewById(R.id.divider).setVisibility(View.GONE);
- }
}
public void applyFromResolveInfo(PackageManager pm, ResolveInfo info,
@@ -133,11 +128,6 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
dims.setText(String.format(mDimensionsFormatString, 1, 1));
dims.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
-
- // Hide the divider in the Phone UI.
- if (!LauncherApplication.isScreenLarge()) {
- findViewById(R.id.divider).setVisibility(View.GONE);
- }
}
public void setHolographicOutline(Bitmap holoOutline) {
@@ -184,7 +174,8 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
mPaint.setAlpha(mHolographicAlpha);
canvas.save();
canvas.scale(mTmpScaleRect.right, mTmpScaleRect.bottom);
- canvas.drawBitmap(mHolographicOutline, 0, 0, mPaint);
+ canvas.drawBitmap(mHolographicOutline, mPreviewImageView.getLeft(),
+ mPreviewImageView.getTop(), mPaint);
canvas.restore();
}
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index c0439ddc9..fcf8d662e 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -323,7 +323,7 @@ public class Workspace extends SmoothPagedView
try {
final Resources res = getResources();
- mBackground = res.getDrawable(R.drawable.all_apps_bg_gradient);
+ mBackground = res.getDrawable(R.drawable.apps_customize_bg);
} catch (Resources.NotFoundException e) {
// In this case, we will skip drawing background protection
}
@@ -2549,7 +2549,12 @@ public class Workspace extends SmoothPagedView
if (!mIsSmall) {
mDragTargetLayout = getCurrentDropLayout();
mDragTargetLayout.onDragEnter();
- showOutlines();
+
+ // Because we don't have space in the Phone UI (the CellLayouts run to the edge) we
+ // don't need to show the outlines
+ if (!LauncherApplication.isScreenLarge()) {
+ showOutlines();
+ }
}
}