diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2020-04-06 22:16:16 +0200 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2020-04-06 22:16:16 +0200 |
commit | bd139f9b53aaeea842d8ee480f339b1ad4232930 (patch) | |
tree | 98dd090670073b78e0706f028f9f92c0d6fe311b /src | |
parent | e0415d1ac501ea2d9bb593224f6517900c56f6f8 (diff) |
make OTR setting working
Diffstat (limited to 'src')
3 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index aede6e326..8354d6517 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1154,7 +1154,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke menuNeedHelp.setVisible(true); menuSearchUpdates.setVisible(false); ConversationMenuConfigurator.configureAttachmentMenu(conversation, menu, activity.xmppConnectionService.getAttachmentChoicePreference(), hasAttachments); - ConversationMenuConfigurator.configureEncryptionMenu(conversation, menu); + ConversationMenuConfigurator.configureEncryptionMenu(conversation, menu, activity); } else { menuNeedHelp.setVisible(false); menuSearchUpdates.setVisible(true); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index b530dc051..624119bb8 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -97,6 +97,7 @@ import me.drakeet.support.toast.ToastCompat; import pl.droidsonroids.gif.GifDrawable; import rocks.xmpp.addr.Jid; +import static de.pixart.messenger.ui.SettingsActivity.ENABLE_OTR_ENCRYPTION; import static de.pixart.messenger.ui.SettingsActivity.USE_BUNDLED_EMOJIS; import static de.pixart.messenger.ui.SettingsActivity.USE_INTERNAL_UPDATER; @@ -439,6 +440,10 @@ public abstract class XmppActivity extends ActionBarActivity { return getBooleanPreference("unicolored_chatbg", R.bool.use_unicolored_chatbg); } + public boolean enableOTR() { + return getBooleanPreference(ENABLE_OTR_ENCRYPTION, R.bool.enable_otr); + } + public void setBubbleColor(final View v, final int backgroundColor, final int borderColor) { GradientDrawable shape = (GradientDrawable) v.getBackground(); shape.setColor(backgroundColor); diff --git a/src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java b/src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java index 9797da56f..8a9434622 100644 --- a/src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java +++ b/src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java @@ -29,6 +29,7 @@ package de.pixart.messenger.ui.util; +import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import android.view.Menu; @@ -42,8 +43,7 @@ import de.pixart.messenger.crypto.OmemoSetting; import de.pixart.messenger.entities.Conversation; import de.pixart.messenger.entities.Conversational; import de.pixart.messenger.entities.Message; - -import static de.pixart.messenger.ui.SettingsActivity.ENABLE_OTR_ENCRYPTION; +import de.pixart.messenger.ui.XmppActivity; public class ConversationMenuConfigurator { @@ -93,7 +93,7 @@ public class ConversationMenuConfigurator { menu.findItem(R.id.attach_location).setVisible(locationAvailable); } - public static void configureEncryptionMenu(@NonNull Conversation conversation, Menu menu) { + public static void configureEncryptionMenu(@NonNull Conversation conversation, Menu menu, final XmppActivity activity) { final MenuItem menuSecure = menu.findItem(R.id.action_security); final boolean participating = conversation.getMode() == Conversational.MODE_SINGLE || conversation.getMucOptions().participating(); if (!participating) { @@ -130,7 +130,7 @@ public class ConversationMenuConfigurator { menuSecure.setIcon(R.drawable.ic_lock_white_24dp); } - otr.setVisible(Config.supportOtr() && conversation.getBooleanAttribute(ENABLE_OTR_ENCRYPTION, false)); + otr.setVisible(Config.supportOtr() && activity.enableOTR()); if (conversation.getMode() == Conversation.MODE_MULTI) { otr.setVisible(false); } |