aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-12-31 06:46:19 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-12-31 06:46:19 +0000
commit321f4da6230fd6197e5e0773db3a8d28b01e5215 (patch)
treebfb96fa3ba80604f582d6e5cbe415cd5c9216633 /app/src/main
parent1d857eed4738a150f6dd41a1ed4d7df672c60f6a (diff)
downloadinfinity-for-reddit-321f4da6230fd6197e5e0773db3a8d28b01e5215.tar
infinity-for-reddit-321f4da6230fd6197e5e0773db3a8d28b01e5215.tar.gz
infinity-for-reddit-321f4da6230fd6197e5e0773db3a8d28b01e5215.tar.bz2
infinity-for-reddit-321f4da6230fd6197e5e0773db3a8d28b01e5215.tar.lz
infinity-for-reddit-321f4da6230fd6197e5e0773db3a8d28b01e5215.tar.xz
infinity-for-reddit-321f4da6230fd6197e5e0773db3a8d28b01e5215.tar.zst
infinity-for-reddit-321f4da6230fd6197e5e0773db3a8d28b01e5215.zip
Long click the url to see more options. Make getRedditUriByPath in LinkResolverActivity private.
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java24
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java21
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java23
-rw-r--r--app/src/main/res/layout/fragment_sidebar.xml5
-rw-r--r--app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml18
-rw-r--r--app/src/main/res/values/strings.xml1
15 files changed, 75 insertions, 86 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
index 82260f00..538c4a2c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
@@ -139,7 +139,7 @@ public class PullNotificationWorker extends Worker {
if (kind.equals(Message.TYPE_COMMENT)) {
Intent intent = new Intent(context, LinkResolverActivity.class);
- Uri uri = LinkResolverActivity.getRedditUriByPath(message.getContext());
+ Uri uri = Uri.parse(message.getContext());
intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
intent.putExtra(LinkResolverActivity.EXTRA_MESSAGE_FULLNAME, message.getFullname());
@@ -152,7 +152,7 @@ public class PullNotificationWorker extends Worker {
builder.setContentIntent(summaryPendingIntent);
} else if (kind.equals(Message.TYPE_LINK)) {
Intent intent = new Intent(context, LinkResolverActivity.class);
- Uri uri = LinkResolverActivity.getRedditUriByPath(message.getContext());
+ Uri uri = Uri.parse(message.getContext());
intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
intent.putExtra(LinkResolverActivity.EXTRA_MESSAGE_FULLNAME, message.getFullname());
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java
index c12403de..78bfe015 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java
@@ -154,11 +154,7 @@ public class CommentActivity extends BaseActivity {
builder.linkResolver((view, link) -> {
Intent intent = new Intent(CommentActivity.this, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
startActivity(intent);
});
}
@@ -218,11 +214,7 @@ public class CommentActivity extends BaseActivity {
builder.linkResolver((view, link) -> {
Intent intent = new Intent(CommentActivity.this, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
startActivity(intent);
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
index 5e0ce147..79e3d8a5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
@@ -191,11 +191,7 @@ public class FullMarkdownActivity extends BaseActivity {
builder.linkResolver((view, link) -> {
Intent intent = new Intent(FullMarkdownActivity.this, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, isNsfw);
startActivity(intent);
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
index 27fa8298..6a76497b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
@@ -51,7 +51,7 @@ public class LinkResolverActivity extends AppCompatActivity {
@Inject
CustomThemeWrapper mCustomThemeWrapper;
- public static Uri getRedditUriByPath(String path) {
+ private Uri getRedditUriByPath(String path) {
return Uri.parse("https://www.reddit.com" + path);
}
@@ -62,7 +62,12 @@ public class LinkResolverActivity extends AppCompatActivity {
((Infinity) getApplication()).getAppComponent().inject(this);
Uri uri = getIntent().getData();
- handleUri(uri);
+
+ if (uri.getScheme() == null && uri.getHost() == null) {
+ handleUri(getRedditUriByPath(uri.toString()));
+ } else {
+ handleUri(uri);
+ }
}
private void handleUri(Uri uri) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
index f86a84a2..7bb8c00c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
@@ -332,11 +332,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
builder.linkResolver((view, link) -> {
Intent intent = new Intent(mActivity, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, mPost.isNSFW());
mActivity.startActivity(intent);
});
@@ -420,11 +416,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
builder.linkResolver((view, link) -> {
Intent intent = new Intent(mActivity, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, mPost.isNSFW());
mActivity.startActivity(intent);
});
@@ -2992,11 +2984,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mImageView.setOnClickListener(view -> {
Intent intent = new Intent(mActivity, LinkResolverActivity.class);
Uri uri = Uri.parse(mPost.getUrl());
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(mPost.getUrl()));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, mPost.isNSFW());
mActivity.startActivity(intent);
});
@@ -3120,11 +3108,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
} else if (mPost.getPostType() == Post.LINK_TYPE || mPost.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
Intent intent = new Intent(mActivity, LinkResolverActivity.class);
Uri uri = Uri.parse(mPost.getUrl());
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(mPost.getUrl()));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, mPost.isNSFW());
mActivity.startActivity(intent);
} else if (mPost.getPostType() == Post.GALLERY_TYPE) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
index ced75d0e..7a9c85d7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
@@ -184,11 +184,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
builder.linkResolver((view, link) -> {
Intent intent = new Intent(mContext, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
mContext.startActivity(intent);
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
index 04ec62f2..504b3a51 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
@@ -164,11 +164,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
builder.linkResolver((view, link) -> {
Intent intent = new Intent(mContext, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
mContext.startActivity(intent);
});
}
@@ -238,7 +234,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
((DataViewHolder) holder).itemView.setOnClickListener(view -> {
if (mMessageType == FetchMessage.MESSAGE_TYPE_INBOX
&& message.getContext() != null && !message.getContext().equals("")) {
- Uri uri = LinkResolverActivity.getRedditUriByPath(message.getContext());
+ Uri uri = Uri.parse(message.getContext());
Intent intent = new Intent(mContext, LinkResolverActivity.class);
intent.setData(uri);
mContext.startActivity(intent);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
index 4abf2e55..970426c3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -2359,11 +2359,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
} else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
Intent intent = new Intent(mActivity, LinkResolverActivity.class);
Uri uri = Uri.parse(post.getUrl());
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(post.getUrl()));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, post.isNSFW());
mActivity.startActivity(intent);
} else if (post.getPostType() == Post.GALLERY_TYPE) {
@@ -2731,11 +2727,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
} else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
Intent intent = new Intent(mActivity, LinkResolverActivity.class);
Uri uri = Uri.parse(post.getUrl());
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(post.getUrl()));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, post.isNSFW());
mActivity.startActivity(intent);
} else if (post.getPostType() == Post.GALLERY_TYPE) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java
index f9426006..9d2de4ec 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java
@@ -73,11 +73,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
builder.linkResolver((view, link) -> {
Intent intent = new Intent(viewPrivateMessagesActivity, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
viewPrivateMessagesActivity.startActivity(intent);
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java
index ee728b96..337a15d6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java
@@ -43,11 +43,7 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
builder.linkResolver((view, link) -> {
Intent intent = new Intent(context, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
context.startActivity(intent);
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java
index 6ce44743..c907f02b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java
@@ -1,6 +1,7 @@
package ml.docilealligator.infinityforreddit.bottomsheetfragments;
import android.app.Activity;
+import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
@@ -25,6 +26,8 @@ import ml.docilealligator.infinityforreddit.R;
public class UrlMenuBottomSheetFragment extends RoundedBottomSheetDialogFragment {
public static final String EXTRA_URL = "EU";
+ @BindView(R.id.link_text_view_url_menu_bottom_sheet_fragment)
+ TextView linkTextView;
@BindView(R.id.open_link_text_view_url_menu_bottom_sheet_fragment)
TextView openLinkTextView;
@BindView(R.id.copy_link_text_view_url_menu_bottom_sheet_fragment)
@@ -32,6 +35,7 @@ public class UrlMenuBottomSheetFragment extends RoundedBottomSheetDialogFragment
@BindView(R.id.share_link_text_view_url_menu_bottom_sheet_fragment)
TextView shareLinkTextView;
private Activity activity;
+ private String url;
public UrlMenuBottomSheetFragment() {
// Required empty public constructor
@@ -43,7 +47,14 @@ public class UrlMenuBottomSheetFragment extends RoundedBottomSheetDialogFragment
View rootView = inflater.inflate(R.layout.fragment_url_menu_bottom_sheet, container, false);
ButterKnife.bind(this, rootView);
- String url = getArguments().getString(EXTRA_URL);
+ url = getArguments().getString(EXTRA_URL);
+
+ Uri uri = Uri.parse(url);
+ if (uri.getScheme() == null && uri.getHost() == null) {
+ url = "https://www.reddit.com" + url;
+ }
+
+ linkTextView.setText(url);
openLinkTextView.setOnClickListener(view -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
@@ -68,9 +79,11 @@ public class UrlMenuBottomSheetFragment extends RoundedBottomSheetDialogFragment
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, url);
- if (intent.resolveActivity(activity.getPackageManager()) != null) {
- startActivity(intent);
- } else {
+ try {
+ Intent shareIntent = Intent.createChooser(intent, null);
+ startActivity(shareIntent);
+ } catch (ActivityNotFoundException e) {
+ e.printStackTrace();
Toast.makeText(activity, R.string.no_app, Toast.LENGTH_SHORT).show();
}
dismiss();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java
index 50a7a912..571350ce 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java
@@ -34,17 +34,20 @@ import io.noties.markwon.MarkwonConfiguration;
import io.noties.markwon.core.MarkwonTheme;
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.linkify.LinkifyPlugin;
+import io.noties.markwon.movement.MovementMethodPlugin;
import io.noties.markwon.recycler.MarkwonAdapter;
import io.noties.markwon.recycler.table.TableEntry;
import io.noties.markwon.recycler.table.TableEntryPlugin;
import io.noties.markwon.simple.ext.SimpleExtPlugin;
+import me.saket.bettermovementmethod.BetterLinkMovementMethod;
+import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.activities.ViewSubredditDetailActivity;
import ml.docilealligator.infinityforreddit.asynctasks.InsertSubredditDataAsyncTask;
+import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
-import ml.docilealligator.infinityforreddit.Infinity;
-import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.subreddit.FetchSubredditData;
import ml.docilealligator.infinityforreddit.subreddit.SubredditData;
import ml.docilealligator.infinityforreddit.subreddit.SubredditViewModel;
@@ -111,16 +114,20 @@ public class SidebarFragment extends Fragment {
builder.linkResolver((view, link) -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
Uri uri = Uri.parse(link);
- if (uri.getScheme() == null && uri.getHost() == null) {
- intent.setData(LinkResolverActivity.getRedditUriByPath(link));
- } else {
- intent.setData(uri);
- }
+ intent.setData(uri);
startActivity(intent);
});
}
})
.usePlugin(StrikethroughPlugin.create())
+ .usePlugin(MovementMethodPlugin.create(BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, recyclerView).setOnLinkLongClickListener((textView, url) -> {
+ UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = new UrlMenuBottomSheetFragment();
+ Bundle bundle = new Bundle();
+ bundle.putString(UrlMenuBottomSheetFragment.EXTRA_URL, url);
+ urlMenuBottomSheetFragment.setArguments(bundle);
+ urlMenuBottomSheetFragment.show(getChildFragmentManager(), urlMenuBottomSheetFragment.getTag());
+ return true;
+ })))
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.usePlugin(SimpleExtPlugin.create(plugin ->
plugin.addExtension(1, '^', (configuration, props) -> {
diff --git a/app/src/main/res/layout/fragment_sidebar.xml b/app/src/main/res/layout/fragment_sidebar.xml
index a0773c9c..0b0e5ace 100644
--- a/app/src/main/res/layout/fragment_sidebar.xml
+++ b/app/src/main/res/layout/fragment_sidebar.xml
@@ -16,7 +16,10 @@
android:id="@+id/markdown_recycler_view_sidebar_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:padding="8dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="144dp"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
android:clipToPadding="false" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
diff --git a/app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml b/app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml
index 852c53ed..65dacae2 100644
--- a/app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml
+++ b/app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml
@@ -13,10 +13,22 @@
android:orientation="vertical">
<TextView
+ android:id="@+id/link_text_view_url_menu_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp" />
+
+ <TextView
android:id="@+id/open_link_text_view_url_menu_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/copy_raw_text"
+ android:text="@string/open_link"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
@@ -34,7 +46,7 @@
android:id="@+id/copy_link_text_view_url_menu_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/copy_markdown"
+ android:text="@string/copy_link"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
@@ -52,7 +64,7 @@
android:id="@+id/share_link_text_view_url_menu_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/copy_all_raw_text"
+ android:text="@string/share_link"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1c423672..c34a01ce 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -583,6 +583,7 @@
<string name="copy_gif_link">Copy Gif Link</string>
<string name="copy_video_link">Copy Video Link</string>
<string name="copy_link">Copy Link</string>
+ <string name="open_link">Open Link</string>
<string name="copy_success">Copied</string>
<string name="copy_link_failed">Cannot copy the link</string>