mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Click RecyclerView to hide exoplayer control in ViewRPANBroadcastFragment.
This commit is contained in:
parent
2c81bb4afc
commit
44c612c6e5
@ -23,10 +23,12 @@ import ml.docilealligator.infinityforreddit.RPANComment;
|
||||
public class RPANCommentStreamRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private RequestManager glide;
|
||||
private ArrayList<RPANComment> rpanComments;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public RPANCommentStreamRecyclerViewAdapter(Context context) {
|
||||
public RPANCommentStreamRecyclerViewAdapter(Context context, ItemClickListener itemClickListener) {
|
||||
glide = Glide.with(context);
|
||||
rpanComments = new ArrayList<>();
|
||||
this.itemClickListener = itemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -78,6 +80,14 @@ public class RPANCommentStreamRecyclerViewAdapter extends RecyclerView.Adapter<R
|
||||
iconImageView = itemView.findViewById(R.id.icon_image_view_item_rpan_comment);
|
||||
authorTextView = itemView.findViewById(R.id.author_text_view_item_rpan_comment);
|
||||
contentTextView = itemView.findViewById(R.id.content_text_view_item_rpan_comment);
|
||||
|
||||
itemView.setOnClickListener(view -> {
|
||||
itemClickListener.onClick();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public interface ItemClickListener {
|
||||
void onClick();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
@ -220,7 +221,39 @@ public class ViewRPANBroadcastFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
adapter = new RPANCommentStreamRecyclerViewAdapter(mActivity);
|
||||
recyclerView.setOnTouchListener(new View.OnTouchListener() {
|
||||
float x1;
|
||||
float x2;
|
||||
float y1;
|
||||
float y2;
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
switch (motionEvent.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
x1 = motionEvent.getX();
|
||||
y1 = motionEvent.getY();
|
||||
return true;
|
||||
case MotionEvent.ACTION_UP:
|
||||
x2 = motionEvent.getX();
|
||||
y2 = motionEvent.getY();
|
||||
|
||||
if (x1 == x2 && y1 == y2) {
|
||||
playerView.hideController();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
adapter = new RPANCommentStreamRecyclerViewAdapter(mActivity, new RPANCommentStreamRecyclerViewAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public void onClick() {
|
||||
|
||||
}
|
||||
});
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
handler = new Handler();
|
||||
|
Loading…
Reference in New Issue
Block a user