diff options
author | zhuw <zhuw@codeaurora.org> | 2018-04-20 17:18:03 +0800 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2018-05-19 06:00:47 +0200 |
commit | 1a8915fb737cb739fc2eef58d0d50ac80724a92d (patch) | |
tree | d0362473b1415e20eab3b3d2af26156f54fc0911 | |
parent | 02511afd6844320ece5fbdf80099068f0e4c533b (diff) | |
download | android_packages_apps_Gallery2-1a8915fb737cb739fc2eef58d0d50ac80724a92d.tar.gz android_packages_apps_Gallery2-1a8915fb737cb739fc2eef58d0d50ac80724a92d.tar.bz2 android_packages_apps_Gallery2-1a8915fb737cb739fc2eef58d0d50ac80724a92d.zip |
Add new rule about watermark
watermark only support single edit operation
Change-Id: I292f545a4facf158d9efbb4a47feebb4e64ad378
-rwxr-xr-x | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 16 | ||||
-rwxr-xr-x | src/com/android/gallery3d/filtershow/category/MainPanel.java | 16 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 0f8c348bb..16e5cf7ad 100755 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -1418,6 +1418,13 @@ public class FilterShowActivity extends AbstractPermissionActivity implements On if (representation == null) { return; } + if (hasWaterMark && representation.getFilterType() != FilterRepresentation.TYPE_WATERMARK && + representation.getFilterType() != + FilterWatermarkRepresentation.TYPE_WATERMARK_CATEGORY) { + clearWaterMark(); + resetHistory(); + showWatermarkButton(false); + } Fragment currentPanel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG); @@ -2446,6 +2453,15 @@ public class FilterShowActivity extends AbstractPermissionActivity implements On MasterImage.getImage().setCurrentFilter(null); MasterImage.getImage().setCurrentFilterRepresentation(null); } + showWatermarkButton(true); + } + + private void showWatermarkButton(boolean visible) { + Fragment currentPanel = getSupportFragmentManager() + .findFragmentByTag(MainPanel.FRAGMENT_TAG); + if (currentPanel instanceof MainPanel) { + ((MainPanel) currentPanel).showWatermarkButton(visible); + } } public void backToMain() { diff --git a/src/com/android/gallery3d/filtershow/category/MainPanel.java b/src/com/android/gallery3d/filtershow/category/MainPanel.java index 26ae32734..cf5d2edc6 100755 --- a/src/com/android/gallery3d/filtershow/category/MainPanel.java +++ b/src/com/android/gallery3d/filtershow/category/MainPanel.java @@ -29,6 +29,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.LinearLayout; +import android.widget.Toast; import org.codeaurora.gallery.R; import org.json.JSONObject; @@ -232,7 +233,14 @@ public class MainPanel extends Fragment implements BottomPanel.BottomPanelDelega waterMarkButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - showPanel(WATERMARK); + if (MasterImage.getImage().getHistory().getItem(1) == null) { + waterMarkButton.setVisibility(View.VISIBLE); + showPanel(WATERMARK); + } else { + Toast.makeText(getActivity(), "Watermark only support single edit", + Toast.LENGTH_SHORT).show(); + waterMarkButton.setVisibility(View.GONE); + } } }); looksButton.setOnClickListener(new View.OnClickListener() { @@ -745,4 +753,10 @@ public class MainPanel extends Fragment implements BottomPanel.BottomPanelDelega dualCamButton.setVisibility(visible ? View.VISIBLE : View.GONE); } } + + public void showWatermarkButton(boolean visible) { + if (waterMarkButton != null) { + waterMarkButton.setVisibility(visible ? View.VISIBLE : View.GONE); + } + } } |