From 52825f409feba1175ec042237ab5ced9b60b60c0 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 27 Mar 2011 11:37:37 +0800 Subject: [PATCH] As suggested by cketti, HashSet -> Set in our method signature definition --- src/com/fsck/k9/activity/AsyncUIProcessor.java | 3 ++- src/com/fsck/k9/activity/ExportHelper.java | 4 +++- src/com/fsck/k9/preferences/IStorageExporter.java | 3 ++- src/com/fsck/k9/preferences/StorageExporter.java | 9 +++++---- .../fsck/k9/preferences/StorageExporterEncryptedXml.java | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/com/fsck/k9/activity/AsyncUIProcessor.java b/src/com/fsck/k9/activity/AsyncUIProcessor.java index 7c9baa55c..264e49dbc 100644 --- a/src/com/fsck/k9/activity/AsyncUIProcessor.java +++ b/src/com/fsck/k9/activity/AsyncUIProcessor.java @@ -2,6 +2,7 @@ package com.fsck.k9.activity; import java.io.File; import java.io.InputStream; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.HashSet; @@ -41,7 +42,7 @@ public class AsyncUIProcessor { public void execute(Runnable runnable) { threadPool.execute(runnable); } - public void exportSettings(final Activity activity, final String storageFormat, final HashSet accountUuids, final ExportListener listener) { + public void exportSettings(final Activity activity, final String storageFormat, final Set accountUuids, final ExportListener listener) { threadPool.execute(new Runnable() { @Override diff --git a/src/com/fsck/k9/activity/ExportHelper.java b/src/com/fsck/k9/activity/ExportHelper.java index 385908001..1fd1fa575 100644 --- a/src/com/fsck/k9/activity/ExportHelper.java +++ b/src/com/fsck/k9/activity/ExportHelper.java @@ -1,6 +1,8 @@ package com.fsck.k9.activity; import java.util.HashSet; +import java.util.Set; + import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; @@ -10,7 +12,7 @@ import com.fsck.k9.R; import com.fsck.k9.preferences.StorageFormat; public class ExportHelper { - public static void exportSettings(final Activity activity, final HashSet accountUuids, final ExportListener listener) { + public static void exportSettings(final Activity activity, final Set 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: String storageFormat = StorageFormat.ENCRYPTED_XML_FILE; AsyncUIProcessor.getInstance(activity.getApplication()).exportSettings(activity, storageFormat, accountUuids, new ExportListener() { diff --git a/src/com/fsck/k9/preferences/IStorageExporter.java b/src/com/fsck/k9/preferences/IStorageExporter.java index 5cf94afad..63cbd00f6 100644 --- a/src/com/fsck/k9/preferences/IStorageExporter.java +++ b/src/com/fsck/k9/preferences/IStorageExporter.java @@ -2,10 +2,11 @@ package com.fsck.k9.preferences; import java.io.OutputStream; import java.util.HashSet; +import java.util.Set; import android.content.Context; public interface IStorageExporter { public boolean needsKey(); - public void exportPreferences(Context context, HashSet accountUuids, OutputStream os, String encryptionKey) throws StorageImportExportException; + public void exportPreferences(Context context, Set accountUuids, OutputStream os, String encryptionKey) throws StorageImportExportException; } diff --git a/src/com/fsck/k9/preferences/StorageExporter.java b/src/com/fsck/k9/preferences/StorageExporter.java index 4f5ea6359..148d09c3b 100644 --- a/src/com/fsck/k9/preferences/StorageExporter.java +++ b/src/com/fsck/k9/preferences/StorageExporter.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.util.HashSet; +import java.util.Set; import android.app.Activity; import android.util.Log; @@ -15,7 +16,7 @@ import com.fsck.k9.activity.ExportListener; import com.fsck.k9.activity.PasswordEntryDialog; public class StorageExporter { - private static void exportPreferences(Activity activity, String storageFormat, HashSet accountUuids, String fileName, OutputStream os, String encryptionKey, final ExportListener listener) { + private static void exportPreferences(Activity activity, String storageFormat, Set accountUuids, String fileName, OutputStream os, String encryptionKey, final ExportListener listener) { try { IStorageExporter storageExporter = StorageFormat.createExporter(storageFormat); if (storageExporter == null) { @@ -35,7 +36,7 @@ public class StorageExporter { } } - public static void exportPreferences(Activity activity, String storageFormat, HashSet accountUuids, String fileName, String encryptionKey, final ExportListener listener) throws StorageImportExportException { + public static void exportPreferences(Activity activity, String storageFormat, Set accountUuids, String fileName, String encryptionKey, final ExportListener listener) throws StorageImportExportException { exportPreferences(activity, storageFormat, accountUuids, fileName, null, encryptionKey, listener); } @@ -43,7 +44,7 @@ public class StorageExporter { exportPreferences(activity, storageFormat, accountUuids, null, os, encryptionKey, listener); } - private static void gatherPassword(final Activity activity, final IStorageExporter storageExporter, final HashSet accountUuids, final String fileName, final OutputStream os, final ExportListener listener) { + private static void gatherPassword(final Activity activity, final IStorageExporter storageExporter, final Set accountUuids, final String fileName, final OutputStream os, final ExportListener listener) { activity.runOnUiThread(new Runnable() { @Override @@ -81,7 +82,7 @@ public class StorageExporter { } - private static void finishExport(Activity activity, IStorageExporter storageExporter, HashSet accountUuids, String fileName, OutputStream os, String encryptionKey, ExportListener listener) throws StorageImportExportException { + private static void finishExport(Activity activity, IStorageExporter storageExporter, Set accountUuids, String fileName, OutputStream os, String encryptionKey, ExportListener listener) throws StorageImportExportException { boolean needToClose = false; if (listener != null) { listener.started(); diff --git a/src/com/fsck/k9/preferences/StorageExporterEncryptedXml.java b/src/com/fsck/k9/preferences/StorageExporterEncryptedXml.java index ca08c09cc..eb2ec1e6d 100644 --- a/src/com/fsck/k9/preferences/StorageExporterEncryptedXml.java +++ b/src/com/fsck/k9/preferences/StorageExporterEncryptedXml.java @@ -5,6 +5,7 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.HashSet; import java.util.Map; +import java.util.Set; import android.content.Context; import android.content.SharedPreferences; @@ -15,7 +16,7 @@ import com.fsck.k9.K9; import com.fsck.k9.Preferences; public class StorageExporterEncryptedXml implements IStorageExporter { - public void exportPreferences(Context context, HashSet accountUuids, OutputStream os, String encryptionKey) throws StorageImportExportException { + public void exportPreferences(Context context, Set accountUuids, OutputStream os, String encryptionKey) throws StorageImportExportException { try { Log.i(K9.LOG_TAG, "Exporting preferences"); K9Krypto krypto = new K9Krypto(encryptionKey, K9Krypto.MODE.ENCRYPT);