diff options
author | nicolasroard <nicolasroard@google.com> | 2013-09-20 19:00:33 -0700 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-09-23 11:30:39 -0700 |
commit | 32646aabd8228e1494ba090a02ffb8adaa369127 (patch) | |
tree | c30b5d7632607b0f7a35f9c6a88fc391719de15c /src | |
parent | 3dcb77a23d80046aa0c9af9ec32394432031d417 (diff) | |
download | android_packages_apps_Gallery2-32646aabd8228e1494ba090a02ffb8adaa369127.tar.gz android_packages_apps_Gallery2-32646aabd8228e1494ba090a02ffb8adaa369127.tar.bz2 android_packages_apps_Gallery2-32646aabd8228e1494ba090a02ffb8adaa369127.zip |
Fix reset
bug:10788166
Change-Id: I989c2caef8ccf4ff7ca84545aed35941248f8034
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 14 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/history/HistoryManager.java | 7 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 9d5005e32..c4aca73a7 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -138,6 +138,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL public static final String TINY_PLANET_ACTION = "com.android.camera.action.TINY_PLANET"; public static final String LAUNCH_FULLSCREEN = "launch-fullscreen"; + public static final boolean RESET_TO_LOADED = false; private ImageShow mImageShow = null; private View mSaveButton = null; @@ -1264,8 +1265,17 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL HistoryManager adapter = mMasterImage.getHistory(); adapter.reset(); HistoryItem historyItem = adapter.getItem(0); - ImagePreset original = new ImagePreset(historyItem.getImagePreset()); - mMasterImage.setPreset(original, historyItem.getFilterRepresentation(), true); + ImagePreset original = null; + if (RESET_TO_LOADED) { + original = new ImagePreset(historyItem.getImagePreset()); + } else { + original = new ImagePreset(); + } + FilterRepresentation rep = null; + if (historyItem != null) { + rep = historyItem.getFilterRepresentation(); + } + mMasterImage.setPreset(original, rep, true); invalidateViews(); backToMain(); } diff --git a/src/com/android/gallery3d/filtershow/history/HistoryManager.java b/src/com/android/gallery3d/filtershow/history/HistoryManager.java index 755e2ea58..569b299cc 100644 --- a/src/com/android/gallery3d/filtershow/history/HistoryManager.java +++ b/src/com/android/gallery3d/filtershow/history/HistoryManager.java @@ -42,6 +42,9 @@ public class HistoryManager { } public HistoryItem getItem(int position) { + if (position > mHistoryItems.size() - 1) { + return null; + } return mHistoryItems.elementAt(position); } @@ -58,7 +61,7 @@ public class HistoryManager { } public boolean canReset() { - if (getCount() <= 1) { + if (getCount() <= 0) { return false; } return true; @@ -108,9 +111,7 @@ public class HistoryManager { if (getCount() == 0) { return; } - HistoryItem first = getItem(getCount() - 1); clear(); - addHistoryItem(first); updateMenuItems(); } |