1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-14 07:08:00 -05:00

Fixed issue 519 and more navigation issues

This commit is contained in:
Bao-Long Nguyen-Trong 2009-06-24 17:51:41 +00:00
parent 384dd4f771
commit 3707e0e666
3 changed files with 23 additions and 26 deletions

View File

@ -274,7 +274,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
Intent intent = getIntent(); Intent intent = getIntent();
boolean startup = (boolean)intent.getBooleanExtra(EXTRA_STARTUP, false); boolean startup = (boolean)intent.getBooleanExtra(EXTRA_STARTUP, false);
if (startup && accounts.length == 1) { if (startup && accounts.length == 1) {
FolderList.actionHandleAccount(this, accounts[0], true); FolderList.actionHandleAccount(this, accounts[0], accounts[0].getAutoExpandFolderName());
finish(); finish();
} }
else { else {

View File

@ -102,6 +102,8 @@ public class FolderList extends K9ListActivity {
private boolean sortDateAscending = false; private boolean sortDateAscending = false;
private boolean mStartup = false;
private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 120000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()); private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 120000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
private DateFormat getDateFormat() { private DateFormat getDateFormat() {
@ -351,10 +353,6 @@ public class FolderList extends K9ListActivity {
actionHandleAccount(context, account, null, startup); actionHandleAccount(context, account, null, startup);
} }
public static void actionHandleAccount(Context context, Account account) {
actionHandleAccount(context, account, null, false);
}
public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder) { public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Email.INTENT_DATA_URI_PREFIX + INTENT_DATA_PATH_SUFFIX + "/" + account.getAccountNumber()), context, FolderList.class); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Email.INTENT_DATA_URI_PREFIX + INTENT_DATA_PATH_SUFFIX + "/" + account.getAccountNumber()), context, FolderList.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@ -374,7 +372,8 @@ public class FolderList extends K9ListActivity {
return actionHandleAccountIntent(context, account, null); return actionHandleAccountIntent(context, account, null);
} }
@Override public void onCreate(Bundle savedInstanceState) { @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Intent intent = getIntent(); Intent intent = getIntent();
@ -383,10 +382,10 @@ public class FolderList extends K9ListActivity {
if (savedInstanceState == null) { if (savedInstanceState == null) {
mInitialFolder = intent.getStringExtra(EXTRA_INITIAL_FOLDER); mInitialFolder = intent.getStringExtra(EXTRA_INITIAL_FOLDER);
Log.v(Email.LOG_TAG, "EXTRA_INITIAL_FOLDER: " + mInitialFolder); Log.v(Email.LOG_TAG, "EXTRA_INITIAL_FOLDER: " + mInitialFolder);
boolean startup = (boolean) intent.getBooleanExtra(EXTRA_STARTUP, false); mStartup = (boolean) intent.getBooleanExtra(EXTRA_STARTUP, false);
Log.v(Email.LOG_TAG, "startup: " + startup); Log.v(Email.LOG_TAG, "startup: " + mStartup);
if (mInitialFolder == null if (mInitialFolder == null
&& startup) { && mStartup) {
mInitialFolder = mAccount.getAutoExpandFolderName(); mInitialFolder = mAccount.getAutoExpandFolderName();
if (Email.FOLDER_NONE.equals(mInitialFolder)) { if (Email.FOLDER_NONE.equals(mInitialFolder)) {
mInitialFolder = null; mInitialFolder = null;
@ -399,7 +398,7 @@ public class FolderList extends K9ListActivity {
Log.v(Email.LOG_TAG, "mInitialFolder: " + mInitialFolder); Log.v(Email.LOG_TAG, "mInitialFolder: " + mInitialFolder);
if (mInitialFolder != null) { if (mInitialFolder != null) {
onOpenFolder(mInitialFolder); onOpenFolder(mInitialFolder, true);
finish(); finish();
} }
else { else {
@ -413,12 +412,10 @@ public class FolderList extends K9ListActivity {
//mListView.setFastScrollEnabled(true); // XXX TODO - reenable when we switch to 1.5 //mListView.setFastScrollEnabled(true); // XXX TODO - reenable when we switch to 1.5
mListView.setScrollingCacheEnabled(true); mListView.setScrollingCacheEnabled(true);
mListView.setOnItemClickListener(new OnItemClickListener() { mListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int itemPosition, long id){ public void onItemClick(AdapterView parent, View v, int itemPosition, long id) {
Log.v(Email.LOG_TAG,"We're clicking "+itemPosition+" -- "+id); Log.v(Email.LOG_TAG,"We're clicking "+itemPosition+" -- "+id);
MessageList.actionHandleFolder(xxx,mAccount, ((FolderInfoHolder)mAdapter.getItem(id)).name); MessageList.actionHandleFolder(xxx, mAccount, ((FolderInfoHolder)mAdapter.getItem(id)).name, false);
} }
}); });
registerForContextMenu(mListView); registerForContextMenu(mListView);
@ -536,7 +533,7 @@ public class FolderList extends K9ListActivity {
private void onAccounts() { private void onAccounts() {
// If we're a child activity (say because Welcome dropped us straight to the message list // If we're a child activity (say because Welcome dropped us straight to the message list
// we won't have a parent activity and we'll need to get back to it // we won't have a parent activity and we'll need to get back to it
if (isTaskRoot()) { if (mStartup) {
startActivity(new Intent(this, Accounts.class)); startActivity(new Intent(this, Accounts.class));
} }
finish(); finish();
@ -614,12 +611,8 @@ public class FolderList extends K9ListActivity {
} }
} }
private void onOpenFolder(FolderInfoHolder folder) { private void onOpenFolder(String folder, boolean startup) {
onOpenFolder(folder.name); MessageList.actionHandleFolder(this, mAccount, folder, startup);
}
private void onOpenFolder(String folder) {
MessageList.actionHandleFolder(this, mAccount, folder);
} }
private void onCompact(Account account) { private void onCompact(Account account) {
@ -644,7 +637,7 @@ public class FolderList extends K9ListActivity {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.open_folder: case R.id.open_folder:
onOpenFolder(folder); onOpenFolder(folder.name, false);
break; break;
case R.id.mark_all_as_read: case R.id.mark_all_as_read:

View File

@ -94,6 +94,7 @@ public class MessageList extends K9ListActivity {
private static final boolean FORCE_REMOTE_SYNC = true; private static final boolean FORCE_REMOTE_SYNC = true;
private static final String EXTRA_ACCOUNT = "account"; private static final String EXTRA_ACCOUNT = "account";
private static final String EXTRA_STARTUP = "startup";
private static final String EXTRA_CLEAR_NOTIFICATION = "clearNotification"; private static final String EXTRA_CLEAR_NOTIFICATION = "clearNotification";
@ -163,6 +164,8 @@ public class MessageList extends K9ListActivity {
private boolean sortDateAscending = false; private boolean sortDateAscending = false;
private boolean mStartup = false;
private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 120000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()); private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 120000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
private DateFormat getDateFormat() { private DateFormat getDateFormat() {
@ -341,9 +344,10 @@ public class MessageList extends K9ListActivity {
* queueing up a remote update of the folder. * queueing up a remote update of the folder.
*/ */
public static void actionHandleFolder(Context context, Account account, String folder) { public static void actionHandleFolder(Context context, Account account, String folder, boolean startup) {
Intent intent = new Intent(context, MessageList.class); Intent intent = new Intent(context, MessageList.class);
intent.putExtra(EXTRA_ACCOUNT, account); intent.putExtra(EXTRA_ACCOUNT, account);
intent.putExtra(EXTRA_STARTUP, startup);
if (folder != null) { if (folder != null) {
intent.putExtra(EXTRA_FOLDER, folder); intent.putExtra(EXTRA_FOLDER, folder);
@ -353,7 +357,6 @@ public class MessageList extends K9ListActivity {
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
//Debug.startMethodTracing("k9"); //Debug.startMethodTracing("k9");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -378,6 +381,7 @@ public class MessageList extends K9ListActivity {
Intent intent = getIntent(); Intent intent = getIntent();
mAccount = (Account)intent.getSerializableExtra(EXTRA_ACCOUNT); mAccount = (Account)intent.getSerializableExtra(EXTRA_ACCOUNT);
mStartup = (boolean)intent.getBooleanExtra(EXTRA_STARTUP, false);
// Take the initial folder into account only if we are *not* restoring the // Take the initial folder into account only if we are *not* restoring the
// activity already // activity already
@ -595,8 +599,8 @@ public class MessageList extends K9ListActivity {
private void onShowFolderList() { private void onShowFolderList() {
// If we're a child activity (say because Welcome dropped us straight to the message list // If we're a child activity (say because Welcome dropped us straight to the message list
// we won't have a parent activity and we'll need to get back to it // we won't have a parent activity and we'll need to get back to it
if (isTaskRoot ()) { if (mStartup) {
FolderList.actionHandleAccount(this, mAccount); FolderList.actionHandleAccount(this, mAccount, false);
} }
finish(); finish();
} }