From 6a50094fdaf5530f387f447cbb0e371cde1e6d11 Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Sat, 15 Dec 2018 14:24:11 +0100 Subject: [PATCH 1/3] - Share ability --- app/build.gradle | 4 +- .../peertube/adapter/VideoAdapter.java | 22 ++++++++ .../peertube/helper/APIUrlHelper.java | 4 ++ .../schueller/peertube/intents/Intents.java | 29 ++++++++++ app/src/main/res/layout/row_video.xml | 56 ++++++++++++++----- app/src/main/res/menu/menu_video_row_mode.xml | 7 +++ app/src/main/res/values/strings.xml | 2 + 7 files changed, 107 insertions(+), 17 deletions(-) create mode 100644 app/src/main/java/net/schueller/peertube/intents/Intents.java create mode 100644 app/src/main/res/menu/menu_video_row_mode.xml diff --git a/app/build.gradle b/app/build.gradle index 8b4c10d..7fa855a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "net.schueller.peertube" minSdkVersion 23 targetSdkVersion 28 - versionCode 105 - versionName "1.0.5" + versionCode 106 + versionName "1.0.6" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) diff --git a/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java b/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java index c9fb785..52091c6 100644 --- a/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java +++ b/app/src/main/java/net/schueller/peertube/adapter/VideoAdapter.java @@ -3,10 +3,12 @@ package net.schueller.peertube.adapter; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; +import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; @@ -16,6 +18,7 @@ import net.schueller.peertube.R; import net.schueller.peertube.activity.VideoPlayActivity; import net.schueller.peertube.helper.APIUrlHelper; import net.schueller.peertube.helper.MetaDataHelper; +import net.schueller.peertube.intents.Intents; import net.schueller.peertube.model.Avatar; import net.schueller.peertube.model.Video; @@ -91,6 +94,23 @@ public class VideoAdapter extends RecyclerView.Adapter { + + PopupMenu popup = new PopupMenu(context, v); + popup.setOnMenuItemClickListener(menuItem -> { + switch (menuItem.getItemId()) { + case R.id.menu_share: + Intents.Share(context, videoList.get(position)); + return true; + default: + return false; + } + }); + popup.inflate(R.menu.menu_video_row_mode); + popup.show(); + + }); + } public void setData(ArrayList