fix mentions and more menu after a fresh login (#986)
This commit is contained in:
parent
15ca16e06f
commit
15af80c5a0
1 changed files with 11 additions and 13 deletions
|
@ -19,7 +19,6 @@ import android.content.ClipData;
|
|||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
|
@ -58,8 +57,6 @@ import javax.inject.Inject;
|
|||
* overlap functionality. So, I'm momentarily leaving it and hopefully working on those will clear
|
||||
* up what needs to be where. */
|
||||
public abstract class SFragment extends BaseFragment {
|
||||
protected String loggedInAccountId;
|
||||
protected String loggedInUsername;
|
||||
|
||||
protected abstract TimelineCases timelineCases();
|
||||
|
||||
|
@ -74,16 +71,6 @@ public abstract class SFragment extends BaseFragment {
|
|||
@Inject
|
||||
public AccountManager accountManager;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
AccountEntity activeAccount = accountManager.getActiveAccount();
|
||||
if (activeAccount != null) {
|
||||
loggedInAccountId = activeAccount.getAccountId();
|
||||
loggedInUsername = activeAccount.getUsername();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivity(Intent intent) {
|
||||
super.startActivity(intent);
|
||||
|
@ -125,6 +112,11 @@ public abstract class SFragment extends BaseFragment {
|
|||
Status.Mention[] mentions = actionableStatus.getMentions();
|
||||
Set<String> mentionedUsernames = new LinkedHashSet<>();
|
||||
mentionedUsernames.add(actionableStatus.getAccount().getUsername());
|
||||
String loggedInUsername = null;
|
||||
AccountEntity activeAccount = accountManager.getActiveAccount();
|
||||
if(activeAccount != null) {
|
||||
loggedInUsername = activeAccount.getUsername();
|
||||
}
|
||||
for (Status.Mention mention : mentions) {
|
||||
mentionedUsernames.add(mention.getUsername());
|
||||
}
|
||||
|
@ -146,6 +138,12 @@ public abstract class SFragment extends BaseFragment {
|
|||
final String accountUsername = status.getActionableStatus().getAccount().getUsername();
|
||||
final Spanned content = status.getActionableStatus().getContent();
|
||||
final String statusUrl = status.getActionableStatus().getUrl();
|
||||
String loggedInAccountId = null;
|
||||
AccountEntity activeAccount = accountManager.getActiveAccount();
|
||||
if(activeAccount != null) {
|
||||
loggedInAccountId = activeAccount.getAccountId();
|
||||
}
|
||||
|
||||
PopupMenu popup = new PopupMenu(getContext(), view);
|
||||
// Give a different menu depending on whether this is the user's own toot or not.
|
||||
if (loggedInAccountId == null || !loggedInAccountId.equals(accountId)) {
|
||||
|
|
Loading…
Reference in a new issue