diff options
Diffstat (limited to 'app/src/main/java')
2 files changed, 45 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java index ba7dcd34..60f596ab 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java @@ -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(); + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java index 2c387acd..219a55de 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java @@ -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(); |