note to self as separate context menu item

This commit is contained in:
kosyak 2023-10-30 21:31:54 +01:00
parent 11316a949d
commit f12c242628
3 changed files with 19 additions and 0 deletions

View file

@ -730,6 +730,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
AccountUtils.showHideMenuItems(menu);
MenuItem menuHideOffline = menu.findItem(R.id.action_hide_offline);
MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
MenuItem noteToSelf = menu.findItem(R.id.action_note_to_self);
qrCodeScanMenuItem.setVisible(isCameraFeatureAvailable());
if (QuickConversationsService.isQuicksy()) {
menuHideOffline.setVisible(false);
@ -737,6 +738,11 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
menuHideOffline.setVisible(true);
menuHideOffline.setChecked(this.mHideOfflineContacts);
}
if (xmppConnectionService.getAccounts().size() != 1) {
noteToSelf.setVisible(false);
}
mMenuSearchView = menu.findItem(R.id.action_search);
mMenuSearchView.setOnActionExpandListener(mOnActionExpandListener);
View mSearchView = mMenuSearchView.getActionView();
@ -781,6 +787,12 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
filter(mSearchEditText.getText().toString());
}
invalidateOptionsMenu();
case R.id.action_note_to_self:
final List<Account> accounts = xmppConnectionService.getAccounts();
if (accounts.size() == 1) {
final Contact self = new Contact(accounts.get(0).getSelfContact());
openConversationForContact(self);
}
}
return super.onOptionsItemSelected(item);
}

View file

@ -14,6 +14,12 @@
android:icon="?attr/icon_scan_qr_code"
app:showAsAction="always"/>
<item
android:id="@+id/action_note_to_self"
android:orderInCategory="80"
android:title="@string/note_to_self"
app:showAsAction="never"/>
<item
android:id="@+id/action_hide_offline"
android:checkable="true"

View file

@ -429,6 +429,7 @@
<string name="avatar_has_been_published">Avatar has been published!</string>
<string name="sending_x_file">Sending %s</string>
<string name="offering_x_file">Offering %s</string>
<string name="note_to_self">Note to self</string>
<string name="hide_offline">Hide offline</string>
<string name="contact_is_typing">%s is typing…</string>
<string name="contact_has_stopped_typing">%s has stopped typing</string>