remove guava dep

This commit is contained in:
Mohamed Zenadi 2017-07-25 14:50:07 +01:00
parent 5da9e67545
commit 55e549dc31
3 changed files with 33 additions and 35 deletions

View file

@ -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'

View file

@ -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;
@ -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

View file

@ -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;
@ -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);