From 2c56de2b461ee77dc7bebe671f86fb9afb6ac043 Mon Sep 17 00:00:00 2001 From: tom79 Date: Mon, 4 Nov 2019 17:53:25 +0100 Subject: [PATCH] Fix issue #337 --- .../android/drawers/StatusListAdapter.java | 82 +++++++++---------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java index 9b931f58b..3cc4060e2 100644 --- a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java @@ -3501,49 +3501,47 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct @Override public void onClick(View v) { - if (targetedId == null || !targetedId.equals(status.getAccount().getId())) { - Account account = status.getAccount(); - Pattern instanceHost = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+\\.[a-z\\.]{2,10})"); - Matcher matcher = instanceHost.matcher(status.getUrl()); - String instance = null; - while (matcher.find()) { - instance = matcher.group(1); + if (status.getReblog() != null) { + if (targetedId == null || !targetedId.equals(status.getReblog().getAccount().getId())) { + Account account = status.getReblog().getAccount(); + Pattern instanceHost = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+\\.[a-z\\.]{2,10})"); + Matcher matcher = instanceHost.matcher(status.getUrl()); + String instance = null; + while (matcher.find()) { + instance = matcher.group(1); + } + account.setInstance(instance); + if (BaseMainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) + CrossActions.doCrossProfile(context, account); + else { + Intent intent = new Intent(context, ShowAccountActivity.class); + Bundle b = new Bundle(); + b.putParcelable("account", status.getAccount()); + b.putBoolean("peertubeaccount", true); + intent.putExtras(b); + context.startActivity(intent); + } } - account.setInstance(instance); - if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) - CrossActions.doCrossProfile(context, account); - else { - Intent intent = new Intent(context, ShowAccountActivity.class); - Bundle b = new Bundle(); - b.putParcelable("account", status.getAccount()); - b.putBoolean("peertubeaccount", true); - intent.putExtras(b); - context.startActivity(intent); - } - } - } - }); - holder.status_account_profile.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (targetedId == null || !targetedId.equals(status.getReblog().getAccount().getId())) { - Account account = status.getReblog().getAccount(); - Pattern instanceHost = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+\\.[a-z\\.]{2,10})"); - Matcher matcher = instanceHost.matcher(status.getUrl()); - String instance = null; - while (matcher.find()) { - instance = matcher.group(1); - } - account.setInstance(instance); - if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) - CrossActions.doCrossProfile(context, account); - else { - Intent intent = new Intent(context, ShowAccountActivity.class); - Bundle b = new Bundle(); - b.putParcelable("account", status.getAccount()); - b.putBoolean("peertubeaccount", true); - intent.putExtras(b); - context.startActivity(intent); + } else { + if (targetedId == null || !targetedId.equals(status.getAccount().getId())) { + Account account = status.getAccount(); + Pattern instanceHost = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+\\.[a-z\\.]{2,10})"); + Matcher matcher = instanceHost.matcher(status.getUrl()); + String instance = null; + while (matcher.find()) { + instance = matcher.group(1); + } + account.setInstance(instance); + if (BaseMainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) + CrossActions.doCrossProfile(context, account); + else { + Intent intent = new Intent(context, ShowAccountActivity.class); + Bundle b = new Bundle(); + b.putParcelable("account", status.getAccount()); + b.putBoolean("peertubeaccount", true); + intent.putExtras(b); + context.startActivity(intent); + } } } }