mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 11:17:25 +01:00
Double tap to upvote comments.
This commit is contained in:
parent
b997963808
commit
d4bf238345
@ -10,7 +10,9 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
import android.view.GestureDetector;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@ -862,6 +864,38 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
}, mVisibleComments.get(commentPosition).getFullName(), newVoteType, holder.getAdapterPosition());
|
}, mVisibleComments.get(commentPosition).getFullName(), newVoteType, holder.getAdapterPosition());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).commentMarkdownView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
private GestureDetector gestureDetector = new GestureDetector(mActivity, new GestureDetector.SimpleOnGestureListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onDoubleTap(MotionEvent e) {
|
||||||
|
((CommentViewHolder) holder).upVoteButton.performClick();
|
||||||
|
return super.onDoubleTap(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
gestureDetector.onTouchEvent(motionEvent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).itemView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
private GestureDetector gestureDetector = new GestureDetector(mActivity, new GestureDetector.SimpleOnGestureListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onDoubleTap(MotionEvent e) {
|
||||||
|
((CommentViewHolder) holder).upVoteButton.performClick();
|
||||||
|
return super.onDoubleTap(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
gestureDetector.onTouchEvent(motionEvent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (comment.isSaved()) {
|
if (comment.isSaved()) {
|
||||||
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -6,7 +6,9 @@ import android.content.Intent;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
|
import android.view.GestureDetector;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@ -307,6 +309,38 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
}, comment.getFullName(), newVoteType, holder.getAdapterPosition());
|
}, comment.getFullName(), newVoteType, holder.getAdapterPosition());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((DataViewHolder) holder).commentMarkdownView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
private GestureDetector gestureDetector = new GestureDetector(mContext, new GestureDetector.SimpleOnGestureListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onDoubleTap(MotionEvent e) {
|
||||||
|
((DataViewHolder) holder).upvoteButton.performClick();
|
||||||
|
return super.onDoubleTap(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
gestureDetector.onTouchEvent(motionEvent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
((DataViewHolder) holder).itemView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
private GestureDetector gestureDetector = new GestureDetector(mContext, new GestureDetector.SimpleOnGestureListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onDoubleTap(MotionEvent e) {
|
||||||
|
((DataViewHolder) holder).upvoteButton.performClick();
|
||||||
|
return super.onDoubleTap(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
gestureDetector.onTouchEvent(motionEvent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (comment.isSaved()) {
|
if (comment.isSaved()) {
|
||||||
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user