Commit 1a8915fb authored by zhuw's avatar zhuw Committed by Arne Coucheron

Add new rule about watermark

watermark only support single edit operation

Change-Id: I292f545a4facf158d9efbb4a47feebb4e64ad378
parent 02511afd
......@@ -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() {
......
......@@ -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);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment