mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-12-25 00:00:19 +02:00
Fix: "Open the original message" can open wrong status (fix #1294)
This commit is contained in:
parent
0152d325bd
commit
f1ed397a52
1 changed files with 17 additions and 12 deletions
|
|
@ -172,18 +172,7 @@ public class MediaActivity extends BaseBarActivity implements OnDownloadInterfac
|
|||
String description = attachments.get(mediaPosition - 1).description;
|
||||
handler = new Handler();
|
||||
if (attachments.get(mediaPosition - 1).status != null) {
|
||||
binding.originalMessage.setOnClickListener(v -> {
|
||||
Intent intentContext = new Intent(MediaActivity.this, ContextActivity.class);
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable(Helper.ARG_STATUS, attachments.get(mediaPosition - 1).status);
|
||||
new CachedBundle(MediaActivity.this).insertBundle(args, Helper.getCurrentAccount(MediaActivity.this), bundleId -> {
|
||||
Bundle bundleCached = new Bundle();
|
||||
bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId);
|
||||
intentContext.putExtras(bundleCached);
|
||||
intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intentContext);
|
||||
});
|
||||
});
|
||||
binding.originalMessage.setOnClickListener(v -> openOriginalMessage(mediaPosition - 1));
|
||||
}
|
||||
|
||||
binding.mediaDescription.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
|
@ -239,6 +228,9 @@ public class MediaActivity extends BaseBarActivity implements OnDownloadInterfac
|
|||
mediaPosition = 1;
|
||||
}
|
||||
String description = attachments.get(position).description;
|
||||
if (attachments.get(position).status != null) {
|
||||
binding.originalMessage.setOnClickListener(v -> openOriginalMessage(position));
|
||||
}
|
||||
if (handler != null) {
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
|
@ -292,6 +284,19 @@ public class MediaActivity extends BaseBarActivity implements OnDownloadInterfac
|
|||
setFullscreen(true);
|
||||
}
|
||||
|
||||
private void openOriginalMessage(int position) {
|
||||
Intent intentContext = new Intent(MediaActivity.this, ContextActivity.class);
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable(Helper.ARG_STATUS, attachments.get(position).status);
|
||||
new CachedBundle(MediaActivity.this).insertBundle(args, Helper.getCurrentAccount(MediaActivity.this), bundleId -> {
|
||||
Bundle bundleCached = new Bundle();
|
||||
bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId);
|
||||
intentContext.putExtras(bundleCached);
|
||||
intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intentContext);
|
||||
});
|
||||
}
|
||||
|
||||
public String getStatusLanguageForTranslation() {
|
||||
return status != null ? status.language : "en";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue