mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
make in-chat-menu more flexible
This commit is contained in:
parent
2c8ce5b9bc
commit
4e3345a912
4 changed files with 16 additions and 29 deletions
|
@ -3,6 +3,9 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
>
|
||||
|
||||
<item android:title="@string/menu_mute"
|
||||
android:id="@+id/menu_mute_notifications"/>
|
||||
|
||||
<item android:title="@string/menu_view_profile"
|
||||
android:id="@+id/menu_profile"/>
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:title="@string/menu_unmute"
|
||||
android:id="@+id/menu_unmute_notifications" />
|
||||
</menu>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:title="@string/menu_mute"
|
||||
android:id="@+id/menu_mute_notifications" />
|
||||
|
||||
</menu>
|
|
@ -428,15 +428,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
return true;
|
||||
}
|
||||
|
||||
if (recipient != null && Prefs.isChatMuted(this, chatId)) {
|
||||
inflater.inflate(R.menu.conversation_muted, menu);
|
||||
}
|
||||
else {
|
||||
inflater.inflate(R.menu.conversation_unmuted, menu);
|
||||
}
|
||||
|
||||
inflater.inflate(R.menu.conversation, menu);
|
||||
|
||||
if(Prefs.isChatMuted(this, chatId)) {
|
||||
menu.findItem(R.id.menu_mute_notifications).setTitle(R.string.menu_unmute);
|
||||
}
|
||||
|
||||
if (!Prefs.isLocationStreamingEnabled(this)) {
|
||||
menu.findItem(R.id.menu_show_map).setVisible(false);
|
||||
}
|
||||
|
@ -469,7 +466,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
case R.id.menu_archive_chat: handleArchiveChat(); return true;
|
||||
case R.id.menu_delete_chat: handleDeleteChat(); return true;
|
||||
case R.id.menu_mute_notifications: handleMuteNotifications(); return true;
|
||||
case R.id.menu_unmute_notifications: handleUnmuteNotifications(); return true;
|
||||
case R.id.menu_profile: handleProfile(); return true;
|
||||
case R.id.menu_show_map: handleShowMap(); return true;
|
||||
case android.R.id.home: handleReturnToConversationList(); return true;
|
||||
|
@ -525,10 +521,15 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
}
|
||||
|
||||
private void handleMuteNotifications() {
|
||||
if(!Prefs.isChatMuted(this, chatId)) {
|
||||
MuteDialog.show(this, until -> {
|
||||
Prefs.setChatMutedUntil(this, chatId, until);
|
||||
titleView.setTitle(glideRequests, dcChat); // update title-mute-icon
|
||||
titleView.setTitle(glideRequests, dcChat);
|
||||
});
|
||||
} else {
|
||||
Prefs.setChatMutedUntil(this, chatId, 0);
|
||||
titleView.setTitle(glideRequests, dcChat);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleProfile() {
|
||||
|
@ -541,11 +542,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void handleUnmuteNotifications() {
|
||||
Prefs.setChatMutedUntil(this, chatId, 0);
|
||||
titleView.setTitle(glideRequests, dcChat); // update title-mute-icon
|
||||
}
|
||||
|
||||
private void handleLeaveGroup() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(getString(R.string.ask_leave_group))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue