diff options
author | Winson Chung <winsonc@google.com> | 2013-09-20 11:32:26 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2013-09-20 11:32:26 -0700 |
commit | 89f9705077c054b541af7da52be832760e2ae2e8 (patch) | |
tree | f1bb9d966eb65fd43509f2695f3185b95adc1576 /src/com/android/launcher3/CellLayout.java | |
parent | 37cab1bc25b99e4ac2429f7d965342a534d441b4 (diff) | |
download | android_packages_apps_Trebuchet-89f9705077c054b541af7da52be832760e2ae2e8.tar.gz android_packages_apps_Trebuchet-89f9705077c054b541af7da52be832760e2ae2e8.tar.bz2 android_packages_apps_Trebuchet-89f9705077c054b541af7da52be832760e2ae2e8.zip |
Fixing small regression in PageIndicators add page, fixing NPE (Bug 10779956)
Change-Id: I7ff711c6fc97987efc57bf023913e33e31ccf140
Diffstat (limited to 'src/com/android/launcher3/CellLayout.java')
-rw-r--r-- | src/com/android/launcher3/CellLayout.java | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 04f4d8154..901f42bdf 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -497,32 +497,31 @@ public class CellLayout extends ViewGroup { int height = width; cellToPoint(fra.mCellX, fra.mCellY, mTempLocation); View child = getChildAt(fra.mCellX, fra.mCellY); + if (child != null) { + int centerX = mTempLocation[0] + mCellWidth / 2; + int centerY = mTempLocation[1] + previewOffset / 2 + + child.getPaddingTop() + grid.folderBackgroundOffset; - int centerX = mTempLocation[0] + mCellWidth / 2; - int centerY = mTempLocation[1] + previewOffset / 2 + - child.getPaddingTop() + grid.folderBackgroundOffset; + canvas.save(); + canvas.translate(centerX - width / 2, centerY - height / 2); + d.setBounds(0, 0, width, height); + d.draw(canvas); + canvas.restore(); - canvas.save(); - canvas.translate(centerX - width / 2, centerY - height / 2); - d.setBounds(0, 0, width, height); - d.draw(canvas); - canvas.restore(); + // Draw inner ring + d = FolderRingAnimator.sSharedInnerRingDrawable; + width = (int) (fra.getInnerRingSize() * getChildrenScale()); + height = width; - // Draw inner ring - d = FolderRingAnimator.sSharedInnerRingDrawable; - width = (int) (fra.getInnerRingSize() * getChildrenScale()); - height = width; - cellToPoint(fra.mCellX, fra.mCellY, mTempLocation); - child = getChildAt(fra.mCellX, fra.mCellY); - - centerX = mTempLocation[0] + mCellWidth / 2; - centerY = mTempLocation[1] + previewOffset / 2 + - child.getPaddingTop() + grid.folderBackgroundOffset; - canvas.save(); - canvas.translate(centerX - width / 2, centerY - width / 2); - d.setBounds(0, 0, width, height); - d.draw(canvas); - canvas.restore(); + centerX = mTempLocation[0] + mCellWidth / 2; + centerY = mTempLocation[1] + previewOffset / 2 + + child.getPaddingTop() + grid.folderBackgroundOffset; + canvas.save(); + canvas.translate(centerX - width / 2, centerY - width / 2); + d.setBounds(0, 0, width, height); + d.draw(canvas); + canvas.restore(); + } } if (mFolderLeaveBehindCell[0] >= 0 && mFolderLeaveBehindCell[1] >= 0) { @@ -532,15 +531,17 @@ public class CellLayout extends ViewGroup { cellToPoint(mFolderLeaveBehindCell[0], mFolderLeaveBehindCell[1], mTempLocation); View child = getChildAt(mFolderLeaveBehindCell[0], mFolderLeaveBehindCell[1]); - int centerX = mTempLocation[0] + mCellWidth / 2; - int centerY = mTempLocation[1] + previewOffset / 2 + - child.getPaddingTop() + grid.folderBackgroundOffset; - - canvas.save(); - canvas.translate(centerX - width / 2, centerY - width / 2); - d.setBounds(0, 0, width, height); - d.draw(canvas); - canvas.restore(); + if (child != null) { + int centerX = mTempLocation[0] + mCellWidth / 2; + int centerY = mTempLocation[1] + previewOffset / 2 + + child.getPaddingTop() + grid.folderBackgroundOffset; + + canvas.save(); + canvas.translate(centerX - width / 2, centerY - width / 2); + d.setBounds(0, 0, width, height); + d.draw(canvas); + canvas.restore(); + } } } |