Fix issue #109 - Mention booster when replying directly to a boost
This commit is contained in:
parent
e3933ae3eb
commit
4267d2798e
|
@ -106,6 +106,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
private String visibility;
|
private String visibility;
|
||||||
private app.fedilab.android.client.entities.api.Account accountMention;
|
private app.fedilab.android.client.entities.api.Account accountMention;
|
||||||
private String statusReplyId;
|
private String statusReplyId;
|
||||||
|
private app.fedilab.android.client.entities.api.Account mentionBooster;
|
||||||
|
|
||||||
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -157,6 +158,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
instance = b.getString(Helper.ARG_INSTANCE, null);
|
instance = b.getString(Helper.ARG_INSTANCE, null);
|
||||||
token = b.getString(Helper.ARG_TOKEN, null);
|
token = b.getString(Helper.ARG_TOKEN, null);
|
||||||
visibility = b.getString(Helper.ARG_VISIBILITY, null);
|
visibility = b.getString(Helper.ARG_VISIBILITY, null);
|
||||||
|
mentionBooster = (app.fedilab.android.client.entities.api.Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
|
||||||
accountMention = (app.fedilab.android.client.entities.api.Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION);
|
accountMention = (app.fedilab.android.client.entities.api.Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION);
|
||||||
}
|
}
|
||||||
binding.toolbar.setPopupTheme(Helper.popupStyle());
|
binding.toolbar.setPopupTheme(Helper.popupStyle());
|
||||||
|
@ -266,6 +268,21 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mentionBooster != null) {
|
||||||
|
Mention mention = new Mention();
|
||||||
|
mention.acct = mentionBooster.acct;
|
||||||
|
mention.url = mentionBooster.url;
|
||||||
|
mention.username = mentionBooster.username;
|
||||||
|
boolean present = false;
|
||||||
|
for (Mention mentionTmp : statusDraftList.get(0).mentions) {
|
||||||
|
if (mentionTmp.acct.equalsIgnoreCase(mentionBooster.acct)) {
|
||||||
|
present = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!present) {
|
||||||
|
statusDraftList.get(0).mentions.add(mention);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (statusReply.spoiler_text != null) {
|
if (statusReply.spoiler_text != null) {
|
||||||
statusDraftList.get(0).spoiler_text = statusReply.spoiler_text;
|
statusDraftList.get(0).spoiler_text = statusReply.spoiler_text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,7 @@ public class Helper {
|
||||||
|
|
||||||
public static final String ARG_STATUS_DRAFT_ID = "ARG_STATUS_DRAFT_ID";
|
public static final String ARG_STATUS_DRAFT_ID = "ARG_STATUS_DRAFT_ID";
|
||||||
public static final String ARG_STATUS_REPLY = "ARG_STATUS_REPLY";
|
public static final String ARG_STATUS_REPLY = "ARG_STATUS_REPLY";
|
||||||
|
public static final String ARG_MENTION_BOOSTER = "ARG_MENTION_BOOSTER";
|
||||||
public static final String ARG_STATUS_REPLY_ID = "ARG_STATUS_REPLY_ID";
|
public static final String ARG_STATUS_REPLY_ID = "ARG_STATUS_REPLY_ID";
|
||||||
public static final String ARG_ACCOUNT = "ARG_ACCOUNT";
|
public static final String ARG_ACCOUNT = "ARG_ACCOUNT";
|
||||||
public static final String ARG_ACCOUNT_MENTION = "ARG_ACCOUNT_MENTION";
|
public static final String ARG_ACCOUNT_MENTION = "ARG_ACCOUNT_MENTION";
|
||||||
|
|
|
@ -1566,6 +1566,9 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
} else {
|
} else {
|
||||||
Intent intent = new Intent(context, ComposeActivity.class);
|
Intent intent = new Intent(context, ComposeActivity.class);
|
||||||
intent.putExtra(Helper.ARG_STATUS_REPLY, statusToDeal);
|
intent.putExtra(Helper.ARG_STATUS_REPLY, statusToDeal);
|
||||||
|
if (status.reblog != null) {
|
||||||
|
intent.putExtra(Helper.ARG_MENTION_BOOSTER, status.account);
|
||||||
|
}
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue