diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2016-02-18 11:51:59 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-02-18 11:51:59 -0800 |
commit | 5c52f3ce0640b13337b3715dd0f4f1debbc14e14 (patch) | |
tree | d1626c929dbc60b9828cd4db284af6efc6dab210 /src | |
parent | 525e2ab54b0a2830e8829055660c66e5e3cd1e48 (diff) | |
parent | dcc252357983e570c4d75cca9c5a60aef5d8b904 (diff) | |
download | android_packages_apps_Gallery2-5c52f3ce0640b13337b3715dd0f4f1debbc14e14.tar.gz android_packages_apps_Gallery2-5c52f3ce0640b13337b3715dd0f4f1debbc14e14.tar.bz2 android_packages_apps_Gallery2-5c52f3ce0640b13337b3715dd0f4f1debbc14e14.zip |
Merge "Gallery2: fix crash when tap screen after all photos were deleted."
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/ui/TimeLineSlotView.java | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/com/android/gallery3d/ui/TimeLineSlotView.java b/src/com/android/gallery3d/ui/TimeLineSlotView.java index 64ee5a2d1..108cb3486 100644 --- a/src/com/android/gallery3d/ui/TimeLineSlotView.java +++ b/src/com/android/gallery3d/ui/TimeLineSlotView.java @@ -725,48 +725,48 @@ public class TimeLineSlotView extends GLView { ArrayList<MediaItem> mediaItemlist = new ArrayList<MediaItem>(); if (mRenderer != null) { mediaItemlist = mRenderer.getAllMediaItems(); - } + } + if (mHeightList == null) { + mHeightList = new ArrayList<Integer>(); + } + if (mMediaSlotMap == null) { + mMediaSlotMap = new HashMap<Integer, RectSlot>(); + } + mHeightList.clear(); + mMediaSlotMap.clear(); if (mediaItemlist != null && mediaItemlist.size() > 0) { - if (mHeightList == null) { - mHeightList = new ArrayList<Integer>(); - } - if (mMediaSlotMap == null) { - mMediaSlotMap = new HashMap<Integer, RectSlot>(); - } - mHeightList.clear(); - mMediaSlotMap.clear(); boolean isPrevTitle = false; int j = 0; int col = 0; - int totalHieght = 0; + int totalHeight = 0; for (int i = 0; i < mediaItemlist.size(); ++i) { MediaItem info = mediaItemlist.get(i); if (info.getMediaType() == MediaObject.MEDIA_TYPE_TIMELINE_TITLE) { - totalHieght += (mSpec.titleHeight+mSlotGap); + totalHeight += (mSpec.titleHeight + mSlotGap); isPrevTitle = true; - col =0; + col = 0; } else { if (isPrevTitle) { - j =0; + j = 0; isPrevTitle = false; } else { ++j; } - if(j%mUnitCount == 0) { - totalHieght += (mSlotHeight+mSlotGap); - col =0; + if (j % mUnitCount == 0) { + totalHeight += (mSlotHeight + mSlotGap); + col = 0; } else { - col = j%mUnitCount; + col = j % mUnitCount; } } - mHeightList.add(totalHieght); + mHeightList.add(totalHeight); if (View.LAYOUT_DIRECTION_RTL == TextUtils .getLayoutDirectionFromLocale(Locale.getDefault())) { - col = mUnitCount - col -1; + col = mUnitCount - col - 1; } - RectSlot rectslot = new RectSlot(info.getMediaType(), i, col, totalHieght); + RectSlot rectslot = new RectSlot(info.getMediaType(), i, col, totalHeight); mMediaSlotMap.put(rectslot.slotIndex, rectslot); } mContentLength = mHeightList.get(mHeightList.size() -1); |