Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
7d32c75
commit 650463a
Showing
3 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
photoeditor/src/main/java/ja/burhanrashid52/photoeditor/SaveSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package ja.burhanrashid52.photoeditor; | ||
|
||
import android.graphics.Bitmap; | ||
|
||
/** | ||
* @author <a href="https://github.com/burhanrashid52">Burhanuddin Rashid</a> | ||
* @since 8/8/2018 | ||
* Builder Class to apply multiple save options | ||
*/ | ||
public class SaveSettings { | ||
private boolean isTransparencyEnabled; | ||
private boolean isClearViewsEnabled; | ||
|
||
boolean isTransparencyEnabled() { | ||
return isTransparencyEnabled; | ||
} | ||
|
||
boolean isClearViewsEnabled() { | ||
return isClearViewsEnabled; | ||
} | ||
|
||
private SaveSettings(Builder builder) { | ||
this.isClearViewsEnabled = builder.isClearViewsEnabled; | ||
this.isTransparencyEnabled = builder.isTransparencyEnabled; | ||
} | ||
|
||
public static class Builder { | ||
private boolean isTransparencyEnabled = true; | ||
private boolean isClearViewsEnabled = true; | ||
|
||
/** | ||
* Define a flag to enable transparency while saving image | ||
* | ||
* @param transparencyEnabled true if enabled | ||
* @return Builder | ||
* @see BitmapUtil#removeTransparency(Bitmap) | ||
*/ | ||
public Builder setTransparencyEnabled(boolean transparencyEnabled) { | ||
isTransparencyEnabled = transparencyEnabled; | ||
return this; | ||
} | ||
|
||
/** | ||
* Define a flag to clear the view after saving the image | ||
* | ||
* @param clearViewsEnabled true if you want to clear all the views on {@link PhotoEditorView} | ||
* @return | ||
*/ | ||
public Builder setClearViewsEnabled(boolean clearViewsEnabled) { | ||
isClearViewsEnabled = clearViewsEnabled; | ||
return this; | ||
} | ||
|
||
public SaveSettings build() { | ||
return new SaveSettings(this); | ||
} | ||
} | ||
} |