Skip to content
Snippets Groups Projects
Commit e86cb669 authored by Mohamed Amine Younes Bouacida's avatar Mohamed Amine Younes Bouacida Committed by Mohamed Amine Younes Bouacida
Browse files

account: allow no-password account revocation

Change-Id: I13591b6aa2fa7be2bf372d78602771d634377220
parent 98e23f9f
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,7 @@ import cx.ring.R;
public class ConfirmRevocationDialog extends DialogFragment {
public static final String DEVICEID_KEY = "deviceid_key";
public static final String HAS_PASSWORD_KEY = "has_password_key";
static final String TAG = ConfirmRevocationDialog.class.getSimpleName();
@BindView(R.id.password_txt_box)
protected TextInputLayout mPasswordTxtBox;
......@@ -53,6 +54,7 @@ public class ConfirmRevocationDialog extends DialogFragment {
@BindString(R.string.revoke_device_title)
protected String mRegisterTitle;
private String mDeviceId;
private Boolean mHasPassword = true;
private ConfirmRevocationListener mListener = null;
public void setListener(ConfirmRevocationListener listener) {
......@@ -65,7 +67,8 @@ public class ConfirmRevocationDialog extends DialogFragment {
View view = requireActivity().getLayoutInflater().inflate(R.layout.dialog_confirm_revocation, null);
ButterKnife.bind(this, view);
mDeviceId = getArguments().getString(DEVICEID_KEY);
mDeviceId = requireArguments().getString(DEVICEID_KEY);
mHasPassword = requireArguments().getBoolean(HAS_PASSWORD_KEY);
final AlertDialog result = new MaterialAlertDialogBuilder(requireContext())
.setView(view)
......@@ -84,12 +87,18 @@ public class ConfirmRevocationDialog extends DialogFragment {
}
});
});
result.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
if(mHasPassword) {
result.getWindow().setSoftInputMode(WindowManager.LayoutParams.
SOFT_INPUT_STATE_VISIBLE);
} else {
mPasswordTxtBox.setVisibility(View.GONE);
}
return result;
}
private boolean checkInput() {
if (mPasswordTxt.getText().toString().isEmpty()) {
if (mHasPassword && mPasswordTxt.getText().toString().isEmpty()) {
mPasswordTxtBox.setErrorEnabled(true);
mPasswordTxtBox.setError(mPromptPassword);
return false;
......
......@@ -542,6 +542,7 @@ public class RingAccountSummaryFragment extends BaseSupportFragment<RingAccountS
ConfirmRevocationDialog dialog = new ConfirmRevocationDialog();
Bundle args = new Bundle();
args.putString(ConfirmRevocationDialog.DEVICEID_KEY, deviceId);
args.putBoolean(ConfirmRevocationDialog.HAS_PASSWORD_KEY, mAccountHasPassword);
dialog.setArguments(args);
dialog.setListener(this);
dialog.show(requireFragmentManager(), FRAGMENT_DIALOG_REVOCATION);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment