diff options
author | Steve Kondik <shade@chemlab.org> | 2012-11-05 12:14:58 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2012-11-05 12:14:58 -0800 |
commit | f5baac88b85efa794ae7909f784538f379dd36f2 (patch) | |
tree | c55b82edcaae558d71fc12f856bb93d9ae8ce8dc /src/com/cyanogenmod/trebuchet/PagedViewWidget.java | |
parent | 5bf25aecb90bd49ca3a8affea877e570b75baed6 (diff) | |
parent | 4124016ae5c8174aa53433894b896604ffa52c67 (diff) | |
download | packages_apps_trebuchet-f5baac88b85efa794ae7909f784538f379dd36f2.zip packages_apps_trebuchet-f5baac88b85efa794ae7909f784538f379dd36f2.tar.gz packages_apps_trebuchet-f5baac88b85efa794ae7909f784538f379dd36f2.tar.bz2 |
Merge branch 'master' of https://android.googlesource.com/platform/packages/apps/Launcher2 into aosp
Conflicts:
res/layout-land/drop_target_bar.xml
src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java
src/com/cyanogenmod/trebuchet/Launcher.java
src/com/cyanogenmod/trebuchet/LauncherModel.java
Change-Id: I5aa702e333da27645b0d765b233f4d8a89991cb9
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/PagedViewWidget.java')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/PagedViewWidget.java | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/com/cyanogenmod/trebuchet/PagedViewWidget.java b/src/com/cyanogenmod/trebuchet/PagedViewWidget.java index c1dfcdc..6fa0d39 100644 --- a/src/com/cyanogenmod/trebuchet/PagedViewWidget.java +++ b/src/com/cyanogenmod/trebuchet/PagedViewWidget.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; +import android.graphics.Rect; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; @@ -44,6 +45,7 @@ public class PagedViewWidget extends LinearLayout { boolean mShortPressTriggered = false; static PagedViewWidget sShortpressTarget = null; boolean mIsAppWidget; + private final Rect mOriginalImagePadding = new Rect(); public PagedViewWidget(Context context) { this(context, null); @@ -63,6 +65,17 @@ public class PagedViewWidget extends LinearLayout { setClipToPadding(false); } + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + final ImageView image = (ImageView) findViewById(R.id.widget_preview); + mOriginalImagePadding.left = image.getPaddingLeft(); + mOriginalImagePadding.top = image.getPaddingTop(); + mOriginalImagePadding.right = image.getPaddingRight(); + mOriginalImagePadding.bottom = image.getPaddingBottom(); + } + public static void setDeletePreviewsWhenDetachedFromWindow(boolean value) { sDeletePreviewsWhenDetachedFromWindow = value; } @@ -79,7 +92,7 @@ public class PagedViewWidget extends LinearLayout { preview.getBitmap().recycle(); } image.setImageDrawable(null); - } + } } } @@ -117,8 +130,8 @@ public class PagedViewWidget extends LinearLayout { public int[] getPreviewSize() { final ImageView i = (ImageView) findViewById(R.id.widget_preview); int[] maxSize = new int[2]; - maxSize[0] = i.getWidth() - i.getPaddingLeft() - i.getPaddingRight(); - maxSize[1] = i.getHeight() - i.getPaddingTop(); + maxSize[0] = i.getWidth() - mOriginalImagePadding.left - mOriginalImagePadding.right; + maxSize[1] = i.getHeight() - mOriginalImagePadding.top; return maxSize; } @@ -132,10 +145,10 @@ public class PagedViewWidget extends LinearLayout { // center horizontally int[] imageSize = getPreviewSize(); int centerAmount = (imageSize[0] - preview.getIntrinsicWidth()) / 2; - image.setPadding(image.getPaddingLeft() + centerAmount, - image.getPaddingTop(), - image.getPaddingRight(), - image.getPaddingBottom()); + image.setPadding(mOriginalImagePadding.left + centerAmount, + mOriginalImagePadding.top, + mOriginalImagePadding.right, + mOriginalImagePadding.bottom); } image.setAlpha(1f); image.mAllowRequestLayout = true; |