From 240bb9cd670857018e00c190370caa2c75dc392b Mon Sep 17 00:00:00 2001 From: kLeZ Date: Tue, 23 Sep 2014 11:04:39 +0200 Subject: Added "Show Time" preference and changed default to 45 to match pass --- .../java/com/zeapo/pwdstore/crypto/PgpHandler.java | 50 ++++++++++--------- app/src/main/res/xml/preference.xml | 56 +++++++++++----------- 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 { - 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 @@ - - - - - - + + + + + + - - + + - + - - + + + + + \ No newline at end of file -- cgit v1.2.3