mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-13 14:48:04 -05:00
Changed the way we use the activity stack
- removed launchMode attributes for all activities - only use one activity task - got rid of "managed back button" behavior
This commit is contained in:
parent
8daea241af
commit
d8e9c48177
@ -66,7 +66,6 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.fsck.k9.activity.Accounts"
|
android:name="com.fsck.k9.activity.Accounts"
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="locale"
|
android:configChanges="locale"
|
||||||
android:uiOptions="splitActionBarWhenNarrow"
|
android:uiOptions="splitActionBarWhenNarrow"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
@ -88,7 +87,6 @@
|
|||||||
android:label="@string/prefs_title"
|
android:label="@string/prefs_title"
|
||||||
android:configChanges="locale"
|
android:configChanges="locale"
|
||||||
android:taskAffinity="com.fsck.k9.activity.setup.Prefs"
|
android:taskAffinity="com.fsck.k9.activity.setup.Prefs"
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
>
|
>
|
||||||
</activity>
|
</activity>
|
||||||
@ -203,7 +201,6 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.fsck.k9.activity.FolderList"
|
android:name="com.fsck.k9.activity.FolderList"
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="locale"
|
android:configChanges="locale"
|
||||||
android:uiOptions="splitActionBarWhenNarrow"
|
android:uiOptions="splitActionBarWhenNarrow"
|
||||||
>
|
>
|
||||||
@ -214,7 +211,6 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.fsck.k9.activity.MessageList"
|
android:name="com.fsck.k9.activity.MessageList"
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="locale"
|
android:configChanges="locale"
|
||||||
android:uiOptions="splitActionBarWhenNarrow"
|
android:uiOptions="splitActionBarWhenNarrow"
|
||||||
>
|
>
|
||||||
|
@ -325,25 +325,14 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
public static final String EXTRA_STARTUP = "startup";
|
public static final String EXTRA_STARTUP = "startup";
|
||||||
|
|
||||||
|
|
||||||
public static void actionLaunch(Context context) {
|
|
||||||
Intent intent = new Intent(context, Accounts.class);
|
|
||||||
intent.putExtra(EXTRA_STARTUP, true);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void listAccounts(Context context) {
|
public static void listAccounts(Context context) {
|
||||||
Intent intent = new Intent(context, Accounts.class);
|
Intent intent = new Intent(context, Accounts.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
||||||
|
Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
intent.putExtra(EXTRA_STARTUP, false);
|
intent.putExtra(EXTRA_STARTUP, false);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void listAccountsClearTop(Context context) {
|
|
||||||
Intent intent = new Intent(context, Accounts.class);
|
|
||||||
intent.putExtra(EXTRA_STARTUP, false);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewIntent(Intent intent) {
|
public void onNewIntent(Intent intent) {
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
@ -1341,6 +1330,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
|
|
||||||
private void onImport() {
|
private void onImport() {
|
||||||
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
i.setType(MimeUtility.K9_SETTINGS_MIME_TYPE);
|
i.setType(MimeUtility.K9_SETTINGS_MIME_TYPE);
|
||||||
|
|
||||||
|
@ -241,16 +241,9 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
sendMail(mAccount);
|
sendMail(mAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Intent actionHandleAccountIntent(Context context, Account account) {
|
|
||||||
return actionHandleAccountIntent(context, account, null, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder) {
|
|
||||||
return actionHandleAccountIntent(context, account, initialFolder, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder, boolean fromShortcut) {
|
public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder, boolean fromShortcut) {
|
||||||
Intent intent = new Intent(context, FolderList.class);
|
Intent intent = new Intent(context, FolderList.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
||||||
|
|
||||||
if (initialFolder != null) {
|
if (initialFolder != null) {
|
||||||
@ -264,13 +257,9 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void actionHandleAccount(Context context, Account account, String initialFolder) {
|
|
||||||
Intent intent = actionHandleAccountIntent(context, account, initialFolder);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void actionHandleAccount(Context context, Account account) {
|
public static void actionHandleAccount(Context context, Account account) {
|
||||||
actionHandleAccount(context, account, null);
|
Intent intent = actionHandleAccountIntent(context, account, null, false);
|
||||||
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Intent actionHandleNotification(Context context, Account account, String initialFolder) {
|
public static Intent actionHandleNotification(Context context, Account account, String initialFolder) {
|
||||||
@ -279,7 +268,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
Uri.parse("email://accounts/" + account.getAccountNumber()),
|
Uri.parse("email://accounts/" + account.getAccountNumber()),
|
||||||
context,
|
context,
|
||||||
FolderList.class);
|
FolderList.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
||||||
intent.putExtra(EXTRA_FROM_NOTIFICATION, true);
|
intent.putExtra(EXTRA_FROM_NOTIFICATION, true);
|
||||||
|
|
||||||
@ -418,7 +407,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
|
|
||||||
if (!mAccount.isAvailable(this)) {
|
if (!mAccount.isAvailable(this)) {
|
||||||
Log.i(K9.LOG_TAG, "account unavaliabale, not showing folder-list but account-list");
|
Log.i(K9.LOG_TAG, "account unavaliabale, not showing folder-list but account-list");
|
||||||
startActivity(new Intent(this, Accounts.class));
|
Accounts.listAccounts(this);
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -434,16 +423,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
|
MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
if (K9.manageBack()) {
|
|
||||||
onAccounts();
|
|
||||||
} else {
|
|
||||||
super.onBackPressed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
//Shortcuts that work no matter what is selected
|
//Shortcuts that work no matter what is selected
|
||||||
@ -643,9 +622,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
|
|
||||||
private void onOpenFolder(String folder) {
|
private void onOpenFolder(String folder) {
|
||||||
MessageList.actionHandleFolder(this, mAccount, folder);
|
MessageList.actionHandleFolder(this, mAccount, folder);
|
||||||
if (K9.manageBack()) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCompact(Account account) {
|
private void onCompact(Account account) {
|
||||||
|
@ -38,7 +38,6 @@ public class LauncherShortcuts extends AccountList {
|
|||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
|
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
|
||||||
String description = account.getDescription();
|
String description = account.getDescription();
|
||||||
|
@ -588,24 +588,27 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
|||||||
*/
|
*/
|
||||||
public static void actionHandleFolder(Context context, Bundle extras) {
|
public static void actionHandleFolder(Context context, Bundle extras) {
|
||||||
Intent intent = new Intent(context, MessageList.class);
|
Intent intent = new Intent(context, MessageList.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
intent.putExtras(extras);
|
intent.putExtras(extras);
|
||||||
intent.putExtra(EXTRA_RETURN_FROM_MESSAGE_VIEW, true);
|
intent.putExtra(EXTRA_RETURN_FROM_MESSAGE_VIEW, true);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void actionHandleFolder(Context context, Account account, String folder) {
|
public static void actionHandleFolder(Context context, Account account, String folder) {
|
||||||
Intent intent = actionHandleFolderIntent(context, account, folder);
|
Intent intent = new Intent(context, MessageList.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
||||||
|
|
||||||
|
if (folder != null) {
|
||||||
|
intent.putExtra(EXTRA_FOLDER, folder);
|
||||||
|
}
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Intent actionHandleFolderIntent(Context context, Account account, String folder) {
|
public static Intent actionHandleFolderIntent(Context context, Account account, String folder) {
|
||||||
Intent intent = new Intent(context, MessageList.class);
|
Intent intent = new Intent(context, MessageList.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
||||||
|
|
||||||
if (folder != null) {
|
if (folder != null) {
|
||||||
@ -616,6 +619,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
|||||||
|
|
||||||
public static void actionHandle(Context context, String title, String queryString, boolean integrate, Flag[] flags, Flag[] forbiddenFlags) {
|
public static void actionHandle(Context context, String title, String queryString, boolean integrate, Flag[] flags, Flag[] forbiddenFlags) {
|
||||||
Intent intent = new Intent(context, MessageList.class);
|
Intent intent = new Intent(context, MessageList.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
intent.putExtra(EXTRA_QUERY, queryString);
|
intent.putExtra(EXTRA_QUERY, queryString);
|
||||||
if (flags != null) {
|
if (flags != null) {
|
||||||
intent.putExtra(EXTRA_QUERY_FLAGS, Utility.combine(flags, ','));
|
intent.putExtra(EXTRA_QUERY_FLAGS, Utility.combine(flags, ','));
|
||||||
@ -625,9 +629,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
|||||||
}
|
}
|
||||||
intent.putExtra(EXTRA_INTEGRATE, integrate);
|
intent.putExtra(EXTRA_INTEGRATE, integrate);
|
||||||
intent.putExtra(EXTRA_TITLE, title);
|
intent.putExtra(EXTRA_TITLE, title);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,19 +993,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
|||||||
return (ActivityState) super.getLastNonConfigurationInstance();
|
return (ActivityState) super.getLastNonConfigurationInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
if (K9.manageBack()) {
|
|
||||||
if (mQueryString == null) {
|
|
||||||
onShowFolderList();
|
|
||||||
} else {
|
|
||||||
onAccounts();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.onBackPressed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
// Shortcuts that work no matter what is selected
|
// Shortcuts that work no matter what is selected
|
||||||
|
@ -245,18 +245,6 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
return super.onKeyUp(keyCode, event);
|
return super.onKeyUp(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
if (K9.manageBack()) {
|
|
||||||
if (mMessageListExtras != null) {
|
|
||||||
MessageList.actionHandleFolder(this, mMessageListExtras);
|
|
||||||
}
|
|
||||||
finish();
|
|
||||||
} else {
|
|
||||||
super.onBackPressed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MessageViewHandler extends Handler {
|
class MessageViewHandler extends Handler {
|
||||||
|
|
||||||
public void progress(final boolean progress) {
|
public void progress(final boolean progress) {
|
||||||
@ -301,10 +289,10 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
public static void actionView(Context context, MessageReference messRef,
|
public static void actionView(Context context, MessageReference messRef,
|
||||||
ArrayList<MessageReference> messReferences, Bundle messageListExtras) {
|
ArrayList<MessageReference> messReferences, Bundle messageListExtras) {
|
||||||
Intent i = new Intent(context, MessageView.class);
|
Intent i = new Intent(context, MessageView.class);
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
i.putExtra(EXTRA_MESSAGE_LIST_EXTRAS, messageListExtras);
|
i.putExtra(EXTRA_MESSAGE_LIST_EXTRAS, messageListExtras);
|
||||||
i.putExtra(EXTRA_MESSAGE_REFERENCE, messRef);
|
i.putExtra(EXTRA_MESSAGE_REFERENCE, messRef);
|
||||||
i.putParcelableArrayListExtra(EXTRA_MESSAGE_REFERENCES, messReferences);
|
i.putParcelableArrayListExtra(EXTRA_MESSAGE_REFERENCES, messReferences);
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
context.startActivity(i);
|
context.startActivity(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class AccountSetupNames extends K9Activity implements OnClickListener {
|
|||||||
}
|
}
|
||||||
mAccount.setName(mName.getText().toString());
|
mAccount.setName(mName.getText().toString());
|
||||||
mAccount.save(Preferences.getPreferences(this));
|
mAccount.save(Preferences.getPreferences(this));
|
||||||
Accounts.listAccountsClearTop(this);
|
Accounts.listAccounts(this);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ public class UnreadWidgetProvider extends AppWidgetProvider {
|
|||||||
unreadCount = stats.unreadMessageCount;
|
unreadCount = stats.unreadMessageCount;
|
||||||
accountName = account.getDescription();
|
accountName = account.getDescription();
|
||||||
if (K9.FOLDER_NONE.equals(account.getAutoExpandFolderName())) {
|
if (K9.FOLDER_NONE.equals(account.getAutoExpandFolderName())) {
|
||||||
clickIntent = FolderList.actionHandleAccountIntent(context, account, null);
|
clickIntent = FolderList.actionHandleAccountIntent(context, account, null,
|
||||||
|
false);
|
||||||
} else {
|
} else {
|
||||||
clickIntent = MessageList.actionHandleFolderIntent(context, account,
|
clickIntent = MessageList.actionHandleFolderIntent(context, account,
|
||||||
account.getAutoExpandFolderName());
|
account.getAutoExpandFolderName());
|
||||||
|
Loading…
Reference in New Issue
Block a user