Show passphrase checkbox in create key

This commit is contained in:
Dominik Schürmann 2015-03-09 22:09:48 +01:00 committed by Adithya Abraham Philip
parent 5f0a468d9a
commit 3012001979
3 changed files with 27 additions and 0 deletions

View File

@ -21,10 +21,14 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
@ -44,6 +48,7 @@ public class CreateKeyPassphraseFragment extends Fragment {
CreateKeyActivity mCreateKeyActivity; CreateKeyActivity mCreateKeyActivity;
PassphraseEditText mPassphraseEdit; PassphraseEditText mPassphraseEdit;
EditText mPassphraseEditAgain; EditText mPassphraseEditAgain;
CheckBox mShowPassphrase;
View mBackButton; View mBackButton;
View mNextButton; View mNextButton;
@ -102,6 +107,7 @@ public class CreateKeyPassphraseFragment extends Fragment {
mPassphraseEdit = (PassphraseEditText) view.findViewById(R.id.create_key_passphrase); mPassphraseEdit = (PassphraseEditText) view.findViewById(R.id.create_key_passphrase);
mPassphraseEditAgain = (EditText) view.findViewById(R.id.create_key_passphrase_again); mPassphraseEditAgain = (EditText) view.findViewById(R.id.create_key_passphrase_again);
mShowPassphrase = (CheckBox) view.findViewById(R.id.create_key_show_passphrase);
mBackButton = view.findViewById(R.id.create_key_back_button); mBackButton = view.findViewById(R.id.create_key_back_button);
mNextButton = view.findViewById(R.id.create_key_next_button); mNextButton = view.findViewById(R.id.create_key_next_button);
@ -121,6 +127,19 @@ public class CreateKeyPassphraseFragment extends Fragment {
createKeyCheck(); createKeyCheck();
} }
}); });
mShowPassphrase.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mPassphraseEdit.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
mPassphraseEditAgain.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
mPassphraseEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
mPassphraseEditAgain.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
}
});
return view; return view;
} }

View File

@ -46,6 +46,13 @@
android:ems="10" android:ems="10"
android:layout_gravity="center_horizontal" /> android:layout_gravity="center_horizontal" />
<CheckBox
android:id="@+id/create_key_show_passphrase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="@string/label_show_passphrase" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@ -129,6 +129,7 @@
<string name="label_passphrase">"Passphrase"</string> <string name="label_passphrase">"Passphrase"</string>
<string name="label_unlock">"Unlocking…"</string> <string name="label_unlock">"Unlocking…"</string>
<string name="label_passphrase_again">"Repeat Passphrase"</string> <string name="label_passphrase_again">"Repeat Passphrase"</string>
<string name="label_show_passphrase">"Show Passphrase"</string>
<string name="label_algorithm">"Algorithm"</string> <string name="label_algorithm">"Algorithm"</string>
<string name="label_ascii_armor">"File ASCII Armor"</string> <string name="label_ascii_armor">"File ASCII Armor"</string>
<string name="label_file_ascii_armor">"Enable ASCII Armor"</string> <string name="label_file_ascii_armor">"Enable ASCII Armor"</string>