diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java index 8029b84a..c3111a67 100644 --- a/app/src/main/java/app/fedilab/android/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/helper/Helper.java @@ -119,7 +119,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Collections; import java.util.Date; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; @@ -352,9 +352,9 @@ public class Helper { public static int counter = 1; static { - Map aMap = new HashMap<>(); - aMap.put(PatternType.MENTION, mentionPattern); + LinkedHashMap aMap = new LinkedHashMap<>(); aMap.put(PatternType.MENTION_LONG, mentionLongPattern); + aMap.put(PatternType.MENTION, mentionPattern); aMap.put(PatternType.TAG, hashtagPattern); aMap.put(PatternType.GROUP, groupPattern); patternHashMap = Collections.unmodifiableMap(aMap); diff --git a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java index c164ae35..19feda16 100644 --- a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java @@ -105,7 +105,7 @@ public class SpannableHelper { } if (url != null && urlText != null && !url.equals(urlText) && !urlText.contains(" 0) { //It's a toot + CrossActionHelper.fetchRemoteStatus(context, currentAccount, url, new CrossActionHelper.Callback() { + @Override + public void federatedStatus(Status status) { + Intent intent = new Intent(context, ContextActivity.class); + intent.putExtra(Helper.ARG_STATUS, status); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + } + + @Override + public void federatedAccount(Account account) { + } + }); + } else {//It's an account + CrossActionHelper.fetchRemoteAccount(context, currentAccount, status.account, new CrossActionHelper.Callback() { + @Override + public void federatedStatus(Status status) { + } + + @Override + public void federatedAccount(Account account) { + Intent intent = new Intent(context, ProfileActivity.class); + Bundle b = new Bundle(); + b.putSerializable(Helper.ARG_ACCOUNT, account); + intent.putExtras(b); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + } + }); + } + } else { + Helper.openBrowser(context, newURL); + } + } @Override