2008-11-01 17:32:06 -04:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
package com.fsck.k9.activity;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2011-04-12 21:37:44 -04:00
|
|
|
import java.io.FileNotFoundException;
|
2011-10-03 18:48:43 -04:00
|
|
|
import java.io.IOException;
|
2011-04-12 21:37:44 -04:00
|
|
|
import java.io.InputStream;
|
2012-08-08 14:03:10 -04:00
|
|
|
import java.util.*;
|
2011-09-05 13:45:33 -04:00
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
2011-10-13 20:52:32 -04:00
|
|
|
import android.app.Activity;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.app.AlertDialog;
|
2011-10-17 23:06:32 -04:00
|
|
|
import android.app.Application;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.app.Dialog;
|
2011-10-01 14:11:14 -04:00
|
|
|
import android.app.ProgressDialog;
|
2011-02-26 12:31:56 -05:00
|
|
|
import android.content.ContentResolver;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.DialogInterface;
|
2012-03-17 13:27:17 -04:00
|
|
|
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.content.Intent;
|
2008-12-18 19:20:56 -05:00
|
|
|
import android.content.pm.PackageInfo;
|
|
|
|
import android.content.pm.PackageManager;
|
2012-02-14 18:11:15 -05:00
|
|
|
import android.content.pm.ResolveInfo;
|
2011-02-26 12:31:56 -05:00
|
|
|
import android.net.Uri;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.os.Bundle;
|
2009-02-05 23:28:29 -05:00
|
|
|
import android.os.Handler;
|
2011-10-16 22:34:26 -04:00
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.TextWatcher;
|
2010-04-16 10:33:54 -04:00
|
|
|
import android.util.Log;
|
2011-04-12 21:37:44 -04:00
|
|
|
import android.util.SparseBooleanArray;
|
2010-04-20 12:37:03 -04:00
|
|
|
import android.util.TypedValue;
|
2012-09-10 07:50:44 -04:00
|
|
|
import android.view.ContextMenu;
|
|
|
|
|
|
|
|
import com.actionbarsherlock.app.ActionBar;
|
|
|
|
import com.actionbarsherlock.view.Menu;
|
|
|
|
import com.actionbarsherlock.view.MenuItem;
|
2011-09-05 13:45:33 -04:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.Window;
|
2012-09-10 07:50:44 -04:00
|
|
|
import android.view.ContextMenu.ContextMenuInfo;
|
|
|
|
import android.view.View.OnClickListener;
|
2008-12-18 19:20:56 -05:00
|
|
|
import android.webkit.WebView;
|
2011-09-05 13:45:33 -04:00
|
|
|
import android.widget.AdapterView;
|
|
|
|
import android.widget.ArrayAdapter;
|
2011-10-16 22:34:26 -04:00
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
import android.widget.EditText;
|
2011-09-05 13:45:33 -04:00
|
|
|
import android.widget.ImageButton;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.ListView;
|
|
|
|
import android.widget.RelativeLayout;
|
2011-10-16 22:34:26 -04:00
|
|
|
import android.widget.ScrollView;
|
2011-09-05 13:45:33 -04:00
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
2012-09-10 07:50:44 -04:00
|
|
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
|
|
|
import android.widget.AdapterView.OnItemClickListener;
|
|
|
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
2011-09-05 13:45:33 -04:00
|
|
|
|
|
|
|
import com.fsck.k9.Account;
|
|
|
|
import com.fsck.k9.AccountStats;
|
|
|
|
import com.fsck.k9.BaseAccount;
|
|
|
|
import com.fsck.k9.FontSizes;
|
|
|
|
import com.fsck.k9.K9;
|
|
|
|
import com.fsck.k9.Preferences;
|
|
|
|
import com.fsck.k9.R;
|
|
|
|
import com.fsck.k9.SearchAccount;
|
|
|
|
import com.fsck.k9.SearchSpecification;
|
2011-10-01 14:11:14 -04:00
|
|
|
import com.fsck.k9.activity.misc.ExtendedAsyncTask;
|
2011-10-13 20:52:32 -04:00
|
|
|
import com.fsck.k9.activity.misc.NonConfigurationInstance;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.activity.setup.AccountSettings;
|
|
|
|
import com.fsck.k9.activity.setup.AccountSetupBasics;
|
|
|
|
import com.fsck.k9.activity.setup.Prefs;
|
2012-08-24 10:29:17 -04:00
|
|
|
import com.fsck.k9.activity.setup.WelcomeMessage;
|
2010-05-19 14:17:06 -04:00
|
|
|
import com.fsck.k9.controller.MessagingController;
|
|
|
|
import com.fsck.k9.controller.MessagingListener;
|
2011-09-05 13:45:33 -04:00
|
|
|
import com.fsck.k9.helper.SizeFormatter;
|
2010-04-05 22:54:48 -04:00
|
|
|
import com.fsck.k9.mail.Flag;
|
2011-10-16 22:34:26 -04:00
|
|
|
import com.fsck.k9.mail.ServerSettings;
|
|
|
|
import com.fsck.k9.mail.Store;
|
|
|
|
import com.fsck.k9.mail.Transport;
|
2011-03-01 23:34:41 -05:00
|
|
|
import com.fsck.k9.mail.internet.MimeUtility;
|
2011-03-19 13:36:58 -04:00
|
|
|
import com.fsck.k9.mail.store.StorageManager;
|
2011-10-16 22:34:26 -04:00
|
|
|
import com.fsck.k9.mail.store.WebDavStore;
|
2012-09-10 07:50:44 -04:00
|
|
|
import com.fsck.k9.view.ColorChip;
|
2011-10-13 23:58:15 -04:00
|
|
|
import com.fsck.k9.preferences.SettingsExporter;
|
2011-10-14 00:00:10 -04:00
|
|
|
import com.fsck.k9.preferences.SettingsImportExportException;
|
2011-10-13 23:58:55 -04:00
|
|
|
import com.fsck.k9.preferences.SettingsImporter;
|
|
|
|
import com.fsck.k9.preferences.SettingsImporter.AccountDescription;
|
2011-10-16 22:34:26 -04:00
|
|
|
import com.fsck.k9.preferences.SettingsImporter.AccountDescriptionPair;
|
2011-10-13 23:58:55 -04:00
|
|
|
import com.fsck.k9.preferences.SettingsImporter.ImportContents;
|
|
|
|
import com.fsck.k9.preferences.SettingsImporter.ImportResults;
|
2011-03-27 01:09:26 -04:00
|
|
|
|
2010-04-05 22:54:48 -04:00
|
|
|
|
2012-08-24 10:29:17 -04:00
|
|
|
public class Accounts extends K9ListActivity implements OnItemClickListener {
|
2010-08-02 07:55:31 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Immutable empty {@link BaseAccount} array
|
|
|
|
*/
|
|
|
|
private static final BaseAccount[] EMPTY_BASE_ACCOUNT_ARRAY = new BaseAccount[0];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Immutable empty {@link Flag} array
|
|
|
|
*/
|
|
|
|
private static final Flag[] EMPTY_FLAG_ARRAY = new Flag[0];
|
|
|
|
|
2012-02-14 18:11:15 -05:00
|
|
|
/**
|
|
|
|
* URL used to open Android Market application
|
|
|
|
*/
|
2012-02-14 23:48:27 -05:00
|
|
|
private static final String ANDROID_MARKET_URL = "https://market.android.com/search?q=oi+file+manager&c=apps";
|
2012-02-14 18:11:15 -05:00
|
|
|
|
2012-02-12 10:29:16 -05:00
|
|
|
/**
|
|
|
|
* Number of special accounts ('Unified Inbox' and 'All Messages')
|
|
|
|
*/
|
|
|
|
private static final int SPECIAL_ACCOUNTS_COUNT = 2;
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final int DIALOG_REMOVE_ACCOUNT = 1;
|
2010-05-12 00:17:52 -04:00
|
|
|
private static final int DIALOG_CLEAR_ACCOUNT = 2;
|
|
|
|
private static final int DIALOG_RECREATE_ACCOUNT = 3;
|
2012-02-16 08:43:38 -05:00
|
|
|
private static final int DIALOG_NO_FILE_MANAGER = 4;
|
|
|
|
|
2010-04-16 10:33:54 -04:00
|
|
|
private ConcurrentHashMap<String, AccountStats> accountStats = new ConcurrentHashMap<String, AccountStats>();
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-04-16 23:32:17 -04:00
|
|
|
private ConcurrentHashMap<BaseAccount, String> pendingWork = new ConcurrentHashMap<BaseAccount, String>();
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-04-21 22:20:35 -04:00
|
|
|
private BaseAccount mSelectedContextAccount;
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
private int mUnreadMessageCount = 0;
|
2009-12-20 00:41:43 -05:00
|
|
|
|
2009-02-05 23:28:29 -05:00
|
|
|
private AccountsHandler mHandler = new AccountsHandler();
|
|
|
|
private AccountsAdapter mAdapter;
|
2010-04-05 22:54:48 -04:00
|
|
|
private SearchAccount unreadAccount = null;
|
|
|
|
private SearchAccount integratedInboxAccount = null;
|
2010-04-20 12:37:03 -04:00
|
|
|
private FontSizes mFontSizes = K9.getFontSizes();
|
2010-01-27 19:29:27 -05:00
|
|
|
|
2012-08-02 10:09:31 -04:00
|
|
|
private MenuItem mRefreshMenuItem;
|
2012-08-27 14:44:40 -04:00
|
|
|
private ActionBar mActionBar;
|
|
|
|
|
|
|
|
private TextView mActionBarTitle;
|
|
|
|
private TextView mActionBarSubTitle;
|
|
|
|
private TextView mActionBarUnread;
|
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
/**
|
2011-10-13 20:52:32 -04:00
|
|
|
* Contains information about objects that need to be retained on configuration changes.
|
2011-10-01 14:11:14 -04:00
|
|
|
*
|
2011-10-13 20:52:32 -04:00
|
|
|
* @see #onRetainNonConfigurationInstance()
|
2011-10-01 14:11:14 -04:00
|
|
|
*/
|
2011-10-13 20:52:32 -04:00
|
|
|
private NonConfigurationInstance mNonConfigurationInstance;
|
2011-10-01 14:11:14 -04:00
|
|
|
|
|
|
|
|
2011-02-26 12:31:56 -05:00
|
|
|
private static final int ACTIVITY_REQUEST_PICK_SETTINGS_FILE = 1;
|
2010-01-27 19:29:27 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
class AccountsHandler extends Handler {
|
|
|
|
private void setViewTitle() {
|
2012-08-28 10:43:25 -04:00
|
|
|
mActionBarTitle.setText(" " + getString(R.string.accounts_title));
|
2012-09-10 22:38:03 -04:00
|
|
|
|
|
|
|
if (mUnreadMessageCount == 0) {
|
|
|
|
mActionBarUnread.setVisibility(View.GONE);
|
|
|
|
} else {
|
|
|
|
mActionBarUnread.setText(Integer.toString(mUnreadMessageCount));
|
|
|
|
mActionBarUnread.setVisibility(View.VISIBLE);
|
|
|
|
}
|
2009-12-29 12:05:44 -05:00
|
|
|
|
2012-08-27 14:44:40 -04:00
|
|
|
String operation = mListener.getOperation(Accounts.this, getTimeFormat());
|
|
|
|
operation.trim();
|
|
|
|
if (operation.length() < 1) {
|
2012-08-28 10:43:25 -04:00
|
|
|
mActionBarSubTitle.setVisibility(View.GONE);
|
2012-08-27 14:44:40 -04:00
|
|
|
} else {
|
2012-08-28 10:43:25 -04:00
|
|
|
mActionBarSubTitle.setVisibility(View.VISIBLE);
|
|
|
|
mActionBarSubTitle.setText(operation);
|
2012-08-27 14:44:40 -04:00
|
|
|
}
|
2009-12-29 12:05:44 -05:00
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
public void refreshTitle() {
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
public void run() {
|
2009-12-29 12:05:44 -05:00
|
|
|
setViewTitle();
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
}
|
2009-12-29 12:05:44 -05:00
|
|
|
});
|
|
|
|
}
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public void dataChanged() {
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
if (mAdapter != null) {
|
2009-11-24 19:40:29 -05:00
|
|
|
mAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2009-12-29 12:05:44 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public void workingAccount(final Account account, final int res) {
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
public void run() {
|
2009-11-24 19:40:29 -05:00
|
|
|
String toastText = getString(res, account.getDescription());
|
|
|
|
|
|
|
|
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_SHORT);
|
|
|
|
toast.show();
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
2009-12-29 12:05:44 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public void accountSizeChanged(final Account account, final long oldSize, final long newSize) {
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
public void run() {
|
2010-04-16 10:33:54 -04:00
|
|
|
AccountStats stats = accountStats.get(account.getUuid());
|
2011-02-06 17:09:48 -05:00
|
|
|
if (newSize != -1 && stats != null && K9.measureAccounts()) {
|
2010-04-16 10:33:54 -04:00
|
|
|
stats.size = newSize;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
String toastText = getString(R.string.account_size_changed, account.getDescription(),
|
2010-11-30 22:07:28 -05:00
|
|
|
SizeFormatter.formatSize(getApplication(), oldSize), SizeFormatter.formatSize(getApplication(), newSize));
|
2009-11-24 19:40:29 -05:00
|
|
|
|
|
|
|
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);
|
|
|
|
toast.show();
|
2011-02-06 17:09:48 -05:00
|
|
|
if (mAdapter != null) {
|
2010-04-16 10:33:54 -04:00
|
|
|
mAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
2009-12-29 12:05:44 -05:00
|
|
|
});
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
public void progress(final boolean progress) {
|
2012-08-02 10:09:31 -04:00
|
|
|
// Make sure we don't try this before the menu is initialized
|
|
|
|
// this could happen while the activity is initialized.
|
|
|
|
if (mRefreshMenuItem == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
public void run() {
|
2012-08-28 10:43:25 -04:00
|
|
|
if (progress) {
|
2012-08-02 10:09:31 -04:00
|
|
|
mRefreshMenuItem.setActionView(R.layout.actionbar_indeterminate_progress_actionview);
|
|
|
|
} else {
|
|
|
|
mRefreshMenuItem.setActionView(null);
|
|
|
|
}
|
2009-12-29 12:05:44 -05:00
|
|
|
}
|
|
|
|
});
|
2012-08-02 10:09:31 -04:00
|
|
|
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
public void progress(final int progress) {
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
public void run() {
|
2009-12-29 12:05:44 -05:00
|
|
|
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, progress);
|
|
|
|
}
|
|
|
|
});
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-02 08:34:54 -05:00
|
|
|
public void setProgress(boolean progress) {
|
2011-02-26 12:31:56 -05:00
|
|
|
mHandler.progress(progress);
|
|
|
|
}
|
2011-03-02 08:34:54 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
ActivityListener mListener = new ActivityListener() {
|
2011-02-13 19:53:50 -05:00
|
|
|
@Override
|
|
|
|
public void informUserOfStatus() {
|
|
|
|
mHandler.refreshTitle();
|
|
|
|
}
|
|
|
|
|
2009-11-21 17:45:39 -05:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) {
|
|
|
|
try {
|
2010-04-16 10:33:54 -04:00
|
|
|
AccountStats stats = account.getStats(Accounts.this);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (stats == null) {
|
2010-11-13 16:40:56 -05:00
|
|
|
Log.w(K9.LOG_TAG, "Unable to get account stats");
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2010-11-13 16:40:56 -05:00
|
|
|
accountStatusChanged(account, stats);
|
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (Exception e) {
|
2010-04-16 10:33:54 -04:00
|
|
|
Log.e(K9.LOG_TAG, "Unable to get account stats", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void accountStatusChanged(BaseAccount account, AccountStats stats) {
|
2010-04-16 10:33:54 -04:00
|
|
|
AccountStats oldStats = accountStats.get(account.getUuid());
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
int oldUnreadMessageCount = 0;
|
2011-02-06 17:09:48 -05:00
|
|
|
if (oldStats != null) {
|
2010-04-16 10:33:54 -04:00
|
|
|
oldUnreadMessageCount = oldStats.unreadMessageCount;
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
if (stats == null) {
|
2010-11-13 16:40:56 -05:00
|
|
|
stats = new AccountStats(); // empty stats for unavailable accounts
|
2011-03-19 13:36:58 -04:00
|
|
|
stats.available = false;
|
2010-11-13 16:40:56 -05:00
|
|
|
}
|
2010-04-16 10:33:54 -04:00
|
|
|
accountStats.put(account.getUuid(), stats);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (account instanceof Account) {
|
2010-04-16 23:32:17 -04:00
|
|
|
mUnreadMessageCount += stats.unreadMessageCount - oldUnreadMessageCount;
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
mHandler.dataChanged();
|
|
|
|
pendingWork.remove(account);
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
if (pendingWork.isEmpty()) {
|
2009-11-21 17:45:39 -05:00
|
|
|
mHandler.progress(Window.PROGRESS_END);
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
mHandler.refreshTitle();
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2009-11-21 17:45:39 -05:00
|
|
|
int level = (Window.PROGRESS_END / mAdapter.getCount()) * (mAdapter.getCount() - pendingWork.size()) ;
|
|
|
|
mHandler.progress(level);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void accountSizeChanged(Account account, long oldSize, long newSize) {
|
2009-11-21 17:45:39 -05:00
|
|
|
mHandler.accountSizeChanged(account, oldSize, newSize);
|
2009-03-31 23:25:16 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void synchronizeMailboxFinished(
|
|
|
|
Account account,
|
|
|
|
String folder,
|
|
|
|
int totalMessagesInMailbox,
|
2011-02-06 17:09:48 -05:00
|
|
|
int numNewMessages) {
|
2010-04-16 23:32:17 -04:00
|
|
|
MessagingController.getInstance(getApplication()).getAccountStats(Accounts.this, account, mListener);
|
2011-02-13 19:53:50 -05:00
|
|
|
super.synchronizeMailboxFinished(account, folder, totalMessagesInMailbox, numNewMessages);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
|
|
|
mHandler.progress(false);
|
2009-12-20 00:41:43 -05:00
|
|
|
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void synchronizeMailboxStarted(Account account, String folder) {
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
super.synchronizeMailboxStarted(account, folder);
|
2009-11-21 17:45:39 -05:00
|
|
|
mHandler.progress(true);
|
2009-03-31 23:25:16 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void synchronizeMailboxFailed(Account account, String folder,
|
2011-02-06 17:09:48 -05:00
|
|
|
String message) {
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
super.synchronizeMailboxFailed(account, folder, message);
|
2009-03-31 23:25:16 -04:00
|
|
|
mHandler.progress(false);
|
|
|
|
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
}
|
2010-04-16 08:20:10 -04:00
|
|
|
|
2009-02-05 23:28:29 -05:00
|
|
|
};
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-04-16 10:33:54 -04:00
|
|
|
private static String ACCOUNT_STATS = "accountStats";
|
2009-02-05 23:28:29 -05:00
|
|
|
private static String SELECTED_CONTEXT_ACCOUNT = "selectedContextAccount";
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
|
2009-09-25 17:06:10 -04:00
|
|
|
public static final String EXTRA_STARTUP = "startup";
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void listAccounts(Context context) {
|
2009-10-21 20:41:06 -04:00
|
|
|
Intent intent = new Intent(context, Accounts.class);
|
2012-09-06 20:39:57 -04:00
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
|
|
|
Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
2009-10-21 20:41:06 -04:00
|
|
|
intent.putExtra(EXTRA_STARTUP, false);
|
|
|
|
context.startActivity(intent);
|
|
|
|
}
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
|
2011-03-01 23:34:41 -05:00
|
|
|
@Override
|
2011-03-02 08:34:54 -05:00
|
|
|
public void onNewIntent(Intent intent) {
|
2011-03-01 23:34:41 -05:00
|
|
|
Uri uri = intent.getData();
|
|
|
|
Log.i(K9.LOG_TAG, "Accounts Activity got uri " + uri);
|
|
|
|
if (uri != null) {
|
|
|
|
ContentResolver contentResolver = getContentResolver();
|
2011-03-02 08:34:54 -05:00
|
|
|
|
2011-03-01 23:34:41 -05:00
|
|
|
Log.i(K9.LOG_TAG, "Accounts Activity got content of type " + contentResolver.getType(uri));
|
|
|
|
|
|
|
|
String contentType = contentResolver.getType(uri);
|
|
|
|
if (MimeUtility.K9_SETTINGS_MIME_TYPE.equals(contentType)) {
|
|
|
|
onImport(uri);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onCreate(Bundle icicle) {
|
2010-07-08 20:27:47 -04:00
|
|
|
super.onCreate(icicle);
|
|
|
|
|
2011-02-25 15:36:47 -05:00
|
|
|
if (!K9.isHideSpecialAccounts()) {
|
2012-02-12 10:29:16 -05:00
|
|
|
createSpecialAccounts();
|
2011-02-25 15:36:47 -05:00
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
Account[] accounts = Preferences.getPreferences(this).getAccounts();
|
|
|
|
Intent intent = getIntent();
|
2011-10-14 14:33:25 -04:00
|
|
|
//onNewIntent(intent);
|
2011-10-01 14:11:14 -04:00
|
|
|
|
2012-08-24 10:29:17 -04:00
|
|
|
// see if we should show the welcome message
|
|
|
|
if (accounts.length < 1) {
|
2012-08-28 10:43:25 -04:00
|
|
|
WelcomeMessage.showWelcomeMessage(this);
|
|
|
|
finish();
|
2012-08-24 10:29:17 -04:00
|
|
|
}
|
|
|
|
|
2010-11-30 22:06:12 -05:00
|
|
|
boolean startup = intent.getBooleanExtra(EXTRA_STARTUP, true);
|
2011-02-25 15:36:47 -05:00
|
|
|
if (startup && K9.startIntegratedInbox() && !K9.isHideSpecialAccounts()) {
|
2010-07-02 20:26:35 -04:00
|
|
|
onOpenAccount(integratedInboxAccount);
|
|
|
|
finish();
|
2011-10-01 14:11:14 -04:00
|
|
|
return;
|
2011-02-08 02:56:08 -05:00
|
|
|
} else if (startup && accounts.length == 1 && onOpenAccount(accounts[0])) {
|
2011-02-13 19:53:50 -05:00
|
|
|
finish();
|
2011-10-01 14:11:14 -04:00
|
|
|
return;
|
2011-01-18 19:36:15 -05:00
|
|
|
}
|
2011-03-20 16:21:24 -04:00
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
requestWindowFeature(Window.FEATURE_PROGRESS);
|
2012-08-27 14:44:40 -04:00
|
|
|
mActionBar = getSupportActionBar();
|
|
|
|
initializeActionBar();
|
2011-10-01 14:11:14 -04:00
|
|
|
setContentView(R.layout.accounts);
|
|
|
|
ListView listView = getListView();
|
|
|
|
listView.setOnItemClickListener(this);
|
|
|
|
listView.setItemsCanFocus(false);
|
2011-10-14 14:33:25 -04:00
|
|
|
listView.setScrollingCacheEnabled(false);
|
2011-10-01 14:11:14 -04:00
|
|
|
registerForContextMenu(listView);
|
2011-03-20 16:21:24 -04:00
|
|
|
|
2012-08-28 10:06:31 -04:00
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
if (icicle != null && icicle.containsKey(SELECTED_CONTEXT_ACCOUNT)) {
|
|
|
|
String accountUuid = icicle.getString("selectedContextAccount");
|
|
|
|
mSelectedContextAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
restoreAccountStats(icicle);
|
2009-06-16 09:55:49 -04:00
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
// Handle activity restarts because of a configuration change (e.g. rotating the screen)
|
2011-10-13 20:52:32 -04:00
|
|
|
mNonConfigurationInstance = (NonConfigurationInstance) getLastNonConfigurationInstance();
|
|
|
|
if (mNonConfigurationInstance != null) {
|
|
|
|
mNonConfigurationInstance.restore(this);
|
2011-01-18 19:36:15 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-27 14:44:40 -04:00
|
|
|
private void initializeActionBar() {
|
2012-09-10 22:33:20 -04:00
|
|
|
mActionBar.setDisplayShowCustomEnabled(true);
|
|
|
|
mActionBar.setCustomView(R.layout.actionbar_custom);
|
2012-08-27 14:44:40 -04:00
|
|
|
|
2012-08-28 10:43:25 -04:00
|
|
|
View customView = mActionBar.getCustomView();
|
|
|
|
mActionBarTitle = (TextView) customView.findViewById(R.id.actionbar_title_first);
|
|
|
|
mActionBarSubTitle = (TextView) customView.findViewById(R.id.actionbar_title_sub);
|
|
|
|
mActionBarUnread = (TextView) customView.findViewById(R.id.actionbar_unread_count);
|
2012-08-27 14:44:40 -04:00
|
|
|
|
2012-09-06 20:59:44 -04:00
|
|
|
mActionBar.setDisplayHomeAsUpEnabled(false);
|
2012-08-27 14:44:40 -04:00
|
|
|
}
|
|
|
|
|
2012-02-12 10:29:16 -05:00
|
|
|
/**
|
2012-02-28 21:03:20 -05:00
|
|
|
* Creates and initializes the special accounts ('Unified Inbox' and 'All Messages')
|
2012-02-12 10:29:16 -05:00
|
|
|
*/
|
|
|
|
private void createSpecialAccounts() {
|
2012-02-28 21:03:20 -05:00
|
|
|
integratedInboxAccount = SearchAccount.createUnifiedInboxAccount(this);
|
|
|
|
unreadAccount = SearchAccount.createAllMessagesAccount(this);
|
2012-02-12 10:29:16 -05:00
|
|
|
}
|
|
|
|
|
2011-01-18 19:36:15 -05:00
|
|
|
@SuppressWarnings("unchecked")
|
2011-02-06 17:09:48 -05:00
|
|
|
private void restoreAccountStats(Bundle icicle) {
|
|
|
|
if (icicle != null) {
|
2011-01-18 19:36:15 -05:00
|
|
|
Map<String, AccountStats> oldStats = (Map<String, AccountStats>)icicle.get(ACCOUNT_STATS);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (oldStats != null) {
|
2011-01-18 19:36:15 -05:00
|
|
|
accountStats.putAll(oldStats);
|
2009-06-16 09:55:49 -04:00
|
|
|
}
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onSaveInstanceState(Bundle outState) {
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onSaveInstanceState(outState);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (mSelectedContextAccount != null) {
|
2010-03-03 23:00:30 -05:00
|
|
|
outState.putString(SELECTED_CONTEXT_ACCOUNT, mSelectedContextAccount.getUuid());
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2010-04-16 10:33:54 -04:00
|
|
|
outState.putSerializable(ACCOUNT_STATS, accountStats);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2011-03-20 16:37:51 -04:00
|
|
|
private StorageManager.StorageListener storageListener = new StorageManager.StorageListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onUnmount(String providerId) {
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onMount(String providerId) {
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onResume() {
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
refresh();
|
2009-02-05 23:28:29 -05:00
|
|
|
MessagingController.getInstance(getApplication()).addListener(mListener);
|
2011-03-19 13:36:58 -04:00
|
|
|
StorageManager.getInstance(getApplication()).addListener(storageListener);
|
2009-02-05 23:28:29 -05:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-02-05 23:28:29 -05:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onPause() {
|
2009-11-21 17:45:39 -05:00
|
|
|
super.onPause();
|
|
|
|
MessagingController.getInstance(getApplication()).removeListener(mListener);
|
2011-03-19 13:36:58 -04:00
|
|
|
StorageManager.getInstance(getApplication()).removeListener(storageListener);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2011-03-20 16:37:51 -04:00
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
/**
|
|
|
|
* Save the reference to a currently displayed dialog or a running AsyncTask (if available).
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public Object onRetainNonConfigurationInstance() {
|
|
|
|
Object retain = null;
|
2011-10-13 20:52:32 -04:00
|
|
|
if (mNonConfigurationInstance != null && mNonConfigurationInstance.retain()) {
|
|
|
|
retain = mNonConfigurationInstance;
|
2011-10-01 14:11:14 -04:00
|
|
|
}
|
|
|
|
return retain;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2011-10-01 14:11:14 -04:00
|
|
|
|
2011-09-05 13:45:33 -04:00
|
|
|
private BaseAccount[] accounts = new BaseAccount[0];
|
|
|
|
private enum ACCOUNT_LOCATION {
|
|
|
|
TOP, MIDDLE, BOTTOM;
|
|
|
|
}
|
|
|
|
private EnumSet<ACCOUNT_LOCATION> accountLocation(BaseAccount account) {
|
|
|
|
EnumSet<ACCOUNT_LOCATION> accountLocation = EnumSet.of(ACCOUNT_LOCATION.MIDDLE);
|
|
|
|
if (accounts.length > 0) {
|
|
|
|
if (accounts[0].equals(account)) {
|
|
|
|
accountLocation.remove(ACCOUNT_LOCATION.MIDDLE);
|
|
|
|
accountLocation.add(ACCOUNT_LOCATION.TOP);
|
|
|
|
}
|
|
|
|
if (accounts[accounts.length - 1].equals(account)) {
|
|
|
|
accountLocation.remove(ACCOUNT_LOCATION.MIDDLE);
|
|
|
|
accountLocation.add(ACCOUNT_LOCATION.BOTTOM);
|
2011-10-14 14:33:25 -04:00
|
|
|
}
|
2011-09-05 13:45:33 -04:00
|
|
|
}
|
|
|
|
return accountLocation;
|
|
|
|
}
|
2011-10-14 14:33:25 -04:00
|
|
|
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void refresh() {
|
2011-09-05 13:45:33 -04:00
|
|
|
accounts = Preferences.getPreferences(this).getAccounts();
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2012-08-24 10:29:17 -04:00
|
|
|
// see if we should show the welcome message
|
|
|
|
if (accounts.length < 1) {
|
2012-08-28 10:43:25 -04:00
|
|
|
WelcomeMessage.showWelcomeMessage(this);
|
|
|
|
finish();
|
2012-08-24 10:29:17 -04:00
|
|
|
}
|
|
|
|
|
2011-02-25 15:36:47 -05:00
|
|
|
List<BaseAccount> newAccounts;
|
2012-02-12 10:29:16 -05:00
|
|
|
if (!K9.isHideSpecialAccounts() && accounts.length > 0) {
|
|
|
|
if (integratedInboxAccount == null || unreadAccount == null) {
|
|
|
|
createSpecialAccounts();
|
|
|
|
}
|
|
|
|
|
|
|
|
newAccounts = new ArrayList<BaseAccount>(accounts.length +
|
|
|
|
SPECIAL_ACCOUNTS_COUNT);
|
2010-04-24 00:35:39 -04:00
|
|
|
newAccounts.add(integratedInboxAccount);
|
|
|
|
newAccounts.add(unreadAccount);
|
2011-03-20 16:37:51 -04:00
|
|
|
} else {
|
2011-02-25 15:36:47 -05:00
|
|
|
newAccounts = new ArrayList<BaseAccount>(accounts.length);
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-11-30 22:04:57 -05:00
|
|
|
newAccounts.addAll(Arrays.asList(accounts));
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-08-02 07:55:31 -04:00
|
|
|
mAdapter = new AccountsAdapter(newAccounts.toArray(EMPTY_BASE_ACCOUNT_ARRAY));
|
2009-02-05 23:28:29 -05:00
|
|
|
getListView().setAdapter(mAdapter);
|
2011-10-06 12:28:14 -04:00
|
|
|
if (!newAccounts.isEmpty()) {
|
2009-11-21 17:45:39 -05:00
|
|
|
mHandler.progress(Window.PROGRESS_START);
|
2009-03-31 23:25:16 -04:00
|
|
|
}
|
2009-10-21 20:41:06 -04:00
|
|
|
pendingWork.clear();
|
Enhanced header in Accounts, MessageList and Folder to show the unread
count, scoped for the Activity, the in-progress operation, the account
on which the operation is in progress, the folder for the operation,
when appropriate, and the progress of the operation, when it applies
to multiple items. For the MessageList, also use the determinate
progress bar to show progress for synchronization of the folder being
displayed.
Fixes Issue 924.
Also, a minor change that might help with Issue 913, by putting the
insertion of the pending command into a background thread.
2009-12-19 19:02:46 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
for (BaseAccount account : newAccounts) {
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
if (account instanceof Account) {
|
2010-04-18 22:55:02 -04:00
|
|
|
pendingWork.put(account, "true");
|
2010-04-16 23:32:17 -04:00
|
|
|
Account realAccount = (Account)account;
|
|
|
|
MessagingController.getInstance(getApplication()).getAccountStats(Accounts.this, realAccount, mListener);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else if (K9.countSearchMessages() && account instanceof SearchAccount) {
|
2010-04-18 22:55:02 -04:00
|
|
|
pendingWork.put(account, "true");
|
2010-04-21 22:20:35 -04:00
|
|
|
final SearchAccount searchAccount = (SearchAccount)account;
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
MessagingController.getInstance(getApplication()).searchLocalMessages(searchAccount, null, new MessagingListener() {
|
2010-04-21 22:20:35 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void searchStats(AccountStats stats) {
|
2010-04-21 22:20:35 -04:00
|
|
|
mListener.accountStatusChanged(searchAccount, stats);
|
|
|
|
}
|
|
|
|
});
|
2010-04-16 23:32:17 -04:00
|
|
|
}
|
2009-02-05 23:28:29 -05:00
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onAddNewAccount() {
|
2008-11-01 17:32:06 -04:00
|
|
|
AccountSetupBasics.actionNewAccount(this);
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onEditPrefs() {
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
Prefs.actionPrefs(this);
|
|
|
|
}
|
2009-03-31 23:25:16 -04:00
|
|
|
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
|
2010-02-09 10:41:40 -05:00
|
|
|
/*
|
|
|
|
* This method is called with 'null' for the argument 'account' if
|
|
|
|
* all accounts are to be checked. This is handled accordingly in
|
|
|
|
* MessagingController.checkMail().
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onCheckMail(Account account) {
|
2009-03-31 23:25:16 -04:00
|
|
|
MessagingController.getInstance(getApplication()).checkMail(this, account, true, true, null);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (account == null) {
|
2010-11-12 20:46:31 -05:00
|
|
|
MessagingController.getInstance(getApplication()).sendPendingMessages(null);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2010-11-12 20:46:31 -05:00
|
|
|
MessagingController.getInstance(getApplication()).sendPendingMessages(account, null);
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onClearCommands(Account account) {
|
2009-11-21 17:45:39 -05:00
|
|
|
MessagingController.getInstance(getApplication()).clearAllPending(account);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onCompose() {
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
Account defaultAccount = Preferences.getPreferences(this).getDefaultAccount();
|
2011-02-06 17:09:48 -05:00
|
|
|
if (defaultAccount != null) {
|
2008-11-01 17:32:06 -04:00
|
|
|
MessageCompose.actionCompose(this, defaultAccount);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2008-11-01 17:32:06 -04:00
|
|
|
onAddNewAccount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-13 16:40:56 -05:00
|
|
|
/**
|
|
|
|
* Show that account's inbox or folder-list
|
|
|
|
* or return false if the account is not available.
|
|
|
|
* @param account the account to open ({@link SearchAccount} or {@link Account})
|
|
|
|
* @return false if unsuccessfull
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
private boolean onOpenAccount(BaseAccount account) {
|
|
|
|
if (account instanceof SearchAccount) {
|
2010-04-05 22:54:48 -04:00
|
|
|
SearchAccount searchAccount = (SearchAccount)account;
|
2010-04-22 00:58:50 -04:00
|
|
|
MessageList.actionHandle(this, searchAccount.getDescription(), searchAccount);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2010-04-16 23:32:17 -04:00
|
|
|
Account realAccount = (Account)account;
|
2011-10-16 22:34:26 -04:00
|
|
|
if (!realAccount.isEnabled()) {
|
|
|
|
onActivateAccount(realAccount);
|
|
|
|
return false;
|
|
|
|
} else if (!realAccount.isAvailable(this)) {
|
2011-03-19 13:36:58 -04:00
|
|
|
String toastText = getString(R.string.account_unavailable, account.getDescription());
|
|
|
|
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_SHORT);
|
|
|
|
toast.show();
|
2011-03-20 16:37:51 -04:00
|
|
|
|
2010-11-13 16:40:56 -05:00
|
|
|
Log.i(K9.LOG_TAG, "refusing to open account that is not available");
|
|
|
|
return false;
|
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
if (K9.FOLDER_NONE.equals(realAccount.getAutoExpandFolderName())) {
|
2010-04-16 23:32:17 -04:00
|
|
|
FolderList.actionHandleAccount(this, realAccount);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2010-04-16 23:32:17 -04:00
|
|
|
MessageList.actionHandleFolder(this, realAccount, realAccount.getAutoExpandFolderName());
|
|
|
|
}
|
2009-12-20 00:41:43 -05:00
|
|
|
}
|
2010-11-13 16:40:56 -05:00
|
|
|
return true;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2011-10-16 22:34:26 -04:00
|
|
|
private void onActivateAccount(Account account) {
|
|
|
|
List<Account> disabledAccounts = new ArrayList<Account>();
|
|
|
|
disabledAccounts.add(account);
|
|
|
|
promptForServerPasswords(disabledAccounts);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ask the user to enter the server passwords for disabled accounts.
|
|
|
|
*
|
|
|
|
* @param disabledAccounts
|
|
|
|
* A non-empty list of {@link Account}s to ask the user for passwords. Never
|
|
|
|
* {@code null}.
|
|
|
|
* <p><strong>Note:</strong> Calling this method will modify the supplied list.</p>
|
|
|
|
*/
|
|
|
|
private void promptForServerPasswords(final List<Account> disabledAccounts) {
|
|
|
|
Account account = disabledAccounts.remove(0);
|
|
|
|
PasswordPromptDialog dialog = new PasswordPromptDialog(account, disabledAccounts);
|
|
|
|
setNonConfigurationInstance(dialog);
|
|
|
|
dialog.show(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ask the user for the incoming/outgoing server passwords.
|
|
|
|
*/
|
|
|
|
private static class PasswordPromptDialog implements NonConfigurationInstance, TextWatcher {
|
|
|
|
private AlertDialog mDialog;
|
|
|
|
private EditText mIncomingPasswordView;
|
|
|
|
private EditText mOutgoingPasswordView;
|
|
|
|
private CheckBox mUseIncomingView;
|
|
|
|
|
|
|
|
private Account mAccount;
|
|
|
|
private List<Account> mRemainingAccounts;
|
|
|
|
private String mIncomingPassword;
|
|
|
|
private String mOutgoingPassword;
|
|
|
|
private boolean mUseIncoming;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @param account
|
|
|
|
* The {@link Account} to ask the server passwords for. Never {@code null}.
|
|
|
|
* @param accounts
|
|
|
|
* The (possibly empty) list of remaining accounts to ask passwords for. Never
|
|
|
|
* {@code null}.
|
|
|
|
*/
|
|
|
|
PasswordPromptDialog(Account account, List<Account> accounts) {
|
|
|
|
mAccount = account;
|
|
|
|
mRemainingAccounts = accounts;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void restore(Activity activity) {
|
|
|
|
show((Accounts) activity, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean retain() {
|
|
|
|
if (mDialog != null) {
|
|
|
|
// Retain entered passwords and checkbox state
|
|
|
|
mIncomingPassword = mIncomingPasswordView.getText().toString();
|
|
|
|
if (mOutgoingPasswordView != null) {
|
|
|
|
mOutgoingPassword = mOutgoingPasswordView.getText().toString();
|
|
|
|
mUseIncoming = mUseIncomingView.isChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dismiss dialog
|
|
|
|
mDialog.dismiss();
|
|
|
|
|
|
|
|
// Clear all references to UI objects
|
|
|
|
mDialog = null;
|
|
|
|
mIncomingPasswordView = null;
|
|
|
|
mOutgoingPasswordView = null;
|
|
|
|
mUseIncomingView = null;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void show(Accounts activity) {
|
|
|
|
show(activity, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void show(final Accounts activity, boolean restore) {
|
|
|
|
ServerSettings incoming = Store.decodeStoreUri(mAccount.getStoreUri());
|
|
|
|
ServerSettings outgoing = Transport.decodeTransportUri(mAccount.getTransportUri());
|
|
|
|
|
|
|
|
// Don't ask for the password to the outgoing server for WebDAV accounts, because
|
|
|
|
// incoming and outgoing servers are identical for this account type.
|
|
|
|
boolean configureOutgoingServer = !WebDavStore.STORE_TYPE.equals(outgoing.type);
|
|
|
|
|
|
|
|
// Create a ScrollView that will be used as container for the whole layout
|
|
|
|
final ScrollView scrollView = new ScrollView(activity);
|
|
|
|
|
|
|
|
// Create the dialog
|
|
|
|
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
|
|
builder.setTitle(activity.getString(R.string.settings_import_activate_account_header));
|
|
|
|
builder.setView(scrollView);
|
|
|
|
builder.setPositiveButton(activity.getString(R.string.okay_action),
|
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
String incomingPassword = mIncomingPasswordView.getText().toString();
|
|
|
|
String outgoingPassword = null;
|
|
|
|
if (mOutgoingPasswordView != null) {
|
|
|
|
outgoingPassword = (mUseIncomingView.isChecked()) ?
|
2012-08-28 10:43:25 -04:00
|
|
|
incomingPassword : mOutgoingPasswordView.getText().toString();
|
2011-10-16 22:34:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
|
|
|
// Set the server passwords in the background
|
|
|
|
SetPasswordsAsyncTask asyncTask = new SetPasswordsAsyncTask(activity, mAccount,
|
|
|
|
incomingPassword, outgoingPassword, mRemainingAccounts);
|
|
|
|
activity.setNonConfigurationInstance(asyncTask);
|
|
|
|
asyncTask.execute();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
builder.setNegativeButton(activity.getString(R.string.cancel_action),
|
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
dialog.dismiss();
|
|
|
|
activity.setNonConfigurationInstance(null);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
mDialog = builder.create();
|
|
|
|
|
|
|
|
// Use the dialog's layout inflater so its theme is used (and not the activity's theme).
|
|
|
|
View layout = mDialog.getLayoutInflater().inflate(
|
2012-08-28 10:43:25 -04:00
|
|
|
R.layout.accounts_password_prompt, null);
|
2011-10-16 22:34:26 -04:00
|
|
|
|
|
|
|
// Set the intro text that tells the user what to do
|
|
|
|
TextView intro = (TextView) layout.findViewById(R.id.password_prompt_intro);
|
|
|
|
String serverPasswords = activity.getResources().getQuantityString(
|
2012-08-28 10:43:25 -04:00
|
|
|
R.plurals.settings_import_server_passwords,
|
|
|
|
(configureOutgoingServer) ? 2 : 1);
|
2011-10-16 22:34:26 -04:00
|
|
|
intro.setText(activity.getString(R.string.settings_import_activate_account_intro,
|
2012-08-28 10:43:25 -04:00
|
|
|
mAccount.getDescription(), serverPasswords));
|
2011-10-16 22:34:26 -04:00
|
|
|
|
|
|
|
// Display the hostname of the incoming server
|
|
|
|
TextView incomingText = (TextView) layout.findViewById(
|
2012-08-28 10:43:25 -04:00
|
|
|
R.id.password_prompt_incoming_server);
|
2011-10-16 22:34:26 -04:00
|
|
|
incomingText.setText(activity.getString(R.string.settings_import_incoming_server,
|
2012-08-28 10:43:25 -04:00
|
|
|
incoming.host));
|
2011-10-16 22:34:26 -04:00
|
|
|
|
|
|
|
mIncomingPasswordView = (EditText) layout.findViewById(R.id.incoming_server_password);
|
|
|
|
mIncomingPasswordView.addTextChangedListener(this);
|
|
|
|
|
|
|
|
if (configureOutgoingServer) {
|
|
|
|
// Display the hostname of the outgoing server
|
|
|
|
TextView outgoingText = (TextView) layout.findViewById(
|
2012-08-28 10:43:25 -04:00
|
|
|
R.id.password_prompt_outgoing_server);
|
2011-10-16 22:34:26 -04:00
|
|
|
outgoingText.setText(activity.getString(R.string.settings_import_outgoing_server,
|
2012-08-28 10:43:25 -04:00
|
|
|
outgoing.host));
|
2011-10-16 22:34:26 -04:00
|
|
|
|
|
|
|
mOutgoingPasswordView = (EditText) layout.findViewById(
|
2012-08-28 10:43:25 -04:00
|
|
|
R.id.outgoing_server_password);
|
2011-10-16 22:34:26 -04:00
|
|
|
mOutgoingPasswordView.addTextChangedListener(this);
|
|
|
|
|
|
|
|
mUseIncomingView = (CheckBox) layout.findViewById(
|
2012-08-28 10:43:25 -04:00
|
|
|
R.id.use_incoming_server_password);
|
2011-10-16 22:34:26 -04:00
|
|
|
mUseIncomingView.setChecked(true);
|
|
|
|
mUseIncomingView.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
if (isChecked) {
|
|
|
|
mOutgoingPasswordView.setText(null);
|
|
|
|
mOutgoingPasswordView.setEnabled(false);
|
|
|
|
} else {
|
|
|
|
mOutgoingPasswordView.setText(mIncomingPasswordView.getText());
|
|
|
|
mOutgoingPasswordView.setEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
layout.findViewById(R.id.outgoing_server_prompt).setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the layout to the ScrollView
|
|
|
|
scrollView.addView(layout);
|
|
|
|
|
|
|
|
// Show the dialog
|
|
|
|
mDialog.show();
|
|
|
|
|
|
|
|
// Restore the contents of the password boxes and the checkbox (if the dialog was
|
|
|
|
// retained during a configuration change).
|
|
|
|
if (restore) {
|
|
|
|
mIncomingPasswordView.setText(mIncomingPassword);
|
|
|
|
if (configureOutgoingServer) {
|
|
|
|
mOutgoingPasswordView.setText(mOutgoingPassword);
|
|
|
|
mUseIncomingView.setChecked(mUseIncoming);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Trigger afterTextChanged() being called
|
|
|
|
// Work around this bug: https://code.google.com/p/android/issues/detail?id=6360
|
|
|
|
mIncomingPasswordView.setText(mIncomingPasswordView.getText());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void afterTextChanged(Editable arg0) {
|
|
|
|
boolean enable = false;
|
|
|
|
// Is the password box for the incoming server password empty?
|
|
|
|
if (mIncomingPasswordView.getText().length() > 0) {
|
|
|
|
// Do we need to check the outgoing server password box?
|
|
|
|
if (mOutgoingPasswordView == null) {
|
|
|
|
enable = true;
|
|
|
|
}
|
|
|
|
// If the checkbox to use the incoming server password is checked we need to make
|
|
|
|
// sure that the password box for the outgoing server isn't empty.
|
|
|
|
else if (mUseIncomingView.isChecked() ||
|
2012-08-28 10:43:25 -04:00
|
|
|
mOutgoingPasswordView.getText().length() > 0) {
|
2011-10-16 22:34:26 -04:00
|
|
|
enable = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Disable "OK" button if the user hasn't specified all necessary passwords.
|
|
|
|
mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
// Not used
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
// Not used
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the incoming/outgoing server password in the background.
|
|
|
|
*/
|
|
|
|
private static class SetPasswordsAsyncTask extends ExtendedAsyncTask<Void, Void, Void> {
|
|
|
|
private Account mAccount;
|
|
|
|
private String mIncomingPassword;
|
|
|
|
private String mOutgoingPassword;
|
|
|
|
private List<Account> mRemainingAccounts;
|
2011-10-17 23:06:32 -04:00
|
|
|
private Application mApplication;
|
2011-10-16 22:34:26 -04:00
|
|
|
|
|
|
|
protected SetPasswordsAsyncTask(Activity activity, Account account,
|
2012-08-28 10:43:25 -04:00
|
|
|
String incomingPassword, String outgoingPassword,
|
|
|
|
List<Account> remainingAccounts) {
|
2011-10-16 22:34:26 -04:00
|
|
|
super(activity);
|
|
|
|
mAccount = account;
|
|
|
|
mIncomingPassword = incomingPassword;
|
|
|
|
mOutgoingPassword = outgoingPassword;
|
|
|
|
mRemainingAccounts = remainingAccounts;
|
2011-10-17 23:06:32 -04:00
|
|
|
mApplication = mActivity.getApplication();
|
2011-10-16 22:34:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void showProgressDialog() {
|
|
|
|
String title = mActivity.getString(R.string.settings_import_activate_account_header);
|
|
|
|
int passwordCount = (mOutgoingPassword == null) ? 1 : 2;
|
|
|
|
String message = mActivity.getResources().getQuantityString(
|
2012-08-28 10:43:25 -04:00
|
|
|
R.plurals.settings_import_setting_passwords, passwordCount);
|
2011-10-16 22:34:26 -04:00
|
|
|
mProgressDialog = ProgressDialog.show(mActivity, title, message, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected Void doInBackground(Void... params) {
|
|
|
|
try {
|
|
|
|
// Set incoming server password
|
|
|
|
String storeUri = mAccount.getStoreUri();
|
|
|
|
ServerSettings incoming = Store.decodeStoreUri(storeUri);
|
|
|
|
ServerSettings newIncoming = incoming.newPassword(mIncomingPassword);
|
|
|
|
String newStoreUri = Store.createStoreUri(newIncoming);
|
|
|
|
mAccount.setStoreUri(newStoreUri);
|
|
|
|
|
|
|
|
if (mOutgoingPassword != null) {
|
|
|
|
// Set outgoing server password
|
|
|
|
String transportUri = mAccount.getTransportUri();
|
|
|
|
ServerSettings outgoing = Transport.decodeTransportUri(transportUri);
|
|
|
|
ServerSettings newOutgoing = outgoing.newPassword(mOutgoingPassword);
|
|
|
|
String newTransportUri = Transport.createTransportUri(newOutgoing);
|
|
|
|
mAccount.setTransportUri(newTransportUri);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mark account as enabled
|
|
|
|
mAccount.setEnabled(true);
|
|
|
|
|
|
|
|
// Save the account settings
|
|
|
|
mAccount.save(Preferences.getPreferences(mContext));
|
2011-10-17 23:06:32 -04:00
|
|
|
|
|
|
|
// Start services if necessary
|
|
|
|
K9.setServicesEnabled(mContext);
|
|
|
|
|
|
|
|
// Get list of folders from remote server
|
|
|
|
MessagingController.getInstance(mApplication).listFolders(mAccount, true, null);
|
2011-10-16 22:34:26 -04:00
|
|
|
} catch (Exception e) {
|
|
|
|
Log.e(K9.LOG_TAG, "Something went while setting account passwords", e);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onPostExecute(Void result) {
|
|
|
|
Accounts activity = (Accounts) mActivity;
|
|
|
|
|
|
|
|
// Let the activity know that the background task is complete
|
|
|
|
activity.setNonConfigurationInstance(null);
|
|
|
|
|
|
|
|
activity.refresh();
|
|
|
|
removeProgressDialog();
|
|
|
|
|
|
|
|
if (mRemainingAccounts.size() > 0) {
|
|
|
|
activity.promptForServerPasswords(mRemainingAccounts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onDeleteAccount(Account account) {
|
2008-11-01 17:32:06 -04:00
|
|
|
mSelectedContextAccount = account;
|
|
|
|
showDialog(DIALOG_REMOVE_ACCOUNT);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public Dialog onCreateDialog(int id) {
|
2012-03-17 15:12:33 -04:00
|
|
|
// Android recreates our dialogs on configuration changes even when they have been
|
|
|
|
// dismissed. Make sure we have all information necessary before creating a new dialog.
|
2011-02-06 17:09:48 -05:00
|
|
|
switch (id) {
|
2012-08-28 10:43:25 -04:00
|
|
|
case DIALOG_REMOVE_ACCOUNT: {
|
|
|
|
if (mSelectedContextAccount == null) {
|
|
|
|
return null;
|
2012-03-17 15:12:33 -04:00
|
|
|
}
|
2011-03-31 21:40:08 -04:00
|
|
|
|
2012-08-28 10:43:25 -04:00
|
|
|
return ConfirmationDialog.create(this, id,
|
|
|
|
R.string.account_delete_dlg_title,
|
|
|
|
getString(R.string.account_delete_dlg_instructions_fmt,
|
|
|
|
mSelectedContextAccount.getDescription()),
|
|
|
|
R.string.okay_action,
|
|
|
|
R.string.cancel_action,
|
|
|
|
new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
if (mSelectedContextAccount instanceof Account) {
|
|
|
|
Account realAccount = (Account) mSelectedContextAccount;
|
|
|
|
try {
|
|
|
|
realAccount.getLocalStore().delete();
|
|
|
|
} catch (Exception e) {
|
|
|
|
// Ignore, this may lead to localStores on sd-cards that
|
|
|
|
// are currently not inserted to be left
|
|
|
|
}
|
|
|
|
MessagingController.getInstance(getApplication())
|
|
|
|
.notifyAccountCancel(Accounts.this, realAccount);
|
|
|
|
Preferences.getPreferences(Accounts.this)
|
|
|
|
.deleteAccount(realAccount);
|
|
|
|
K9.setServicesEnabled(Accounts.this);
|
|
|
|
refresh();
|
|
|
|
}
|
2011-04-12 08:16:22 -04:00
|
|
|
}
|
2012-08-28 10:43:25 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
case DIALOG_CLEAR_ACCOUNT: {
|
|
|
|
if (mSelectedContextAccount == null) {
|
|
|
|
return null;
|
2012-03-17 15:12:33 -04:00
|
|
|
}
|
2012-08-28 10:43:25 -04:00
|
|
|
|
|
|
|
return ConfirmationDialog.create(this, id,
|
|
|
|
R.string.account_clear_dlg_title,
|
|
|
|
getString(R.string.account_clear_dlg_instructions_fmt,
|
|
|
|
mSelectedContextAccount.getDescription()),
|
|
|
|
R.string.okay_action,
|
|
|
|
R.string.cancel_action,
|
|
|
|
new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
if (mSelectedContextAccount instanceof Account) {
|
|
|
|
Account realAccount = (Account) mSelectedContextAccount;
|
|
|
|
mHandler.workingAccount(realAccount,
|
|
|
|
R.string.clearing_account);
|
|
|
|
MessagingController.getInstance(getApplication())
|
|
|
|
.clear(realAccount, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
case DIALOG_RECREATE_ACCOUNT: {
|
|
|
|
if (mSelectedContextAccount == null) {
|
|
|
|
return null;
|
2012-03-17 15:12:33 -04:00
|
|
|
}
|
2012-08-28 10:43:25 -04:00
|
|
|
|
|
|
|
return ConfirmationDialog.create(this, id,
|
|
|
|
R.string.account_recreate_dlg_title,
|
|
|
|
getString(R.string.account_recreate_dlg_instructions_fmt,
|
|
|
|
mSelectedContextAccount.getDescription()),
|
|
|
|
R.string.okay_action,
|
|
|
|
R.string.cancel_action,
|
|
|
|
new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
if (mSelectedContextAccount instanceof Account) {
|
|
|
|
Account realAccount = (Account) mSelectedContextAccount;
|
|
|
|
mHandler.workingAccount(realAccount,
|
|
|
|
R.string.recreating_account);
|
|
|
|
MessagingController.getInstance(getApplication())
|
|
|
|
.recreate(realAccount, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
case DIALOG_NO_FILE_MANAGER: {
|
|
|
|
return ConfirmationDialog.create(this, id,
|
|
|
|
R.string.import_dialog_error_title,
|
|
|
|
getString(R.string.import_dialog_error_message),
|
|
|
|
R.string.open_market,
|
|
|
|
R.string.close,
|
|
|
|
new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
Uri uri = Uri.parse(ANDROID_MARKET_URL);
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
|
|
|
startActivity(intent);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2012-03-17 15:12:33 -04:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
return super.onCreateDialog(id);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onPrepareDialog(int id, Dialog d) {
|
2010-06-29 20:41:27 -04:00
|
|
|
AlertDialog alert = (AlertDialog) d;
|
2011-02-06 17:09:48 -05:00
|
|
|
switch (id) {
|
2012-08-28 10:43:25 -04:00
|
|
|
case DIALOG_REMOVE_ACCOUNT: {
|
|
|
|
alert.setMessage(getString(R.string.account_delete_dlg_instructions_fmt,
|
|
|
|
mSelectedContextAccount.getDescription()));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIALOG_CLEAR_ACCOUNT: {
|
|
|
|
alert.setMessage(getString(R.string.account_clear_dlg_instructions_fmt,
|
|
|
|
mSelectedContextAccount.getDescription()));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIALOG_RECREATE_ACCOUNT: {
|
|
|
|
alert.setMessage(getString(R.string.account_recreate_dlg_instructions_fmt,
|
|
|
|
mSelectedContextAccount.getDescription()));
|
|
|
|
break;
|
|
|
|
}
|
2009-10-25 09:58:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
super.onPrepareDialog(id, d);
|
|
|
|
}
|
|
|
|
|
2012-09-10 07:50:44 -04:00
|
|
|
@Override
|
|
|
|
public boolean onContextItemSelected(android.view.MenuItem item) {
|
|
|
|
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();
|
|
|
|
// submenus don't actually set the menuInfo, so the "advanced"
|
|
|
|
// submenu wouldn't work.
|
|
|
|
if (menuInfo != null) {
|
|
|
|
mSelectedContextAccount = (BaseAccount)getListView().getItemAtPosition(menuInfo.position);
|
|
|
|
}
|
|
|
|
Account realAccount = null;
|
|
|
|
if (mSelectedContextAccount instanceof Account) {
|
|
|
|
realAccount = (Account)mSelectedContextAccount;
|
|
|
|
}
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case R.id.delete_account:
|
|
|
|
onDeleteAccount(realAccount);
|
|
|
|
break;
|
|
|
|
case R.id.activate:
|
|
|
|
onActivateAccount(realAccount);
|
|
|
|
break;
|
|
|
|
case R.id.clear_pending:
|
|
|
|
onClearCommands(realAccount);
|
|
|
|
break;
|
|
|
|
case R.id.clear:
|
|
|
|
onClear(realAccount);
|
|
|
|
break;
|
|
|
|
case R.id.recreate:
|
|
|
|
onRecreate(realAccount);
|
|
|
|
break;
|
|
|
|
case R.id.export:
|
|
|
|
onExport(false, realAccount);
|
|
|
|
break;
|
|
|
|
case R.id.move_up:
|
|
|
|
onMove(realAccount, true);
|
|
|
|
break;
|
|
|
|
case R.id.move_down:
|
|
|
|
onMove(realAccount, false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onClear(Account account) {
|
2010-05-12 00:17:52 -04:00
|
|
|
showDialog(DIALOG_CLEAR_ACCOUNT);
|
2010-05-15 15:46:16 -04:00
|
|
|
|
2010-05-12 00:17:52 -04:00
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onRecreate(Account account) {
|
2010-05-12 00:17:52 -04:00
|
|
|
showDialog(DIALOG_RECREATE_ACCOUNT);
|
2009-02-09 22:18:42 -05:00
|
|
|
}
|
2011-09-05 13:38:03 -04:00
|
|
|
private void onMove(final Account account, final boolean up) {
|
2011-10-14 14:33:25 -04:00
|
|
|
MoveAccountAsyncTask asyncTask = new MoveAccountAsyncTask(this, account, up);
|
|
|
|
setNonConfigurationInstance(asyncTask);
|
|
|
|
asyncTask.execute();
|
2011-09-05 13:38:03 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
2010-04-16 23:32:17 -04:00
|
|
|
BaseAccount account = (BaseAccount)parent.getItemAtPosition(position);
|
2010-01-27 19:29:27 -05:00
|
|
|
onOpenAccount(account);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case R.id.add_new_account:
|
|
|
|
onAddNewAccount();
|
|
|
|
break;
|
|
|
|
case R.id.edit_prefs:
|
|
|
|
onEditPrefs();
|
|
|
|
break;
|
|
|
|
case R.id.check_mail:
|
|
|
|
onCheckMail(null);
|
|
|
|
break;
|
|
|
|
case R.id.compose:
|
|
|
|
onCompose();
|
|
|
|
break;
|
|
|
|
case R.id.about:
|
|
|
|
onAbout();
|
|
|
|
break;
|
|
|
|
case R.id.search:
|
|
|
|
onSearchRequested();
|
|
|
|
break;
|
2011-02-26 19:39:06 -05:00
|
|
|
case R.id.export_all:
|
2011-03-27 00:03:23 -04:00
|
|
|
onExport(true, null);
|
2011-02-26 19:39:06 -05:00
|
|
|
break;
|
|
|
|
case R.id.import_settings:
|
|
|
|
onImport();
|
|
|
|
break;
|
2011-02-06 17:09:48 -05:00
|
|
|
default:
|
|
|
|
return super.onOptionsItemSelected(item);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private static String[][] USED_LIBRARIES = new String[][] {
|
2011-01-28 21:49:39 -05:00
|
|
|
new String[] {"jutf7", "http://jutf7.sourceforge.net/"},
|
|
|
|
new String[] {"JZlib", "http://www.jcraft.com/jzlib/"},
|
|
|
|
new String[] {"Commons IO", "http://commons.apache.org/io/"},
|
|
|
|
new String[] {"Mime4j", "http://james.apache.org/mime4j/"},
|
2011-11-14 16:58:01 -05:00
|
|
|
new String[] {"HtmlCleaner", "http://htmlcleaner.sourceforge.net/"},
|
2012-09-13 00:30:40 -04:00
|
|
|
new String[] {"ActionBarSherlock", "http://actionbarsherlock.com/"},
|
|
|
|
new String[] {"Android-PullToRefresh", "https://github.com/chrisbanes/Android-PullToRefresh"}
|
2011-01-28 21:49:39 -05:00
|
|
|
};
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onAbout() {
|
2009-11-21 17:45:39 -05:00
|
|
|
String appName = getString(R.string.app_name);
|
2012-08-08 14:03:10 -04:00
|
|
|
int year = Calendar.getInstance().get(Calendar.YEAR);
|
2009-11-21 17:45:39 -05:00
|
|
|
WebView wv = new WebView(this);
|
2011-01-28 21:49:39 -05:00
|
|
|
StringBuilder html = new StringBuilder()
|
2011-01-31 18:45:23 -05:00
|
|
|
.append("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />")
|
|
|
|
.append("<img src=\"file:///android_asset/icon.png\" alt=\"").append(appName).append("\"/>")
|
|
|
|
.append("<h1>")
|
|
|
|
.append(String.format(getString(R.string.about_title_fmt),
|
|
|
|
"<a href=\"" + getString(R.string.app_webpage_url)) + "\">")
|
|
|
|
.append(appName)
|
|
|
|
.append("</a>")
|
|
|
|
.append("</h1><p>")
|
|
|
|
.append(appName)
|
|
|
|
.append(" ")
|
|
|
|
.append(String.format(getString(R.string.debug_version_fmt), getVersionNumber()))
|
|
|
|
.append("</p><p>")
|
|
|
|
.append(String.format(getString(R.string.app_authors_fmt),
|
|
|
|
getString(R.string.app_authors)))
|
|
|
|
.append("</p><p>")
|
|
|
|
.append(String.format(getString(R.string.app_revision_fmt),
|
|
|
|
"<a href=\"" + getString(R.string.app_revision_url) + "\">" +
|
|
|
|
getString(R.string.app_revision_url) +
|
|
|
|
"</a>"))
|
|
|
|
.append("</p><hr/><p>")
|
|
|
|
.append(String.format(getString(R.string.app_copyright_fmt), year, year))
|
|
|
|
.append("</p><hr/><p>")
|
|
|
|
.append(getString(R.string.app_license))
|
|
|
|
.append("</p><hr/><p>");
|
2011-01-28 21:49:39 -05:00
|
|
|
|
|
|
|
StringBuilder libs = new StringBuilder().append("<ul>");
|
2011-02-06 17:09:48 -05:00
|
|
|
for (String[] library : USED_LIBRARIES) {
|
2011-10-06 12:20:11 -04:00
|
|
|
libs.append("<li><a href=\"").append(library[1]).append("\">").append(library[0]).append("</a></li>");
|
2011-01-28 21:49:39 -05:00
|
|
|
}
|
|
|
|
libs.append("</ul>");
|
|
|
|
|
|
|
|
html.append(String.format(getString(R.string.app_libraries), libs.toString()))
|
2011-01-31 18:45:23 -05:00
|
|
|
.append("</p><hr/><p>")
|
|
|
|
.append(String.format(getString(R.string.app_emoji_icons),
|
|
|
|
"<div>TypePad \u7d75\u6587\u5b57\u30a2\u30a4\u30b3\u30f3\u753b\u50cf " +
|
|
|
|
"(<a href=\"http://typepad.jp/\">Six Apart Ltd</a>) / " +
|
|
|
|
"<a href=\"http://creativecommons.org/licenses/by/2.1/jp/\">CC BY 2.1</a></div>"))
|
2011-11-14 16:58:01 -05:00
|
|
|
.append("</p><hr/><p>")
|
|
|
|
.append(getString(R.string.app_htmlcleaner_license));
|
|
|
|
|
2011-01-28 21:49:39 -05:00
|
|
|
|
|
|
|
wv.loadDataWithBaseURL("file:///android_res/drawable/", html.toString(), "text/html", "utf-8", null);
|
2009-11-21 17:45:39 -05:00
|
|
|
new AlertDialog.Builder(this)
|
2008-12-18 19:20:56 -05:00
|
|
|
.setView(wv)
|
|
|
|
.setCancelable(true)
|
2011-02-06 17:09:48 -05:00
|
|
|
.setPositiveButton(R.string.okay_action, new DialogInterface.OnClickListener() {
|
|
|
|
public void onClick(DialogInterface d, int c) {
|
2009-11-21 17:45:39 -05:00
|
|
|
d.dismiss();
|
|
|
|
}
|
2008-12-18 19:20:56 -05:00
|
|
|
})
|
|
|
|
.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get current version number.
|
|
|
|
*
|
|
|
|
* @return String version
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
private String getVersionNumber() {
|
2009-11-21 17:45:39 -05:00
|
|
|
String version = "?";
|
2011-02-06 17:09:48 -05:00
|
|
|
try {
|
2009-11-21 17:45:39 -05:00
|
|
|
PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0);
|
|
|
|
version = pi.versionName;
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (PackageManager.NameNotFoundException e) {
|
2009-11-21 17:45:39 -05:00
|
|
|
//Log.e(TAG, "Package name not found", e);
|
2010-11-30 22:07:28 -05:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
return version;
|
|
|
|
}
|
|
|
|
|
2012-09-10 07:50:44 -04:00
|
|
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onCreateOptionsMenu(menu);
|
2012-07-12 12:29:41 -04:00
|
|
|
getSupportMenuInflater().inflate(R.menu.accounts_option, menu);
|
2012-08-02 10:09:31 -04:00
|
|
|
mRefreshMenuItem = menu.findItem(R.id.check_mail);
|
2008-11-01 17:32:06 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-09-10 07:50:44 -04:00
|
|
|
@Override
|
|
|
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
|
|
|
super.onCreateContextMenu(menu, v, menuInfo);
|
|
|
|
menu.setHeaderTitle(R.string.accounts_context_menu_title);
|
|
|
|
|
|
|
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
|
|
|
BaseAccount account = mAdapter.getItem(info.position);
|
|
|
|
|
|
|
|
if ((account instanceof Account) && !((Account) account).isEnabled()) {
|
|
|
|
getMenuInflater().inflate(R.menu.disabled_accounts_context, menu);
|
|
|
|
} else {
|
|
|
|
getMenuInflater().inflate(R.menu.accounts_context, menu);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (account instanceof SearchAccount) {
|
|
|
|
for (int i = 0; i < menu.size(); i++) {
|
|
|
|
android.view.MenuItem item = menu.getItem(i);
|
|
|
|
item.setVisible(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
EnumSet<ACCOUNT_LOCATION> accountLocation = accountLocation(account);
|
|
|
|
if (accountLocation.contains(ACCOUNT_LOCATION.TOP)) {
|
|
|
|
menu.findItem(R.id.move_up).setEnabled(false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
menu.findItem(R.id.move_up).setEnabled(true);
|
|
|
|
}
|
|
|
|
if (accountLocation.contains(ACCOUNT_LOCATION.BOTTOM)) {
|
|
|
|
menu.findItem(R.id.move_down).setEnabled(false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
menu.findItem(R.id.move_down).setEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-02 08:34:54 -05:00
|
|
|
private void onImport() {
|
2011-02-26 12:31:56 -05:00
|
|
|
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
2012-09-06 20:39:57 -04:00
|
|
|
i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
2011-02-26 12:31:56 -05:00
|
|
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
2011-03-23 01:00:24 -04:00
|
|
|
i.setType(MimeUtility.K9_SETTINGS_MIME_TYPE);
|
2012-02-14 18:11:15 -05:00
|
|
|
|
|
|
|
PackageManager packageManager = getPackageManager();
|
|
|
|
List<ResolveInfo> infos = packageManager.queryIntentActivities(i, 0);
|
|
|
|
|
|
|
|
if (infos.size() > 0) {
|
|
|
|
startActivityForResult(Intent.createChooser(i, null),
|
2012-08-28 10:43:25 -04:00
|
|
|
ACTIVITY_REQUEST_PICK_SETTINGS_FILE);
|
2012-02-14 18:11:15 -05:00
|
|
|
} else {
|
2012-02-16 08:43:38 -05:00
|
|
|
showDialog(DIALOG_NO_FILE_MANAGER);
|
2012-02-14 18:11:15 -05:00
|
|
|
}
|
2011-02-26 12:31:56 -05:00
|
|
|
}
|
2011-03-02 08:34:54 -05:00
|
|
|
|
2011-02-26 12:31:56 -05:00
|
|
|
@Override
|
2011-03-02 08:34:54 -05:00
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
2011-02-26 12:31:56 -05:00
|
|
|
Log.i(K9.LOG_TAG, "onActivityResult requestCode = " + requestCode + ", resultCode = " + resultCode + ", data = " + data);
|
|
|
|
if (resultCode != RESULT_OK)
|
|
|
|
return;
|
2011-03-02 08:34:54 -05:00
|
|
|
if (data == null) {
|
2011-02-26 12:31:56 -05:00
|
|
|
return;
|
|
|
|
}
|
2011-03-02 08:34:54 -05:00
|
|
|
switch (requestCode) {
|
|
|
|
case ACTIVITY_REQUEST_PICK_SETTINGS_FILE:
|
|
|
|
onImport(data.getData());
|
|
|
|
break;
|
2011-02-26 12:31:56 -05:00
|
|
|
}
|
|
|
|
}
|
2011-03-02 08:34:54 -05:00
|
|
|
|
|
|
|
private void onImport(Uri uri) {
|
2011-10-13 23:38:27 -04:00
|
|
|
ListImportContentsAsyncTask asyncTask = new ListImportContentsAsyncTask(this, uri);
|
2011-10-13 20:52:32 -04:00
|
|
|
setNonConfigurationInstance(asyncTask);
|
|
|
|
asyncTask.execute();
|
2011-10-01 14:11:14 -04:00
|
|
|
}
|
|
|
|
|
2011-10-13 20:52:32 -04:00
|
|
|
|
|
|
|
private void showSimpleDialog(int headerRes, int messageRes, Object... args) {
|
|
|
|
SimpleDialog dialog = new SimpleDialog(headerRes, messageRes, args);
|
|
|
|
dialog.show(this);
|
|
|
|
setNonConfigurationInstance(dialog);
|
2011-10-01 14:11:14 -04:00
|
|
|
}
|
|
|
|
|
2011-10-16 22:34:26 -04:00
|
|
|
/**
|
|
|
|
* A simple dialog.
|
|
|
|
*/
|
2011-10-13 20:52:32 -04:00
|
|
|
private static class SimpleDialog implements NonConfigurationInstance {
|
|
|
|
private final int mHeaderRes;
|
|
|
|
private final int mMessageRes;
|
|
|
|
private Object[] mArguments;
|
|
|
|
private Dialog mDialog;
|
|
|
|
|
|
|
|
SimpleDialog(int headerRes, int messageRes, Object... args) {
|
|
|
|
this.mHeaderRes = headerRes;
|
|
|
|
this.mMessageRes = messageRes;
|
|
|
|
this.mArguments = args;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void restore(Activity activity) {
|
2011-10-13 22:15:45 -04:00
|
|
|
show((Accounts) activity);
|
2011-10-13 20:52:32 -04:00
|
|
|
}
|
2011-10-01 14:11:14 -04:00
|
|
|
|
2011-10-13 20:52:32 -04:00
|
|
|
@Override
|
|
|
|
public boolean retain() {
|
|
|
|
if (mDialog != null) {
|
|
|
|
mDialog.dismiss();
|
|
|
|
mDialog = null;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-10-13 22:15:45 -04:00
|
|
|
public void show(final Accounts activity) {
|
2011-10-16 22:34:26 -04:00
|
|
|
final String message = generateMessage(activity);
|
2011-10-13 20:52:32 -04:00
|
|
|
|
|
|
|
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
|
|
builder.setTitle(mHeaderRes);
|
|
|
|
builder.setMessage(message);
|
|
|
|
builder.setPositiveButton(R.string.okay_action,
|
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
dialog.dismiss();
|
2011-10-13 22:15:45 -04:00
|
|
|
activity.setNonConfigurationInstance(null);
|
2011-10-16 22:34:26 -04:00
|
|
|
okayAction(activity);
|
2011-10-13 20:52:32 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
mDialog = builder.show();
|
|
|
|
}
|
2011-10-16 22:34:26 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the message the dialog should display.
|
|
|
|
*
|
|
|
|
* @param activity
|
|
|
|
* The {@code Activity} this dialog belongs to.
|
|
|
|
*
|
|
|
|
* @return The message the dialog should display
|
|
|
|
*/
|
|
|
|
protected String generateMessage(Accounts activity) {
|
|
|
|
return activity.getString(mMessageRes, mArguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is called after the "OK" button was pressed.
|
|
|
|
*
|
|
|
|
* @param activity
|
|
|
|
* The {@code Activity} this dialog belongs to.
|
|
|
|
*/
|
|
|
|
protected void okayAction(Accounts activity) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows a dialog that displays how many accounts were successfully imported.
|
|
|
|
*
|
|
|
|
* @param importResults
|
|
|
|
* The {@link ImportResults} instance returned by the {@link SettingsImporter}.
|
|
|
|
* @param filename
|
|
|
|
* The name of the settings file that was imported.
|
|
|
|
*/
|
|
|
|
private void showAccountsImportedDialog(ImportResults importResults, String filename) {
|
|
|
|
AccountsImportedDialog dialog = new AccountsImportedDialog(importResults, filename);
|
|
|
|
dialog.show(this);
|
|
|
|
setNonConfigurationInstance(dialog);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2011-04-12 21:37:44 -04:00
|
|
|
|
2011-10-16 22:34:26 -04:00
|
|
|
/**
|
|
|
|
* A dialog that displays how many accounts were successfully imported.
|
|
|
|
*/
|
|
|
|
private static class AccountsImportedDialog extends SimpleDialog {
|
|
|
|
private ImportResults mImportResults;
|
|
|
|
private String mFilename;
|
|
|
|
|
|
|
|
AccountsImportedDialog(ImportResults importResults, String filename) {
|
|
|
|
super(R.string.settings_import_success_header, R.string.settings_import_success);
|
|
|
|
mImportResults = importResults;
|
|
|
|
mFilename = filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected String generateMessage(Accounts activity) {
|
|
|
|
//TODO: display names of imported accounts (name from file *and* possibly new name)
|
|
|
|
|
|
|
|
int imported = mImportResults.importedAccounts.size();
|
|
|
|
String accounts = activity.getResources().getQuantityString(
|
2012-08-28 10:43:25 -04:00
|
|
|
R.plurals.settings_import_success, imported, imported);
|
2011-10-16 22:34:26 -04:00
|
|
|
return activity.getString(R.string.settings_import_success, accounts, mFilename);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void okayAction(Accounts activity) {
|
|
|
|
Context context = activity.getApplicationContext();
|
|
|
|
Preferences preferences = Preferences.getPreferences(context);
|
|
|
|
List<Account> disabledAccounts = new ArrayList<Account>();
|
|
|
|
for (AccountDescriptionPair accountPair : mImportResults.importedAccounts) {
|
|
|
|
Account account = preferences.getAccount(accountPair.imported.uuid);
|
2011-11-06 19:44:10 -05:00
|
|
|
if (account != null && !account.isEnabled()) {
|
2011-10-16 22:34:26 -04:00
|
|
|
disabledAccounts.add(account);
|
|
|
|
}
|
|
|
|
}
|
2011-11-06 19:44:10 -05:00
|
|
|
if (disabledAccounts.size() > 0) {
|
|
|
|
activity.promptForServerPasswords(disabledAccounts);
|
|
|
|
} else {
|
|
|
|
activity.setNonConfigurationInstance(null);
|
|
|
|
}
|
2011-10-16 22:34:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display a dialog that lets the user select which accounts to import from the settings file.
|
|
|
|
*
|
|
|
|
* @param importContents
|
|
|
|
* The {@link ImportContents} instance returned by
|
|
|
|
* {@link SettingsImporter#getImportStreamContents(InputStream)}
|
|
|
|
* @param uri
|
|
|
|
* The (content) URI of the settings file.
|
|
|
|
*/
|
2011-10-13 23:38:27 -04:00
|
|
|
private void showImportSelectionDialog(ImportContents importContents, Uri uri) {
|
|
|
|
ImportSelectionDialog dialog = new ImportSelectionDialog(importContents, uri);
|
2011-10-13 20:52:32 -04:00
|
|
|
dialog.show(this);
|
|
|
|
setNonConfigurationInstance(dialog);
|
|
|
|
}
|
|
|
|
|
2011-10-16 22:34:26 -04:00
|
|
|
/**
|
|
|
|
* A dialog that lets the user select which accounts to import from the settings file.
|
|
|
|
*/
|
2011-10-13 20:52:32 -04:00
|
|
|
private static class ImportSelectionDialog implements NonConfigurationInstance {
|
|
|
|
private ImportContents mImportContents;
|
|
|
|
private Uri mUri;
|
2012-03-17 13:27:17 -04:00
|
|
|
private AlertDialog mDialog;
|
2011-10-13 20:52:32 -04:00
|
|
|
private SparseBooleanArray mSelection;
|
|
|
|
|
|
|
|
|
2011-10-13 23:38:27 -04:00
|
|
|
ImportSelectionDialog(ImportContents importContents, Uri uri) {
|
2011-10-13 20:52:32 -04:00
|
|
|
mImportContents = importContents;
|
|
|
|
mUri = uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void restore(Activity activity) {
|
|
|
|
show((Accounts) activity, mSelection);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean retain() {
|
|
|
|
if (mDialog != null) {
|
|
|
|
// Save the selection state of each list item
|
2012-03-17 13:27:17 -04:00
|
|
|
mSelection = mDialog.getListView().getCheckedItemPositions();
|
2011-10-13 20:52:32 -04:00
|
|
|
|
|
|
|
mDialog.dismiss();
|
|
|
|
mDialog = null;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void show(Accounts activity) {
|
|
|
|
show(activity, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void show(final Accounts activity, SparseBooleanArray selection) {
|
|
|
|
List<String> contents = new ArrayList<String>();
|
|
|
|
|
|
|
|
if (mImportContents.globalSettings) {
|
2011-10-13 21:42:04 -04:00
|
|
|
contents.add(activity.getString(R.string.settings_import_global_settings));
|
2011-10-13 20:52:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
for (AccountDescription account : mImportContents.accounts) {
|
|
|
|
contents.add(account.name);
|
|
|
|
}
|
|
|
|
|
2012-03-17 13:27:17 -04:00
|
|
|
int count = contents.size();
|
|
|
|
boolean[] checkedItems = new boolean[count];
|
2011-10-13 20:52:32 -04:00
|
|
|
if (selection != null) {
|
2012-03-17 13:27:17 -04:00
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
checkedItems[i] = selection.get(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
checkedItems[i] = true;
|
2011-10-13 20:52:32 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//TODO: listview header: "Please select the settings you wish to import"
|
|
|
|
//TODO: listview footer: "Select all" / "Select none" buttons?
|
|
|
|
//TODO: listview footer: "Overwrite existing accounts?" checkbox
|
|
|
|
|
2012-03-17 13:27:17 -04:00
|
|
|
OnMultiChoiceClickListener listener = new OnMultiChoiceClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
|
|
|
((AlertDialog) dialog).getListView().setItemChecked(which, isChecked);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-10-13 20:52:32 -04:00
|
|
|
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
2012-03-17 13:27:17 -04:00
|
|
|
builder.setMultiChoiceItems(contents.toArray(new String[0]), checkedItems, listener);
|
2011-10-13 21:42:04 -04:00
|
|
|
builder.setTitle(activity.getString(R.string.settings_import_selection));
|
2011-10-13 20:52:32 -04:00
|
|
|
builder.setInverseBackgroundForced(true);
|
|
|
|
builder.setPositiveButton(R.string.okay_action,
|
2012-08-28 10:43:25 -04:00
|
|
|
new DialogInterface.OnClickListener() {
|
2011-10-13 20:52:32 -04:00
|
|
|
|
2012-08-28 10:43:25 -04:00
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
ListView listView = ((AlertDialog) dialog).getListView();
|
|
|
|
SparseBooleanArray pos = listView.getCheckedItemPositions();
|
|
|
|
|
|
|
|
boolean includeGlobals = mImportContents.globalSettings ? pos.get(0) : false;
|
|
|
|
List<String> accountUuids = new ArrayList<String>();
|
|
|
|
int start = mImportContents.globalSettings ? 1 : 0;
|
|
|
|
for (int i = start, end = listView.getCount(); i < end; i++) {
|
|
|
|
if (pos.get(i)) {
|
|
|
|
accountUuids.add(mImportContents.accounts.get(i - start).uuid);
|
2011-10-13 20:52:32 -04:00
|
|
|
}
|
2012-08-28 10:43:25 -04:00
|
|
|
}
|
2011-10-13 20:52:32 -04:00
|
|
|
|
2012-08-28 10:43:25 -04:00
|
|
|
/*
|
|
|
|
* TODO: Think some more about this. Overwriting could change the store
|
|
|
|
* type. This requires some additional code in order to work smoothly
|
|
|
|
* while the app is running.
|
|
|
|
*/
|
|
|
|
boolean overwrite = false;
|
2011-10-13 20:52:32 -04:00
|
|
|
|
2012-08-28 10:43:25 -04:00
|
|
|
dialog.dismiss();
|
|
|
|
activity.setNonConfigurationInstance(null);
|
2011-10-13 20:52:32 -04:00
|
|
|
|
2012-08-28 10:43:25 -04:00
|
|
|
ImportAsyncTask importAsyncTask = new ImportAsyncTask(activity,
|
|
|
|
includeGlobals, accountUuids, overwrite, mUri);
|
|
|
|
activity.setNonConfigurationInstance(importAsyncTask);
|
|
|
|
importAsyncTask.execute();
|
|
|
|
}
|
|
|
|
});
|
2011-10-13 20:52:32 -04:00
|
|
|
builder.setNegativeButton(R.string.cancel_action,
|
2012-08-28 10:43:25 -04:00
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
dialog.dismiss();
|
|
|
|
activity.setNonConfigurationInstance(null);
|
|
|
|
}
|
|
|
|
});
|
2011-10-13 20:52:32 -04:00
|
|
|
mDialog = builder.show();
|
|
|
|
}
|
2011-03-01 22:21:00 -05:00
|
|
|
}
|
2011-03-20 16:21:24 -04:00
|
|
|
|
2011-10-16 22:34:26 -04:00
|
|
|
/**
|
|
|
|
* Set the {@code NonConfigurationInstance} this activity should retain on configuration
|
|
|
|
* changes.
|
|
|
|
*
|
|
|
|
* @param inst
|
|
|
|
* The {@link NonConfigurationInstance} that should be retained when
|
|
|
|
* {@link Accounts#onRetainNonConfigurationInstance()} is called.
|
|
|
|
*/
|
2011-10-13 20:52:32 -04:00
|
|
|
private void setNonConfigurationInstance(NonConfigurationInstance inst) {
|
|
|
|
mNonConfigurationInstance = inst;
|
2011-10-01 14:11:14 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
class AccountsAdapter extends ArrayAdapter<BaseAccount> {
|
|
|
|
public AccountsAdapter(BaseAccount[] accounts) {
|
2008-11-01 17:32:06 -04:00
|
|
|
super(Accounts.this, 0, accounts);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public View getView(int position, View convertView, ViewGroup parent) {
|
2010-04-21 22:20:35 -04:00
|
|
|
final BaseAccount account = getItem(position);
|
2008-11-01 17:32:06 -04:00
|
|
|
View view;
|
2011-02-06 17:09:48 -05:00
|
|
|
if (convertView != null) {
|
2008-11-01 17:32:06 -04:00
|
|
|
view = convertView;
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2008-11-01 17:32:06 -04:00
|
|
|
view = getLayoutInflater().inflate(R.layout.accounts_item, parent, false);
|
|
|
|
}
|
|
|
|
AccountViewHolder holder = (AccountViewHolder) view.getTag();
|
2011-02-06 17:09:48 -05:00
|
|
|
if (holder == null) {
|
2008-11-01 17:32:06 -04:00
|
|
|
holder = new AccountViewHolder();
|
|
|
|
holder.description = (TextView) view.findViewById(R.id.description);
|
|
|
|
holder.email = (TextView) view.findViewById(R.id.email);
|
|
|
|
holder.newMessageCount = (TextView) view.findViewById(R.id.new_message_count);
|
2010-04-16 23:32:17 -04:00
|
|
|
holder.flaggedMessageCount = (TextView) view.findViewById(R.id.flagged_message_count);
|
2010-04-21 22:20:35 -04:00
|
|
|
holder.activeIcons = (RelativeLayout) view.findViewById(R.id.active_icons);
|
2010-01-13 20:07:28 -05:00
|
|
|
|
2010-01-06 00:23:32 -05:00
|
|
|
holder.chip = view.findViewById(R.id.chip);
|
2010-05-11 22:52:10 -04:00
|
|
|
holder.folders = (ImageButton) view.findViewById(R.id.folders);
|
2011-02-02 22:42:45 -05:00
|
|
|
holder.accountsItemLayout = (LinearLayout)view.findViewById(R.id.accounts_item_layout);
|
2010-01-13 20:07:28 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
view.setTag(holder);
|
|
|
|
}
|
2010-04-16 10:33:54 -04:00
|
|
|
AccountStats stats = accountStats.get(account.getUuid());
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
if (stats != null && account instanceof Account && stats.size >= 0) {
|
2010-04-16 23:32:17 -04:00
|
|
|
holder.email.setText(SizeFormatter.formatSize(Accounts.this, stats.size));
|
2010-05-09 11:50:58 -04:00
|
|
|
holder.email.setVisibility(View.VISIBLE);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
|
|
|
if (account.getEmail().equals(account.getDescription())) {
|
2010-05-09 11:50:58 -04:00
|
|
|
holder.email.setVisibility(View.GONE);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2010-05-09 11:50:58 -04:00
|
|
|
holder.email.setVisibility(View.VISIBLE);
|
|
|
|
holder.email.setText(account.getEmail());
|
|
|
|
}
|
2010-04-16 10:33:54 -04:00
|
|
|
}
|
2010-05-11 22:51:59 -04:00
|
|
|
|
2010-04-16 10:33:54 -04:00
|
|
|
String description = account.getDescription();
|
2011-02-06 17:09:48 -05:00
|
|
|
if (description == null || description.length() == 0) {
|
2010-04-16 10:33:54 -04:00
|
|
|
description = account.getEmail();
|
|
|
|
}
|
|
|
|
|
|
|
|
holder.description.setText(description);
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-16 10:33:54 -04:00
|
|
|
Integer unreadMessageCount = null;
|
2011-02-06 17:09:48 -05:00
|
|
|
if (stats != null) {
|
2010-04-16 10:33:54 -04:00
|
|
|
unreadMessageCount = stats.unreadMessageCount;
|
2009-11-21 17:45:39 -05:00
|
|
|
holder.newMessageCount.setText(Integer.toString(unreadMessageCount));
|
|
|
|
holder.newMessageCount.setVisibility(unreadMessageCount > 0 ? View.VISIBLE : View.GONE);
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-16 23:32:17 -04:00
|
|
|
holder.flaggedMessageCount.setText(Integer.toString(stats.flaggedMessageCount));
|
2010-04-17 00:33:25 -04:00
|
|
|
holder.flaggedMessageCount.setVisibility(K9.messageListStars() && stats.flaggedMessageCount > 0 ? View.VISIBLE : View.GONE);
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-22 00:58:50 -04:00
|
|
|
holder.flaggedMessageCount.setOnClickListener(new AccountClickListener(account, SearchModifier.FLAGGED));
|
|
|
|
holder.newMessageCount.setOnClickListener(new AccountClickListener(account, SearchModifier.UNREAD));
|
2011-03-20 16:37:51 -04:00
|
|
|
|
2011-03-19 13:36:58 -04:00
|
|
|
view.getBackground().setAlpha(stats.available ? 0 : 127);
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
holder.activeIcons.setOnClickListener(new OnClickListener() {
|
|
|
|
public void onClick(View v) {
|
2010-04-21 22:20:35 -04:00
|
|
|
Toast toast = Toast.makeText(getApplication(), getString(R.string.tap_hint), Toast.LENGTH_SHORT);
|
|
|
|
toast.show();
|
|
|
|
}
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
);
|
2010-04-21 22:20:35 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2009-11-21 17:45:39 -05:00
|
|
|
holder.newMessageCount.setVisibility(View.GONE);
|
2010-04-16 23:32:17 -04:00
|
|
|
holder.flaggedMessageCount.setVisibility(View.GONE);
|
2011-03-19 13:36:58 -04:00
|
|
|
view.getBackground().setAlpha(0);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
if (account instanceof Account) {
|
2010-04-16 23:32:17 -04:00
|
|
|
Account realAccount = (Account)account;
|
2010-04-25 04:47:24 -04:00
|
|
|
|
2010-12-28 04:11:10 -05:00
|
|
|
holder.chip.setBackgroundDrawable(realAccount.generateColorChip().drawable());
|
2011-02-06 17:09:48 -05:00
|
|
|
if (unreadMessageCount == null) {
|
2010-04-16 23:32:17 -04:00
|
|
|
holder.chip.getBackground().setAlpha(0);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else if (unreadMessageCount == 0) {
|
2010-04-16 23:32:17 -04:00
|
|
|
holder.chip.getBackground().setAlpha(127);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2010-04-16 23:32:17 -04:00
|
|
|
holder.chip.getBackground().setAlpha(255);
|
|
|
|
}
|
2010-01-06 00:23:32 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2012-09-10 11:01:51 -04:00
|
|
|
holder.chip.setBackgroundDrawable(new ColorChip(0xff999999, false).drawable());
|
2010-01-06 09:12:19 -05:00
|
|
|
}
|
2010-01-13 20:07:28 -05:00
|
|
|
|
2010-05-11 22:52:10 -04:00
|
|
|
|
2012-01-11 20:18:41 -05:00
|
|
|
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountName());
|
|
|
|
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountDescription());
|
2010-04-20 12:37:03 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
if (K9.useCompactLayouts()) {
|
2011-02-02 22:42:45 -05:00
|
|
|
holder.accountsItemLayout.setMinimumHeight(0);
|
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
if (account instanceof SearchAccount || K9.useCompactLayouts()) {
|
2010-05-11 22:52:10 -04:00
|
|
|
|
|
|
|
holder.folders.setVisibility(View.GONE);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2010-05-11 22:52:10 -04:00
|
|
|
holder.folders.setVisibility(View.VISIBLE);
|
2011-02-06 17:09:48 -05:00
|
|
|
holder.folders.setOnClickListener(new OnClickListener() {
|
|
|
|
public void onClick(View v) {
|
2010-05-11 22:52:10 -04:00
|
|
|
FolderList.actionHandleAccount(Accounts.this, (Account)account);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
class AccountViewHolder {
|
2008-11-01 17:32:06 -04:00
|
|
|
public TextView description;
|
|
|
|
public TextView email;
|
|
|
|
public TextView newMessageCount;
|
2010-04-16 23:32:17 -04:00
|
|
|
public TextView flaggedMessageCount;
|
2010-04-21 22:20:35 -04:00
|
|
|
public RelativeLayout activeIcons;
|
2010-01-06 00:23:32 -05:00
|
|
|
public View chip;
|
2010-05-11 22:52:10 -04:00
|
|
|
public ImageButton folders;
|
2011-02-02 22:42:45 -05:00
|
|
|
public LinearLayout accountsItemLayout;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
private Flag[] combine(Flag[] set1, Flag[] set2) {
|
|
|
|
if (set1 == null) {
|
2010-04-22 00:58:50 -04:00
|
|
|
return set2;
|
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
if (set2 == null) {
|
2010-04-22 00:58:50 -04:00
|
|
|
return set1;
|
|
|
|
}
|
|
|
|
Set<Flag> flags = new HashSet<Flag>();
|
2010-11-30 22:04:57 -05:00
|
|
|
flags.addAll(Arrays.asList(set1));
|
|
|
|
flags.addAll(Arrays.asList(set2));
|
2010-08-02 07:55:31 -04:00
|
|
|
return flags.toArray(EMPTY_FLAG_ARRAY);
|
2010-04-22 00:58:50 -04:00
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private class AccountClickListener implements OnClickListener {
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-22 00:58:50 -04:00
|
|
|
final BaseAccount account;
|
|
|
|
final SearchModifier searchModifier;
|
2011-02-06 17:09:48 -05:00
|
|
|
AccountClickListener(BaseAccount nAccount, SearchModifier nSearchModifier) {
|
2010-04-22 00:58:50 -04:00
|
|
|
account = nAccount;
|
|
|
|
searchModifier = nSearchModifier;
|
|
|
|
}
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onClick(View v) {
|
2010-04-22 00:58:50 -04:00
|
|
|
String description = getString(R.string.search_title, account.getDescription(), getString(searchModifier.resId));
|
2011-02-06 17:09:48 -05:00
|
|
|
if (account instanceof SearchAccount) {
|
2010-04-22 00:58:50 -04:00
|
|
|
SearchAccount searchAccount = (SearchAccount)account;
|
2010-04-29 00:59:14 -04:00
|
|
|
|
|
|
|
MessageList.actionHandle(Accounts.this,
|
|
|
|
description, "", searchAccount.isIntegrate(),
|
|
|
|
combine(searchAccount.getRequiredFlags(), searchModifier.requiredFlags),
|
|
|
|
combine(searchAccount.getForbiddenFlags(), searchModifier.forbiddenFlags));
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
|
|
|
SearchSpecification searchSpec = new SearchSpecification() {
|
2010-04-22 00:58:50 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public String[] getAccountUuids() {
|
2010-04-22 00:58:50 -04:00
|
|
|
return new String[] { account.getUuid() };
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public Flag[] getForbiddenFlags() {
|
2010-04-22 00:58:50 -04:00
|
|
|
return searchModifier.forbiddenFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public String getQuery() {
|
2010-04-22 00:58:50 -04:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public Flag[] getRequiredFlags() {
|
2010-04-22 00:58:50 -04:00
|
|
|
return searchModifier.requiredFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public boolean isIntegrate() {
|
2010-04-22 00:58:50 -04:00
|
|
|
return false;
|
|
|
|
}
|
2010-04-24 15:10:57 -04:00
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public String[] getFolderNames() {
|
2010-04-24 15:10:57 -04:00
|
|
|
return null;
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-22 00:58:50 -04:00
|
|
|
};
|
|
|
|
MessageList.actionHandle(Accounts.this, description, searchSpec);
|
|
|
|
}
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-22 00:58:50 -04:00
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-03-27 00:03:23 -04:00
|
|
|
public void onExport(final boolean includeGlobals, final Account account) {
|
2011-03-25 01:28:14 -04:00
|
|
|
|
|
|
|
// TODO, prompt to allow a user to choose which accounts to export
|
2011-03-29 00:59:02 -04:00
|
|
|
Set<String> accountUuids = null;
|
2011-03-25 01:28:14 -04:00
|
|
|
if (account != null) {
|
2011-03-29 00:59:02 -04:00
|
|
|
accountUuids = new HashSet<String>();
|
2011-03-25 01:28:14 -04:00
|
|
|
accountUuids.add(account.getUuid());
|
|
|
|
}
|
|
|
|
|
2011-10-13 23:38:27 -04:00
|
|
|
ExportAsyncTask asyncTask = new ExportAsyncTask(this, includeGlobals, accountUuids);
|
2011-10-13 20:52:32 -04:00
|
|
|
setNonConfigurationInstance(asyncTask);
|
|
|
|
asyncTask.execute();
|
2011-03-27 19:18:36 -04:00
|
|
|
}
|
2011-03-25 00:56:25 -04:00
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
/**
|
|
|
|
* Handles exporting of global settings and/or accounts in a background thread.
|
|
|
|
*/
|
|
|
|
private static class ExportAsyncTask extends ExtendedAsyncTask<Void, Void, Boolean> {
|
2011-03-27 19:18:36 -04:00
|
|
|
private boolean mIncludeGlobals;
|
|
|
|
private Set<String> mAccountUuids;
|
|
|
|
private String mFileName;
|
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
|
|
|
|
private ExportAsyncTask(Accounts activity, boolean includeGlobals,
|
2012-08-28 10:43:25 -04:00
|
|
|
Set<String> accountUuids) {
|
2011-10-01 14:11:14 -04:00
|
|
|
super(activity);
|
2011-03-27 19:18:36 -04:00
|
|
|
mIncludeGlobals = includeGlobals;
|
|
|
|
mAccountUuids = accountUuids;
|
|
|
|
}
|
2011-03-27 01:09:26 -04:00
|
|
|
|
2011-03-27 19:18:36 -04:00
|
|
|
@Override
|
2011-10-01 14:11:14 -04:00
|
|
|
protected void showProgressDialog() {
|
|
|
|
String title = mContext.getString(R.string.settings_export_dialog_title);
|
|
|
|
String message = mContext.getString(R.string.settings_exporting);
|
|
|
|
mProgressDialog = ProgressDialog.show(mActivity, title, message, true);
|
2011-03-27 19:18:36 -04:00
|
|
|
}
|
2011-03-25 00:56:25 -04:00
|
|
|
|
2011-03-27 19:18:36 -04:00
|
|
|
@Override
|
|
|
|
protected Boolean doInBackground(Void... params) {
|
|
|
|
try {
|
2011-10-13 23:58:15 -04:00
|
|
|
mFileName = SettingsExporter.exportToFile(mContext, mIncludeGlobals,
|
2012-08-28 10:43:25 -04:00
|
|
|
mAccountUuids);
|
2011-10-14 00:00:10 -04:00
|
|
|
} catch (SettingsImportExportException e) {
|
2011-03-27 19:18:36 -04:00
|
|
|
Log.w(K9.LOG_TAG, "Exception during export", e);
|
|
|
|
return false;
|
2011-03-25 00:56:25 -04:00
|
|
|
}
|
2011-03-27 19:18:36 -04:00
|
|
|
return true;
|
|
|
|
}
|
2011-03-25 00:56:25 -04:00
|
|
|
|
2011-03-27 19:18:36 -04:00
|
|
|
@Override
|
|
|
|
protected void onPostExecute(Boolean success) {
|
2011-10-01 14:11:14 -04:00
|
|
|
Accounts activity = (Accounts) mActivity;
|
|
|
|
|
|
|
|
// Let the activity know that the background task is complete
|
2011-10-13 20:52:32 -04:00
|
|
|
activity.setNonConfigurationInstance(null);
|
2011-10-01 14:11:14 -04:00
|
|
|
|
|
|
|
removeProgressDialog();
|
|
|
|
|
2011-03-27 19:18:36 -04:00
|
|
|
if (success) {
|
2011-10-13 20:52:32 -04:00
|
|
|
activity.showSimpleDialog(R.string.settings_export_success_header,
|
2012-08-28 10:43:25 -04:00
|
|
|
R.string.settings_export_success, mFileName);
|
2011-03-27 19:18:36 -04:00
|
|
|
} else {
|
2011-10-13 21:42:04 -04:00
|
|
|
//TODO: better error messages
|
2011-10-13 20:52:32 -04:00
|
|
|
activity.showSimpleDialog(R.string.settings_export_failed_header,
|
2012-08-28 10:43:25 -04:00
|
|
|
R.string.settings_export_failure);
|
2011-03-25 00:56:25 -04:00
|
|
|
}
|
2011-03-27 19:18:36 -04:00
|
|
|
}
|
2011-03-25 00:56:25 -04:00
|
|
|
}
|
2011-04-12 21:37:44 -04:00
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
/**
|
|
|
|
* Handles importing of global settings and/or accounts in a background thread.
|
|
|
|
*/
|
|
|
|
private static class ImportAsyncTask extends ExtendedAsyncTask<Void, Void, Boolean> {
|
2011-04-12 21:37:44 -04:00
|
|
|
private boolean mIncludeGlobals;
|
2011-04-19 17:04:43 -04:00
|
|
|
private List<String> mAccountUuids;
|
2011-04-12 21:37:44 -04:00
|
|
|
private boolean mOverwrite;
|
2011-10-03 18:48:43 -04:00
|
|
|
private Uri mUri;
|
2011-04-28 22:29:16 -04:00
|
|
|
private ImportResults mImportResults;
|
2011-04-12 21:37:44 -04:00
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
private ImportAsyncTask(Accounts activity, boolean includeGlobals,
|
2012-08-28 10:43:25 -04:00
|
|
|
List<String> accountUuids, boolean overwrite, Uri uri) {
|
2011-10-01 14:11:14 -04:00
|
|
|
super(activity);
|
2011-04-12 21:37:44 -04:00
|
|
|
mIncludeGlobals = includeGlobals;
|
|
|
|
mAccountUuids = accountUuids;
|
|
|
|
mOverwrite = overwrite;
|
2011-10-03 18:48:43 -04:00
|
|
|
mUri = uri;
|
2011-04-12 21:37:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-10-01 14:11:14 -04:00
|
|
|
protected void showProgressDialog() {
|
|
|
|
String title = mContext.getString(R.string.settings_import_dialog_title);
|
|
|
|
String message = mContext.getString(R.string.settings_importing);
|
|
|
|
mProgressDialog = ProgressDialog.show(mActivity, title, message, true);
|
2011-04-12 21:37:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected Boolean doInBackground(Void... params) {
|
|
|
|
try {
|
2011-10-03 18:48:43 -04:00
|
|
|
InputStream is = mContext.getContentResolver().openInputStream(mUri);
|
|
|
|
try {
|
2011-10-13 23:58:55 -04:00
|
|
|
mImportResults = SettingsImporter.importSettings(mContext, is,
|
2012-08-28 10:43:25 -04:00
|
|
|
mIncludeGlobals, mAccountUuids, mOverwrite);
|
2011-10-03 18:48:43 -04:00
|
|
|
} finally {
|
|
|
|
try {
|
|
|
|
is.close();
|
2012-08-28 10:43:25 -04:00
|
|
|
} catch (IOException e) {
|
|
|
|
/* Ignore */
|
|
|
|
}
|
2011-10-03 18:48:43 -04:00
|
|
|
}
|
2011-10-14 00:00:10 -04:00
|
|
|
} catch (SettingsImportExportException e) {
|
2011-10-03 18:48:43 -04:00
|
|
|
Log.w(K9.LOG_TAG, "Exception during import", e);
|
|
|
|
return false;
|
|
|
|
} catch (FileNotFoundException e) {
|
|
|
|
Log.w(K9.LOG_TAG, "Couldn't open import file", e);
|
2011-04-12 21:37:44 -04:00
|
|
|
return false;
|
2011-10-13 22:15:45 -04:00
|
|
|
} catch (Exception e) {
|
|
|
|
Log.w(K9.LOG_TAG, "Unknown error", e);
|
|
|
|
return false;
|
2011-04-12 21:37:44 -04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onPostExecute(Boolean success) {
|
2011-10-01 14:11:14 -04:00
|
|
|
Accounts activity = (Accounts) mActivity;
|
|
|
|
|
|
|
|
// Let the activity know that the background task is complete
|
2011-10-13 20:52:32 -04:00
|
|
|
activity.setNonConfigurationInstance(null);
|
2011-10-01 14:11:14 -04:00
|
|
|
|
|
|
|
removeProgressDialog();
|
|
|
|
|
2011-10-13 21:42:04 -04:00
|
|
|
String filename = mUri.getLastPathSegment();
|
2011-10-14 00:19:30 -04:00
|
|
|
boolean globalSettings = mImportResults.globalSettings;
|
|
|
|
int imported = mImportResults.importedAccounts.size();
|
|
|
|
if (success && (globalSettings || imported > 0)) {
|
|
|
|
if (imported == 0) {
|
|
|
|
activity.showSimpleDialog(R.string.settings_import_success_header,
|
2012-08-28 10:43:25 -04:00
|
|
|
R.string.settings_import_global_settings_success, filename);
|
2011-10-14 00:19:30 -04:00
|
|
|
} else {
|
2011-10-16 22:34:26 -04:00
|
|
|
activity.showAccountsImportedDialog(mImportResults, filename);
|
2011-10-14 00:19:30 -04:00
|
|
|
}
|
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
activity.refresh();
|
2011-04-12 21:37:44 -04:00
|
|
|
} else {
|
2011-10-13 21:42:04 -04:00
|
|
|
//TODO: better error messages
|
2011-10-13 20:52:32 -04:00
|
|
|
activity.showSimpleDialog(R.string.settings_import_failed_header,
|
2012-08-28 10:43:25 -04:00
|
|
|
R.string.settings_import_failure, filename);
|
2011-04-12 21:37:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-01 14:11:14 -04:00
|
|
|
private static class ListImportContentsAsyncTask extends ExtendedAsyncTask<Void, Void, Boolean> {
|
2011-04-12 21:37:44 -04:00
|
|
|
private Uri mUri;
|
2011-10-01 14:11:14 -04:00
|
|
|
private ImportContents mImportContents;
|
|
|
|
|
2011-10-13 23:38:27 -04:00
|
|
|
private ListImportContentsAsyncTask(Accounts activity, Uri uri) {
|
2011-10-01 14:11:14 -04:00
|
|
|
super(activity);
|
2011-04-12 21:37:44 -04:00
|
|
|
|
|
|
|
mUri = uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-10-01 14:11:14 -04:00
|
|
|
protected void showProgressDialog() {
|
|
|
|
String title = mContext.getString(R.string.settings_import_dialog_title);
|
|
|
|
String message = mContext.getString(R.string.settings_import_scanning_file);
|
|
|
|
mProgressDialog = ProgressDialog.show(mActivity, title, message, true);
|
2011-04-12 21:37:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected Boolean doInBackground(Void... params) {
|
|
|
|
try {
|
2011-10-01 14:11:14 -04:00
|
|
|
ContentResolver resolver = mContext.getContentResolver();
|
|
|
|
InputStream is = resolver.openInputStream(mUri);
|
2011-10-03 18:48:43 -04:00
|
|
|
try {
|
2011-10-13 23:58:55 -04:00
|
|
|
mImportContents = SettingsImporter.getImportStreamContents(is);
|
2011-10-03 18:48:43 -04:00
|
|
|
} finally {
|
|
|
|
try {
|
|
|
|
is.close();
|
2012-08-28 10:43:25 -04:00
|
|
|
} catch (IOException e) {
|
|
|
|
/* Ignore */
|
|
|
|
}
|
2011-10-03 18:48:43 -04:00
|
|
|
}
|
2011-10-14 00:00:10 -04:00
|
|
|
} catch (SettingsImportExportException e) {
|
2011-04-12 21:37:44 -04:00
|
|
|
Log.w(K9.LOG_TAG, "Exception during export", e);
|
|
|
|
return false;
|
2012-08-28 10:43:25 -04:00
|
|
|
} catch (FileNotFoundException e) {
|
2011-04-12 21:37:44 -04:00
|
|
|
Log.w(K9.LOG_TAG, "Couldn't read content from URI " + mUri);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onPostExecute(Boolean success) {
|
2011-10-01 14:11:14 -04:00
|
|
|
Accounts activity = (Accounts) mActivity;
|
|
|
|
|
|
|
|
// Let the activity know that the background task is complete
|
2011-10-13 20:52:32 -04:00
|
|
|
activity.setNonConfigurationInstance(null);
|
2011-10-01 14:11:14 -04:00
|
|
|
|
|
|
|
removeProgressDialog();
|
|
|
|
|
2011-04-12 21:37:44 -04:00
|
|
|
if (success) {
|
2011-10-13 23:38:27 -04:00
|
|
|
activity.showImportSelectionDialog(mImportContents, mUri);
|
2011-10-01 14:11:14 -04:00
|
|
|
} else {
|
2011-10-13 21:42:04 -04:00
|
|
|
String filename = mUri.getLastPathSegment();
|
|
|
|
//TODO: better error messages
|
2011-10-13 20:52:32 -04:00
|
|
|
activity.showSimpleDialog(R.string.settings_import_failed_header,
|
2012-08-28 10:43:25 -04:00
|
|
|
R.string.settings_import_failure, filename);
|
2011-10-01 14:11:14 -04:00
|
|
|
}
|
2011-04-12 21:37:44 -04:00
|
|
|
}
|
|
|
|
}
|
2011-10-14 14:33:25 -04:00
|
|
|
|
|
|
|
private static class MoveAccountAsyncTask extends ExtendedAsyncTask<Void, Void, Void> {
|
|
|
|
private Account mAccount;
|
|
|
|
private boolean mUp;
|
|
|
|
|
|
|
|
protected MoveAccountAsyncTask(Activity activity, Account account, boolean up) {
|
|
|
|
super(activity);
|
|
|
|
mAccount = account;
|
|
|
|
mUp = up;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void showProgressDialog() {
|
2011-10-16 21:58:42 -04:00
|
|
|
String message = mActivity.getString(R.string.manage_accounts_moving_message);
|
|
|
|
mProgressDialog = ProgressDialog.show(mActivity, null, message, true);
|
2011-10-14 14:33:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected Void doInBackground(Void... args) {
|
|
|
|
mAccount.move(Preferences.getPreferences(mContext), mUp);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onPostExecute(Void arg) {
|
|
|
|
Accounts activity = (Accounts) mActivity;
|
|
|
|
|
|
|
|
// Let the activity know that the background task is complete
|
|
|
|
activity.setNonConfigurationInstance(null);
|
|
|
|
|
|
|
|
activity.refresh();
|
|
|
|
removeProgressDialog();
|
|
|
|
}
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|