mirror of
https://github.com/moparisthebest/k-9
synced 2025-03-03 01:51:49 -05:00
tidied activity code: astyle --style=java -s4 --brackets=attach --convert-tabs
This commit is contained in:
parent
094215ebe0
commit
c6b15012e0
@ -69,8 +69,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
long newSize;
|
||||
}
|
||||
|
||||
class AccountsHandler extends Handler
|
||||
{
|
||||
class AccountsHandler extends Handler {
|
||||
private static final int DATA_CHANGED = 1;
|
||||
private static final int MSG_ACCOUNT_SIZE_CHANGED = 2;
|
||||
private static final int MSG_WORKING_ACCOUNT = 3;
|
||||
@ -78,18 +77,14 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
private static final int MSG_FOLDER_SYNCING = 5;
|
||||
private static final int MSG_DEFINITE_PROGRESS = 6;
|
||||
|
||||
public void handleMessage(android.os.Message msg)
|
||||
{
|
||||
switch (msg.what)
|
||||
{
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
switch (msg.what) {
|
||||
case DATA_CHANGED:
|
||||
if (mAdapter != null)
|
||||
{
|
||||
if (mAdapter != null) {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
break;
|
||||
case MSG_WORKING_ACCOUNT:
|
||||
{
|
||||
case MSG_WORKING_ACCOUNT: {
|
||||
Account account = (Account)msg.obj;
|
||||
int res = msg.arg1;
|
||||
String toastText = getString(res, account.getDescription());
|
||||
@ -98,8 +93,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
toast.show();
|
||||
break;
|
||||
}
|
||||
case MSG_ACCOUNT_SIZE_CHANGED:
|
||||
{
|
||||
case MSG_ACCOUNT_SIZE_CHANGED: {
|
||||
AccountSizeChangedHolder holder = (AccountSizeChangedHolder)msg.obj;
|
||||
Account account = holder.account;
|
||||
Long oldSize = holder.oldSize;
|
||||
@ -111,13 +105,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
toast.show();
|
||||
break;
|
||||
}
|
||||
case MSG_FOLDER_SYNCING:
|
||||
{
|
||||
case MSG_FOLDER_SYNCING: {
|
||||
String folderName = (String) ((Object[]) msg.obj)[0];
|
||||
String dispString;
|
||||
dispString = getString(R.string.accounts_title);
|
||||
if (folderName != null)
|
||||
{
|
||||
if (folderName != null) {
|
||||
dispString += " (" + getString(R.string.status_loading)
|
||||
+ folderName + ")";
|
||||
}
|
||||
@ -136,13 +128,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
}
|
||||
}
|
||||
|
||||
public void dataChanged()
|
||||
{
|
||||
public void dataChanged() {
|
||||
sendEmptyMessage(DATA_CHANGED);
|
||||
}
|
||||
|
||||
public void workingAccount(Account account, int res)
|
||||
{
|
||||
public void workingAccount(Account account, int res) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_WORKING_ACCOUNT;
|
||||
msg.obj = account;
|
||||
@ -151,8 +141,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
public void accountSizeChanged(Account account, long oldSize, long newSize)
|
||||
{
|
||||
public void accountSizeChanged(Account account, long oldSize, long newSize) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_ACCOUNT_SIZE_CHANGED;
|
||||
AccountSizeChangedHolder holder = new AccountSizeChangedHolder();
|
||||
@ -163,26 +152,22 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
public void progress(boolean progress)
|
||||
{
|
||||
public void progress(boolean progress) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_PROGRESS;
|
||||
msg.arg1 = progress ? 1 : 0;
|
||||
sendMessage(msg);
|
||||
}
|
||||
public void progress(int progress)
|
||||
{
|
||||
public void progress(int progress) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_DEFINITE_PROGRESS;
|
||||
msg.arg1 = progress ;
|
||||
sendMessage(msg);
|
||||
}
|
||||
public void folderSyncing(String folder)
|
||||
{
|
||||
public void folderSyncing(String folder) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_FOLDER_SYNCING;
|
||||
msg.obj = new String[]
|
||||
{ folder };
|
||||
msg.obj = new String[] { folder };
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
@ -190,26 +175,22 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
|
||||
MessagingListener mListener = new MessagingListener() {
|
||||
@Override
|
||||
public void accountStatusChanged(Account account, int unreadMessageCount)
|
||||
{
|
||||
public void accountStatusChanged(Account account, int unreadMessageCount) {
|
||||
unreadMessageCounts.put(account.getUuid(), unreadMessageCount);
|
||||
mHandler.dataChanged();
|
||||
pendingWork.remove(account);
|
||||
|
||||
|
||||
if (pendingWork.isEmpty())
|
||||
{
|
||||
if (pendingWork.isEmpty()) {
|
||||
mHandler.progress(Window.PROGRESS_END);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
int level = (Window.PROGRESS_END / mAdapter.getCount()) * (mAdapter.getCount() - pendingWork.size()) ;
|
||||
mHandler.progress(level);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accountSizeChanged(Account account, long oldSize, long newSize)
|
||||
{
|
||||
public void accountSizeChanged(Account account, long oldSize, long newSize) {
|
||||
|
||||
mHandler.accountSizeChanged(account, oldSize, newSize);
|
||||
|
||||
@ -228,8 +209,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxStarted(Account account, String folder)
|
||||
{
|
||||
public void synchronizeMailboxStarted(Account account, String folder) {
|
||||
mHandler.progress(true);
|
||||
mHandler.folderSyncing(account.getDescription()
|
||||
+ getString(R.string.notification_bg_title_separator) + folder);
|
||||
@ -237,8 +217,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxFailed(Account account, String folder,
|
||||
String message)
|
||||
{
|
||||
String message) {
|
||||
mHandler.progress(false);
|
||||
mHandler.folderSyncing(null);
|
||||
}
|
||||
@ -274,8 +253,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
if (startup && accounts.length == 1) {
|
||||
FolderList.actionHandleAccount(this, accounts[0], accounts[0].getAutoExpandFolderName());
|
||||
finish();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
requestWindowFeature(Window.FEATURE_PROGRESS);
|
||||
|
||||
@ -369,8 +347,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
Account defaultAccount = Preferences.getPreferences(this).getDefaultAccount();
|
||||
if (defaultAccount != null) {
|
||||
MessageCompose.actionCompose(this, defaultAccount);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
onAddNewAccount();
|
||||
}
|
||||
}
|
||||
@ -588,8 +565,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
View view;
|
||||
if (convertView != null) {
|
||||
view = convertView;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
view = getLayoutInflater().inflate(R.layout.accounts_item, parent, false);
|
||||
}
|
||||
AccountViewHolder holder = (AccountViewHolder) view.getTag();
|
||||
@ -610,8 +586,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
if (unreadMessageCount != null) {
|
||||
holder.newMessageCount.setText(Integer.toString(unreadMessageCount));
|
||||
holder.newMessageCount.setVisibility(unreadMessageCount > 0 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//holder.newMessageCount.setText("-");
|
||||
holder.newMessageCount.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ import com.android.email.R;
|
||||
import com.android.email.mail.Folder;
|
||||
import com.android.email.mail.MessagingException;
|
||||
|
||||
public class ChooseFolder extends K9ListActivity
|
||||
{
|
||||
public class ChooseFolder extends K9ListActivity {
|
||||
String mFolder;
|
||||
Account mAccount;
|
||||
String mUID;
|
||||
@ -48,8 +47,7 @@ public class ChooseFolder extends K9ListActivity
|
||||
public static final String EXTRA_SHOW_DISPLAYABLE_ONLY = "com.android.email.ChooseFolder_showDisplayableOnly";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
@ -70,7 +68,7 @@ public class ChooseFolder extends K9ListActivity
|
||||
if (intent.getStringExtra(EXTRA_SHOW_DISPLAYABLE_ONLY) != null) {
|
||||
showDisplayableOnly = true;
|
||||
}
|
||||
if(mFolder == null)
|
||||
if (mFolder == null)
|
||||
mFolder = "";
|
||||
|
||||
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
|
||||
@ -83,13 +81,11 @@ public class ChooseFolder extends K9ListActivity
|
||||
|
||||
|
||||
this.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
public void onItemClick(AdapterView adapterview, View view, int i, long l)
|
||||
{
|
||||
public void onItemClick(AdapterView adapterview, View view, int i, long l) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(EXTRA_CUR_FOLDER, mFolder);
|
||||
String destFolderName = (String)((TextView)view).getText();
|
||||
if (heldInbox != null && getString(R.string.special_mailbox_name_inbox).equals(destFolderName))
|
||||
{
|
||||
if (heldInbox != null && getString(R.string.special_mailbox_name_inbox).equals(destFolderName)) {
|
||||
destFolderName = heldInbox;
|
||||
}
|
||||
intent.putExtra(EXTRA_NEW_FOLDER, destFolderName);
|
||||
@ -101,18 +97,15 @@ public class ChooseFolder extends K9ListActivity
|
||||
|
||||
}
|
||||
|
||||
class ChooseFolderHandler extends Handler
|
||||
{
|
||||
class ChooseFolderHandler extends Handler {
|
||||
|
||||
private static final int MSG_PROGRESS = 2;
|
||||
|
||||
private static final int MSG_DATA_CHANGED = 3;
|
||||
private static final int MSG_SET_SELECTED_FOLDER = 4;
|
||||
|
||||
public void handleMessage(android.os.Message msg)
|
||||
{
|
||||
switch (msg.what)
|
||||
{
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_PROGRESS:
|
||||
setProgressBarIndeterminateVisibility(msg.arg1 != 0);
|
||||
break;
|
||||
@ -127,87 +120,70 @@ public class ChooseFolder extends K9ListActivity
|
||||
}
|
||||
}
|
||||
|
||||
public void progress(boolean progress)
|
||||
{
|
||||
public void progress(boolean progress) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_PROGRESS;
|
||||
msg.arg1 = progress ? 1 : 0;
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
public void setSelectedFolder(int position)
|
||||
{
|
||||
public void setSelectedFolder(int position) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_SET_SELECTED_FOLDER;
|
||||
msg.arg1 = position;
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
public void dataChanged()
|
||||
{
|
||||
public void dataChanged() {
|
||||
sendEmptyMessage(MSG_DATA_CHANGED);
|
||||
}
|
||||
}
|
||||
|
||||
private MessagingListener mListener = new MessagingListener()
|
||||
{
|
||||
public void listFoldersStarted(Account account)
|
||||
{
|
||||
if (!account.equals(mAccount))
|
||||
{
|
||||
private MessagingListener mListener = new MessagingListener() {
|
||||
public void listFoldersStarted(Account account) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
mHandler.progress(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listFoldersFailed(Account account, String message)
|
||||
{
|
||||
if (!account.equals(mAccount))
|
||||
{
|
||||
public void listFoldersFailed(Account account, String message) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
mHandler.progress(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listFoldersFinished(Account account)
|
||||
{
|
||||
if (!account.equals(mAccount))
|
||||
{
|
||||
public void listFoldersFinished(Account account) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
mHandler.progress(false);
|
||||
}
|
||||
@Override
|
||||
public void listFolders(Account account, Folder[] folders)
|
||||
{
|
||||
if (!account.equals(mAccount))
|
||||
{
|
||||
public void listFolders(Account account, Folder[] folders) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
Account.FolderMode aMode = Account.FolderMode.ALL;
|
||||
if (showDisplayableOnly)
|
||||
{
|
||||
if (showDisplayableOnly) {
|
||||
aMode = account.getFolderDisplayMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
aMode = account.getFolderTargetMode();
|
||||
}
|
||||
Preferences prefs = Preferences.getPreferences(getApplication().getApplicationContext());
|
||||
ArrayList<String> localFolders = new ArrayList<String>();
|
||||
|
||||
for (Folder folder : folders)
|
||||
{
|
||||
for (Folder folder : folders) {
|
||||
String name = folder.getName();
|
||||
|
||||
// Inbox needs to be compared case-insensitively
|
||||
if(hideCurrentFolder && (name.equals(mFolder) || (Email.INBOX.equalsIgnoreCase(mFolder) && Email.INBOX.equalsIgnoreCase(name)))) {
|
||||
if (hideCurrentFolder && (name.equals(mFolder) || (Email.INBOX.equalsIgnoreCase(mFolder) && Email.INBOX.equalsIgnoreCase(name)))) {
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
try {
|
||||
folder.refresh(prefs);
|
||||
Folder.FolderClass fMode = folder.getDisplayClass();
|
||||
|
||||
@ -215,13 +191,10 @@ public class ChooseFolder extends K9ListActivity
|
||||
|| (aMode == Account.FolderMode.FIRST_AND_SECOND_CLASS &&
|
||||
fMode != Folder.FolderClass.FIRST_CLASS &&
|
||||
fMode != Folder.FolderClass.SECOND_CLASS)
|
||||
|| (aMode == Account.FolderMode.NOT_SECOND_CLASS && fMode == Folder.FolderClass.SECOND_CLASS))
|
||||
{
|
||||
|| (aMode == Account.FolderMode.NOT_SECOND_CLASS && fMode == Folder.FolderClass.SECOND_CLASS)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (MessagingException me)
|
||||
{
|
||||
} catch (MessagingException me) {
|
||||
Log.e(Email.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me);
|
||||
}
|
||||
|
||||
@ -229,28 +202,22 @@ public class ChooseFolder extends K9ListActivity
|
||||
|
||||
}
|
||||
|
||||
if (showOptionNone)
|
||||
{
|
||||
if (showOptionNone) {
|
||||
localFolders.add(Email.FOLDER_NONE);
|
||||
}
|
||||
|
||||
Collections.sort(localFolders, new Comparator<String>() {
|
||||
public int compare(String aName, String bName)
|
||||
{
|
||||
if (Email.FOLDER_NONE.equalsIgnoreCase(aName))
|
||||
{
|
||||
public int compare(String aName, String bName) {
|
||||
if (Email.FOLDER_NONE.equalsIgnoreCase(aName)) {
|
||||
return -1;
|
||||
}
|
||||
if (Email.FOLDER_NONE.equalsIgnoreCase(bName))
|
||||
{
|
||||
if (Email.FOLDER_NONE.equalsIgnoreCase(bName)) {
|
||||
return 1;
|
||||
}
|
||||
if (Email.INBOX.equalsIgnoreCase(aName))
|
||||
{
|
||||
if (Email.INBOX.equalsIgnoreCase(aName)) {
|
||||
return -1;
|
||||
}
|
||||
if (Email.INBOX.equalsIgnoreCase(bName))
|
||||
{
|
||||
if (Email.INBOX.equalsIgnoreCase(bName)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -262,22 +229,19 @@ public class ChooseFolder extends K9ListActivity
|
||||
int selectedFolder = -1;
|
||||
int position = 0;
|
||||
for (String name : localFolders) {
|
||||
if (Email.INBOX.equalsIgnoreCase(name))
|
||||
{
|
||||
if (Email.INBOX.equalsIgnoreCase(name)) {
|
||||
adapter.add(getString(R.string.special_mailbox_name_inbox));
|
||||
heldInbox = name;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
adapter.add(name);
|
||||
}
|
||||
|
||||
if((name.equals(mFolder) || (Email.INBOX.equalsIgnoreCase(mFolder) && Email.INBOX.equalsIgnoreCase(name)))) {
|
||||
if ((name.equals(mFolder) || (Email.INBOX.equalsIgnoreCase(mFolder) && Email.INBOX.equalsIgnoreCase(name)))) {
|
||||
selectedFolder = position;
|
||||
}
|
||||
position++;
|
||||
}
|
||||
if (selectedFolder != -1)
|
||||
{
|
||||
if (selectedFolder != -1) {
|
||||
mHandler.setSelectedFolder(selectedFolder);
|
||||
}
|
||||
mHandler.dataChanged();
|
||||
|
@ -19,8 +19,7 @@ import com.android.email.K9ListActivity;
|
||||
import com.android.email.Preferences;
|
||||
import com.android.email.R;
|
||||
|
||||
public class ChooseIdentity extends K9ListActivity
|
||||
{
|
||||
public class ChooseIdentity extends K9ListActivity {
|
||||
Account mAccount;
|
||||
String mUID;
|
||||
ArrayAdapter<String> adapter;
|
||||
@ -32,8 +31,7 @@ public class ChooseIdentity extends K9ListActivity
|
||||
protected List<Account.Identity> identities = null;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
@ -52,24 +50,20 @@ public class ChooseIdentity extends K9ListActivity
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
refreshView();
|
||||
}
|
||||
|
||||
|
||||
protected void refreshView()
|
||||
{
|
||||
protected void refreshView() {
|
||||
adapter.clear();
|
||||
|
||||
identities = mAccount.getIdentities();
|
||||
for (Account.Identity identity : identities)
|
||||
{
|
||||
for (Account.Identity identity : identities) {
|
||||
String email = identity.getEmail();
|
||||
String description = identity.getDescription();
|
||||
if (description == null || description.trim().length() == 0)
|
||||
{
|
||||
if (description == null || description.trim().length() == 0) {
|
||||
description = getString(R.string.message_view_from_format, identity.getName(), identity.getEmail());
|
||||
}
|
||||
adapter.add(description);
|
||||
@ -77,24 +71,18 @@ public class ChooseIdentity extends K9ListActivity
|
||||
|
||||
}
|
||||
|
||||
protected void setupClickListeners()
|
||||
{
|
||||
this.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener()
|
||||
{
|
||||
public void onItemClick(AdapterView adapterview, View view, int i, long l)
|
||||
{
|
||||
protected void setupClickListeners() {
|
||||
this.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
public void onItemClick(AdapterView adapterview, View view, int i, long l) {
|
||||
Account.Identity identity = mAccount.getIdentity(i);
|
||||
String email = identity.getEmail();
|
||||
if (email != null && email.trim().equals("") == false)
|
||||
{
|
||||
if (email != null && email.trim().equals("") == false) {
|
||||
Intent intent = new Intent();
|
||||
|
||||
intent.putExtra(EXTRA_IDENTITY, mAccount.getIdentity(i));
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Toast.makeText(ChooseIdentity.this, getString(R.string.identity_has_no_email),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
@ -103,16 +91,13 @@ public class ChooseIdentity extends K9ListActivity
|
||||
|
||||
}
|
||||
|
||||
class ChooseIdentityHandler extends Handler
|
||||
{
|
||||
class ChooseIdentityHandler extends Handler {
|
||||
|
||||
private static final int MSG_PROGRESS = 2;
|
||||
private static final int MSG_DATA_CHANGED = 3;
|
||||
|
||||
public void handleMessage(android.os.Message msg)
|
||||
{
|
||||
switch (msg.what)
|
||||
{
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_PROGRESS:
|
||||
setProgressBarIndeterminateVisibility(msg.arg1 != 0);
|
||||
break;
|
||||
@ -122,16 +107,14 @@ public class ChooseIdentity extends K9ListActivity
|
||||
}
|
||||
}
|
||||
|
||||
public void progress(boolean progress)
|
||||
{
|
||||
public void progress(boolean progress) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_PROGRESS;
|
||||
msg.arg1 = progress ? 1 : 0;
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
public void dataChanged()
|
||||
{
|
||||
public void dataChanged() {
|
||||
sendEmptyMessage(MSG_DATA_CHANGED);
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,7 @@ import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class EditIdentity extends K9Activity
|
||||
{
|
||||
public class EditIdentity extends K9Activity {
|
||||
|
||||
public static final String EXTRA_IDENTITY = "com.android.email.EditIdentity_identity";
|
||||
public static final String EXTRA_IDENTITY_INDEX = "com.android.email.EditIdentity_identity_index";
|
||||
@ -30,16 +29,14 @@ public class EditIdentity extends K9Activity
|
||||
private EditText mNameView;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mIdentity = (Account.Identity)getIntent().getSerializableExtra(EXTRA_IDENTITY);
|
||||
mIdentityIndex = getIntent().getIntExtra(EXTRA_IDENTITY_INDEX, -1);
|
||||
mAccount = (Account) getIntent().getSerializableExtra(EXTRA_ACCOUNT);
|
||||
|
||||
if (mIdentityIndex == -1)
|
||||
{
|
||||
if (mIdentityIndex == -1) {
|
||||
mIdentity = mAccount.new Identity();
|
||||
}
|
||||
|
||||
@ -49,8 +46,7 @@ public class EditIdentity extends K9Activity
|
||||
* If we're being reloaded we override the original account with the one
|
||||
* we saved
|
||||
*/
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_IDENTITY))
|
||||
{
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_IDENTITY)) {
|
||||
mIdentity = (Account.Identity)savedInstanceState.getSerializable(EXTRA_IDENTITY);
|
||||
}
|
||||
|
||||
@ -71,13 +67,11 @@ public class EditIdentity extends K9Activity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
private void saveIdentity()
|
||||
{
|
||||
private void saveIdentity() {
|
||||
|
||||
mIdentity.setDescription(mDescriptionView.getText().toString());
|
||||
mIdentity.setEmail(mEmailView.getText().toString());
|
||||
@ -86,12 +80,9 @@ public class EditIdentity extends K9Activity
|
||||
mIdentity.setSignature(mSignatureView.getText().toString());
|
||||
|
||||
List<Account.Identity> identities = mAccount.getIdentities();
|
||||
if (mIdentityIndex == -1)
|
||||
{
|
||||
if (mIdentityIndex == -1) {
|
||||
identities.add(mIdentity);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
identities.remove(mIdentityIndex);
|
||||
identities.add(mIdentityIndex, mIdentity);
|
||||
}
|
||||
@ -102,10 +93,8 @@ public class EditIdentity extends K9Activity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK)
|
||||
{
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
saveIdentity();
|
||||
return true;
|
||||
}
|
||||
@ -113,8 +102,7 @@ public class EditIdentity extends K9Activity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState)
|
||||
{
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putSerializable(EXTRA_IDENTITY, mIdentity);
|
||||
}
|
||||
|
@ -271,14 +271,12 @@ public class FolderList extends K9ListActivity {
|
||||
* queueing up a remote update of the folder.
|
||||
*/
|
||||
|
||||
private void checkMail(FolderInfoHolder folder)
|
||||
{
|
||||
private void checkMail(FolderInfoHolder folder) {
|
||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email - UpdateWorker");
|
||||
wakeLock.setReferenceCounted(false);
|
||||
wakeLock.acquire(Email.WAKE_LOCK_TIMEOUT);
|
||||
MessagingListener listener = new MessagingListener()
|
||||
{
|
||||
MessagingListener listener = new MessagingListener() {
|
||||
public void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
@ -331,8 +329,7 @@ public class FolderList extends K9ListActivity {
|
||||
|
||||
if (initialFolder != null) {
|
||||
intent.putExtra(EXTRA_INITIAL_FOLDER, initialFolder);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
intent.putExtra(EXTRA_STARTUP, true);
|
||||
}
|
||||
return intent;
|
||||
@ -361,8 +358,7 @@ public class FolderList extends K9ListActivity {
|
||||
&& mStartup) {
|
||||
initialFolder = mAccount.getAutoExpandFolderName();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
initialFolder = null;
|
||||
mStartup = false;
|
||||
savedFolderName = savedInstanceState.getString(STATE_CURRENT_FOLDER);
|
||||
@ -373,8 +369,7 @@ public class FolderList extends K9ListActivity {
|
||||
&& !Email.FOLDER_NONE.equals(initialFolder)) {
|
||||
onOpenFolder(initialFolder, true);
|
||||
finish();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
|
||||
mListView = getListView();
|
||||
@ -411,8 +406,7 @@ public class FolderList extends K9ListActivity {
|
||||
|
||||
setTitle(mAccount.getDescription());
|
||||
|
||||
if (savedFolderName != null)
|
||||
{
|
||||
if (savedFolderName != null) {
|
||||
mSelectedContextFolder = mAdapter.getFolder(savedFolderName);
|
||||
}
|
||||
}
|
||||
@ -450,8 +444,7 @@ public class FolderList extends K9ListActivity {
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if (mSelectedContextFolder != null)
|
||||
{
|
||||
if (mSelectedContextFolder != null) {
|
||||
outState.putString(STATE_CURRENT_FOLDER, mSelectedContextFolder.name);
|
||||
}
|
||||
}
|
||||
@ -498,8 +491,7 @@ public class FolderList extends K9ListActivity {
|
||||
}
|
||||
|
||||
private void onAccounts() {
|
||||
if (mStartup || isTaskRoot())
|
||||
{
|
||||
if (mStartup || isTaskRoot()) {
|
||||
Accounts.listAccounts(this);
|
||||
}
|
||||
|
||||
@ -874,25 +866,20 @@ public class FolderList extends K9ListActivity {
|
||||
|
||||
}
|
||||
|
||||
private void refreshFolder(Account account, String folderName)
|
||||
{
|
||||
private void refreshFolder(Account account, String folderName) {
|
||||
// There has to be a cheaper way to get at the localFolder object than this
|
||||
try {
|
||||
if (account != null && folderName != null)
|
||||
{
|
||||
if (account != null && folderName != null) {
|
||||
Folder localFolder = (Folder) Store.getInstance(account.getLocalStoreUri(), getApplication()).getFolder(folderName);
|
||||
if (localFolder != null)
|
||||
{
|
||||
if (localFolder != null) {
|
||||
FolderInfoHolder folderHolder = getFolder(folderName);
|
||||
if (folderHolder != null)
|
||||
{
|
||||
if (folderHolder != null) {
|
||||
folderHolder.populate(localFolder);
|
||||
mHandler.dataChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
Log.e(Email.LOG_TAG, "Exception while populating folder", e);
|
||||
}
|
||||
|
||||
@ -925,8 +912,7 @@ public class FolderList extends K9ListActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPushActive(Account account, String folderName, boolean enabled)
|
||||
{
|
||||
public void setPushActive(Account account, String folderName, boolean enabled) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
@ -1016,7 +1002,7 @@ public class FolderList extends K9ListActivity {
|
||||
FolderInfoHolder holder = null;
|
||||
|
||||
int index = getFolderIndex(folder);
|
||||
if(index >= 0 ){
|
||||
if (index >= 0 ) {
|
||||
holder = (FolderInfoHolder) getItem(index);
|
||||
if (holder != null) {
|
||||
return holder;
|
||||
@ -1075,8 +1061,7 @@ public class FolderList extends K9ListActivity {
|
||||
.format(lastCheckedDate));
|
||||
}
|
||||
|
||||
if (folder.pushActive)
|
||||
{
|
||||
if (folder.pushActive) {
|
||||
statusText = getString(R.string.folder_push_active_symbol) + " "+ statusText;
|
||||
}
|
||||
|
||||
@ -1154,8 +1139,7 @@ public class FolderList extends K9ListActivity {
|
||||
int ret = s1.compareToIgnoreCase(s2);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return s1.compareTo(s2);
|
||||
}
|
||||
}
|
||||
@ -1230,4 +1214,4 @@ public class FolderList extends K9ListActivity {
|
||||
public String rawFolderName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,18 +16,14 @@ import com.android.email.Account;
|
||||
import com.android.email.Preferences;
|
||||
import com.android.email.R;
|
||||
|
||||
public class ManageIdentities extends ChooseIdentity
|
||||
{
|
||||
public class ManageIdentities extends ChooseIdentity {
|
||||
private boolean mIdentitiesChanged = false;
|
||||
public static final String EXTRA_IDENTITIES = "com.android.email.EditIdentity_identities";
|
||||
|
||||
private static final int ACTIVITY_EDIT_IDENTITY = 1;
|
||||
protected void setupClickListeners()
|
||||
{
|
||||
this.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener()
|
||||
{
|
||||
public void onItemClick(AdapterView adapterview, View view, int i, long l)
|
||||
{
|
||||
protected void setupClickListeners() {
|
||||
this.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
public void onItemClick(AdapterView adapterview, View view, int i, long l) {
|
||||
editItem(i);
|
||||
}
|
||||
});
|
||||
@ -36,8 +32,7 @@ public class ManageIdentities extends ChooseIdentity
|
||||
registerForContextMenu(listView);
|
||||
}
|
||||
|
||||
private void editItem(int i)
|
||||
{
|
||||
private void editItem(int i) {
|
||||
Intent intent = new Intent(ManageIdentities.this, EditIdentity.class);
|
||||
|
||||
intent.putExtra(EditIdentity.EXTRA_ACCOUNT, mAccount);
|
||||
@ -47,18 +42,15 @@ public class ManageIdentities extends ChooseIdentity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
{
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
getMenuInflater().inflate(R.menu.manage_identities_option, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
{
|
||||
switch (item.getItemId())
|
||||
{
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.new_identity:
|
||||
Intent intent = new Intent(ManageIdentities.this, EditIdentity.class);
|
||||
|
||||
@ -72,24 +64,20 @@ public class ManageIdentities extends ChooseIdentity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
|
||||
{
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
menu.setHeaderTitle(R.string.manage_identities_context_menu_title);
|
||||
getMenuInflater().inflate(R.menu.manage_identities_context, menu);
|
||||
}
|
||||
|
||||
public boolean onContextItemSelected(MenuItem item)
|
||||
{
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();
|
||||
switch (item.getItemId())
|
||||
{
|
||||
switch (item.getItemId()) {
|
||||
case R.id.edit:
|
||||
editItem(menuInfo.position);
|
||||
break;
|
||||
case R.id.up:
|
||||
if (menuInfo.position > 0)
|
||||
{
|
||||
if (menuInfo.position > 0) {
|
||||
Account.Identity identity = identities.remove(menuInfo.position);
|
||||
identities.add(menuInfo.position - 1, identity);
|
||||
mIdentitiesChanged = true;
|
||||
@ -98,8 +86,7 @@ public class ManageIdentities extends ChooseIdentity
|
||||
|
||||
break;
|
||||
case R.id.down:
|
||||
if (menuInfo.position < identities.size() - 1)
|
||||
{
|
||||
if (menuInfo.position < identities.size() - 1) {
|
||||
Account.Identity identity = identities.remove(menuInfo.position);
|
||||
identities.add(menuInfo.position + 1, identity);
|
||||
mIdentitiesChanged = true;
|
||||
@ -113,14 +100,11 @@ public class ManageIdentities extends ChooseIdentity
|
||||
refreshView();
|
||||
break;
|
||||
case R.id.remove:
|
||||
if (identities.size() > 1)
|
||||
{
|
||||
if (identities.size() > 1) {
|
||||
identities.remove(menuInfo.position);
|
||||
mIdentitiesChanged = true;
|
||||
refreshView();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Toast.makeText(this, getString(R.string.no_removable_identity),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
@ -131,8 +115,7 @@ public class ManageIdentities extends ChooseIdentity
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mAccount.refresh(Preferences.getPreferences(getApplication().getApplicationContext()));
|
||||
refreshView();
|
||||
@ -140,19 +123,15 @@ public class ManageIdentities extends ChooseIdentity
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK)
|
||||
{
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
saveIdentities();
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private void saveIdentities()
|
||||
{
|
||||
if (mIdentitiesChanged)
|
||||
{
|
||||
private void saveIdentities() {
|
||||
if (mIdentitiesChanged) {
|
||||
mAccount.setIdentities(identities);
|
||||
mAccount.save(Preferences.getPreferences(getApplication().getApplicationContext()));
|
||||
}
|
||||
|
@ -220,8 +220,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
i.putExtra(EXTRA_MESSAGE, message.getUid());
|
||||
if (replyAll) {
|
||||
i.setAction(ACTION_REPLY_ALL);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
i.setAction(ACTION_REPLY);
|
||||
}
|
||||
context.startActivity(i);
|
||||
@ -379,16 +378,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
Address[] addresses = Address.parse(uri.getSchemeSpecificPart());
|
||||
addAddresses(mToView, addresses);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
/*
|
||||
* If we can't extract any information from the URI it's okay. They can
|
||||
* still compose a message.
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Intent.ACTION_SEND.equals(action)) {
|
||||
} else if (Intent.ACTION_SEND.equals(action)) {
|
||||
/*
|
||||
* Someone is trying to compose an email with an attachment, probably Pictures.
|
||||
* The Intent should contain an EXTRA_STREAM with the data to attach.
|
||||
@ -475,18 +472,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
mSourceMessageUid = (String) intent.getStringExtra(EXTRA_MESSAGE);
|
||||
}
|
||||
|
||||
if (mIdentity == null)
|
||||
{
|
||||
if (mIdentity == null) {
|
||||
mIdentity = mAccount.getIdentity(0);
|
||||
}
|
||||
|
||||
if (mAccount.isSignatureBeforeQuotedText())
|
||||
{
|
||||
if (mAccount.isSignatureBeforeQuotedText()) {
|
||||
mSignatureView = upperSignature;
|
||||
lowerSignature.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mSignatureView = lowerSignature;
|
||||
upperSignature.setVisibility(View.GONE);
|
||||
}
|
||||
@ -690,8 +683,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
}
|
||||
|
||||
message.setBody(mp);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* No attachments to include, just stick the text body in the message and call
|
||||
* it good.
|
||||
@ -705,7 +697,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
private String appendSignature (String text) {
|
||||
String signature= mSignatureView.getText().toString();
|
||||
|
||||
if (signature != null && ! signature.contentEquals("")){
|
||||
if (signature != null && ! signature.contentEquals("")) {
|
||||
text += "\n" + signature;
|
||||
}
|
||||
|
||||
@ -719,8 +711,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
MimeMessage message;
|
||||
try {
|
||||
message = createMessage(!save); // Only append sig on save
|
||||
}
|
||||
catch (MessagingException me) {
|
||||
} catch (MessagingException me) {
|
||||
Log.e(Email.LOG_TAG, "Failed to create new message for send or save.", me);
|
||||
throw new RuntimeException("Failed to create a new message for send or save.", me);
|
||||
}
|
||||
@ -731,8 +722,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
*/
|
||||
if (mDraftUid != null) {
|
||||
message.setUid(mDraftUid);
|
||||
}
|
||||
else if (ACTION_EDIT_DRAFT.equals(getIntent().getAction())) {
|
||||
} else if (ACTION_EDIT_DRAFT.equals(getIntent().getAction())) {
|
||||
/*
|
||||
* We're saving a previously saved draft, so update the new message's uid
|
||||
* to the old message's uid.
|
||||
@ -742,12 +732,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
|
||||
String k9identity = Utility.base64Encode("" + mMessageContentView.getText().toString().length());
|
||||
|
||||
if (mIdentityChanged || mSignatureChanged)
|
||||
{
|
||||
if (mIdentityChanged || mSignatureChanged) {
|
||||
String signature = mSignatureView.getText().toString();
|
||||
k9identity += ":" + Utility.base64Encode(signature) ;
|
||||
if (mIdentityChanged)
|
||||
{
|
||||
if (mIdentityChanged) {
|
||||
|
||||
String name = mIdentity.getName();
|
||||
String email = mIdentity.getEmail();
|
||||
@ -766,8 +754,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
if ((getChangingConfigurations() & ActivityInfo.CONFIG_ORIENTATION) == 0) {
|
||||
mHandler.sendEmptyMessage(MSG_SAVED_DRAFT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* Send the message
|
||||
* TODO Is it possible for us to be editing a draft with a null source message? Don't
|
||||
@ -859,7 +846,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
attachment.uri = uri;
|
||||
|
||||
if (attachment.size == -1 || attachment.name == null) {
|
||||
Cursor metadataCursor = contentResolver.query( uri, new String[]{ OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE }, null, null, null);
|
||||
Cursor metadataCursor = contentResolver.query( uri, new String[] { OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE }, null, null, null);
|
||||
if (metadataCursor != null) {
|
||||
try {
|
||||
if (metadataCursor.moveToFirst()) {
|
||||
@ -916,12 +903,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if(resultCode != RESULT_OK)
|
||||
if (resultCode != RESULT_OK)
|
||||
return;
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
switch(requestCode) {
|
||||
switch (requestCode) {
|
||||
case ACTIVITY_REQUEST_PICK_ATTACHMENT:
|
||||
|
||||
addAttachment(data.getData());
|
||||
@ -933,14 +920,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
}
|
||||
}
|
||||
|
||||
private void onIdentityChosen(Intent intent)
|
||||
{
|
||||
private void onIdentityChosen(Intent intent) {
|
||||
Bundle bundle = intent.getExtras();;
|
||||
switchToIdentity( (Account.Identity)bundle.getSerializable(ChooseIdentity.EXTRA_IDENTITY));
|
||||
}
|
||||
|
||||
private void switchToIdentity(Account.Identity identity)
|
||||
{
|
||||
private void switchToIdentity(Account.Identity identity) {
|
||||
mIdentity = identity;
|
||||
mIdentityChanged = true;
|
||||
mDraftNeedsSaving = true;
|
||||
@ -948,17 +933,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
updateSignature();
|
||||
}
|
||||
|
||||
private void updateFrom()
|
||||
{
|
||||
if (mIdentityChanged)
|
||||
{
|
||||
private void updateFrom() {
|
||||
if (mIdentityChanged) {
|
||||
mFromView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mFromView.setText(getString(R.string.message_view_from_format, mIdentity.getName(), mIdentity.getEmail()));
|
||||
}
|
||||
|
||||
private void updateSignature()
|
||||
{
|
||||
private void updateSignature() {
|
||||
mSignatureView.setText(mIdentity.getSignature());
|
||||
}
|
||||
|
||||
@ -1007,16 +989,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onChooseIdentity()
|
||||
{
|
||||
if (mAccount.getIdentities().size() > 1)
|
||||
{
|
||||
private void onChooseIdentity() {
|
||||
if (mAccount.getIdentities().size() > 1) {
|
||||
Intent intent = new Intent(this, ChooseIdentity.class);
|
||||
intent.putExtra(ChooseIdentity.EXTRA_ACCOUNT, mAccount);
|
||||
startActivityForResult(intent, ACTIVITY_CHOOSE_IDENTITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Toast.makeText(this, getString(R.string.no_identities),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
@ -1054,8 +1032,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
addAttachment(uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1074,8 +1051,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
try {
|
||||
if (message.getSubject() != null && !message.getSubject().toLowerCase().startsWith("re:")) {
|
||||
mSubjectView.setText("Re: " + message.getSubject());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mSubjectView.setText(message.getSubject());
|
||||
}
|
||||
/*
|
||||
@ -1085,8 +1061,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
Address[] replyToAddresses;
|
||||
if (message.getReplyTo().length > 0) {
|
||||
addAddresses(mToView, replyToAddresses = message.getReplyTo());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
addAddresses(mToView, replyToAddresses = message.getFrom());
|
||||
}
|
||||
|
||||
@ -1100,13 +1075,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
buffy.append(message.getReferences()[i]);
|
||||
|
||||
mReferences = buffy.toString() + " " + mInReplyTo;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mReferences = mInReplyTo;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Log.d(Email.LOG_TAG, "could not get Message-ID.");
|
||||
}
|
||||
|
||||
@ -1124,8 +1097,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
mQuotedText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (ACTION_REPLY_ALL.equals(action) || ACTION_REPLY.equals(action))
|
||||
{
|
||||
if (ACTION_REPLY_ALL.equals(action) || ACTION_REPLY.equals(action)) {
|
||||
Account.Identity useIdentity = null;
|
||||
for (Address address : message.getRecipients(RecipientType.TO)) {
|
||||
Account.Identity identity = mAccount.findIdentity(address);
|
||||
@ -1134,8 +1106,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (useIdentity == null)
|
||||
{
|
||||
if (useIdentity == null) {
|
||||
if (message.getRecipients(RecipientType.CC).length > 0) {
|
||||
for (Address address : message.getRecipients(RecipientType.CC)) {
|
||||
Account.Identity identity = mAccount.findIdentity(address);
|
||||
@ -1146,11 +1117,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
}
|
||||
}
|
||||
}
|
||||
if (useIdentity != null)
|
||||
{
|
||||
if (useIdentity != null) {
|
||||
Account.Identity defaultIdentity = mAccount.getIdentity(0);
|
||||
if (useIdentity != defaultIdentity)
|
||||
{
|
||||
if (useIdentity != defaultIdentity) {
|
||||
switchToIdentity(useIdentity);
|
||||
}
|
||||
}
|
||||
@ -1174,20 +1143,17 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
mCcView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MessagingException me) {
|
||||
} catch (MessagingException me) {
|
||||
/*
|
||||
* This really should not happen at this point but if it does it's okay.
|
||||
* The user can continue composing their message.
|
||||
*/
|
||||
}
|
||||
}
|
||||
else if (ACTION_FORWARD.equals(action)) {
|
||||
} else if (ACTION_FORWARD.equals(action)) {
|
||||
try {
|
||||
if (message.getSubject() != null && !message.getSubject().toLowerCase().startsWith("fwd:")) {
|
||||
mSubjectView.setText("Fwd: " + message.getSubject());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mSubjectView.setText(message.getSubject());
|
||||
}
|
||||
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
|
||||
@ -1217,15 +1183,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
mHandler.sendEmptyMessage(MSG_SKIPPED_ATTACHMENTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MessagingException me) {
|
||||
} catch (MessagingException me) {
|
||||
/*
|
||||
* This really should not happen at this point but if it does it's okay.
|
||||
* The user can continue composing their message.
|
||||
*/
|
||||
}
|
||||
}
|
||||
else if (ACTION_EDIT_DRAFT.equals(action)) {
|
||||
} else if (ACTION_EDIT_DRAFT.equals(action)) {
|
||||
try {
|
||||
mSubjectView.setText(message.getSubject());
|
||||
addAddresses(mToView, message.getRecipients(RecipientType.TO));
|
||||
@ -1243,12 +1207,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
}
|
||||
Integer bodyLength = null;
|
||||
String[] k9identities = message.getHeader(Email.K9MAIL_IDENTITY);
|
||||
if (k9identities != null && k9identities.length > 0)
|
||||
{
|
||||
if (k9identities != null && k9identities.length > 0) {
|
||||
String k9identity = k9identities[0];
|
||||
|
||||
if (k9identity != null)
|
||||
{
|
||||
if (k9identity != null) {
|
||||
Log.d(Email.LOG_TAG, "Got a saved identity: " + k9identity);
|
||||
StringTokenizer tokens = new StringTokenizer(k9identity, ":", false);
|
||||
|
||||
@ -1256,59 +1218,43 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
String name = null;
|
||||
String email = null;
|
||||
String signature = null;
|
||||
if (tokens.hasMoreTokens())
|
||||
{
|
||||
if (tokens.hasMoreTokens()) {
|
||||
bodyLengthS = Utility.base64Decode(tokens.nextToken());
|
||||
try
|
||||
{
|
||||
try {
|
||||
bodyLength = Integer.parseInt(bodyLengthS);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
Log.e(Email.LOG_TAG, "Unable to parse bodyLength '" + bodyLengthS + "'");
|
||||
}
|
||||
}
|
||||
if (tokens.hasMoreTokens())
|
||||
{
|
||||
if (tokens.hasMoreTokens()) {
|
||||
signature = Utility.base64Decode(tokens.nextToken());
|
||||
}
|
||||
if (tokens.hasMoreTokens())
|
||||
{
|
||||
if (tokens.hasMoreTokens()) {
|
||||
name = Utility.base64Decode(tokens.nextToken());
|
||||
}
|
||||
if (tokens.hasMoreTokens())
|
||||
{
|
||||
if (tokens.hasMoreTokens()) {
|
||||
email = Utility.base64Decode(tokens.nextToken());
|
||||
}
|
||||
|
||||
Account.Identity newIdentity= mAccount.new Identity();
|
||||
if (signature != null)
|
||||
{
|
||||
if (signature != null) {
|
||||
newIdentity.setSignature(signature);
|
||||
mSignatureChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
newIdentity.setSignature(mIdentity.getSignature());
|
||||
}
|
||||
|
||||
if (name != null)
|
||||
{
|
||||
if (name != null) {
|
||||
newIdentity.setName(name);
|
||||
mIdentityChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
newIdentity.setName(mIdentity.getName());
|
||||
}
|
||||
|
||||
if (email != null)
|
||||
{
|
||||
if (email != null) {
|
||||
newIdentity.setEmail(email);
|
||||
mIdentityChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
newIdentity.setEmail(mIdentity.getEmail());
|
||||
}
|
||||
|
||||
@ -1322,8 +1268,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
|
||||
if (part != null) {
|
||||
String text = MimeUtility.getTextFromPart(part);
|
||||
if (bodyLength != null && bodyLength + 1 < text.length()) // + 1 to get rid of the newline we added when saving the draft
|
||||
{
|
||||
if (bodyLength != null && bodyLength + 1 < text.length()) { // + 1 to get rid of the newline we added when saving the draft
|
||||
String bodyText = text.substring(0, bodyLength);
|
||||
String quotedText = text.substring(bodyLength + 1, text.length());
|
||||
|
||||
@ -1332,14 +1277,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
|
||||
mQuotedTextBar.setVisibility(View.VISIBLE);
|
||||
mQuotedText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mMessageContentView.setText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MessagingException me) {
|
||||
} catch (MessagingException me) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
@ -202,8 +202,7 @@ public class MessageList extends K9ListActivity {
|
||||
|
||||
case MSG_SORT_MESSAGES:
|
||||
|
||||
synchronized(mAdapter.messages)
|
||||
{
|
||||
synchronized (mAdapter.messages) {
|
||||
Collections.sort(mAdapter.messages);
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
@ -211,8 +210,7 @@ public class MessageList extends K9ListActivity {
|
||||
|
||||
case MSG_REMOVE_MESSAGE: {
|
||||
List<MessageInfoHolder> messages = (List<MessageInfoHolder>)((Object[]) msg.obj)[0];
|
||||
for (MessageInfoHolder message : messages)
|
||||
{
|
||||
for (MessageInfoHolder message : messages) {
|
||||
mAdapter.messages.remove(message);
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
@ -221,12 +219,10 @@ public class MessageList extends K9ListActivity {
|
||||
|
||||
case MSG_ADD_MESSAGE: {
|
||||
List<MessageInfoHolder> messages = (List<MessageInfoHolder>)((Object[]) msg.obj)[0];
|
||||
for (MessageInfoHolder message : messages)
|
||||
{
|
||||
for (MessageInfoHolder message : messages) {
|
||||
int index = Collections.binarySearch( mAdapter.messages, message);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
if (index < 0) {
|
||||
index = (index * -1) - 1;
|
||||
}
|
||||
|
||||
@ -251,11 +247,9 @@ public class MessageList extends K9ListActivity {
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_FOLDER_LOADING:
|
||||
{
|
||||
case MSG_FOLDER_LOADING: {
|
||||
FolderInfoHolder folder = mCurrentFolder;
|
||||
if (folder != null)
|
||||
{
|
||||
if (folder != null) {
|
||||
folder.loading = msg.arg1 != 0;
|
||||
}
|
||||
break;
|
||||
@ -294,8 +288,7 @@ public class MessageList extends K9ListActivity {
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
private void sortMessages()
|
||||
{
|
||||
private void sortMessages() {
|
||||
sendEmptyMessage(MSG_SORT_MESSAGES);
|
||||
}
|
||||
|
||||
@ -317,8 +310,7 @@ public class MessageList extends K9ListActivity {
|
||||
public void folderSyncing(String folder) {
|
||||
android.os.Message msg = new android.os.Message();
|
||||
msg.what = MSG_FOLDER_SYNCING;
|
||||
msg.obj = new String[]
|
||||
{ folder };
|
||||
msg.obj = new String[] { folder };
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
@ -439,7 +431,7 @@ public class MessageList extends K9ListActivity {
|
||||
String currentFolder = savedInstanceState.getString(STATE_CURRENT_FOLDER);
|
||||
int selectedChild = savedInstanceState.getInt( STATE_KEY_SELECTION, -1);
|
||||
|
||||
if (selectedChild != 0 ){
|
||||
if (selectedChild != 0 ) {
|
||||
mListView.setSelection(selectedChild);
|
||||
}
|
||||
if (currentFolder != null ) {
|
||||
@ -498,15 +490,27 @@ public class MessageList extends K9ListActivity {
|
||||
//Shortcuts that work no matter what is selected
|
||||
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_C: { onCompose(); return true;}
|
||||
case KeyEvent.KEYCODE_C: {
|
||||
onCompose();
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_Q:
|
||||
//case KeyEvent.KEYCODE_BACK:
|
||||
{ onShowFolderList(); return true; }
|
||||
{
|
||||
onShowFolderList();
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_O: { onCycleSort(); return true; }
|
||||
case KeyEvent.KEYCODE_O: {
|
||||
onCycleSort();
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_I: { onToggleSortAscending(); return true; }
|
||||
case KeyEvent.KEYCODE_I: {
|
||||
onToggleSortAscending();
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_H: {
|
||||
Toast toast = Toast.makeText(this, R.string.message_list_help_key, Toast.LENGTH_LONG);
|
||||
@ -522,23 +526,50 @@ public class MessageList extends K9ListActivity {
|
||||
|
||||
if (message != null) {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_DEL: { onDelete(message, position); return true;}
|
||||
case KeyEvent.KEYCODE_DEL: {
|
||||
onDelete(message, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_D: { onDelete(message, position); return true;}
|
||||
case KeyEvent.KEYCODE_D: {
|
||||
onDelete(message, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_F: { onForward(message); return true;}
|
||||
case KeyEvent.KEYCODE_F: {
|
||||
onForward(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_A: { onReplyAll(message); return true; }
|
||||
case KeyEvent.KEYCODE_A: {
|
||||
onReplyAll(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_R: { onReply(message); return true; }
|
||||
case KeyEvent.KEYCODE_R: {
|
||||
onReply(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_G: { onToggleFlag(message); return true; }
|
||||
case KeyEvent.KEYCODE_G: {
|
||||
onToggleFlag(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_M: { onMove(message); return true; }
|
||||
case KeyEvent.KEYCODE_M: {
|
||||
onMove(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_Y: { onCopy(message); return true; }
|
||||
case KeyEvent.KEYCODE_Y: {
|
||||
onCopy(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_Z: { onToggleRead(message); return true; }
|
||||
case KeyEvent.KEYCODE_Z: {
|
||||
onToggleRead(message);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -580,8 +611,7 @@ public class MessageList extends K9ListActivity {
|
||||
}
|
||||
|
||||
private void onShowFolderList() {
|
||||
if (mStartup || isTaskRoot())
|
||||
{
|
||||
if (mStartup || isTaskRoot()) {
|
||||
FolderList.actionHandleAccount(this, mAccount, false);
|
||||
}
|
||||
|
||||
@ -1280,12 +1310,10 @@ public class MessageList extends K9ListActivity {
|
||||
List<MessageInfoHolder> messagesToAdd = new ArrayList<MessageInfoHolder>();
|
||||
List<MessageInfoHolder> messagesToRemove = new ArrayList<MessageInfoHolder>();
|
||||
|
||||
for (Message message : messages)
|
||||
{
|
||||
for (Message message : messages) {
|
||||
MessageInfoHolder m = getMessage( message.getUid());
|
||||
|
||||
if (m == null)
|
||||
{
|
||||
if (m == null) {
|
||||
m = new MessageInfoHolder(message, folder);
|
||||
messagesToAdd.add(m);
|
||||
} else {
|
||||
@ -1300,16 +1328,13 @@ public class MessageList extends K9ListActivity {
|
||||
}
|
||||
}
|
||||
|
||||
if (messagesToRemove.size() > 0)
|
||||
{
|
||||
if (messagesToRemove.size() > 0) {
|
||||
removeMessages(messagesToRemove);
|
||||
}
|
||||
if (messagesToAdd.size() > 0)
|
||||
{
|
||||
if (messagesToAdd.size() > 0) {
|
||||
mHandler.addMessages(messagesToAdd);
|
||||
}
|
||||
if (needsSort)
|
||||
{
|
||||
if (needsSort) {
|
||||
mHandler.sortMessages();
|
||||
}
|
||||
}
|
||||
|
@ -4,20 +4,15 @@ import android.content.Context;
|
||||
|
||||
import com.android.email.R;
|
||||
|
||||
public class SizeFormatter
|
||||
{
|
||||
public static String formatSize(Context context, long size)
|
||||
{
|
||||
if (size > 1024000000)
|
||||
{
|
||||
public class SizeFormatter {
|
||||
public static String formatSize(Context context, long size) {
|
||||
if (size > 1024000000) {
|
||||
return ((float)(size / 102400000) / 10) + context.getString(R.string.abbrev_gigabytes);
|
||||
}
|
||||
if (size > 1024000)
|
||||
{
|
||||
if (size > 1024000) {
|
||||
return ((float)(size / 102400) / 10) + context.getString(R.string.abbrev_megabytes);
|
||||
}
|
||||
if (size > 1024)
|
||||
{
|
||||
if (size > 1024) {
|
||||
return ((float)(size / 102) / 10) + context.getString(R.string.abbrev_kilobytes);
|
||||
}
|
||||
return size + context.getString(R.string.abbrev_bytes);
|
||||
|
@ -88,13 +88,10 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
|
||||
boolean isPushCapable = false;
|
||||
Store store = null;
|
||||
try
|
||||
{
|
||||
try {
|
||||
store = Store.getInstance(mAccount.getStoreUri(), getApplication());
|
||||
isPushCapable = store.isPushCapable();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
Log.e(Email.LOG_TAG, "Could not get remote store", e);
|
||||
}
|
||||
|
||||
@ -354,8 +351,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
AccountSetupOutgoing.actionEditOutgoingSettings(this, mAccount);
|
||||
}
|
||||
|
||||
public void onChooseAutoExpandFolder()
|
||||
{
|
||||
public void onChooseAutoExpandFolder() {
|
||||
Intent selectIntent = new Intent(this, ChooseFolder.class);
|
||||
selectIntent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount);
|
||||
|
||||
@ -367,28 +363,20 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
|
||||
}
|
||||
|
||||
private String translateFolder(String in)
|
||||
{
|
||||
private String translateFolder(String in) {
|
||||
|
||||
if (Email.INBOX.equalsIgnoreCase(in))
|
||||
{
|
||||
if (Email.INBOX.equalsIgnoreCase(in)) {
|
||||
return getString(R.string.special_mailbox_name_inbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return in;
|
||||
}
|
||||
}
|
||||
|
||||
private String reverseTranslateFolder(String in)
|
||||
{
|
||||
private String reverseTranslateFolder(String in) {
|
||||
|
||||
if (getString(R.string.special_mailbox_name_inbox).equals(in))
|
||||
{
|
||||
if (getString(R.string.special_mailbox_name_inbox).equals(in)) {
|
||||
return Email.INBOX;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return in;
|
||||
}
|
||||
}
|
||||
|
@ -104,8 +104,7 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void failure(Exception use)
|
||||
{
|
||||
private void failure(Exception use) {
|
||||
Log.e(Email.LOG_TAG, "Failure", use);
|
||||
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
|
||||
|
||||
|
@ -137,8 +137,7 @@ public class AccountSetupBasics extends K9Activity
|
||||
|
||||
private String getOwnerName() {
|
||||
String name = null;
|
||||
try
|
||||
{
|
||||
try {
|
||||
String projection[] = {
|
||||
ContactMethods.NAME
|
||||
};
|
||||
@ -151,18 +150,13 @@ public class AccountSetupBasics extends K9Activity
|
||||
name = c.getString(0);
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
Log.e(Email.LOG_TAG, "Could not get owner name, using default account name", e);
|
||||
}
|
||||
if (name == null || name.length() == 0) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
name = getDefaultAccountName();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
Log.e(Email.LOG_TAG, "Could not get default account name", e);
|
||||
}
|
||||
}
|
||||
@ -172,8 +166,7 @@ public class AccountSetupBasics extends K9Activity
|
||||
return name;
|
||||
}
|
||||
|
||||
private String getDefaultAccountName()
|
||||
{
|
||||
private String getDefaultAccountName() {
|
||||
String name = null;
|
||||
Account account = Preferences.getPreferences(this).getDefaultAccount();
|
||||
if (account != null) {
|
||||
@ -271,8 +264,7 @@ public class AccountSetupBasics extends K9Activity
|
||||
|
||||
if (mProvider.note != null) {
|
||||
showDialog(DIALOG_NOTE);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
finishAutoSetup();
|
||||
}
|
||||
}
|
||||
@ -343,8 +335,7 @@ public class AccountSetupBasics extends K9Activity
|
||||
int resId = xml.getAttributeResourceValue(null, name, 0);
|
||||
if (resId == 0) {
|
||||
return xml.getAttributeValue(null, name);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return getString(resId);
|
||||
}
|
||||
}
|
||||
@ -363,34 +354,29 @@ public class AccountSetupBasics extends K9Activity
|
||||
provider.label = getXmlAttribute(xml, "label");
|
||||
provider.domain = getXmlAttribute(xml, "domain");
|
||||
provider.note = getXmlAttribute(xml, "note");
|
||||
}
|
||||
else if (xmlEventType == XmlResourceParser.START_TAG
|
||||
} else if (xmlEventType == XmlResourceParser.START_TAG
|
||||
&& "incoming".equals(xml.getName())
|
||||
&& provider != null) {
|
||||
provider.incomingUriTemplate = new URI(getXmlAttribute(xml, "uri"));
|
||||
provider.incomingUsernameTemplate = getXmlAttribute(xml, "username");
|
||||
}
|
||||
else if (xmlEventType == XmlResourceParser.START_TAG
|
||||
} else if (xmlEventType == XmlResourceParser.START_TAG
|
||||
&& "outgoing".equals(xml.getName())
|
||||
&& provider != null) {
|
||||
provider.outgoingUriTemplate = new URI(getXmlAttribute(xml, "uri"));
|
||||
provider.outgoingUsernameTemplate = getXmlAttribute(xml, "username");
|
||||
}
|
||||
else if (xmlEventType == XmlResourceParser.END_TAG
|
||||
} else if (xmlEventType == XmlResourceParser.END_TAG
|
||||
&& "provider".equals(xml.getName())
|
||||
&& provider != null) {
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
Log.e(Email.LOG_TAG, "Error while trying to load provider settings.", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String[] splitEmail(String email)
|
||||
{
|
||||
private String[] splitEmail(String email) {
|
||||
String[] retParts = new String[2];
|
||||
String[] emailParts = email.split("@");
|
||||
retParts[0] = (emailParts.length > 0 ) ? emailParts[0] : "";
|
||||
|
@ -151,7 +151,8 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
||||
}
|
||||
}
|
||||
|
||||
}.start();
|
||||
}
|
||||
.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -229,8 +230,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
||||
|
||||
mProgressBar.setIndeterminate(false);
|
||||
StringBuffer chainInfo = new StringBuffer(100);
|
||||
for (int i = 0; i < chain.length; i++)
|
||||
{
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
// display certificate chain information
|
||||
chainInfo.append("Certificate chain[" + i + "]:\n");
|
||||
chainInfo.append("Subject: " + chain[i].getSubjectDN().toString() + "\n");
|
||||
|
@ -309,8 +309,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
}
|
||||
|
||||
private void updatePortFromSecurityType() {
|
||||
if (mAccountPorts != null)
|
||||
{
|
||||
if (mAccountPorts != null) {
|
||||
int securityType = (Integer)((SpinnerOption)mSecurityTypeView.getSelectedItem()).value;
|
||||
mPortView.setText(Integer.toString(mAccountPorts[securityType]));
|
||||
}
|
||||
@ -401,8 +400,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
switch (v.getId()) {
|
||||
case R.id.next:
|
||||
onNext();
|
||||
@ -420,9 +418,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
selectImapFolder(SELECT_OUTBOX_FOLDER);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
failure(e);
|
||||
}
|
||||
}
|
||||
@ -454,8 +450,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
startActivityForResult(selectIntent, activityCode);
|
||||
}
|
||||
|
||||
private void failure(Exception use)
|
||||
{
|
||||
private void failure(Exception use) {
|
||||
Log.e(Email.LOG_TAG, "Failure", use);
|
||||
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
|
||||
|
||||
|
@ -115,18 +115,15 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
||||
|
||||
|
||||
boolean isPushCapable = false;
|
||||
try
|
||||
{
|
||||
try {
|
||||
Store store = Store.getInstance(mAccount.getStoreUri(), getApplication());
|
||||
isPushCapable = store.isPushCapable();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
Log.e(Email.LOG_TAG, "Could not get remote store", e);
|
||||
}
|
||||
|
||||
|
||||
if(!isPushCapable) {
|
||||
if (!isPushCapable) {
|
||||
mPushEnable.setVisibility(View.GONE);
|
||||
} else {
|
||||
mPushEnable.setChecked(true);
|
||||
|
@ -287,8 +287,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
||||
mRequireLoginSettingsView.setVisibility(isChecked ? View.VISIBLE : View.GONE);
|
||||
validateFields();
|
||||
}
|
||||
private void failure(Exception use)
|
||||
{
|
||||
private void failure(Exception use) {
|
||||
Log.e(Email.LOG_TAG, "Failure", use);
|
||||
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
|
||||
|
||||
|
@ -54,28 +54,22 @@ public class FolderSettings extends K9PreferenceActivity {
|
||||
String folderName = (String)getIntent().getSerializableExtra(EXTRA_FOLDER_NAME);
|
||||
Account mAccount = (Account)getIntent().getSerializableExtra(EXTRA_ACCOUNT);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
Store localStore = Store.getInstance(mAccount.getLocalStoreUri(),
|
||||
getApplication());
|
||||
mFolder = (LocalFolder) localStore.getFolder(folderName);
|
||||
mFolder.refresh(Preferences.getPreferences(this));
|
||||
}
|
||||
catch (MessagingException me)
|
||||
{
|
||||
} catch (MessagingException me) {
|
||||
Log.e(Email.LOG_TAG, "Unable to edit folder " + folderName + " preferences", me);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isPushCapable = false;
|
||||
Store store = null;
|
||||
try
|
||||
{
|
||||
try {
|
||||
store = Store.getInstance(mAccount.getStoreUri(), getApplication());
|
||||
isPushCapable = store.isPushCapable();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
Log.e(Email.LOG_TAG, "Could not get remote store", e);
|
||||
}
|
||||
|
||||
@ -128,12 +122,9 @@ public class FolderSettings extends K9PreferenceActivity {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
try
|
||||
{
|
||||
try {
|
||||
mFolder.refresh(Preferences.getPreferences(this));
|
||||
}
|
||||
catch (MessagingException me)
|
||||
{
|
||||
} catch (MessagingException me) {
|
||||
Log.e(Email.LOG_TAG, "Could not refresh folder preferences for folder " + mFolder.getName(), me);
|
||||
}
|
||||
}
|
||||
@ -143,13 +134,10 @@ public class FolderSettings extends K9PreferenceActivity {
|
||||
mFolder.setSyncClass(FolderClass.valueOf(mSyncClass.getValue()));
|
||||
mFolder.setPushClass(FolderClass.valueOf(mPushClass.getValue()));
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
mFolder.save(Preferences.getPreferences(this));
|
||||
Email.setServicesEnabled(this);
|
||||
}
|
||||
catch (MessagingException me)
|
||||
{
|
||||
} catch (MessagingException me) {
|
||||
Log.e(Email.LOG_TAG, "Could not refresh folder preferences for folder " + mFolder.getName(), me);
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ public class Prefs extends K9PreferenceActivity {
|
||||
String newBackgroundOps = mBackgroundOps.getValue();
|
||||
Email.setBackgroundOps(newBackgroundOps);
|
||||
Email.save(preferences);
|
||||
if (newBackgroundOps.equals(initBackgroundOps) == false)
|
||||
{
|
||||
if (newBackgroundOps.equals(initBackgroundOps) == false) {
|
||||
MailService.backgroundDataChanged(this);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user