From 0d1fcecde60bbb1eb3b43736807883b12e54b2e8 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 5 Aug 2019 10:30:22 +0800 Subject: Searching subreddits to post is available. Use Toolbar instead of ActionBar in various activities. Minor bugs fixed. --- app/src/main/java/CustomView/CustomMarkwonView.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'app/src/main/java/CustomView/CustomMarkwonView.java') diff --git a/app/src/main/java/CustomView/CustomMarkwonView.java b/app/src/main/java/CustomView/CustomMarkwonView.java index c0d59f05..50ac4bbf 100644 --- a/app/src/main/java/CustomView/CustomMarkwonView.java +++ b/app/src/main/java/CustomView/CustomMarkwonView.java @@ -24,23 +24,24 @@ public class CustomMarkwonView extends MarkwonView { super(context, attrs); } - public void setMarkdown(@Nullable String markdown, Context conte) { - SpannableConfiguration configuration = SpannableConfiguration.builder(conte).linkResolver((view, link) -> { + public void setMarkdown(@Nullable String markdown, Context context) { + SpannableConfiguration configuration = SpannableConfiguration.builder(context).linkResolver((view, link) -> { if(link.startsWith("/u/") || link.startsWith("u/")) { - Intent intent = new Intent(conte, ViewUserDetailActivity.class); + Intent intent = new Intent(context, ViewUserDetailActivity.class); intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, link.substring(3)); - conte.startActivity(intent); + context.startActivity(intent); } else if(link.startsWith("/r/") || link.startsWith("r/")) { - Intent intent = new Intent(conte, ViewSubredditDetailActivity.class); + Intent intent = new Intent(context, ViewSubredditDetailActivity.class); intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, link.substring(3)); - conte.startActivity(intent); + context.startActivity(intent); } else { CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); // add share action to menu list builder.addDefaultShareMenuItem(); - builder.setToolbarColor(conte.getResources().getColor(R.color.colorPrimary)); + builder.setToolbarColor(context.getResources().getColor(R.color.colorPrimary)); CustomTabsIntent customTabsIntent = builder.build(); - customTabsIntent.launchUrl(conte, Uri.parse(link)); + customTabsIntent.intent.setPackage(context.getPackageName()); + customTabsIntent.launchUrl(context, Uri.parse(link)); } }).build(); -- cgit v1.2.3