summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values-en-rGB-large/strings.xml6
-rw-r--r--res/values-it-large/strings.xml6
-rw-r--r--res/values-vi-large/strings.xml6
-rw-r--r--src/com/android/launcher2/AllAppsPagedView.java47
-rw-r--r--src/com/android/launcher2/AllAppsTabbed.java26
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java3
-rw-r--r--src/com/android/launcher2/CustomizePagedView.java46
-rw-r--r--src/com/android/launcher2/CustomizeTrayTabHost.java29
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java23
-rw-r--r--src/com/android/launcher2/PagedViewCellLayoutChildren.java22
-rw-r--r--src/com/android/launcher2/PagedViewIcon.java25
11 files changed, 166 insertions, 73 deletions
diff --git a/res/values-en-rGB-large/strings.xml b/res/values-en-rGB-large/strings.xml
index 60042b2d4..276ab94e8 100644
--- a/res/values-en-rGB-large/strings.xml
+++ b/res/values-en-rGB-large/strings.xml
@@ -19,7 +19,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="wallpaper_dialog_title" msgid="5764793286524787718">"Select wallpaper"</string>
- <string name="wallpaper_chooser_empty" msgid="7358237455389125747">"No wallpaper available"</string>
- <string name="wallpaper_cancel" msgid="6502936522490675611">"Cancel"</string>
+ <string name="wallpaper_dialog_title" msgid="8362944198120933329">"Select wallpaper"</string>
+ <string name="wallpaper_chooser_empty" msgid="6543937491391049913">"No wallpaper available"</string>
+ <string name="wallpaper_cancel" msgid="5942480248232268588">"Cancel"</string>
</resources>
diff --git a/res/values-it-large/strings.xml b/res/values-it-large/strings.xml
index e667b75cb..249f880d4 100644
--- a/res/values-it-large/strings.xml
+++ b/res/values-it-large/strings.xml
@@ -19,7 +19,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="wallpaper_dialog_title" msgid="5764793286524787718">"Seleziona sfondo"</string>
- <string name="wallpaper_chooser_empty" msgid="7358237455389125747">"Nessuno sfondo disponibile"</string>
- <string name="wallpaper_cancel" msgid="6502936522490675611">"Annulla"</string>
+ <string name="wallpaper_dialog_title" msgid="8362944198120933329">"Seleziona sfondo"</string>
+ <string name="wallpaper_chooser_empty" msgid="6543937491391049913">"Nessuno sfondo disponibile"</string>
+ <string name="wallpaper_cancel" msgid="5942480248232268588">"Annulla"</string>
</resources>
diff --git a/res/values-vi-large/strings.xml b/res/values-vi-large/strings.xml
index 925732745..c8ce028d8 100644
--- a/res/values-vi-large/strings.xml
+++ b/res/values-vi-large/strings.xml
@@ -19,7 +19,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="wallpaper_dialog_title" msgid="5764793286524787718">"Chọn hình nền"</string>
- <string name="wallpaper_chooser_empty" msgid="7358237455389125747">"Không có sẵn hình nền nào"</string>
- <string name="wallpaper_cancel" msgid="6502936522490675611">"Hủy"</string>
+ <string name="wallpaper_dialog_title" msgid="8362944198120933329">"Chọn hình nền"</string>
+ <string name="wallpaper_chooser_empty" msgid="6543937491391049913">"Không có sẵn hình nền nào"</string>
+ <string name="wallpaper_cancel" msgid="5942480248232268588">"Hủy"</string>
</resources>
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index d9a503fbe..59ba57bdf 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -66,6 +66,8 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
private final LayoutInflater mInflater;
private boolean mAllowHardwareLayerCreation;
+ private boolean mFirstMeasure = true;
+
private int mPageContentWidth;
private boolean mHasMadeSuccessfulDrop;
@@ -91,11 +93,6 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
Resources r = context.getResources();
setDragSlopeThreshold(
r.getInteger(R.integer.config_appsCustomizeDragSlopeThreshold) / 100.0f);
-
- // Create a dummy page and set it up to find out the content width (used by our parent)
- PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
- setupPage(layout);
- mPageContentWidth = layout.getContentWidth();
}
@Override
@@ -104,6 +101,31 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
mCenterPagesVertically = false;
}
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
+ final int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+
+ if (mFirstMeasure) {
+ mFirstMeasure = false;
+
+ // TODO: actually calculate mCellCountX/mCellCountY as some function of
+ // widthSize and heightSize
+ //mCellCountX = ?;
+ //mCellCountY = ?;
+
+ // Since mCellCountX/mCellCountY changed, we need to update the pages
+ invalidatePageData();
+
+ // Create a dummy page and set it up to find out the content width (used by our parent)
+ PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
+ setupPage(layout);
+ mPageContentWidth = layout.getContentWidth();
+ }
+ }
+
void allowHardwareLayerCreation() {
// This is called after the first time we launch into All Apps. Before that point,
// there's no need for hardware layers here since there's a hardware layer set on the
@@ -482,6 +504,11 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
@Override
public void syncPages() {
+ if (mFirstMeasure) {
+ // We don't know our size yet, which means we haven't calculated cell count x/y;
+ // onMeasure will call us once we figure out our size
+ return;
+ }
// ensure that we have the right number of pages (min of 1, since we have placeholders)
int numPages = Math.max(1,
(int) Math.ceil((float) mFilteredApps.size() / (mCellCountX * mCellCountY)));
@@ -517,6 +544,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
if (!mFilteredApps.isEmpty()) {
int curNumPageItems = layout.getPageChildCount();
int numPageItems = endIndex - startIndex;
+ boolean createHolographicOutlines = (numPages > 1);
// If we were previously an empty page, then restart anew
boolean wasEmptyPage = false;
@@ -541,7 +569,6 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
// Add any necessary items
for (int i = curNumPageItems; i < numPageItems; ++i) {
- final boolean createHolographicOutlines = (numPages > 1);
TextView text = (TextView) mInflater.inflate(
R.layout.all_apps_paged_view_application, layout, false);
text.setOnClickListener(this);
@@ -549,14 +576,13 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
text.setOnTouchListener(this);
layout.addViewToCellLayout(text, -1, i,
- new PagedViewCellLayout.LayoutParams(0, 0, 1, 1), createHolographicOutlines);
+ new PagedViewCellLayout.LayoutParams(0, 0, 1, 1));
}
// Actually reapply to the existing text views
for (int i = startIndex; i < endIndex; ++i) {
final int index = i - startIndex;
final ApplicationInfo info = mFilteredApps.get(i);
- final boolean createHolographicOutlines = (numPages > 1);
PagedViewIcon icon = (PagedViewIcon) layout.getChildOnPageAt(index);
icon.applyFromApplicationInfo(
info, mPageViewIconCache, true, createHolographicOutlines);
@@ -567,6 +593,9 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
params.cellY = index / mCellCountX;
}
+ // We should try and sync all the holographic icons after adding/removing new items
+ layout.reloadHolographicIcons(createHolographicOutlines);
+
// Default to left-aligned icons
layout.enableCenteredContent(false);
} else {
@@ -585,7 +614,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
layout.enableCenteredContent(true);
layout.removeAllViewsOnPage();
layout.addViewToCellLayout(icon, -1, 0,
- new PagedViewCellLayout.LayoutParams(0, 0, 4, 1), createHolographicOutlines);
+ new PagedViewCellLayout.LayoutParams(0, 0, 4, 1));
}
layout.createHardwareLayers();
}
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index 96de5a733..a2f10f5ab 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -35,7 +35,6 @@ import android.widget.TabWidget;
import android.widget.TextView;
import java.util.ArrayList;
-import java.util.Random;
/**
* Implements a tabbed version of AllApps2D.
@@ -126,16 +125,6 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans
}
});
- // Set the width of the tab bar properly
- int pageWidth = mAllApps.getPageContentWidth();
- View allAppsTabBar = (View) findViewById(R.id.all_apps_tab_bar);
- if (allAppsTabBar == null) throw new Resources.NotFoundException();
- int tabWidgetPadding = 0;
- final int childCount = tabWidget.getChildCount();
- if (childCount > 0) {
- tabWidgetPadding += tabWidget.getChildAt(0).getPaddingLeft() * 2;
- }
- allAppsTabBar.getLayoutParams().width = pageWidth + tabWidgetPadding;
// It needs to be INVISIBLE so that it will be measured in the layout.
// Otherwise the animations is messed up when we show it for the first time.
@@ -175,7 +164,20 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
- mFirstLayout = false;
+ if (mFirstLayout) {
+ mFirstLayout = false;
+ // Set the width of the tab bar properly
+ int pageWidth = mAllApps.getPageContentWidth();
+ TabWidget tabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs);
+ View allAppsTabBar = (View) findViewById(R.id.all_apps_tab_bar);
+ if (allAppsTabBar == null) throw new Resources.NotFoundException();
+ int tabWidgetPadding = 0;
+ final int childCount = tabWidget.getChildCount();
+ if (childCount > 0) {
+ tabWidgetPadding += tabWidget.getChildAt(0).getPaddingLeft() * 2;
+ }
+ allAppsTabBar.getLayoutParams().width = pageWidth + tabWidgetPadding;
+ }
super.onLayout(changed, l, t, r, b);
}
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 14e051c64..87be63efa 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -561,8 +561,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int index = i - startIndex;
int x = index % mCellCountX;
int y = index / mCellCountX;
- layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1),
- isHardwareAccelerated() && (numPages > 1));
+ layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1));
}
}
/*
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index e5bc8b8a5..68ec535d8 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -54,6 +54,7 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.View.MeasureSpec;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import android.widget.Checkable;
@@ -124,6 +125,8 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
private final Canvas mCanvas = new Canvas();
private final LayoutInflater mInflater;
+ private boolean mFirstMeasure = true;
+
private final float mTmpFloatPos[] = new float[2];
private final float ANIMATION_SCALE = 0.5f;
@@ -173,12 +176,6 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
setDragSlopeThreshold(
r.getInteger(R.integer.config_customizationDrawerDragSlopeThreshold) / 100.0f);
- // Create a dummy page and set it up to find out the content width (used by our parent)
- PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
- setupPage(layout);
- mPageContentWidth = layout.getContentWidth();
- mMinPageWidth = layout.getWidthBeforeFirstLayout();
-
setVisibility(View.GONE);
setSoundEffectsEnabled(false);
setupWorkspaceLayout();
@@ -190,6 +187,32 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
mCenterPagesVertically = false;
}
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
+ final int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+
+ if (mFirstMeasure) {
+ mFirstMeasure = false;
+
+ // TODO: actually calculate mCellCountX/mCellCountY as some function of
+ // widthSize and heightSize
+ //mCellCountX = ?
+ //mCellCountY = ?
+
+ // Since mCellCountX/mCellCountY changed, we need to update the pages
+ invalidatePageData();
+
+ // Create a dummy page and set it up to find out the content width (used by our parent)
+ PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
+ setupPage(layout);
+ mPageContentWidth = layout.getContentWidth();
+ mMinPageWidth = layout.getWidthBeforeFirstLayout();
+ }
+ }
+
public void setLauncher(Launcher launcher) {
Context context = getContext();
mLauncher = launcher;
@@ -1042,8 +1065,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
final int x = index % mCellCountX;
final int y = index / mCellCountX;
setupPage(layout);
- layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1),
- createHolographicOutlines);
+ layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1));
}
}
@@ -1088,13 +1110,17 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
final int x = index % mCellCountX;
final int y = index / mCellCountX;
setupPage(layout);
- layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1),
- createHolographicOutlines);
+ layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1));
}
}
@Override
public void syncPages() {
+ if (mFirstMeasure) {
+ // We don't know our size yet, which means we haven't calculated cell count x/y;
+ // onMeasure will call us once we figure out our size
+ return;
+ }
boolean enforceMinimumPagedWidths = false;
boolean centerPagedViewCellLayouts = false;
switch (mCustomizationType) {
diff --git a/src/com/android/launcher2/CustomizeTrayTabHost.java b/src/com/android/launcher2/CustomizeTrayTabHost.java
index 2c47895d2..ab50cf161 100644
--- a/src/com/android/launcher2/CustomizeTrayTabHost.java
+++ b/src/com/android/launcher2/CustomizeTrayTabHost.java
@@ -115,17 +115,6 @@ public class CustomizeTrayTabHost extends TabHost implements LauncherTransitiona
}
}
});
-
- // Set the width of the tab bar properly
- int pageWidth = customizePagedView.getPageContentWidth();
- TabWidget customizeTabBar = (TabWidget) findViewById(com.android.internal.R.id.tabs);
- if (customizeTabBar == null) throw new Resources.NotFoundException();
- int tabWidgetPadding = 0;
- final int childCount = tabWidget.getChildCount();
- if (childCount > 0) {
- tabWidgetPadding += tabWidget.getChildAt(0).getPaddingLeft() * 2;
- }
- customizeTabBar.getLayoutParams().width = pageWidth + tabWidgetPadding;
}
@Override
@@ -150,7 +139,23 @@ public class CustomizeTrayTabHost extends TabHost implements LauncherTransitiona
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
- mFirstLayout = false;
+ if (mFirstLayout) {
+ mFirstLayout = false;
+
+ final CustomizePagedView customizePagedView =
+ (CustomizePagedView) findViewById(R.id.customization_drawer_tab_contents);
+ TabWidget tabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs);
+ // Set the width of the tab bar properly
+ int pageWidth = customizePagedView.getPageContentWidth();
+ TabWidget customizeTabBar = (TabWidget) findViewById(com.android.internal.R.id.tabs);
+ if (customizeTabBar == null) throw new Resources.NotFoundException();
+ int tabWidgetPadding = 0;
+ final int childCount = tabWidget.getChildCount();
+ if (childCount > 0) {
+ tabWidgetPadding += tabWidget.getChildAt(0).getPaddingLeft() * 2;
+ }
+ customizeTabBar.getLayoutParams().width = pageWidth + tabWidgetPadding;
+ }
super.onLayout(changed, l, t, r, b);
}
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 6a3c84d03..9022cac18 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -128,8 +128,17 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
}
}
+ /** Syncs the holographic icon views to the child icon views */
+ public void reloadHolographicIcons(boolean createHolographicOutlines) {
+ if (createHolographicOutlines) {
+ mChildren.loadHolographicOutlines();
+ } else {
+ mChildren.clearHolographicOutlines();
+ }
+ }
+
public boolean addViewToCellLayout(View child, int index, int childId,
- PagedViewCellLayout.LayoutParams params, boolean createHolographicOutlines) {
+ PagedViewCellLayout.LayoutParams params) {
final PagedViewCellLayout.LayoutParams lp = params;
// Generate an id for each view, this assumes we have at most 256x256 cells
@@ -149,10 +158,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
if (mAllowHardwareLayerCreation) {
pagedViewIcon.disableCache();
}
- if (createHolographicOutlines) {
- mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(),
- index, lp);
- }
+ mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(),
+ index, lp);
}
return true;
}
@@ -169,11 +176,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
@Override
public void removeViewOnPageAt(int index) {
mChildren.removeViewAt(index);
- // Holographic icons are disabled in certain cases (on lower hardware, or if there is only
- // one page), so check before we try and remove the view at a specified index.
- if (mHolographicChildren.getChildAt(index) != null) {
- mHolographicChildren.removeViewAt(index);
- }
+ mHolographicChildren.removeViewAt(index);
}
@Override
diff --git a/src/com/android/launcher2/PagedViewCellLayoutChildren.java b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
index 92ff46184..6333f7f2e 100644
--- a/src/com/android/launcher2/PagedViewCellLayoutChildren.java
+++ b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
@@ -165,4 +165,26 @@ public class PagedViewCellLayoutChildren extends ViewGroup {
}
}
}
+
+ public void loadHolographicOutlines() {
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View view = getChildAt(i);
+ if (view instanceof PagedViewIcon) {
+ PagedViewIcon icon = (PagedViewIcon) view;
+ icon.loadHolographicIcon();
+ }
+ }
+ }
+
+ public void clearHolographicOutlines() {
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View view = getChildAt(i);
+ if (view instanceof PagedViewIcon) {
+ PagedViewIcon icon = (PagedViewIcon) view;
+ icon.clearHolographicIcon();
+ }
+ }
+ }
}
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index e23f1c6d1..306ff9e7b 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -153,16 +153,29 @@ public class PagedViewIcon extends CachedTextView implements Checkable {
return false;
}
+ public void loadHolographicIcon() {
+ if (mHolographicOutline == null) {
+ mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
+ if (!queueHolographicOutlineCreation()) {
+ getHolographicOutlineView().invalidate();
+ }
+ }
+ }
+ public void clearHolographicIcon() {
+ mHolographicOutline = null;
+ getHolographicOutlineView().invalidate();
+ }
+
public void applyFromApplicationInfo(ApplicationInfo info, PagedViewIconCache cache,
boolean scaleUp, boolean createHolographicOutlines) {
+ mIconCache = cache;
+ mIconCacheKey = new PagedViewIconCache.Key(info);
mIcon = info.iconBitmap;
setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(mIcon), null, null);
setText(info.title);
setTag(info);
if (createHolographicOutlines) {
- mIconCache = cache;
- mIconCacheKey = new PagedViewIconCache.Key(info);
mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
if (!queueHolographicOutlineCreation()) {
getHolographicOutlineView().invalidate();
@@ -217,13 +230,7 @@ public class PagedViewIcon extends CachedTextView implements Checkable {
Bitmap overlay = null;
// draw any blended overlays
- if (mCheckedOutline == null) {
- if (canvas.isHardwareAccelerated() && mHolographicOutline != null
- && mHolographicAlpha > 0) {
- mPaint.setAlpha(mHolographicAlpha);
- overlay = mHolographicOutline;
- }
- } else {
+ if (mCheckedOutline != null) {
mPaint.setAlpha(255);
overlay = mCheckedOutline;
}