aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-04-08 15:42:45 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-04-08 15:42:45 +0000
commit73025a5a13de21c07b6a2cb45d4df3d5475deb37 (patch)
treea1a7c1d3eb46c48d372ff9e6bc3276991b3934e2 /app/src/main/java
parente65944ceb0207044081cc94220c2ba2a53673c74 (diff)
downloadinfinity-for-reddit-73025a5a13de21c07b6a2cb45d4df3d5475deb37.tar
infinity-for-reddit-73025a5a13de21c07b6a2cb45d4df3d5475deb37.tar.gz
infinity-for-reddit-73025a5a13de21c07b6a2cb45d4df3d5475deb37.tar.bz2
infinity-for-reddit-73025a5a13de21c07b6a2cb45d4df3d5475deb37.tar.lz
infinity-for-reddit-73025a5a13de21c07b6a2cb45d4df3d5475deb37.tar.xz
infinity-for-reddit-73025a5a13de21c07b6a2cb45d4df3d5475deb37.tar.zst
infinity-for-reddit-73025a5a13de21c07b6a2cb45d4df3d5475deb37.zip
Copying multireddit's path is now available.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java
index e5e20f8b..860cad46 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java
@@ -1,5 +1,7 @@
package ml.docilealligator.infinityforreddit.bottomsheetfragments;
+import android.content.ClipData;
+import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -7,6 +9,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
+import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
@@ -15,10 +18,10 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
import butterknife.BindView;
import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.activities.EditMultiRedditActivity;
import ml.docilealligator.infinityforreddit.activities.SubscribedThingListingActivity;
import ml.docilealligator.infinityforreddit.multireddit.MultiReddit;
-import ml.docilealligator.infinityforreddit.R;
/**
* A simple {@link Fragment} subclass.
@@ -27,6 +30,8 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia
public static final String EXTRA_MULTI_REDDIT = "EMR";
+ @BindView(R.id.copy_multi_reddit_path_text_view_multi_reddit_options_bottom_sheet_fragment)
+ TextView copyMultiredditPathTextView;
@BindView(R.id.edit_multi_reddit_text_view_multi_reddit_options_bottom_sheet_fragment)
TextView editMultiRedditTextView;
@BindView(R.id.delete_multi_reddit_text_view_multi_reddit_options_bottom_sheet_fragment)
@@ -47,6 +52,20 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia
MultiReddit multiReddit = getArguments().getParcelable(EXTRA_MULTI_REDDIT);
+ copyMultiredditPathTextView.setOnClickListener(view -> {
+ if (multiReddit != null) {
+ ClipboardManager clipboard = (ClipboardManager) subscribedThingListingActivity.getSystemService(Context.CLIPBOARD_SERVICE);
+ if (clipboard != null) {
+ ClipData clip = ClipData.newPlainText("simple text", multiReddit.getPath());
+ clipboard.setPrimaryClip(clip);
+ Toast.makeText(subscribedThingListingActivity, multiReddit.getPath(), Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(subscribedThingListingActivity, R.string.copy_multi_reddit_path_failed, Toast.LENGTH_SHORT).show();
+ }
+ }
+ dismiss();
+ });
+
editMultiRedditTextView.setOnClickListener(view -> {
if (multiReddit != null) {
Intent editIntent = new Intent(subscribedThingListingActivity, EditMultiRedditActivity.class);