remove guava dep
This commit is contained in:
parent
5da9e67545
commit
55e549dc31
3 changed files with 33 additions and 35 deletions
|
@ -66,7 +66,6 @@ dependencies {
|
||||||
compile 'com.jcraft:jsch:0.1.53'
|
compile 'com.jcraft:jsch:0.1.53'
|
||||||
compile 'org.apache.commons:commons-io:1.3.2'
|
compile 'org.apache.commons:commons-io:1.3.2'
|
||||||
compile 'com.jayway.android.robotium:robotium-solo:5.3.1'
|
compile 'com.jayway.android.robotium:robotium-solo:5.3.1'
|
||||||
compile 'com.google.guava:guava:18.0'
|
|
||||||
}
|
}
|
||||||
tasks.findAll { // make all tasks whose name starts with 'assemble'...
|
tasks.findAll { // make all tasks whose name starts with 'assemble'...
|
||||||
it.name.startsWith 'assemble'
|
it.name.startsWith 'assemble'
|
||||||
|
|
|
@ -31,9 +31,6 @@ import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.nononsenseapps.filepicker.FilePickerActivity;
|
import com.nononsenseapps.filepicker.FilePickerActivity;
|
||||||
import com.zeapo.pwdstore.autofill.AutofillPreferenceActivity;
|
import com.zeapo.pwdstore.autofill.AutofillPreferenceActivity;
|
||||||
import com.zeapo.pwdstore.crypto.PgpHandler;
|
import com.zeapo.pwdstore.crypto.PgpHandler;
|
||||||
|
@ -48,11 +45,11 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class UserPreference extends AppCompatActivity {
|
public class UserPreference extends AppCompatActivity {
|
||||||
private final static int IMPORT_SSH_KEY = 1;
|
private final static int IMPORT_SSH_KEY = 1;
|
||||||
|
@ -131,7 +128,7 @@ public class UserPreference extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
findPreference("git_delete_repo").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
findPreference("git_delete_repo").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
new AlertDialog.Builder(callingActivity).
|
new AlertDialog.Builder(callingActivity).
|
||||||
|
@ -242,19 +239,18 @@ public class UserPreference extends AppCompatActivity {
|
||||||
findPreference("ssh_see_key").setEnabled(sharedPreferences.getBoolean("use_generated_key", false));
|
findPreference("ssh_see_key").setEnabled(sharedPreferences.getBoolean("use_generated_key", false));
|
||||||
findPreference("git_delete_repo").setEnabled(!sharedPreferences.getBoolean("git_external", false));
|
findPreference("git_delete_repo").setEnabled(!sharedPreferences.getBoolean("git_external", false));
|
||||||
Preference keyPref = findPreference("openpgp_key_id_pref");
|
Preference keyPref = findPreference("openpgp_key_id_pref");
|
||||||
Set<String> selectedKeys = sharedPreferences.getStringSet("openpgp_key_ids_set", new HashSet<String>());
|
ArrayList<String> selectedKeys = new ArrayList<>(sharedPreferences.getStringSet("openpgp_key_ids_set", new HashSet<String>()));
|
||||||
if (selectedKeys.isEmpty()) {
|
if (selectedKeys.isEmpty()) {
|
||||||
keyPref.setSummary("No key selected");
|
keyPref.setSummary("No key selected");
|
||||||
} else {
|
} else {
|
||||||
keyPref.setSummary(
|
StringBuilder summaryBuilder = new StringBuilder();
|
||||||
Joiner.on(',')
|
for (int i = 0; i < selectedKeys.size(); ++i) {
|
||||||
.join(Iterables.transform(selectedKeys, new Function<String, Object>() {
|
String s = selectedKeys.get(i);
|
||||||
@Override
|
summaryBuilder.append(OpenPgpUtils.convertKeyIdToHex(Long.valueOf(s)));
|
||||||
public Object apply(String input) {
|
if (i < selectedKeys.size() - 1)
|
||||||
return OpenPgpUtils.convertKeyIdToHex(Long.valueOf(input));
|
summaryBuilder.append("; ");
|
||||||
}
|
}
|
||||||
}))
|
keyPref.setSummary(summaryBuilder.toString());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if the autofill service is enabled and check the preference accordingly
|
// see if the autofill service is enabled and check the preference accordingly
|
||||||
|
|
|
@ -32,7 +32,6 @@ import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.common.primitives.Longs;
|
|
||||||
import com.zeapo.pwdstore.BuildConfig;
|
import com.zeapo.pwdstore.BuildConfig;
|
||||||
import com.zeapo.pwdstore.PasswordEntry;
|
import com.zeapo.pwdstore.PasswordEntry;
|
||||||
import com.zeapo.pwdstore.R;
|
import com.zeapo.pwdstore.R;
|
||||||
|
@ -53,7 +52,6 @@ import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -139,7 +137,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
switch (getIntent().getStringExtra("Operation")){
|
switch (getIntent().getStringExtra("Operation")) {
|
||||||
case "ENCRYPT":
|
case "ENCRYPT":
|
||||||
getMenuInflater().inflate(R.menu.pgp_handler_new_password, menu);
|
getMenuInflater().inflate(R.menu.pgp_handler_new_password, menu);
|
||||||
break;
|
break;
|
||||||
|
@ -187,11 +185,11 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectFolder() {
|
private void selectFolder() {
|
||||||
if (selectFolderData == null || passwordList == null){
|
if (selectFolderData == null || passwordList == null) {
|
||||||
Log.wtf(Constants.TAG,"Folder selected while the app didn't ask for one to be selected?");
|
Log.wtf(Constants.TAG, "Folder selected while the app didn't ask for one to be selected?");
|
||||||
}
|
}
|
||||||
selectFolderData.putExtra("SELECTED_FOLDER_PATH",passwordList.getCurrentDir().getAbsolutePath());
|
selectFolderData.putExtra("SELECTED_FOLDER_PATH", passwordList.getCurrentDir().getAbsolutePath());
|
||||||
setResult(RESULT_OK,selectFolderData);
|
setResult(RESULT_OK, selectFolderData);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +275,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
DialogFragment df = new pwgenDialogFragment();
|
DialogFragment df = new pwgenDialogFragment();
|
||||||
df.show(getFragmentManager(), "generator");
|
df.show(getFragmentManager(), "generator");
|
||||||
default:
|
default:
|
||||||
Log.wtf(Constants.TAG,"This should not happen.... PgpHandler.java#handleClick(View) default reached.");
|
Log.wtf(Constants.TAG, "This should not happen.... PgpHandler.java#handleClick(View) default reached.");
|
||||||
// should not happen
|
// should not happen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,7 +363,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
public void run() {
|
public void run() {
|
||||||
clipboard.setPrimaryClip(ClipData.newPlainText(count, count));
|
clipboard.setPrimaryClip(ClipData.newPlainText(count, count));
|
||||||
}
|
}
|
||||||
}, i*500);
|
}, i * 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,15 +428,15 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
|
|
||||||
private void selectFolder(Intent data) {
|
private void selectFolder(Intent data) {
|
||||||
|
|
||||||
if (data.getStringExtra("Operation") == null || !data.getStringExtra("Operation").equals("SELECTFOLDER")){
|
if (data.getStringExtra("Operation") == null || !data.getStringExtra("Operation").equals("SELECTFOLDER")) {
|
||||||
Log.e(Constants.TAG,"PgpHandler#selectFolder(Intent) triggered with incorrect intent.");
|
Log.e(Constants.TAG, "PgpHandler#selectFolder(Intent) triggered with incorrect intent.");
|
||||||
if (BuildConfig.DEBUG){
|
if (BuildConfig.DEBUG) {
|
||||||
throw new UnsupportedOperationException("Triggered with incorrect intent.");
|
throw new UnsupportedOperationException("Triggered with incorrect intent.");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(Constants.TAG,"PgpHandler#selectFolder(Intent).");
|
Log.d(Constants.TAG, "PgpHandler#selectFolder(Intent).");
|
||||||
|
|
||||||
|
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
|
@ -492,8 +490,8 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
textViewPassword.setText(entry.getPassword());
|
textViewPassword.setText(entry.getPassword());
|
||||||
|
|
||||||
Button toggleVisibilityButton = (Button) findViewById(R.id.crypto_password_toggle_show);
|
Button toggleVisibilityButton = (Button) findViewById(R.id.crypto_password_toggle_show);
|
||||||
toggleVisibilityButton.setVisibility(showPassword?View.GONE:View.VISIBLE);
|
toggleVisibilityButton.setVisibility(showPassword ? View.GONE : View.VISIBLE);
|
||||||
textViewPassword.setTransformationMethod(showPassword?null:new HoldToShowPasswordTransformation(toggleVisibilityButton, new Runnable() {
|
textViewPassword.setTransformationMethod(showPassword ? null : new HoldToShowPasswordTransformation(toggleVisibilityButton, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
textViewPassword.setText(entry.getPassword());
|
textViewPassword.setText(entry.getPassword());
|
||||||
|
@ -662,9 +660,14 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
public void encrypt(Intent data) {
|
public void encrypt(Intent data) {
|
||||||
data.setAction(OpenPgpApi.ACTION_ENCRYPT);
|
data.setAction(OpenPgpApi.ACTION_ENCRYPT);
|
||||||
|
|
||||||
ArrayList<Long> longKeys = new ArrayList<>();
|
// EXTRA_KEY_IDS requires long[]
|
||||||
for (String keyId : keyIDs) longKeys.add(Long.valueOf(keyId));
|
long[] longKeys = new long[keyIDs.size()];
|
||||||
data.putExtra(OpenPgpApi.EXTRA_KEY_IDS, Longs.toArray(longKeys));
|
int i = 0;
|
||||||
|
for (String keyId : keyIDs) {
|
||||||
|
longKeys[i] = Long.valueOf(keyId);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
data.putExtra(OpenPgpApi.EXTRA_KEY_IDS, longKeys);
|
||||||
|
|
||||||
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
||||||
|
|
||||||
|
@ -721,7 +724,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
|
|
||||||
Bundle extra = getIntent().getExtras();
|
Bundle extra = getIntent().getExtras();
|
||||||
final String operation = extra.getString("Operation");
|
final String operation = extra.getString("Operation");
|
||||||
if (operation == null){
|
if (operation == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
|
|
Loading…
Reference in a new issue