mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
As suggested by cketti, HashSet -> Set in our method signature
definition
This commit is contained in:
parent
087feb478b
commit
52825f409f
@ -2,6 +2,7 @@ package com.fsck.k9.activity;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -41,7 +42,7 @@ public class AsyncUIProcessor {
|
|||||||
public void execute(Runnable runnable) {
|
public void execute(Runnable runnable) {
|
||||||
threadPool.execute(runnable);
|
threadPool.execute(runnable);
|
||||||
}
|
}
|
||||||
public void exportSettings(final Activity activity, final String storageFormat, final HashSet<String> accountUuids, final ExportListener listener) {
|
public void exportSettings(final Activity activity, final String storageFormat, final Set<String> accountUuids, final ExportListener listener) {
|
||||||
threadPool.execute(new Runnable() {
|
threadPool.execute(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.fsck.k9.activity;
|
package com.fsck.k9.activity;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -10,7 +12,7 @@ import com.fsck.k9.R;
|
|||||||
import com.fsck.k9.preferences.StorageFormat;
|
import com.fsck.k9.preferences.StorageFormat;
|
||||||
|
|
||||||
public class ExportHelper {
|
public class ExportHelper {
|
||||||
public static void exportSettings(final Activity activity, final HashSet<String> accountUuids, final ExportListener listener) {
|
public static void exportSettings(final Activity activity, final Set<String> accountUuids, final ExportListener listener) {
|
||||||
// Once there are more file formats, build a UI to select which one to use. For now, use the encrypted/encoded format:
|
// Once there are more file formats, build a UI to select which one to use. For now, use the encrypted/encoded format:
|
||||||
String storageFormat = StorageFormat.ENCRYPTED_XML_FILE;
|
String storageFormat = StorageFormat.ENCRYPTED_XML_FILE;
|
||||||
AsyncUIProcessor.getInstance(activity.getApplication()).exportSettings(activity, storageFormat, accountUuids, new ExportListener() {
|
AsyncUIProcessor.getInstance(activity.getApplication()).exportSettings(activity, storageFormat, accountUuids, new ExportListener() {
|
||||||
|
@ -2,10 +2,11 @@ package com.fsck.k9.preferences;
|
|||||||
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public interface IStorageExporter {
|
public interface IStorageExporter {
|
||||||
public boolean needsKey();
|
public boolean needsKey();
|
||||||
public void exportPreferences(Context context, HashSet<String> accountUuids, OutputStream os, String encryptionKey) throws StorageImportExportException;
|
public void exportPreferences(Context context, Set<String> accountUuids, OutputStream os, String encryptionKey) throws StorageImportExportException;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.io.File;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -15,7 +16,7 @@ import com.fsck.k9.activity.ExportListener;
|
|||||||
import com.fsck.k9.activity.PasswordEntryDialog;
|
import com.fsck.k9.activity.PasswordEntryDialog;
|
||||||
|
|
||||||
public class StorageExporter {
|
public class StorageExporter {
|
||||||
private static void exportPreferences(Activity activity, String storageFormat, HashSet<String> accountUuids, String fileName, OutputStream os, String encryptionKey, final ExportListener listener) {
|
private static void exportPreferences(Activity activity, String storageFormat, Set<String> accountUuids, String fileName, OutputStream os, String encryptionKey, final ExportListener listener) {
|
||||||
try {
|
try {
|
||||||
IStorageExporter storageExporter = StorageFormat.createExporter(storageFormat);
|
IStorageExporter storageExporter = StorageFormat.createExporter(storageFormat);
|
||||||
if (storageExporter == null) {
|
if (storageExporter == null) {
|
||||||
@ -35,7 +36,7 @@ public class StorageExporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void exportPreferences(Activity activity, String storageFormat, HashSet<String> accountUuids, String fileName, String encryptionKey, final ExportListener listener) throws StorageImportExportException {
|
public static void exportPreferences(Activity activity, String storageFormat, Set<String> accountUuids, String fileName, String encryptionKey, final ExportListener listener) throws StorageImportExportException {
|
||||||
exportPreferences(activity, storageFormat, accountUuids, fileName, null, encryptionKey, listener);
|
exportPreferences(activity, storageFormat, accountUuids, fileName, null, encryptionKey, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ public class StorageExporter {
|
|||||||
exportPreferences(activity, storageFormat, accountUuids, null, os, encryptionKey, listener);
|
exportPreferences(activity, storageFormat, accountUuids, null, os, encryptionKey, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void gatherPassword(final Activity activity, final IStorageExporter storageExporter, final HashSet<String> accountUuids, final String fileName, final OutputStream os, final ExportListener listener) {
|
private static void gatherPassword(final Activity activity, final IStorageExporter storageExporter, final Set<String> accountUuids, final String fileName, final OutputStream os, final ExportListener listener) {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -81,7 +82,7 @@ public class StorageExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void finishExport(Activity activity, IStorageExporter storageExporter, HashSet<String> accountUuids, String fileName, OutputStream os, String encryptionKey, ExportListener listener) throws StorageImportExportException {
|
private static void finishExport(Activity activity, IStorageExporter storageExporter, Set<String> accountUuids, String fileName, OutputStream os, String encryptionKey, ExportListener listener) throws StorageImportExportException {
|
||||||
boolean needToClose = false;
|
boolean needToClose = false;
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.started();
|
listener.started();
|
||||||
|
@ -5,6 +5,7 @@ import java.io.OutputStreamWriter;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -15,7 +16,7 @@ import com.fsck.k9.K9;
|
|||||||
import com.fsck.k9.Preferences;
|
import com.fsck.k9.Preferences;
|
||||||
|
|
||||||
public class StorageExporterEncryptedXml implements IStorageExporter {
|
public class StorageExporterEncryptedXml implements IStorageExporter {
|
||||||
public void exportPreferences(Context context, HashSet<String> accountUuids, OutputStream os, String encryptionKey) throws StorageImportExportException {
|
public void exportPreferences(Context context, Set<String> accountUuids, OutputStream os, String encryptionKey) throws StorageImportExportException {
|
||||||
try {
|
try {
|
||||||
Log.i(K9.LOG_TAG, "Exporting preferences");
|
Log.i(K9.LOG_TAG, "Exporting preferences");
|
||||||
K9Krypto krypto = new K9Krypto(encryptionKey, K9Krypto.MODE.ENCRYPT);
|
K9Krypto krypto = new K9Krypto(encryptionKey, K9Krypto.MODE.ENCRYPT);
|
||||||
|
Loading…
Reference in New Issue
Block a user