From ad31ff758cd6d735c52fde73bd09e2536e3b2a1b Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 29 Sep 2021 06:57:20 -0400 Subject: [PATCH] I'm working to display share button when long press on a claim #1133. (https://github.com/lbryio/lbry-android/issues/1133) So far, I've got it working pretty well. Now, there's quite a few ways to implement a menu after a long press. Signal Messenger has a cool UI for when users long click on a message. But other apps like NewPipe just use a dialog to display other options. To keep things simple, I used a popup menu. Now, I added other menu items that you'd see in the FileViewFragment (download, repost, etc.). I added these because only putting "share" in the menu didn't seem like much of a menu. "Share" is the only menu item that actually works right now. --- .../browser/adapter/ClaimListAdapter.java | 93 ++++++++++++++++--- app/src/main/res/values/styles.xml | 6 ++ 2 files changed, 86 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/io/lbry/browser/adapter/ClaimListAdapter.java b/app/src/main/java/io/lbry/browser/adapter/ClaimListAdapter.java index e08f8a8b..2b10c904 100644 --- a/app/src/main/java/io/lbry/browser/adapter/ClaimListAdapter.java +++ b/app/src/main/java/io/lbry/browser/adapter/ClaimListAdapter.java @@ -1,9 +1,12 @@ package io.lbry.browser.adapter; import android.content.Context; +import android.content.Intent; import android.text.format.DateUtils; import android.util.Log; +import android.view.Gravity; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; @@ -11,6 +14,7 @@ import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; +import androidx.appcompat.widget.PopupMenu; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; @@ -23,6 +27,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import io.lbry.browser.MainActivity; import io.lbry.browser.R; import io.lbry.browser.exceptions.LbryUriException; import io.lbry.browser.listener.SelectionModeListener; @@ -374,19 +379,8 @@ public class ClaimListAdapter extends RecyclerView.Adaptertrue @color/colorPrimaryDark @style/AppTheme.DrawerArrowStyle + @style/ClaimPopupMenu @@ -32,4 +33,9 @@ @color/actionBarForeground + +