Skip to content
Open
Show file tree
Hide file tree
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
16 changes: 11 additions & 5 deletions zoomy/src/main/java/com/ablanco/zoomy/ZoomableTouchListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public boolean onDoubleTap(MotionEvent e) {
private Runnable mEndingZoomAction = new Runnable() {
@Override
public void run() {
removeFromDecorView(mShadow);
if (mConfig.isShadowEnabled()) {
removeFromDecorView(mShadow);
}
removeFromDecorView(mZoomableView);
mTarget.setVisibility(View.VISIBLE);
mZoomableView = null;
Expand Down Expand Up @@ -196,10 +198,12 @@ private void startZoomingView(View view) {
mZoomableView.setX(mTargetViewCords.x);
mZoomableView.setY(mTargetViewCords.y);

if (mShadow == null) mShadow = new View(mTarget.getContext());
mShadow.setBackgroundResource(0);
if (mConfig.isShadowEnabled()) {
if (mShadow == null) mShadow = new View(mTarget.getContext());
mShadow.setBackgroundResource(0);
addToDecorView(mShadow);
}

addToDecorView(mShadow);
addToDecorView(mZoomableView);

//trick for simulating the view is getting out of his parent
Expand All @@ -222,7 +226,9 @@ public boolean onScale(ScaleGestureDetector detector) {

mZoomableView.setScaleX(mScaleFactor);
mZoomableView.setScaleY(mScaleFactor);
obscureDecorView(mScaleFactor);
if (mConfig.isShadowEnabled()) {
obscureDecorView(mScaleFactor);
}
return true;
}

Expand Down
7 changes: 7 additions & 0 deletions zoomy/src/main/java/com/ablanco/zoomy/Zoomy.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public Builder enableImmersiveMode(boolean enable) {
return this;
}

public Builder enableShadow(boolean enable) {
checkNotDisposed();
if (mConfig == null) mConfig = new ZoomyConfig();
this.mConfig.setShadowEnabled(enable);
return this;
}

public Builder interpolator(Interpolator interpolator) {
checkNotDisposed();
this.mZoomInterpolator = interpolator;
Expand Down
9 changes: 9 additions & 0 deletions zoomy/src/main/java/com/ablanco/zoomy/ZoomyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class ZoomyConfig {

private boolean zoomAnimationEnabled = true;
private boolean immersiveModeEnabled = true;
private boolean shadowEnabled = true;

public boolean isZoomAnimationEnabled() {
return zoomAnimationEnabled;
Expand All @@ -25,4 +26,12 @@ public boolean isImmersiveModeEnabled() {
public void setImmersiveModeEnabled(boolean immersiveModeEnabled) {
this.immersiveModeEnabled = immersiveModeEnabled;
}

public boolean isShadowEnabled() {
return shadowEnabled;
}

public void setShadowEnabled(boolean shadowEnabled) {
this.shadowEnabled = shadowEnabled;
}
}