aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wong <wongma@protonmail.ch>2015-07-18 15:57:19 -0400
committerMatthew Wong <wongma@protonmail.ch>2015-07-18 15:57:19 -0400
commit01b7b2102dd40ed2bdbad3eefd91a4ed03d10a73 (patch)
tree1aadf7abc4e5d4e19a254a265edcfdd2e9f4c9a4
parent8c6142bca6ca825ac937b0faebe38f5b626c283e (diff)
parent608f61b6051d8bd03fd75628c225cccb9c0bedde (diff)
Merge remote-tracking branch 'upstream/master'
Conflicts: app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java9
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java22
-rw-r--r--app/src/main/res/layout/encrypt_layout.xml5
-rw-r--r--app/src/main/res/values/strings.xml1
4 files changed, 24 insertions, 13 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
index 9c0bc877..2d007618 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
@@ -327,17 +327,17 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
if (showPassword) {
findViewById(R.id.crypto_container).setVisibility(View.VISIBLE);
- Typeface type = Typeface.createFromAsset(getAssets(), "fonts/sourcecodepro.ttf");
+ Typeface monoTypeface = Typeface.createFromAsset(getAssets(), "fonts/sourcecodepro.ttf");
String[] passContent = os.toString("UTF-8").split("\n");
((TextView) findViewById(R.id.crypto_password_show))
- .setTypeface(type);
+ .setTypeface(monoTypeface);
((TextView) findViewById(R.id.crypto_password_show))
.setText(passContent[0]);
String extraContent = os.toString("UTF-8").replaceFirst(".*\n", "");
if (extraContent.length() != 0) {
((TextView) findViewById(R.id.crypto_extra_show))
- .setTypeface(type);
+ .setTypeface(monoTypeface);
((TextView) findViewById(R.id.crypto_extra_show))
.setText(extraContent);
}
@@ -499,6 +499,9 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
decryptAndVerify(new Intent());
} else if (extra.getString("Operation").equals("ENCRYPT")) {
setContentView(R.layout.encrypt_layout);
+ Typeface monoTypeface = Typeface.createFromAsset(getAssets(), "fonts/sourcecodepro.ttf");
+ ((EditText) findViewById(R.id.crypto_password_edit)).setTypeface(monoTypeface);
+ ((EditText) findViewById(R.id.crypto_extra_edit)).setTypeface(monoTypeface);
String cat = extra.getString("FILE_PATH");
cat = cat.replace(PasswordRepository.getWorkTree().getAbsolutePath(), "");
cat = cat + "/";
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java b/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java
index 5dae4d23..1a42e2ba 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java
@@ -1,16 +1,19 @@
package com.zeapo.pwdstore;
+import android.app.Activity;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
+import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
+import android.widget.EditText;
import android.widget.TextView;
import com.zeapo.pwdstore.pwgen.pwgen;
@@ -30,8 +33,11 @@ public class pwgenDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- LayoutInflater inflater = getActivity().getLayoutInflater();
+ final Activity callingActivity = getActivity();
+ LayoutInflater inflater = callingActivity.getLayoutInflater();
final View view = inflater.inflate(R.layout.fragment_pwgen, null);
+ Typeface monoTypeface = Typeface.createFromAsset(callingActivity.getAssets(), "fonts/sourcecodepro.ttf");
+
builder.setView(view);
SharedPreferences prefs
@@ -55,11 +61,13 @@ public class pwgenDialogFragment extends DialogFragment {
TextView textView = (TextView) view.findViewById(R.id.lengthNumber);
textView.setText(Integer.toString(prefs.getInt("length", 20)));
+ ((EditText) view.findViewById(R.id.passwordText)).setTypeface(monoTypeface);
+
builder.setPositiveButton(getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- TextView edit = (TextView) getActivity().findViewById(R.id.crypto_password_edit);
- TextView generate = (TextView) getDialog().findViewById(R.id.passwordText);
+ EditText edit = (EditText) callingActivity.findViewById(R.id.crypto_password_edit);
+ EditText generate = (EditText) view.findViewById(R.id.passwordText);
edit.append(generate.getText());
}
});
@@ -78,7 +86,7 @@ public class pwgenDialogFragment extends DialogFragment {
@Override
public void onShow(DialogInterface dialog) {
setPreferences();
- TextView textView = (TextView) view.findViewById(R.id.passwordText);
+ EditText textView = (EditText) view.findViewById(R.id.passwordText);
textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0));
Button b = ad.getButton(AlertDialog.BUTTON_NEUTRAL);
@@ -86,7 +94,7 @@ public class pwgenDialogFragment extends DialogFragment {
@Override
public void onClick(View v) {
setPreferences();
- TextView textView = (TextView) getDialog().findViewById(R.id.passwordText);
+ EditText textView = (EditText) getDialog().findViewById(R.id.passwordText);
textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0));
}
});
@@ -112,11 +120,11 @@ public class pwgenDialogFragment extends DialogFragment {
if (!((CheckBox) getDialog().findViewById(R.id.pronounceable)).isChecked()) {
preferences.add("s");
}
- TextView textView = (TextView) getDialog().findViewById(R.id.lengthNumber);
+ EditText textView = (EditText) getDialog().findViewById(R.id.lengthNumber);
try {
int length = Integer.valueOf(textView.getText().toString());
return pwgen.setPrefs(getActivity().getApplicationContext(), preferences, length);
- } catch (NumberFormatException e) {
+ } catch(NumberFormatException e) {
return pwgen.setPrefs(getActivity().getApplicationContext(), preferences);
}
}
diff --git a/app/src/main/res/layout/encrypt_layout.xml b/app/src/main/res/layout/encrypt_layout.xml
index dcb6bf88..84fe99c3 100644
--- a/app/src/main/res/layout/encrypt_layout.xml
+++ b/app/src/main/res/layout/encrypt_layout.xml
@@ -66,12 +66,11 @@
android:layout_height="wrap_content"
android:typeface="monospace"
android:layout_weight="1"/>
- <ImageButton
+ <Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:src="@drawable/ic_action_new"
- android:background="@drawable/blue_rectangle"
android:id="@+id/generate_password"
+ android:text="@string/pwd_generate_button"
android:onClick="handleClick"/>
</LinearLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f77b732d..f60e4b15 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -149,5 +149,6 @@
<string name="show_password_pref_title">Show the password</string>
<string name="show_password_pref_summary">Control the visibility of the passwords once decrypted, this does not disable the password copy</string>
<string name="toast_password_copied">Password copied into the clipboard</string>
+ <string name="pwd_generate_button">Generate</string>
</resources>