Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,16 @@ public abstract class BaseSliderView {
*/
private ScaleType mScaleType = ScaleType.Fit;

private int resizeWidth = -1;
private int resizeHeight = -1;

public void setResizeDimensions(int resizeWidth, int resizeHeight) {
this.resizeHeight = resizeHeight;
this.resizeWidth = resizeWidth;
}

public enum ScaleType{
CenterCrop, CenterInside, Fit, FitCenterCrop
CenterCrop, CenterInside, Fit, FitCenterCrop, OnlyScaleDown
}

protected BaseSliderView(Context context) {
Expand Down Expand Up @@ -241,6 +249,13 @@ public void onClick(View v) {
case CenterInside:
rq.fit().centerInside();
break;
case OnlyScaleDown:
if (resizeWidth == -1 && resizeHeight == -1) {
throw new IllegalArgumentException("At least one dimension has to be a positive number");
}
rq.resize(resizeWidth, resizeHeight)
.onlyScaleDown();
break;
}

rq.into(targetImageView,new Callback() {
Expand Down