added snackbar to indicate smp. more error handling in verify activity
This commit is contained in:
		
							parent
							
								
									6cd2ff0d88
								
							
						
					
					
						commit
						e33fc26cbe
					
				|  | @ -417,6 +417,10 @@ public class Conversation extends AbstractEntity { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	public boolean smpRequested() { | ||||||
|  | 		return smp().status == Smp.STATUS_CONTACT_REQUESTED; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	public void setNextMessage(String message) { | 	public void setNextMessage(String message) { | ||||||
| 		this.nextMessage = message; | 		this.nextMessage = message; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -35,7 +35,6 @@ import net.java.otr4j.session.SessionStatus; | ||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Set; |  | ||||||
| import java.util.concurrent.ConcurrentLinkedQueue; | import java.util.concurrent.ConcurrentLinkedQueue; | ||||||
| 
 | 
 | ||||||
| import eu.siacs.conversations.R; | import eu.siacs.conversations.R; | ||||||
|  | @ -53,7 +52,6 @@ import eu.siacs.conversations.ui.XmppActivity.OnValueEdited; | ||||||
| import eu.siacs.conversations.ui.adapter.MessageAdapter; | import eu.siacs.conversations.ui.adapter.MessageAdapter; | ||||||
| import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureClicked; | import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureClicked; | ||||||
| import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureLongClicked; | import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureLongClicked; | ||||||
| import eu.siacs.conversations.utils.UIHelper; |  | ||||||
| import eu.siacs.conversations.xmpp.jid.Jid; | import eu.siacs.conversations.xmpp.jid.Jid; | ||||||
| 
 | 
 | ||||||
| public class ConversationFragment extends Fragment { | public class ConversationFragment extends Fragment { | ||||||
|  | @ -146,6 +144,19 @@ public class ConversationFragment extends Fragment { | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
|  | 	protected OnClickListener clickToVerify = new OnClickListener() { | ||||||
|  | 
 | ||||||
|  | 		@Override | ||||||
|  | 		public void onClick(View v) { | ||||||
|  | 			if (conversation.getOtrFingerprint() != null) { | ||||||
|  | 				Intent intent = new Intent(getActivity(), VerifyOTRActivity.class); | ||||||
|  | 				intent.setAction(VerifyOTRActivity.ACTION_VERIFY_CONTACT); | ||||||
|  | 				intent.putExtra("contact", conversation.getContact().getJid().toBareJid().toString()); | ||||||
|  | 				intent.putExtra("account", conversation.getAccount().getJid().toBareJid().toString()); | ||||||
|  | 				startActivity(intent); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
| 	private ConcurrentLinkedQueue<Message> mEncryptedMessages = new ConcurrentLinkedQueue<>(); | 	private ConcurrentLinkedQueue<Message> mEncryptedMessages = new ConcurrentLinkedQueue<>(); | ||||||
| 	private boolean mDecryptJobRunning = false; | 	private boolean mDecryptJobRunning = false; | ||||||
| 	private OnEditorActionListener mEditorActionListener = new OnEditorActionListener() { | 	private OnEditorActionListener mEditorActionListener = new OnEditorActionListener() { | ||||||
|  | @ -296,7 +307,7 @@ public class ConversationFragment extends Fragment { | ||||||
| 											.getConversation()); | 											.getConversation()); | ||||||
| 								} | 								} | ||||||
| 							} | 							} | ||||||
| 						}  else { | 						} else { | ||||||
| 							Account account = message.getConversation().getAccount(); | 							Account account = message.getConversation().getAccount(); | ||||||
| 							Intent intent = new Intent(activity, EditAccountActivity.class); | 							Intent intent = new Intent(activity, EditAccountActivity.class); | ||||||
| 							intent.putExtra("jid", account.getJid().toBareJid().toString()); | 							intent.putExtra("jid", account.getJid().toBareJid().toString()); | ||||||
|  | @ -505,6 +516,39 @@ public class ConversationFragment extends Fragment { | ||||||
| 								activity.switchToContactDetails(contact); | 								activity.switchToContactDetails(contact); | ||||||
| 							} | 							} | ||||||
| 						}); | 						}); | ||||||
|  | 			} else if (conversation.getMode() == Conversation.MODE_SINGLE) { | ||||||
|  | 				makeFingerprintWarning(); | ||||||
|  | 			} else if (!conversation.getMucOptions().online() | ||||||
|  | 					&& conversation.getAccount().getStatus() == Account.STATUS_ONLINE) { | ||||||
|  | 				int error = conversation.getMucOptions().getError(); | ||||||
|  | 				switch (error) { | ||||||
|  | 					case MucOptions.ERROR_NICK_IN_USE: | ||||||
|  | 						showSnackbar(R.string.nick_in_use, R.string.edit, | ||||||
|  | 								clickToMuc); | ||||||
|  | 						break; | ||||||
|  | 					case MucOptions.ERROR_ROOM_NOT_FOUND: | ||||||
|  | 						showSnackbar(R.string.conference_not_found, | ||||||
|  | 								R.string.leave, leaveMuc); | ||||||
|  | 						break; | ||||||
|  | 					case MucOptions.ERROR_PASSWORD_REQUIRED: | ||||||
|  | 						showSnackbar(R.string.conference_requires_password, | ||||||
|  | 								R.string.enter_password, enterPassword); | ||||||
|  | 						break; | ||||||
|  | 					case MucOptions.ERROR_BANNED: | ||||||
|  | 						showSnackbar(R.string.conference_banned, | ||||||
|  | 								R.string.leave, leaveMuc); | ||||||
|  | 						break; | ||||||
|  | 					case MucOptions.ERROR_MEMBERS_ONLY: | ||||||
|  | 						showSnackbar(R.string.conference_members_only, | ||||||
|  | 								R.string.leave, leaveMuc); | ||||||
|  | 						break; | ||||||
|  | 					case MucOptions.KICKED_FROM_ROOM: | ||||||
|  | 						showSnackbar(R.string.conference_kicked, R.string.join, | ||||||
|  | 								joinMuc); | ||||||
|  | 						break; | ||||||
|  | 					default: | ||||||
|  | 						break; | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 			for (Message message : this.conversation.getMessages()) { | 			for (Message message : this.conversation.getMessages()) { | ||||||
| 				if (message.getEncryption() == Message.ENCRYPTION_PGP | 				if (message.getEncryption() == Message.ENCRYPTION_PGP | ||||||
|  | @ -526,44 +570,6 @@ public class ConversationFragment extends Fragment { | ||||||
| 				updateStatusMessages(); | 				updateStatusMessages(); | ||||||
| 			} | 			} | ||||||
| 			this.messageListAdapter.notifyDataSetChanged(); | 			this.messageListAdapter.notifyDataSetChanged(); | ||||||
| 			if (conversation.getMode() == Conversation.MODE_SINGLE) { |  | ||||||
| 				if (messageList.size() >= 1) { |  | ||||||
| 					makeFingerprintWarning(); |  | ||||||
| 				} |  | ||||||
| 			} else { |  | ||||||
| 				if (!conversation.getMucOptions().online() |  | ||||||
| 						&& conversation.getAccount().getStatus() == Account.STATUS_ONLINE) { |  | ||||||
| 					int error = conversation.getMucOptions().getError(); |  | ||||||
| 					switch (error) { |  | ||||||
| 						case MucOptions.ERROR_NICK_IN_USE: |  | ||||||
| 							showSnackbar(R.string.nick_in_use, R.string.edit, |  | ||||||
| 									clickToMuc); |  | ||||||
| 							break; |  | ||||||
| 						case MucOptions.ERROR_ROOM_NOT_FOUND: |  | ||||||
| 							showSnackbar(R.string.conference_not_found, |  | ||||||
| 									R.string.leave, leaveMuc); |  | ||||||
| 							break; |  | ||||||
| 						case MucOptions.ERROR_PASSWORD_REQUIRED: |  | ||||||
| 							showSnackbar(R.string.conference_requires_password, |  | ||||||
| 									R.string.enter_password, enterPassword); |  | ||||||
| 							break; |  | ||||||
| 						case MucOptions.ERROR_BANNED: |  | ||||||
| 							showSnackbar(R.string.conference_banned, |  | ||||||
| 									R.string.leave, leaveMuc); |  | ||||||
| 							break; |  | ||||||
| 						case MucOptions.ERROR_MEMBERS_ONLY: |  | ||||||
| 							showSnackbar(R.string.conference_members_only, |  | ||||||
| 									R.string.leave, leaveMuc); |  | ||||||
| 							break; |  | ||||||
| 						case MucOptions.KICKED_FROM_ROOM: |  | ||||||
| 							showSnackbar(R.string.conference_kicked, R.string.join, |  | ||||||
| 									joinMuc); |  | ||||||
| 							break; |  | ||||||
| 						default: |  | ||||||
| 							break; |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 			updateChatMsgHint(); | 			updateChatMsgHint(); | ||||||
| 			if (!activity.isConversationsOverviewVisable() || !activity.isConversationsOverviewHideable()) { | 			if (!activity.isConversationsOverviewVisable() || !activity.isConversationsOverviewHideable()) { | ||||||
| 				activity.xmppConnectionService.markRead(conversation, true); | 				activity.xmppConnectionService.markRead(conversation, true); | ||||||
|  | @ -680,24 +686,11 @@ public class ConversationFragment extends Fragment { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	protected void makeFingerprintWarning() { | 	protected void makeFingerprintWarning() { | ||||||
| 		if (conversation.hasValidOtrSession() | 		if (conversation.smpRequested()) { | ||||||
| 				&& (!conversation.isMuted()) | 			showSnackbar(R.string.smp_requested, R.string.verify, clickToVerify); | ||||||
| 				&& (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) | 		} else if (conversation.hasValidOtrSession() && (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) | ||||||
| 				&& (!conversation.isOtrFingerprintVerified())) { | 				&& (!conversation.isOtrFingerprintVerified())) { | ||||||
| 			showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, | 			showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, clickToVerify); | ||||||
| 					new OnClickListener() { |  | ||||||
| 
 |  | ||||||
| 						@Override |  | ||||||
| 						public void onClick(View v) { |  | ||||||
| 							if (conversation.getOtrFingerprint() != null) { |  | ||||||
| 								Intent intent = new Intent(getActivity(),VerifyOTRActivity.class); |  | ||||||
| 								intent.setAction(VerifyOTRActivity.ACTION_VERIFY_CONTACT); |  | ||||||
| 								intent.putExtra("contact",conversation.getContact().getJid().toBareJid().toString()); |  | ||||||
| 								intent.putExtra("account",conversation.getAccount().getJid().toBareJid().toString()); |  | ||||||
| 								startActivity(intent); |  | ||||||
| 							} |  | ||||||
| 						} |  | ||||||
| 					}); |  | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -824,15 +817,15 @@ public class ConversationFragment extends Fragment { | ||||||
| 		final ConversationActivity activity = (ConversationActivity) getActivity(); | 		final ConversationActivity activity = (ConversationActivity) getActivity(); | ||||||
| 		final XmppConnectionService xmppService = activity.xmppConnectionService; | 		final XmppConnectionService xmppService = activity.xmppConnectionService; | ||||||
| 		activity.selectPresence(message.getConversation(), | 		activity.selectPresence(message.getConversation(), | ||||||
| 			new OnPresenceSelected() { | 				new OnPresenceSelected() { | ||||||
| 
 | 
 | ||||||
| 				@Override | 					@Override | ||||||
| 				public void onPresenceSelected() { | 					public void onPresenceSelected() { | ||||||
| 					message.setCounterpart(conversation.getNextCounterpart()); | 						message.setCounterpart(conversation.getNextCounterpart()); | ||||||
| 					xmppService.sendMessage(message); | 						xmppService.sendMessage(message); | ||||||
| 					messageSent(); | 						messageSent(); | ||||||
| 				} | 					} | ||||||
| 			}); | 				}); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public void appendText(String text) { | 	public void appendText(String text) { | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ import android.view.View; | ||||||
| import android.widget.Button; | import android.widget.Button; | ||||||
| import android.widget.EditText; | import android.widget.EditText; | ||||||
| import android.widget.ImageView; | import android.widget.ImageView; | ||||||
|  | import android.widget.RelativeLayout; | ||||||
| import android.widget.TextView; | import android.widget.TextView; | ||||||
| import android.widget.Toast; | import android.widget.Toast; | ||||||
| 
 | 
 | ||||||
|  | @ -27,6 +28,9 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer | ||||||
| 
 | 
 | ||||||
| 	public static final String ACTION_VERIFY_CONTACT = "verify_contact"; | 	public static final String ACTION_VERIFY_CONTACT = "verify_contact"; | ||||||
| 
 | 
 | ||||||
|  | 	private RelativeLayout mVerificationAreaOne; | ||||||
|  | 	private RelativeLayout mVerificationAreaTwo; | ||||||
|  | 	private TextView mErrorNoSession; | ||||||
| 	private TextView mRemoteJid; | 	private TextView mRemoteJid; | ||||||
| 	private TextView mRemoteFingerprint; | 	private TextView mRemoteFingerprint; | ||||||
| 	private TextView mYourFingerprint; | 	private TextView mYourFingerprint; | ||||||
|  | @ -38,6 +42,16 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer | ||||||
| 	private TextView mStatusMessage; | 	private TextView mStatusMessage; | ||||||
| 	private Account mAccount; | 	private Account mAccount; | ||||||
| 	private Conversation mConversation; | 	private Conversation mConversation; | ||||||
|  | 
 | ||||||
|  | 	private View.OnClickListener mVerifyFingerprintListener = new View.OnClickListener() { | ||||||
|  | 
 | ||||||
|  | 		@Override | ||||||
|  | 		public void onClick(View view) { | ||||||
|  | 			mConversation.verifyOtrFingerprint(); | ||||||
|  | 			finish(); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
| 	private View.OnClickListener mCreateSharedSecretListener = new View.OnClickListener() { | 	private View.OnClickListener mCreateSharedSecretListener = new View.OnClickListener() { | ||||||
| 		@Override | 		@Override | ||||||
| 		public void onClick(final View view) { | 		public void onClick(final View view) { | ||||||
|  | @ -53,6 +67,7 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer | ||||||
| 		@Override | 		@Override | ||||||
| 		public void onClick(View view) { | 		public void onClick(View view) { | ||||||
| 			abortSmp(); | 			abortSmp(); | ||||||
|  | 			updateView(); | ||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
| 	private View.OnClickListener mRespondSharedSecretListener = new View.OnClickListener() { | 	private View.OnClickListener mRespondSharedSecretListener = new View.OnClickListener() { | ||||||
|  | @ -103,6 +118,8 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer | ||||||
| 			try { | 			try { | ||||||
| 				session.abortSmp(); | 				session.abortSmp(); | ||||||
| 				mConversation.smp().status = Conversation.Smp.STATUS_NONE; | 				mConversation.smp().status = Conversation.Smp.STATUS_NONE; | ||||||
|  | 				mConversation.smp().hint = null; | ||||||
|  | 				mConversation.smp().secret = null; | ||||||
| 				return true; | 				return true; | ||||||
| 			} catch (OtrException e) { | 			} catch (OtrException e) { | ||||||
| 				return false; | 				return false; | ||||||
|  | @ -156,53 +173,67 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	protected void updateView() { | 	protected void updateView() { | ||||||
| 		this.mYourFingerprint.setText(this.mAccount.getOtrFingerprint(xmppConnectionService)); | 		if (this.mConversation.hasValidOtrSession()) { | ||||||
| 		this.mRemoteFingerprint.setText(this.mConversation.getOtrFingerprint()); | 			this.mVerificationAreaOne.setVisibility(View.VISIBLE); | ||||||
| 		this.mRemoteJid.setText(this.mConversation.getContact().getJid().toBareJid().toString()); | 			this.mVerificationAreaTwo.setVisibility(View.VISIBLE); | ||||||
| 		Conversation.Smp smp = mConversation.smp(); | 			this.mErrorNoSession.setVisibility(View.GONE); | ||||||
| 		Session session = mConversation.getOtrSession(); | 			this.mYourFingerprint.setText(this.mAccount.getOtrFingerprint(xmppConnectionService)); | ||||||
| 		if (smp.status == Conversation.Smp.STATUS_NONE) { | 			this.mRemoteFingerprint.setText(this.mConversation.getOtrFingerprint()); | ||||||
| 			activateButton(mButtonSharedSecretPositive, R.string.create, mCreateSharedSecretListener); | 			this.mRemoteJid.setText(this.mConversation.getContact().getJid().toBareJid().toString()); | ||||||
| 			deactivateButton(mButtonSharedSecretNegative, R.string.cancel); | 			Conversation.Smp smp = mConversation.smp(); | ||||||
| 			this.mSharedSecretHint.setFocusableInTouchMode(true); | 			Session session = mConversation.getOtrSession(); | ||||||
| 			this.mSharedSecretSecret.setFocusableInTouchMode(true); | 			if (mConversation.isOtrFingerprintVerified()) { | ||||||
| 			this.mSharedSecretSecret.setText(""); | 				deactivateButton(mButtonVerifyFingerprint, R.string.verified); | ||||||
| 			this.mSharedSecretHint.setText(""); | 			} else { | ||||||
| 			this.mSharedSecretHint.setVisibility(View.VISIBLE); | 				activateButton(mButtonVerifyFingerprint, R.string.verify, mVerifyFingerprintListener); | ||||||
| 			this.mSharedSecretSecret.setVisibility(View.VISIBLE); | 			} | ||||||
| 			this.mStatusMessage.setVisibility(View.GONE); | 			if (smp.status == Conversation.Smp.STATUS_NONE) { | ||||||
| 		} else if (smp.status == Conversation.Smp.STATUS_CONTACT_REQUESTED) { | 				activateButton(mButtonSharedSecretPositive, R.string.create, mCreateSharedSecretListener); | ||||||
| 			this.mSharedSecretHint.setFocusable(false); | 				deactivateButton(mButtonSharedSecretNegative, R.string.cancel); | ||||||
| 			this.mSharedSecretHint.setText(smp.hint); | 				this.mSharedSecretHint.setFocusableInTouchMode(true); | ||||||
| 			this.mSharedSecretSecret.setFocusableInTouchMode(true); | 				this.mSharedSecretSecret.setFocusableInTouchMode(true); | ||||||
| 			this.mSharedSecretHint.setVisibility(View.VISIBLE); | 				this.mSharedSecretSecret.setText(""); | ||||||
| 			this.mSharedSecretSecret.setVisibility(View.VISIBLE); | 				this.mSharedSecretHint.setText(""); | ||||||
| 			this.mStatusMessage.setVisibility(View.GONE); | 				this.mSharedSecretHint.setVisibility(View.VISIBLE); | ||||||
| 			deactivateButton(mButtonSharedSecretNegative, R.string.cancel); | 				this.mSharedSecretSecret.setVisibility(View.VISIBLE); | ||||||
| 			activateButton(mButtonSharedSecretPositive, R.string.respond, mRespondSharedSecretListener); | 				this.mStatusMessage.setVisibility(View.GONE); | ||||||
| 		} else if (smp.status == Conversation.Smp.STATUS_FAILED) { | 			} else if (smp.status == Conversation.Smp.STATUS_CONTACT_REQUESTED) { | ||||||
| 			activateButton(mButtonSharedSecretNegative, R.string.cancel, mFinishListener); | 				this.mSharedSecretHint.setFocusable(false); | ||||||
| 			activateButton(mButtonSharedSecretPositive, R.string.try_again, mRetrySharedSecretListener); | 				this.mSharedSecretHint.setText(smp.hint); | ||||||
| 			this.mSharedSecretHint.setVisibility(View.GONE); | 				this.mSharedSecretSecret.setFocusableInTouchMode(true); | ||||||
| 			this.mSharedSecretSecret.setVisibility(View.GONE); | 				this.mSharedSecretHint.setVisibility(View.VISIBLE); | ||||||
| 			this.mStatusMessage.setVisibility(View.VISIBLE); | 				this.mSharedSecretSecret.setVisibility(View.VISIBLE); | ||||||
| 			this.mStatusMessage.setText(R.string.secrets_do_not_match); | 				this.mStatusMessage.setVisibility(View.GONE); | ||||||
| 			this.mStatusMessage.setTextColor(getWarningTextColor()); | 				deactivateButton(mButtonSharedSecretNegative, R.string.cancel); | ||||||
| 		} else if (smp.status == Conversation.Smp.STATUS_VERIFIED) { | 				activateButton(mButtonSharedSecretPositive, R.string.respond, mRespondSharedSecretListener); | ||||||
| 			this.mSharedSecretHint.setVisibility(View.GONE); | 			} else if (smp.status == Conversation.Smp.STATUS_FAILED) { | ||||||
| 			this.mSharedSecretSecret.setVisibility(View.GONE); | 				activateButton(mButtonSharedSecretNegative, R.string.cancel, mFinishListener); | ||||||
| 			this.mStatusMessage.setVisibility(View.VISIBLE); | 				activateButton(mButtonSharedSecretPositive, R.string.try_again, mRetrySharedSecretListener); | ||||||
| 			this.mStatusMessage.setText(R.string.verified); | 				this.mSharedSecretHint.setVisibility(View.GONE); | ||||||
| 			this.mStatusMessage.setTextColor(getPrimaryColor()); | 				this.mSharedSecretSecret.setVisibility(View.GONE); | ||||||
| 			deactivateButton(mButtonSharedSecretNegative, R.string.cancel); | 				this.mStatusMessage.setVisibility(View.VISIBLE); | ||||||
| 			activateButton(mButtonSharedSecretPositive, R.string.finish, mFinishListener); | 				this.mStatusMessage.setText(R.string.secrets_do_not_match); | ||||||
| 		} else if (session != null && session.isSmpInProgress()) { | 				this.mStatusMessage.setTextColor(getWarningTextColor()); | ||||||
| 			deactivateButton(mButtonSharedSecretPositive,R.string.in_progress); | 			} else if (smp.status == Conversation.Smp.STATUS_VERIFIED) { | ||||||
| 			activateButton(mButtonSharedSecretNegative,R.string.cancel,mCancelSharedSecretListener); | 				this.mSharedSecretHint.setVisibility(View.GONE); | ||||||
| 			this.mSharedSecretHint.setVisibility(View.VISIBLE); | 				this.mSharedSecretSecret.setVisibility(View.GONE); | ||||||
| 			this.mSharedSecretSecret.setVisibility(View.VISIBLE); | 				this.mStatusMessage.setVisibility(View.VISIBLE); | ||||||
| 			this.mSharedSecretHint.setFocusable(false); | 				this.mStatusMessage.setText(R.string.verified); | ||||||
| 			this.mSharedSecretSecret.setFocusable(false); | 				this.mStatusMessage.setTextColor(getPrimaryColor()); | ||||||
|  | 				deactivateButton(mButtonSharedSecretNegative, R.string.cancel); | ||||||
|  | 				activateButton(mButtonSharedSecretPositive, R.string.finish, mFinishListener); | ||||||
|  | 			} else if (session != null && session.isSmpInProgress()) { | ||||||
|  | 				deactivateButton(mButtonSharedSecretPositive, R.string.in_progress); | ||||||
|  | 				activateButton(mButtonSharedSecretNegative, R.string.cancel, mCancelSharedSecretListener); | ||||||
|  | 				this.mSharedSecretHint.setVisibility(View.VISIBLE); | ||||||
|  | 				this.mSharedSecretSecret.setVisibility(View.VISIBLE); | ||||||
|  | 				this.mSharedSecretHint.setFocusable(false); | ||||||
|  | 				this.mSharedSecretSecret.setFocusable(false); | ||||||
|  | 			} | ||||||
|  | 		} else { | ||||||
|  | 			this.mVerificationAreaOne.setVisibility(View.GONE); | ||||||
|  | 			this.mVerificationAreaTwo.setVisibility(View.GONE); | ||||||
|  | 			this.mErrorNoSession.setVisibility(View.VISIBLE); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -233,6 +264,9 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer | ||||||
| 		this.mSharedSecretSecret = (EditText) findViewById(R.id.shared_secret_secret); | 		this.mSharedSecretSecret = (EditText) findViewById(R.id.shared_secret_secret); | ||||||
| 		this.mSharedSecretHint = (EditText) findViewById(R.id.shared_secret_hint); | 		this.mSharedSecretHint = (EditText) findViewById(R.id.shared_secret_hint); | ||||||
| 		this.mStatusMessage= (TextView) findViewById(R.id.status_message); | 		this.mStatusMessage= (TextView) findViewById(R.id.status_message); | ||||||
|  | 		this.mVerificationAreaOne = (RelativeLayout) findViewById(R.id.verification_area_one); | ||||||
|  | 		this.mVerificationAreaTwo = (RelativeLayout) findViewById(R.id.verification_area_two); | ||||||
|  | 		this.mErrorNoSession = (TextView) findViewById(R.id.error_no_session); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
|  |  | ||||||
|  | @ -8,7 +8,18 @@ | ||||||
|         android:layout_width="fill_parent" |         android:layout_width="fill_parent" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:orientation="vertical"> |         android:orientation="vertical"> | ||||||
|  |         <TextView | ||||||
|  |             android:id="@+id/error_no_session" | ||||||
|  |             android:layout_margin="16dp" | ||||||
|  |             android:layout_width="wrap_content" | ||||||
|  |             android:layout_height="wrap_content" | ||||||
|  |             android:text="@string/no_otr_session_found" | ||||||
|  |             android:layout_gravity="center_horizontal" | ||||||
|  |             android:textColor="@color/primarytext" | ||||||
|  |             android:textSize="?attr/TextSizeBody" | ||||||
|  |             /> | ||||||
|         <RelativeLayout |         <RelativeLayout | ||||||
|  |             android:id="@+id/verification_area_one" | ||||||
|             android:layout_width="fill_parent" |             android:layout_width="fill_parent" | ||||||
|             android:layout_height="fill_parent" |             android:layout_height="fill_parent" | ||||||
|             android:background="@drawable/infocard_border" |             android:background="@drawable/infocard_border" | ||||||
|  | @ -90,6 +101,7 @@ | ||||||
|             </LinearLayout> |             </LinearLayout> | ||||||
|         </RelativeLayout> |         </RelativeLayout> | ||||||
|         <RelativeLayout |         <RelativeLayout | ||||||
|  |             android:id="@+id/verification_area_two" | ||||||
|             android:layout_width="fill_parent" |             android:layout_width="fill_parent" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|             android:layout_margin="8dp" |             android:layout_margin="8dp" | ||||||
|  |  | ||||||
|  | @ -326,4 +326,6 @@ | ||||||
|     <string name="try_again">Try again</string>; |     <string name="try_again">Try again</string>; | ||||||
|     <string name="finish">Finish</string> |     <string name="finish">Finish</string> | ||||||
|     <string name="verified">Verified!</string> |     <string name="verified">Verified!</string> | ||||||
|  |     <string name="smp_requested">Contact requested SMP verification</string> | ||||||
|  |     <string name="no_otr_session_found">No valid OTR session has been found!</string> | ||||||
| </resources> | </resources> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 iNPUTmice
						iNPUTmice