mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-25 15:11:52 -05:00
astyle
This commit is contained in:
parent
107408c0d9
commit
32b5afc702
@ -139,8 +139,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
}
|
||||
}
|
||||
|
||||
public void setProgress(boolean progress)
|
||||
{
|
||||
public void setProgress(boolean progress) {
|
||||
mHandler.progress(progress);
|
||||
}
|
||||
|
||||
@ -242,8 +241,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent)
|
||||
{
|
||||
public void onNewIntent(Intent intent) {
|
||||
Uri uri = intent.getData();
|
||||
Log.i(K9.LOG_TAG, "Accounts Activity got uri " + uri);
|
||||
if (uri != null) {
|
||||
@ -783,8 +781,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
}
|
||||
}
|
||||
|
||||
private void onImport()
|
||||
{
|
||||
private void onImport() {
|
||||
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
i.setType("*/*");
|
||||
@ -792,66 +789,52 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.i(K9.LOG_TAG, "onActivityResult requestCode = " + requestCode + ", resultCode = " + resultCode + ", data = " + data);
|
||||
if (resultCode != RESULT_OK)
|
||||
return;
|
||||
if (data == null)
|
||||
{
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
switch (requestCode)
|
||||
{
|
||||
case ACTIVITY_REQUEST_PICK_SETTINGS_FILE:
|
||||
onImport(data.getData());
|
||||
break;
|
||||
switch (requestCode) {
|
||||
case ACTIVITY_REQUEST_PICK_SETTINGS_FILE:
|
||||
onImport(data.getData());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void onImport(Uri uri)
|
||||
{
|
||||
private void onImport(Uri uri) {
|
||||
Log.i(K9.LOG_TAG, "onImport importing from URI " + uri.getPath());
|
||||
try
|
||||
{
|
||||
try {
|
||||
final String fileName = uri.getPath();
|
||||
ContentResolver resolver = getContentResolver();
|
||||
final InputStream is = resolver.openInputStream(uri);
|
||||
|
||||
PasswordEntryDialog dialog = new PasswordEntryDialog(this, getString(R.string.settings_encryption_password_prompt),
|
||||
new PasswordEntryDialog.PasswordEntryListener()
|
||||
{
|
||||
public void passwordChosen(String chosenPassword)
|
||||
{
|
||||
String toastText = Accounts.this.getString(R.string.settings_importing );
|
||||
new PasswordEntryDialog.PasswordEntryListener() {
|
||||
public void passwordChosen(String chosenPassword) {
|
||||
String toastText = Accounts.this.getString(R.string.settings_importing);
|
||||
Toast toast = Toast.makeText(Accounts.this.getApplication(), toastText, Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
mHandler.progress(true);
|
||||
AsyncUIProcessor.getInstance(Accounts.this.getApplication()).importSettings(is, chosenPassword, new ImportListener()
|
||||
{
|
||||
public void failure(final String message, Exception e)
|
||||
{
|
||||
Accounts.this.runOnUiThread(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
AsyncUIProcessor.getInstance(Accounts.this.getApplication()).importSettings(is, chosenPassword, new ImportListener() {
|
||||
public void failure(final String message, Exception e) {
|
||||
Accounts.this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
mHandler.progress(false);
|
||||
showDialog(Accounts.this, R.string.settings_import_failed_header, Accounts.this.getString(R.string.settings_import_failure, fileName, message));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void importSuccess(final int numAccounts)
|
||||
{
|
||||
Accounts.this.runOnUiThread(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
public void importSuccess(final int numAccounts) {
|
||||
Accounts.this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
mHandler.progress(false);
|
||||
String messageText =
|
||||
numAccounts != 1
|
||||
? Accounts.this.getString(R.string.settings_import_success_multiple, numAccounts, fileName )
|
||||
: Accounts.this.getString(R.string.settings_import_success_single, fileName );
|
||||
? Accounts.this.getString(R.string.settings_import_success_multiple, numAccounts, fileName)
|
||||
: Accounts.this.getString(R.string.settings_import_success_single, fileName);
|
||||
showDialog(Accounts.this, R.string.settings_import_success_header, messageText);
|
||||
refresh();
|
||||
}
|
||||
@ -860,22 +843,18 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
});
|
||||
}
|
||||
|
||||
public void cancel()
|
||||
{
|
||||
public void cancel() {
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
catch (FileNotFoundException fnfe)
|
||||
{
|
||||
String toastText = Accounts.this.getString(R.string.settings_import_failure, uri.getPath(), fnfe.getMessage() );
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
String toastText = Accounts.this.getString(R.string.settings_import_failure, uri.getPath(), fnfe.getMessage());
|
||||
Toast toast = Toast.makeText(Accounts.this.getApplication(), toastText, 1);
|
||||
toast.show();
|
||||
}
|
||||
}
|
||||
|
||||
private static void showDialog(final Activity activity, int headerRes, String message)
|
||||
{
|
||||
private static void showDialog(final Activity activity, int headerRes, String message) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(headerRes);
|
||||
builder.setMessage(message);
|
||||
|
@ -37,8 +37,7 @@ public class ActivityListener extends MessagingListener {
|
||||
String displayName = mLoadingFolderName;
|
||||
if (K9.INBOX.equalsIgnoreCase(displayName)) {
|
||||
displayName = context.getString(R.string.special_mailbox_name_inbox);
|
||||
}
|
||||
else if ((mAccount != null) && mAccount.getOutboxFolderName().equals(displayName)) {
|
||||
} else if ((mAccount != null) && mAccount.getOutboxFolderName().equals(displayName)) {
|
||||
displayName = context.getString(R.string.special_mailbox_name_outbox);
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,7 @@ public class ExportHelper {
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
private static void showDialog(final Activity activity, int headerRes, String message)
|
||||
{
|
||||
private static void showDialog(final Activity activity, int headerRes, String message) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(headerRes);
|
||||
builder.setMessage(message);
|
||||
|
@ -151,8 +151,7 @@ public class FolderList extends K9ListActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void setProgress(boolean progress)
|
||||
{
|
||||
public void setProgress(boolean progress) {
|
||||
mHandler.progress(progress);
|
||||
}
|
||||
|
||||
|
@ -519,8 +519,7 @@ public class MessageList
|
||||
}
|
||||
}
|
||||
|
||||
public void setProgress(boolean progress)
|
||||
{
|
||||
public void setProgress(boolean progress) {
|
||||
mHandler.progress(progress);
|
||||
}
|
||||
|
||||
|
@ -943,13 +943,13 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
@Override
|
||||
protected Dialog onCreateDialog(final int id) {
|
||||
switch (id) {
|
||||
case R.id.dialog_confirm_delete:
|
||||
return createConfirmDeleteDialog(id);
|
||||
case R.id.dialog_attachment_progress:
|
||||
ProgressDialog d = new ProgressDialog(this);
|
||||
d.setIndeterminate(true);
|
||||
d.setTitle(R.string.dialog_attachment_progress_title);
|
||||
return d;
|
||||
case R.id.dialog_confirm_delete:
|
||||
return createConfirmDeleteDialog(id);
|
||||
case R.id.dialog_attachment_progress:
|
||||
ProgressDialog d = new ProgressDialog(this);
|
||||
d.setIndeterminate(true);
|
||||
d.setTitle(R.string.dialog_attachment_progress_title);
|
||||
return d;
|
||||
}
|
||||
return super.onCreateDialog(id);
|
||||
}
|
||||
|
@ -853,12 +853,10 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
|
||||
// TODO: In the future the call above should be changed to only return remote folders.
|
||||
// For now we just remove the Outbox folder if present.
|
||||
Iterator<? extends Folder> iter = folders.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Iterator <? extends Folder > iter = folders.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Folder folder = iter.next();
|
||||
if (mAccount.getOutboxFolderName().equals(folder.getName()))
|
||||
{
|
||||
if (mAccount.getOutboxFolderName().equals(folder.getName())) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class EncoderUtil {
|
||||
int encodedLength = bEncodedLength(bytes);
|
||||
|
||||
int totalLength = prefix.length() + encodedLength
|
||||
+ ENC_WORD_SUFFIX.length();
|
||||
+ ENC_WORD_SUFFIX.length();
|
||||
if (totalLength <= ENCODED_WORD_MAX_LENGTH) {
|
||||
return prefix + org.apache.james.mime4j.codec.EncoderUtil.encodeB(bytes) + ENC_WORD_SUFFIX;
|
||||
} else {
|
||||
@ -111,7 +111,7 @@ public class EncoderUtil {
|
||||
int encodedLength = qEncodedLength(bytes);
|
||||
|
||||
int totalLength = prefix.length() + encodedLength
|
||||
+ ENC_WORD_SUFFIX.length();
|
||||
+ ENC_WORD_SUFFIX.length();
|
||||
if (totalLength <= ENCODED_WORD_MAX_LENGTH) {
|
||||
return prefix + org.apache.james.mime4j.codec.EncoderUtil.encodeQ(bytes, org.apache.james.mime4j.codec.EncoderUtil.Usage.WORD_ENTITY) + ENC_WORD_SUFFIX;
|
||||
} else {
|
||||
|
@ -142,8 +142,7 @@ public class MimeHeader {
|
||||
}
|
||||
}
|
||||
|
||||
public void setCharset(String charset)
|
||||
{
|
||||
public void setCharset(String charset) {
|
||||
mCharset = charset;
|
||||
}
|
||||
}
|
||||
|
@ -14,21 +14,18 @@ import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
public class K9Krypto
|
||||
{
|
||||
public class K9Krypto {
|
||||
final Base64 mBase64;
|
||||
final Cipher mCipher;
|
||||
|
||||
private final static String AES = "AES";
|
||||
private final static String SECURE_RANDOM_TYPE = "SHA1PRNG";
|
||||
|
||||
public enum MODE
|
||||
{
|
||||
public enum MODE {
|
||||
ENCRYPT(Cipher.ENCRYPT_MODE), DECRYPT(Cipher.DECRYPT_MODE);
|
||||
|
||||
int mode;
|
||||
private MODE(int nMode)
|
||||
{
|
||||
private MODE(int nMode) {
|
||||
mode = nMode;
|
||||
}
|
||||
}
|
||||
@ -56,8 +53,7 @@ public class K9Krypto
|
||||
return new String(plainText);
|
||||
}
|
||||
|
||||
private Cipher setupCipher(int mode, byte[] processedKey) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException
|
||||
{
|
||||
private Cipher setupCipher(int mode, byte[] processedKey) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(processedKey, AES);
|
||||
Cipher cipher = Cipher.getInstance(AES);
|
||||
cipher.init(mode, secretKeySpec);
|
||||
|
Loading…
x
Reference in New Issue
Block a user