mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-25 08:58:55 -05:00
show password dialog when account was magic created
This commit is contained in:
parent
3f65b0e985
commit
ef27055434
@ -507,6 +507,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||
final MenuItem showBlocklist = menu.findItem(R.id.action_show_block_list);
|
||||
final MenuItem showMoreInfo = menu.findItem(R.id.action_server_info_show_more);
|
||||
final MenuItem changePassword = menu.findItem(R.id.action_change_password_on_server);
|
||||
final MenuItem showPassword = menu.findItem(R.id.action_show_password);
|
||||
final MenuItem clearDevices = menu.findItem(R.id.action_clear_devices);
|
||||
final MenuItem renewCertificate = menu.findItem(R.id.action_renew_certificate);
|
||||
final MenuItem mamPrefs = menu.findItem(R.id.action_mam_prefs);
|
||||
@ -535,6 +536,13 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||
mamPrefs.setVisible(false);
|
||||
changePresence.setVisible(false);
|
||||
}
|
||||
|
||||
if (mAccount != null) {
|
||||
showPassword.setVisible(mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)
|
||||
&& !mAccount.isOptionSet(Account.OPTION_REGISTER));
|
||||
} else {
|
||||
showPassword.setVisible(false);
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@ -642,6 +650,9 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||
case R.id.action_change_presence:
|
||||
changePresence();
|
||||
break;
|
||||
case R.id.action_show_password:
|
||||
showPassword();
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
@ -900,6 +911,17 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||
xmppConnectionService.fetchMamPreferences(mAccount, this);
|
||||
}
|
||||
|
||||
private void showPassword() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
View view = getLayoutInflater().inflate(R.layout.dialog_show_password, null);
|
||||
TextView password = (TextView) view.findViewById(R.id.password);
|
||||
password.setText(mAccount.getPassword());
|
||||
builder.setTitle(R.string.password);
|
||||
builder.setView(view);
|
||||
builder.setPositiveButton(R.string.cancel, null);
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyStatusUpdated(AxolotlService.FetchStatus report) {
|
||||
refreshUi();
|
||||
|
19
src/main/res/layout/dialog_show_password.xml
Normal file
19
src/main/res/layout/dialog_show_password.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:typeface="monospace"
|
||||
android:textSize="?attr/TextSizeHeadline"
|
||||
android:fontFamily="monospace"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/black87" >
|
||||
</TextView>
|
||||
|
||||
</LinearLayout>
|
@ -33,6 +33,11 @@
|
||||
android:id="@+id/action_mam_prefs"
|
||||
android:title="@string/mam_prefs"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_show_password"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/show_password"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_change_password_on_server"
|
||||
android:showAsAction="never"
|
||||
|
@ -640,4 +640,5 @@
|
||||
<string name="presence_dnd">Busy</string>
|
||||
<string name="secure_password_generated">A secure password has been generated</string>
|
||||
<string name="device_does_not_support_battery_op">Your device does not support opting out of battery optimization</string>
|
||||
<string name="show_password">Show password</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user