Mention action on profiles

main
Eugen Rochko 7 years ago
parent dbed424d6f
commit 1015f27554
  1. 9
      app/src/main/java/com/keylesspalace/tusky/AccountActivity.java
  2. 4
      app/src/main/res/menu/account_toolbar.xml
  3. 1
      app/src/main/res/values/strings.xml

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

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

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

Loading…
Cancel
Save