Mention action on profiles

This commit is contained in:
Eugen Rochko 2017-03-10 23:37:02 +01:00
parent dbed424d6f
commit 1015f27554
3 changed files with 14 additions and 0 deletions

View file

@ -61,6 +61,7 @@ public class AccountActivity extends BaseActivity {
private boolean isSelf;
private String openInWebUrl;
private TabLayout tabLayout;
private Account loadedAccount;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -170,6 +171,8 @@ public class AccountActivity extends BaseActivity {
}
private void onObtainAccountSuccess(Account account) {
loadedAccount = account;
TextView username = (TextView) findViewById(R.id.account_username);
TextView displayName = (TextView) findViewById(R.id.account_display_name);
TextView note = (TextView) findViewById(R.id.account_note);
@ -448,6 +451,12 @@ public class AccountActivity extends BaseActivity {
onBackPressed();
return true;
}
case R.id.action_mention: {
Intent intent = new Intent(this, ComposeActivity.class);
intent.putExtra("mentioned_usernames", new String[] { loadedAccount.username });
startActivity(intent);
return true;
}
case R.id.action_open_in_web: {
Uri uri = Uri.parse(openInWebUrl);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);

View file

@ -2,6 +2,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_mention"
android:title="@string/action_mention"
app:showAsAction="never" />
<item android:id="@+id/action_open_in_web"
android:title="@string/action_open_in_web"
app:showAsAction="never" />

View file

@ -128,5 +128,6 @@
<string name="error_muting">That user wasn\'t muted.</string>
<string name="search">Search accounts…</string>
<string name="toggle_nsfw">NSFW</string>
<string name="action_mention">Mention</string>
</resources>