mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Disable image rotation in ViewImageActivity. Disable dispatching touch event in ViewImageActivity when the image is zooming in or out in order to view the image.
This commit is contained in:
parent
eb973138f7
commit
3c1423a127
@ -32,6 +32,8 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.alexvasilkov.gestures.GestureController;
|
||||||
|
import com.alexvasilkov.gestures.State;
|
||||||
import com.alexvasilkov.gestures.views.GestureImageView;
|
import com.alexvasilkov.gestures.views.GestureImageView;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.load.DataSource;
|
import com.bumptech.glide.load.DataSource;
|
||||||
@ -69,6 +71,7 @@ public class ViewImageActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private float totalLengthY = 0.0f;
|
private float totalLengthY = 0.0f;
|
||||||
private float touchY = -1.0f;
|
private float touchY = -1.0f;
|
||||||
|
private float zoom = 1.0f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -256,10 +259,19 @@ public class ViewImageActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
imageView.getController().getSettings()
|
imageView.getController().addOnStateChangeListener(new GestureController.OnStateChangeListener() {
|
||||||
.setPanEnabled(true)
|
@Override
|
||||||
.setRotationEnabled(true)
|
public void onStateChanged(State state) {
|
||||||
.setRestrictRotation(true);
|
zoom = state.getZoom();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStateReset(State oldState, State newState) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
imageView.getController().getSettings().setPanEnabled(true);
|
||||||
|
|
||||||
Glide.with(this).load(mImageUrl).listener(new RequestListener<Drawable>() {
|
Glide.with(this).load(mImageUrl).listener(new RequestListener<Drawable>() {
|
||||||
@Override
|
@Override
|
||||||
@ -343,7 +355,9 @@ public class ViewImageActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||||
|
if(zoom == 1.0) {
|
||||||
swipe.dispatchTouchEvent(ev);
|
swipe.dispatchTouchEvent(ev);
|
||||||
|
}
|
||||||
return super.dispatchTouchEvent(ev);
|
return super.dispatchTouchEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user