diff options
Diffstat (limited to 'src/com/android/launcher2')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher2/FolderIcon.java | 41 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 7 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 24 |
4 files changed, 67 insertions, 13 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 949d87266..0e442eaeb 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -315,7 +315,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen private boolean testDataReady() { // 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(); + if (mContentType == AppsCustomizePagedView.ContentType.Widgets) { + return !mApps.isEmpty() && !mWidgets.isEmpty(); + } else { + return !mApps.isEmpty(); + } } /** Restores the page for an item at the specified index */ @@ -574,7 +578,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen public void setContentType(ContentType type) { mContentType = type; - invalidatePageData(0, true); + invalidatePageData(0, (type != ContentType.Applications)); } public boolean isContentType(ContentType type) { diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java index f1a150856..cde5d947f 100644 --- a/src/com/android/launcher2/FolderIcon.java +++ b/src/com/android/launcher2/FolderIcon.java @@ -27,6 +27,7 @@ import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.os.Parcelable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; @@ -50,6 +51,7 @@ public class FolderIcon extends LinearLayout implements FolderListener { private Launcher mLauncher; Folder mFolder; FolderInfo mInfo; + private static boolean sStaticValuesDirty = true; // The number of icons to display in the private static final int NUM_ITEMS_IN_PREVIEW = 3; @@ -132,18 +134,26 @@ public class FolderIcon extends LinearLayout implements FolderListener { folder.setFolderIcon(icon); folder.bind(folderInfo); icon.mFolder = folder; - icon.mFolderRingAnimator = new FolderRingAnimator(launcher, icon); - - folderInfo.addListener(icon); - Resources res = launcher.getResources(); - if (sSharedFolderLeaveBehind == null) { + + // We need to reload the static values when configuration changes in case they are + // different in another configuration + if (sStaticValuesDirty) { sSharedFolderLeaveBehind = res.getDrawable(R.drawable.portal_ring_rest); } + icon.mFolderRingAnimator = new FolderRingAnimator(launcher, icon); + folderInfo.addListener(icon); + return icon; } + @Override + protected Parcelable onSaveInstanceState() { + sStaticValuesDirty = true; + return super.onSaveInstanceState(); + } + public static class FolderRingAnimator { public int mCellX; public int mCellY; @@ -167,15 +177,14 @@ public class FolderIcon extends LinearLayout implements FolderListener { mOuterRingDrawable = res.getDrawable(R.drawable.portal_ring_outer_holo); mInnerRingDrawable = res.getDrawable(R.drawable.portal_ring_inner_holo); - if (sPreviewSize < 0 || sPreviewPadding < 0) { + // We need to reload the static values when configuration changes in case they are + // different in another configuration + if (sStaticValuesDirty) { sPreviewSize = res.getDimensionPixelSize(R.dimen.folder_preview_size); sPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding); - } - if (sSharedOuterRingDrawable == null) { sSharedOuterRingDrawable = res.getDrawable(R.drawable.portal_ring_outer_holo); - } - if (sSharedInnerRingDrawable == null) { sSharedInnerRingDrawable = res.getDrawable(R.drawable.portal_ring_inner_holo); + sStaticValuesDirty = false; } } @@ -554,6 +563,18 @@ public class FolderIcon extends LinearLayout implements FolderListener { va.start(); } + public void setTextVisible(boolean visible) { + if (visible) { + mFolderName.setVisibility(VISIBLE); + } else { + mFolderName.setVisibility(INVISIBLE); + } + } + + public boolean getTextVisible() { + return mFolderName.getVisibility() == VISIBLE; + } + public void onItemsChanged() { invalidate(); requestLayout(); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index b42a6f7f7..22a34e6c7 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -24,6 +24,7 @@ import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.app.Activity; +import android.app.ActivityManager; import android.app.AlertDialog; import android.app.Dialog; import android.app.SearchManager; @@ -1060,6 +1061,8 @@ public final class Launcher extends Activity void closeSystemDialogs() { getWindow().closeAllPanels(); + /** + * We should remove this code when we remove all the dialog code. try { dismissDialog(DIALOG_CREATE_SHORTCUT); // Unlock the workspace if the dialog was showing @@ -1073,6 +1076,7 @@ public final class Launcher extends Activity } catch (Exception e) { // An exception is thrown if the dialog is not visible, which is fine } + */ // Whatever we were doing is hereby canceled. mWaitingForResult = false; @@ -2981,6 +2985,9 @@ public final class Launcher extends Activity // TEMPORARY: DISABLE CLINGS ON LARGE UI if (LauncherApplication.isScreenLarge()) return; + // disable clings when running in a test harness + if(ActivityManager.isRunningInTestHarness()) return; + // Enable the clings only if they have not been dismissed before SharedPreferences prefs = getSharedPreferences("com.android.launcher2.prefs", Context.MODE_PRIVATE); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index b6a1666ab..1c13f1409 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -465,6 +465,11 @@ public class Workspace extends SmoothPagedView layout = mLauncher.getHotseat().getLayout(); child.setOnKeyListener(null); + // Hide folder title in the hotseat + if (child instanceof FolderIcon) { + ((FolderIcon) child).setTextVisible(false); + } + if (screen < 0) { screen = mLauncher.getHotseat().getOrderInHotseat(x, y); } else { @@ -474,6 +479,11 @@ public class Workspace extends SmoothPagedView y = mLauncher.getHotseat().getCellYFromOrder(screen); } } else { + // Show folder title if not in the hotseat + if (child instanceof FolderIcon) { + ((FolderIcon) child).setTextVisible(true); + } + layout = (CellLayout) getChildAt(screen); child.setOnKeyListener(new BubbleTextViewKeyEventListener()); } @@ -1900,6 +1910,8 @@ public class Workspace extends SmoothPagedView final Rect clipRect = mTempRect; v.getDrawingRect(clipRect); + boolean textVisible = false; + destCanvas.save(); if (v instanceof TextView && pruneToDrawable) { Drawable d = ((TextView) v).getCompoundDrawables()[1]; @@ -1908,7 +1920,12 @@ public class Workspace extends SmoothPagedView d.draw(destCanvas); } else { if (v instanceof FolderIcon) { - clipRect.bottom = getResources().getDimensionPixelSize(R.dimen.folder_preview_size); + // For FolderIcons the text can bleed into the icon area, and so we need to + // hide the text completely (which can't be achieved by clipping). + if (((FolderIcon) v).getTextVisible()) { + ((FolderIcon) v).setTextVisible(false); + textVisible = true; + } } else if (v instanceof BubbleTextView) { final BubbleTextView tv = (BubbleTextView) v; clipRect.bottom = tv.getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V + @@ -1921,6 +1938,11 @@ public class Workspace extends SmoothPagedView destCanvas.translate(-v.getScrollX() + padding / 2, -v.getScrollY() + padding / 2); destCanvas.clipRect(clipRect, Op.REPLACE); v.draw(destCanvas); + + // Restore text visibility of FolderIcon if necessary + if (textVisible) { + ((FolderIcon) v).setTextVisible(true); + } } destCanvas.restore(); } |