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