diff options
author | Adam Cohen <adamcohen@google.com> | 2011-08-23 21:07:26 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2011-08-23 22:46:56 -0700 |
commit | 099f60d51f6310e1290687e83958e665b3324504 (patch) | |
tree | 1ce260449b1f53fa41d3c842ce0d83f0c6aca59a /src/com/android/launcher2/FolderIcon.java | |
parent | fba22b172db7556c48e704667baecce8ed22d904 (diff) | |
download | android_packages_apps_Trebuchet-099f60d51f6310e1290687e83958e665b3324504.tar.gz android_packages_apps_Trebuchet-099f60d51f6310e1290687e83958e665b3324504.tar.bz2 android_packages_apps_Trebuchet-099f60d51f6310e1290687e83958e665b3324504.zip |
Fixing folder icon in landscape, issue 5135333
Change-Id: Idf46b12a947bdc0e56993b8827021855d5349bc1
Diffstat (limited to 'src/com/android/launcher2/FolderIcon.java')
-rw-r--r-- | src/com/android/launcher2/FolderIcon.java | 41 |
1 files changed, 31 insertions, 10 deletions
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(); |