aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-07 05:19:57 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-07 05:19:57 +0000
commit44c612c6e557cec5967437d33acf4837c7527e42 (patch)
treeac973e3d1a0f118573fec5747e0eccb2c1077d55 /app
parent2c81bb4afc6ae83229fc0404f4366fe560dcb63b (diff)
downloadinfinity-for-reddit-44c612c6e557cec5967437d33acf4837c7527e42.tar
infinity-for-reddit-44c612c6e557cec5967437d33acf4837c7527e42.tar.gz
infinity-for-reddit-44c612c6e557cec5967437d33acf4837c7527e42.tar.bz2
infinity-for-reddit-44c612c6e557cec5967437d33acf4837c7527e42.tar.lz
infinity-for-reddit-44c612c6e557cec5967437d33acf4837c7527e42.tar.xz
infinity-for-reddit-44c612c6e557cec5967437d33acf4837c7527e42.tar.zst
infinity-for-reddit-44c612c6e557cec5967437d33acf4837c7527e42.zip
Click RecyclerView to hide exoplayer control in ViewRPANBroadcastFragment.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java35
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();