removed password repeat field in favor of show password field

This commit is contained in:
Daniel Gultsch 2017-12-14 19:28:52 +01:00
parent 02011790b4
commit 60ae269870
7 changed files with 83 additions and 139 deletions

View File

@ -17,6 +17,9 @@ repositories {
maven {
url 'https://maven.google.com'
}
maven {
url "https://jitpack.io"
}
}
configurations {
@ -37,8 +40,8 @@ dependencies {
compile "com.android.support:appcompat-v7:$supportLibVersion"
compile "com.android.support:support-emoji:$supportLibVersion"
freeCompile "com.android.support:support-emoji-bundled:$supportLibVersion"
compile 'org.bouncycastle:bcmail-jdk15on:1.52'
compile 'org.jitsi:org.otr4j:0.22'
compile 'org.bouncycastle:bcmail-jdk15on:1.56'
compile 'org.gnu.inet:libidn:1.15'
compile 'com.google.zxing:core:3.2.1'
compile 'com.google.zxing:android-integration:3.2.1'
@ -50,6 +53,7 @@ dependencies {
compile 'com.makeramen:roundedimageview:2.3.0'
compile "com.wefika:flowlayout:0.4.1"
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
compile 'com.github.scottyab:showhidepasswordedittext:0.8'
}

View File

@ -74,7 +74,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private static final int REQUEST_DATA_SAVER = 0x37af244;
private AutoCompleteTextView mAccountJid;
private EditText mPassword;
private EditText mPasswordConfirm;
private CheckBox mRegisterNew;
private Button mCancelButton;
private Button mSaveButton;
@ -130,7 +129,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
@Override
public void onClick(final View v) {
final String password = mPassword.getText().toString();
final String passwordConfirm = mPasswordConfirm.getText().toString();
final boolean wasDisabled = mAccount != null && mAccount.getStatus() == Account.State.DISABLED;
if (!mInitMode && passwordChangedInMagicCreateMode()) {
@ -219,13 +217,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
mAccountJid.requestFocus();
return;
}
if (registerNewAccount) {
if (!password.equals(passwordConfirm)) {
mPasswordConfirm.setError(getString(R.string.passwords_do_not_match));
mPasswordConfirm.requestFocus();
return;
}
}
if (mAccount != null) {
if (mInitMode && mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) {
mAccount.setOption(Account.OPTION_MAGIC_CREATE, mAccount.getPassword().contains(password));
@ -234,7 +225,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
mAccount.setPort(numericPort);
mAccount.setHostname(hostname);
mAccountJid.setError(null);
mPasswordConfirm.setError(null);
mAccount.setPassword(password);
mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
if (!xmppConnectionService.updateAccount(mAccount)) {
@ -523,7 +513,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mAccountJidLabel = (TextView) findViewById(R.id.account_jid_label);
this.mPassword = (EditText) findViewById(R.id.account_password);
this.mPassword.addTextChangedListener(this.mTextWatcher);
this.mPasswordConfirm = (EditText) findViewById(R.id.account_password_confirm);
this.mAvatar = (ImageView) findViewById(R.id.avater);
this.mAvatar.setOnClickListener(this.mAvatarClickListener);
this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new);
@ -580,13 +569,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
final OnCheckedChangeListener OnCheckedShowConfirmPassword = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView,
final boolean isChecked) {
if (isChecked) {
mPasswordConfirm.setVisibility(View.VISIBLE);
} else {
mPasswordConfirm.setVisibility(View.GONE);
}
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
updateSaveButton();
}
};
@ -603,7 +586,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
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 renewCertificate = menu.findItem(R.id.action_renew_certificate);
final MenuItem mamPrefs = menu.findItem(R.id.action_mam_prefs);
final MenuItem changePresence = menu.findItem(R.id.action_change_presence);
@ -629,13 +611,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
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);
}
@ -786,9 +761,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
case R.id.action_change_presence:
changePresence();
break;
case R.id.action_show_password:
showPassword();
break;
}
return super.onOptionsItemSelected(item);
}
@ -863,7 +835,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) {
this.mRegisterNew.setVisibility(View.VISIBLE);
this.mRegisterNew.setChecked(true);
this.mPasswordConfirm.setText(this.mAccount.getPassword());
} else {
this.mRegisterNew.setVisibility(View.GONE);
this.mRegisterNew.setChecked(false);
@ -1131,17 +1102,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
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();

View File

@ -426,8 +426,9 @@ public abstract class XmppActivity extends Activity {
protected boolean isOptimizingBattery() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
return !pm.isIgnoringBatteryOptimizations(getPackageName());
final PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
return pm == null
&& !pm.isIgnoringBatteryOptimizations(getPackageName());
} else {
return false;
}
@ -435,8 +436,9 @@ public abstract class XmppActivity extends Activity {
protected boolean isAffectedByDataSaver() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.isActiveNetworkMetered()
final ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
return cm != null
&& cm.isActiveNetworkMetered()
&& cm.getRestrictBackgroundStatus() == ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED;
} else {
return false;

View File

@ -29,6 +29,7 @@
android:background="?attr/infocard_border"
android:orientation="vertical"
android:padding="@dimen/infocard_padding">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avater"
android:layout_width="72dp"
@ -37,11 +38,13 @@
android:layout_marginRight="16dp"
android:contentDescription="@string/account_image_description"
app:riv_corner_radius="2dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/avater"
android:orientation="vertical">
<TextView
android:id="@+id/account_jid_label"
android:layout_width="wrap_content"
@ -68,15 +71,24 @@
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<EditText
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="56sp">
<com.scottyab.showhidepasswordedittext.ShowHidePasswordEditText
android:id="@+id/account_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:hint="@string/password"
android:inputType="textPassword"
android:textColor="?attr/color_text_primary"
android:textColorHint="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"/>
android:textSize="?attr/TextSizeBody"
app:tint_color="?attr/color_text_secondary"/>
</RelativeLayout>
<LinearLayout
android:id="@+id/name_port"
@ -85,11 +97,13 @@
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.8"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
@ -97,6 +111,7 @@
android:text="@string/account_settings_hostname"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<EditText
android:id="@+id/hostname"
android:layout_width="fill_parent"
@ -107,18 +122,21 @@
android:textColorHint="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:orientation="vertical"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/account_settings_port"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<EditText
android:id="@+id/port"
android:layout_width="match_parent"
@ -130,6 +148,7 @@
android:textSize="?attr/TextSizeBody"/>
</LinearLayout>
</LinearLayout>
<CheckBox
android:id="@+id/account_register_new"
android:layout_width="wrap_content"
@ -138,27 +157,6 @@
android:text="@string/register_account"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/account_confirm_password_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/account_settings_confirm_password"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:visibility="gone"/>
<EditText
android:id="@+id/account_password_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="@string/confirm_password"
android:inputType="textPassword"
android:textColor="?attr/color_text_primary"
android:textColorHint="?attr/color_text_secondary"
android:textSize="?attr/TextSizeBody"
android:visibility="gone"/>
</LinearLayout>
</RelativeLayout>
@ -174,6 +172,7 @@
android:orientation="vertical"
android:padding="@dimen/infocard_padding"
android:visibility="gone">
<TextView
android:id="@+id/os_optimization_headline"
android:layout_width="wrap_content"
@ -182,6 +181,7 @@
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold"/>
<TextView
android:id="@+id/os_optimization_body"
android:layout_width="wrap_content"
@ -192,16 +192,17 @@
android:text="@string/battery_optimizations_enabled_explained"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
<Button
android:id="@+id/os_optimization_disable"
style="?android:attr/borderlessButtonStyle"
android:layout_marginRight="-8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/os_optimization_body"
android:layout_marginRight="-8dp"
android:text="@string/disable"
android:textColor="@color/accent"/>
</RelativeLayout>
@ -234,11 +235,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_session_established"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/session_est"
@ -252,6 +253,7 @@
</TableRow>
</TableLayout>
<TableLayout
android:id="@+id/server_info_more"
android:layout_width="match_parent"
@ -267,11 +269,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_pep"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_pep"
@ -291,11 +293,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_blocking"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_blocking"
@ -315,11 +317,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_stream_management"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_sm"
@ -339,11 +341,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_roster_version"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_roster_version"
@ -363,11 +365,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_carbon_messages"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_carbons"
@ -387,11 +389,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_mam"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_mam"
@ -411,11 +413,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_csi"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_csi"
@ -427,6 +429,7 @@
android:textSize="?attr/TextSizeBody"
tools:ignore="RtlHardcoded"/>
</TableRow>
<TableRow
android:id="@+id/push_row"
android:layout_width="fill_parent"
@ -435,11 +438,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_push"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_push"
@ -450,6 +453,7 @@
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
@ -457,11 +461,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_http_upload"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:singleLine="true"
android:ellipsize="end"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/server_info_http_upload"
@ -512,10 +516,10 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding"
android:src="?attr/icon_remove"
android:alpha="?attr/icon_alpha"
android:visibility="visible"/>
</RelativeLayout>
@ -608,26 +612,28 @@
android:id="@+id/action_copy_axolotl_to_clipboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground"
android:contentDescription="@string/copy_omemo_clipboard_description"
android:padding="@dimen/image_button_padding"
android:src="?attr/icon_copy"
android:alpha="?attr/icon_alpha"
android:visibility="visible"/>
<ImageButton
android:id="@+id/action_regenerate_axolotl_key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground"
android:contentDescription="@string/regenerate_omemo_key"
android:padding="@dimen/image_button_padding"
android:alpha="?attr/icon_alpha"
android:src="?attr/icon_refresh"
android:visibility="gone"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/other_device_keys_card"
android:layout_width="fill_parent"
@ -658,13 +664,14 @@
android:orientation="vertical"
android:showDividers="middle">
</LinearLayout>
<Button
android:id="@+id/clear_devices"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/clear_other_devices"
android:layout_gravity="center_horizontal"
android:text="@string/clear_other_devices"
android:textColor="@color/accent"/>
</LinearLayout>
</LinearLayout>

View File

@ -1,22 +0,0 @@
<?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:paddingLeft="?attr/dialog_horizontal_padding"
android:paddingRight="?attr/dialog_horizontal_padding"
android:paddingBottom="?attr/dialog_vertical_padding"
android:paddingTop="?attr/dialog_vertical_padding">
<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>

View File

@ -49,11 +49,6 @@
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"

View File

@ -179,8 +179,6 @@
<string name="account_settings_example_jabber_id">username@example.com</string>
<string name="account_settings_confirm_password">Confirm password</string>
<string name="password">Password</string>
<string name="confirm_password">Confirm password</string>
<string name="passwords_do_not_match">Passwords do not match</string>
<string name="invalid_jid">This is not a valid Jabber ID</string>
<string name="error_out_of_memory">Out of memory. Image is too large</string>
<string name="add_phone_book_text">Do you want to add %s to your address book?</string>