mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-26 16:47:30 +00:00
Remove swipe to dismiss Post view temporarily
This commit is contained in:
parent
788358eb35
commit
2b2f390f59
@ -2,6 +2,8 @@ package awais.instagrabber.adapters.viewholder;
|
||||
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.net.Uri;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@ -59,9 +61,19 @@ public class SliderPhotoViewHolder extends SliderItemViewHolder {
|
||||
})
|
||||
.setLowResImageRequest(ImageRequest.fromUri(model.getThumbnailUrl()))
|
||||
.build());
|
||||
binding.getRoot().setOnClickListener(v -> {
|
||||
if (sliderCallback != null) {
|
||||
sliderCallback.onItemClicked(position);
|
||||
// binding.getRoot().setOnClickListener(v -> {
|
||||
// if (sliderCallback != null) {
|
||||
// sliderCallback.onItemClicked(position);
|
||||
// }
|
||||
// });
|
||||
binding.getRoot().setTapListener(new GestureDetector.SimpleOnGestureListener() {
|
||||
@Override
|
||||
public boolean onSingleTapUp(final MotionEvent e) {
|
||||
if (sliderCallback != null) {
|
||||
sliderCallback.onItemClicked(position);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
final AnimatedZoomableController zoomableController = AnimatedZoomableController.newInstance();
|
||||
|
@ -7,11 +7,8 @@
|
||||
|
||||
package awais.instagrabber.customviews.drawee;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Matrix;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@ -53,46 +50,47 @@ public class DraggableZoomableDraweeView extends ZoomableDraweeView {
|
||||
private int lastNewPointerCount;
|
||||
private boolean wasTransformCorrected;
|
||||
|
||||
@Override
|
||||
protected void onTransformEnd(final Matrix transform) {
|
||||
super.onTransformEnd(transform);
|
||||
final AnimatedZoomableController zoomableController = (AnimatedZoomableController) getZoomableController();
|
||||
final TransformGestureDetector detector = zoomableController.getDetector();
|
||||
lastNewPointerCount = detector.getNewPointerCount();
|
||||
lastPointerCount = detector.getPointerCount();
|
||||
}
|
||||
// @Override
|
||||
// protected void onTransformEnd(final Matrix transform) {
|
||||
// super.onTransformEnd(transform);
|
||||
// final AnimatedZoomableController zoomableController = (AnimatedZoomableController) getZoomableController();
|
||||
// final TransformGestureDetector detector = zoomableController.getDetector();
|
||||
// lastNewPointerCount = detector.getNewPointerCount();
|
||||
// lastPointerCount = detector.getPointerCount();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onTranslationLimited(final float offsetLeft, final float offsetTop) {
|
||||
// super.onTranslationLimited(offsetLeft, offsetTop);
|
||||
// wasTransformCorrected = offsetTop != 0;
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onTranslationLimited(final float offsetLeft, final float offsetTop) {
|
||||
super.onTranslationLimited(offsetLeft, offsetTop);
|
||||
wasTransformCorrected = offsetTop != 0;
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(final MotionEvent event) {
|
||||
boolean superResult = false;
|
||||
if (verticalDragHelper.isDragging()) {
|
||||
final boolean onDragTouch = verticalDragHelper.onDragTouch(event);
|
||||
if (onDragTouch) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!verticalDragHelper.isDragging()) {
|
||||
superResult = super.onTouchEvent(event);
|
||||
if (wasTransformCorrected
|
||||
&& (lastPointerCount == 1 || lastPointerCount == 0)
|
||||
&& (lastNewPointerCount == 1 || lastNewPointerCount == 0)) {
|
||||
final boolean onDragTouch = verticalDragHelper.onDragTouch(event);
|
||||
if (onDragTouch) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
final boolean gestureListenerResult = verticalDragHelper.onGestureTouchEvent(event);
|
||||
if (gestureListenerResult) {
|
||||
return true;
|
||||
}
|
||||
return superResult;
|
||||
}
|
||||
// @SuppressLint("ClickableViewAccessibility")
|
||||
// @Override
|
||||
// public boolean onTouchEvent(final MotionEvent event) {
|
||||
// boolean superResult = false;
|
||||
// superResult = super.onTouchEvent(event);
|
||||
// if (verticalDragHelper.isDragging()) {
|
||||
// final boolean onDragTouch = verticalDragHelper.onDragTouch(event);
|
||||
// if (onDragTouch) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// if (!verticalDragHelper.isDragging()) {
|
||||
// superResult = super.onTouchEvent(event);
|
||||
// if (wasTransformCorrected
|
||||
// && (lastPointerCount == 1 || lastPointerCount == 0)
|
||||
// && (lastNewPointerCount == 1 || lastNewPointerCount == 0)) {
|
||||
// final boolean onDragTouch = verticalDragHelper.onDragTouch(event);
|
||||
// if (onDragTouch) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// final boolean gestureListenerResult = verticalDragHelper.onGestureTouchEvent(event);
|
||||
// if (gestureListenerResult) {
|
||||
// return true;
|
||||
// }
|
||||
// return superResult;
|
||||
// }
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.view.ViewGroup;
|
||||
@ -72,7 +74,6 @@ import awais.instagrabber.customviews.VideoPlayerCallbackAdapter;
|
||||
import awais.instagrabber.customviews.VideoPlayerViewHelper;
|
||||
import awais.instagrabber.customviews.drawee.AnimatedZoomableController;
|
||||
import awais.instagrabber.databinding.DialogPostViewBinding;
|
||||
import awais.instagrabber.fragments.main.ProfileFragment;
|
||||
import awais.instagrabber.models.FeedModel;
|
||||
import awais.instagrabber.models.PostChild;
|
||||
import awais.instagrabber.models.ProfileModel;
|
||||
@ -544,8 +545,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
bundle.putString("postId", feedModel.getPostId());
|
||||
bundle.putBoolean("isComment", false);
|
||||
navController.navigate(R.id.action_global_likesViewerFragment, bundle);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Utils.displayToastAboveView(context, v, getString(R.string.like_without_count));
|
||||
}
|
||||
return true;
|
||||
@ -744,8 +744,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
if (result) {
|
||||
feedModel.setPostCaption(input.getText().toString());
|
||||
binding.caption.setText(input.getText().toString());
|
||||
}
|
||||
else Toast.makeText(context, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
||||
} else Toast.makeText(context, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -927,12 +926,19 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
})
|
||||
.build();
|
||||
binding.postImage.setController(controller);
|
||||
binding.postImage.setOnClickListener(v -> toggleDetails());
|
||||
// binding.postImage.setOnClickListener(v -> toggleDetails());
|
||||
final AnimatedZoomableController zoomableController = AnimatedZoomableController.newInstance();
|
||||
zoomableController.setMaxScaleFactor(3f);
|
||||
binding.postImage.setZoomableController(zoomableController);
|
||||
binding.postImage.setTapListener(new GestureDetector.SimpleOnGestureListener() {
|
||||
@Override
|
||||
public boolean onSingleTapUp(final MotionEvent e) {
|
||||
toggleDetails();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
binding.postImage.setAllowTouchInterceptionWhileZoomed(true);
|
||||
binding.postImage.setOnVerticalDragListener(onVerticalDragListener);
|
||||
// binding.postImage.setOnVerticalDragListener(onVerticalDragListener);
|
||||
}
|
||||
|
||||
private void setupSlider() {
|
||||
|
Loading…
Reference in New Issue
Block a user