-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #16. Added support for setAspectRatio, useSourceImageAspectRatio …
…and setMaxResultSize UCrop features.
- Loading branch information
Victor
committed
May 29, 2016
1 parent
2009e5e
commit 2b0c9f6
Showing
5 changed files
with
113 additions
and
9 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
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
78 changes: 78 additions & 0 deletions
78
rx_paparazzo/src/main/java/com/fuck_boilerplate/rx_paparazzo/entities/Options.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,78 @@ | ||
/* | ||
* Copyright 2016 FuckBoilerplate | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.fuck_boilerplate.rx_paparazzo.entities; | ||
|
||
import android.support.annotation.IntRange; | ||
|
||
import com.yalantis.ucrop.UCrop; | ||
|
||
public class Options extends UCrop.Options { | ||
private boolean useSourceImageAspectRatio; | ||
private float x, y; | ||
private int width, height; | ||
|
||
/** | ||
* Set an aspect ratio for crop bounds. | ||
* User won't see the menu with other ratios options. | ||
* | ||
* @param x aspect ratio X | ||
* @param y aspect ratio Y | ||
*/ | ||
public void setAspectRatio(float x, float y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
/** | ||
* Set an aspect ratio for crop bounds that is evaluated from source image width and height. | ||
* User won't see the menu with other ratios options. | ||
*/ | ||
public void useSourceImageAspectRatio() { | ||
useSourceImageAspectRatio = true; | ||
} | ||
|
||
/** | ||
* Set maximum size for result cropped image. | ||
* | ||
* @param width max cropped image width | ||
* @param height max cropped image height | ||
*/ | ||
public void setMaxResultSize(@IntRange(from = 100) int width, @IntRange(from = 100) int height) { | ||
this.width = width; | ||
this.height = height; | ||
} | ||
|
||
public boolean isUseSourceImageAspectRatio() { | ||
return useSourceImageAspectRatio; | ||
} | ||
|
||
public float getX() { | ||
return x; | ||
} | ||
|
||
public float getY() { | ||
return y; | ||
} | ||
|
||
public int getWidth() { | ||
return width; | ||
} | ||
|
||
public int getHeight() { | ||
return height; | ||
} | ||
} |
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