summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorkLeZ <julius8774@gmail.com>2014-09-23 11:04:39 +0200
committerkLeZ <julius8774@gmail.com>2014-09-23 11:04:39 +0200
commit240bb9cd670857018e00c190370caa2c75dc392b (patch)
treed6b1ce21ad0baa9b7c8cbf2433b02322bb256145 /app/src/main
parenta9126f72142468397a061ebff426c1233dded7fc (diff)
Added "Show Time" preference and changed default to 45 to match pass
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java50
-rw-r--r--app/src/main/res/xml/preference.xml56
2 files changed, 51 insertions, 55 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 3213fd2e..78902d8a 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
@@ -1,5 +1,21 @@
package com.zeapo.pwdstore.crypto;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+
+import org.apache.commons.io.FileUtils;
+import org.eclipse.jgit.util.StringUtils;
+import org.openintents.openpgp.IOpenPgpService;
+import org.openintents.openpgp.OpenPgpError;
+import org.openintents.openpgp.util.OpenPgpApi;
+import org.openintents.openpgp.util.OpenPgpServiceConnection;
+import org.openintents.openpgp.util.OpenPgpUtils;
+
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
@@ -7,7 +23,6 @@ import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
-import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
@@ -22,35 +37,15 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
-import android.widget.GridLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
-import com.zeapo.pwdstore.GitAsyncTask;
import com.zeapo.pwdstore.R;
import com.zeapo.pwdstore.UserPreference;
import com.zeapo.pwdstore.utils.PasswordRepository;
-import org.apache.commons.io.FileUtils;
-import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.util.StringUtils;
-import org.openintents.openpgp.IOpenPgpService;
-import org.openintents.openpgp.OpenPgpError;
-import org.openintents.openpgp.OpenPgpSignatureResult;
-import org.openintents.openpgp.util.OpenPgpApi;
-import org.openintents.openpgp.util.OpenPgpServiceConnection;
-import org.openintents.openpgp.util.OpenPgpUtils;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-
public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnBound{
@@ -206,8 +201,6 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB
}
public class DelayShow extends AsyncTask<Void, Integer, Boolean> {
- int count = 0;
- final int SHOW_TIME = 10;
ProgressBar pb;
@Override
@@ -221,15 +214,20 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB
((LinearLayout) findViewById(R.id.crypto_extra_show_layout)).setVisibility(View.VISIBLE);
this.pb = (ProgressBar) findViewById(R.id.pbLoading);
+
+ // Make Show Time a user preference
+ // kLeZ: Changed to match the default for pass
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(container.getContext());
+ final int SHOW_TIME = Integer.parseInt(settings.getString("general_show_time", "45"));
this.pb.setMax(SHOW_TIME);
}
@Override
protected Boolean doInBackground(Void... params) {
- while (this.count < SHOW_TIME) {
+ while (this.pb.getProgress() < this.pb.getMax())
+ {
SystemClock.sleep(1000);
- this.count++;
- publishProgress(this.count);
+ publishProgress(this.pb.getProgress() + 1);
}
return true;
}
diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml
index d52570d5..56a16f49 100644
--- a/app/src/main/res/xml/preference.xml
+++ b/app/src/main/res/xml/preference.xml
@@ -1,36 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
- <PreferenceCategory android:title="Git">
- <EditTextPreference android:title="Server"
- android:key="git_remote_server"
- android:hint="server.com"
- android:inputType="textUri"/>
- <EditTextPreference android:title="Remote location"
- android:key="git_remote_location"
- android:hint="path/to/repository"
- android:inputType="textUri"/>
- <EditTextPreference android:title="Username"
- android:key="git_remote_username"
- android:hint="username"
- android:inputType="textPersonName"/>
- <Preference
- android:title="SSH Key"
- android:key="ssh_key"/>
- </PreferenceCategory>
+ <PreferenceCategory android:title="Git">
+ <EditTextPreference android:title="Server"
+ android:key="git_remote_server" android:hint="server.com"
+ android:inputType="textUri" />
+ <EditTextPreference android:title="Remote location"
+ android:key="git_remote_location" android:hint="path/to/repository"
+ android:inputType="textUri" />
+ <EditTextPreference android:title="Username"
+ android:key="git_remote_username" android:hint="username"
+ android:inputType="textPersonName" />
+ <Preference android:title="SSH Key" android:key="ssh_key" />
+ </PreferenceCategory>
- <PreferenceCategory android:title="Crypto">
- <org.openintents.openpgp.util.OpenPgpListPreference
- android:key="openpgp_provider_list"
- android:title="Select OpenPGP Provider!" />
+ <PreferenceCategory android:title="Crypto">
+ <org.openintents.openpgp.util.OpenPgpListPreference
+ android:key="openpgp_provider_list" android:title="Select OpenPGP Provider!" />
- <EditTextPreference android:title="Set your OpenPGP account"
- android:hint="mail@somewhere.tld"
- android:key="openpgp_account_name"
- android:inputType="textEmailAddress"/>
+ <EditTextPreference android:title="Set your OpenPGP account"
+ android:hint="mail@somewhere.tld" android:key="openpgp_account_name"
+ android:inputType="textEmailAddress" />
- <Preference
- android:title="Select OpenPGP Key id"
- android:key="openpgp_key_id"/>
- </PreferenceCategory>
+ <Preference android:title="Select OpenPGP Key id"
+ android:key="openpgp_key_id" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="General">
+ <EditTextPreference android:title="Password Show Time"
+ android:dialogTitle="Set the time you want the password to be in clipboard"
+ android:summary="Set the time you want the password to be in clipboard"
+ android:hint="45" android:key="general_show_time" />
+ </PreferenceCategory>
</PreferenceScreen> \ No newline at end of file