summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java14
-rw-r--r--src/com/android/gallery3d/filtershow/history/HistoryManager.java7
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();
}