mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Copying multireddit's path is now available.
This commit is contained in:
parent
e65944ceb0
commit
73025a5a13
@ -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);
|
||||
|
@ -10,6 +10,25 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/copy_multi_reddit_path_text_view_multi_reddit_options_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:text="@string/copy_multi_reddit_path"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:drawableStart="@drawable/ic_copy_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/edit_multi_reddit_text_view_multi_reddit_options_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -897,6 +897,8 @@
|
||||
<string name="author_flair_preview">Author Flair</string>
|
||||
<string name="comment_content_preview">I got my girlfriend a “Get better soon” card.\nShe\'s not ill or anything, but she could definitely get better.</string>
|
||||
|
||||
<string name="copy_multi_reddit_path">Copy Multireddit\'s Path</string>
|
||||
<string name="copy_multi_reddit_path_failed">Unable to copy multireddit\'s path</string>
|
||||
<string name="edit_multi_reddit">Edit Multireddit</string>
|
||||
<string name="delete_multi_reddit">Delete Multireddit</string>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user