mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-26 09:38:52 -05:00
Fixed issue 519 and more navigation issues
This commit is contained in:
parent
384dd4f771
commit
3707e0e666
@ -274,7 +274,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
Intent intent = getIntent();
|
||||
boolean startup = (boolean)intent.getBooleanExtra(EXTRA_STARTUP, false);
|
||||
if (startup && accounts.length == 1) {
|
||||
FolderList.actionHandleAccount(this, accounts[0], true);
|
||||
FolderList.actionHandleAccount(this, accounts[0], accounts[0].getAutoExpandFolderName());
|
||||
finish();
|
||||
}
|
||||
else {
|
||||
|
@ -102,6 +102,8 @@ public class FolderList extends K9ListActivity {
|
||||
|
||||
private boolean sortDateAscending = false;
|
||||
|
||||
private boolean mStartup = false;
|
||||
|
||||
private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 120000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
|
||||
|
||||
private DateFormat getDateFormat() {
|
||||
@ -351,10 +353,6 @@ public class FolderList extends K9ListActivity {
|
||||
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) {
|
||||
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);
|
||||
@ -374,7 +372,8 @@ public class FolderList extends K9ListActivity {
|
||||
return actionHandleAccountIntent(context, account, null);
|
||||
}
|
||||
|
||||
@Override public void onCreate(Bundle savedInstanceState) {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Intent intent = getIntent();
|
||||
@ -383,10 +382,10 @@ public class FolderList extends K9ListActivity {
|
||||
if (savedInstanceState == null) {
|
||||
mInitialFolder = intent.getStringExtra(EXTRA_INITIAL_FOLDER);
|
||||
Log.v(Email.LOG_TAG, "EXTRA_INITIAL_FOLDER: " + mInitialFolder);
|
||||
boolean startup = (boolean) intent.getBooleanExtra(EXTRA_STARTUP, false);
|
||||
Log.v(Email.LOG_TAG, "startup: " + startup);
|
||||
mStartup = (boolean) intent.getBooleanExtra(EXTRA_STARTUP, false);
|
||||
Log.v(Email.LOG_TAG, "startup: " + mStartup);
|
||||
if (mInitialFolder == null
|
||||
&& startup) {
|
||||
&& mStartup) {
|
||||
mInitialFolder = mAccount.getAutoExpandFolderName();
|
||||
if (Email.FOLDER_NONE.equals(mInitialFolder)) {
|
||||
mInitialFolder = null;
|
||||
@ -399,7 +398,7 @@ public class FolderList extends K9ListActivity {
|
||||
|
||||
Log.v(Email.LOG_TAG, "mInitialFolder: " + mInitialFolder);
|
||||
if (mInitialFolder != null) {
|
||||
onOpenFolder(mInitialFolder);
|
||||
onOpenFolder(mInitialFolder, true);
|
||||
finish();
|
||||
}
|
||||
else {
|
||||
@ -413,12 +412,10 @@ public class FolderList extends K9ListActivity {
|
||||
//mListView.setFastScrollEnabled(true); // XXX TODO - reenable when we switch to 1.5
|
||||
mListView.setScrollingCacheEnabled(true);
|
||||
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);
|
||||
MessageList.actionHandleFolder(xxx,mAccount, ((FolderInfoHolder)mAdapter.getItem(id)).name);
|
||||
MessageList.actionHandleFolder(xxx, mAccount, ((FolderInfoHolder)mAdapter.getItem(id)).name, false);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
registerForContextMenu(mListView);
|
||||
|
||||
@ -536,7 +533,7 @@ public class FolderList extends K9ListActivity {
|
||||
private void onAccounts() {
|
||||
// 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
|
||||
if (isTaskRoot()) {
|
||||
if (mStartup) {
|
||||
startActivity(new Intent(this, Accounts.class));
|
||||
}
|
||||
finish();
|
||||
@ -614,12 +611,8 @@ public class FolderList extends K9ListActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void onOpenFolder(FolderInfoHolder folder) {
|
||||
onOpenFolder(folder.name);
|
||||
}
|
||||
|
||||
private void onOpenFolder(String folder) {
|
||||
MessageList.actionHandleFolder(this, mAccount, folder);
|
||||
private void onOpenFolder(String folder, boolean startup) {
|
||||
MessageList.actionHandleFolder(this, mAccount, folder, startup);
|
||||
}
|
||||
|
||||
private void onCompact(Account account) {
|
||||
@ -644,7 +637,7 @@ public class FolderList extends K9ListActivity {
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.open_folder:
|
||||
onOpenFolder(folder);
|
||||
onOpenFolder(folder.name, false);
|
||||
break;
|
||||
|
||||
case R.id.mark_all_as_read:
|
||||
|
@ -94,6 +94,7 @@ public class MessageList extends K9ListActivity {
|
||||
private static final boolean FORCE_REMOTE_SYNC = true;
|
||||
|
||||
private static final String EXTRA_ACCOUNT = "account";
|
||||
private static final String EXTRA_STARTUP = "startup";
|
||||
|
||||
private static final String EXTRA_CLEAR_NOTIFICATION = "clearNotification";
|
||||
|
||||
@ -163,6 +164,8 @@ public class MessageList extends K9ListActivity {
|
||||
|
||||
private boolean sortDateAscending = false;
|
||||
|
||||
private boolean mStartup = false;
|
||||
|
||||
private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 120000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
|
||||
|
||||
private DateFormat getDateFormat() {
|
||||
@ -341,9 +344,10 @@ public class MessageList extends K9ListActivity {
|
||||
* 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.putExtra(EXTRA_ACCOUNT, account);
|
||||
intent.putExtra(EXTRA_STARTUP, startup);
|
||||
|
||||
if (folder != null) {
|
||||
intent.putExtra(EXTRA_FOLDER, folder);
|
||||
@ -353,7 +357,6 @@ public class MessageList extends K9ListActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
//Debug.startMethodTracing("k9");
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -378,6 +381,7 @@ public class MessageList extends K9ListActivity {
|
||||
|
||||
Intent intent = getIntent();
|
||||
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
|
||||
// activity already
|
||||
@ -595,8 +599,8 @@ public class MessageList extends K9ListActivity {
|
||||
private void onShowFolderList() {
|
||||
// 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
|
||||
if (isTaskRoot ()) {
|
||||
FolderList.actionHandleAccount(this, mAccount);
|
||||
if (mStartup) {
|
||||
FolderList.actionHandleAccount(this, mAccount, false);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user