make OTR setting working
This commit is contained in:
parent
e0415d1ac5
commit
bd139f9b53
3 changed files with 10 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Reference in a new issue