summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChao Zhang <chaoz@codeaurora.org>2016-04-20 11:08:03 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-04-21 01:28:12 -0700
commit4dbacef51b9aed14cfa34a8a72ec4fe07684dc9e (patch)
tree6b102242fdeb1d8e28ac69db5f68022e28c649fc /src
parent83f6d7921826802781618763918b89445c5feb12 (diff)
downloadandroid_packages_apps_Gallery2-4dbacef51b9aed14cfa34a8a72ec4fe07684dc9e.tar.gz
android_packages_apps_Gallery2-4dbacef51b9aed14cfa34a8a72ec4fe07684dc9e.tar.bz2
android_packages_apps_Gallery2-4dbacef51b9aed14cfa34a8a72ec4fe07684dc9e.zip
Gallery2: fix some abnormal of comparison button in photo editor.
1. don't call backToMain() when press comparison button. 2. don't call updateCategories() when press comparison button. 3. fix comparison button disappeared when exit Crop editor. 4. hide comparison button in Straighten editor. Change-Id: Ib5d2a9df59d2e1c5ed0d0764dc7520c1ed518207 CRs-Fixed: 1005753
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java14
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java1
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/MasterImage.java16
3 files changed, 24 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 39dfbd42e..a5b58f2b1 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -404,9 +404,8 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
HistoryManager adapter = mMasterImage.getHistory();
int position = adapter.backToOriginal();// adapter.undo();
- mMasterImage.onHistoryItemClick(position);
+ mMasterImage.onHistoryItemClick(position, false);
v.setPressed(true);
- backToMain();
invalidateViews();
}
if (action == MotionEvent.ACTION_UP
@@ -415,7 +414,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
v.setPressed(false);
HistoryManager adapter = mMasterImage.getHistory();
int position = adapter.backToCurrent();
- mMasterImage.onHistoryItemClick(position);
+ mMasterImage.onHistoryItemClick(position, false);
invalidateViews();
}
@@ -1654,13 +1653,18 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
loadMainPanel();
showDefaultImageView();
+ showComparisonButton();
}
- @Override
- public void onBackPressed() {
+ private void showComparisonButton() {
if (imgComparison != null && imgComparison.getVisibility() == View.GONE) {
imgComparison.setVisibility(View.VISIBLE);
}
+ }
+
+ @Override
+ public void onBackPressed() {
+ showComparisonButton();
Fragment currentPanel = getSupportFragmentManager().findFragmentByTag(
MainPanel.FRAGMENT_TAG);
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java b/src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java
index 829af18eb..cec45f15f 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageStraighten.java
@@ -249,6 +249,7 @@ public class ImageStraighten extends ImageShow {
MasterImage.getImage().invalidateFiltersOnly();
return;
}
+ toggleComparisonButtonVisibility();
GeometryMathUtils.initializeHolder(mDrawHolder, mLocalRep);
mDrawHolder.straighten = mAngle;
int imageWidth = image.getWidth();
diff --git a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
index c1c9d693d..b2aae85a6 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
@@ -334,6 +334,12 @@ public class MasterImage implements RenderingRequestCaller {
public synchronized void setPreset(ImagePreset preset,
FilterRepresentation change,
boolean addToHistory) {
+ setPreset(preset, change, addToHistory, true);
+ }
+
+ public synchronized void setPreset(ImagePreset preset,
+ FilterRepresentation change,
+ boolean addToHistory, boolean updateCategory) {
if (DEBUG) {
preset.showFilters();
}
@@ -345,10 +351,16 @@ public class MasterImage implements RenderingRequestCaller {
}
updatePresets(true);
resetGeometryImages(false);
- mActivity.updateCategories();
+ if (updateCategory) {
+ mActivity.updateCategories();
+ }
}
public void onHistoryItemClick(int position) {
+ onHistoryItemClick(position, true);
+ }
+
+ public void onHistoryItemClick(int position, boolean updateCategory) {
HistoryItem historyItem = mHistory.getItem(position);
// We need a copy from the history
if (historyItem == null) {
@@ -356,7 +368,7 @@ public class MasterImage implements RenderingRequestCaller {
}
ImagePreset newPreset = new ImagePreset(historyItem.getImagePreset());
// don't need to add it to the history
- setPreset(newPreset, historyItem.getFilterRepresentation(), false);
+ setPreset(newPreset, historyItem.getFilterRepresentation(), false, updateCategory);
mHistory.setCurrentPreset(position);
}