Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8e9c481 authored by cketti's avatar cketti
Browse files

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
parent 8daea241
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@

        <activity
            android:name="com.fsck.k9.activity.Accounts"
            android:launchMode="singleTask"
            android:configChanges="locale"
            android:uiOptions="splitActionBarWhenNarrow"
            android:label="@string/app_name">
@@ -88,7 +87,6 @@
            android:label="@string/prefs_title"
            android:configChanges="locale"
            android:taskAffinity="com.fsck.k9.activity.setup.Prefs"
            android:launchMode="singleTask"
            android:excludeFromRecents="true"
            >
        </activity>
@@ -203,7 +201,6 @@
        </activity>
        <activity
            android:name="com.fsck.k9.activity.FolderList"
            android:launchMode="singleTask"
            android:configChanges="locale"
            android:uiOptions="splitActionBarWhenNarrow"
            >
@@ -214,7 +211,6 @@
        </activity>
        <activity
            android:name="com.fsck.k9.activity.MessageList"
            android:launchMode="singleTask"
            android:configChanges="locale"
            android:uiOptions="splitActionBarWhenNarrow"
            >
+3 −13
Original line number Diff line number Diff line
@@ -325,25 +325,14 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
    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) {
        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);
        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
    public void onNewIntent(Intent intent) {
        Uri uri = intent.getData();
@@ -1341,6 +1330,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {

    private void onImport() {
        Intent i = new Intent(Intent.ACTION_GET_CONTENT);
        i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        i.addCategory(Intent.CATEGORY_OPENABLE);
        i.setType(MimeUtility.K9_SETTINGS_MIME_TYPE);

+5 −29
Original line number Diff line number Diff line
@@ -241,16 +241,9 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
        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) {
        Intent intent = new Intent(context, FolderList.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra(EXTRA_ACCOUNT, account.getUuid());

        if (initialFolder != null) {
@@ -264,13 +257,9 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
        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) {
        actionHandleAccount(context, account, null);
        Intent intent = actionHandleAccountIntent(context, account, null, false);
        context.startActivity(intent);
    }

    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()),
            context,
            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_FROM_NOTIFICATION, true);

@@ -418,7 +407,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {

        if (!mAccount.isAvailable(this)) {
            Log.i(K9.LOG_TAG, "account unavaliabale, not showing folder-list but account-list");
            startActivity(new Intent(this, Accounts.class));
            Accounts.listAccounts(this);
            finish();
            return;
        }
@@ -434,16 +423,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
        MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
    }


    @Override
    public void onBackPressed() {
        if (K9.manageBack()) {
            onAccounts();
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        //Shortcuts that work no matter what is selected
@@ -643,9 +622,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {

    private void onOpenFolder(String folder) {
        MessageList.actionHandleFolder(this, mAccount, folder);
        if (K9.manageBack()) {
            finish();
        }
    }

    private void onCompact(Account account) {
+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ public class LauncherShortcuts extends AccountList {
                    true);
        }

        shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        Intent intent = new Intent();
        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
        String description = account.getDescription();
+11 −23
Original line number Diff line number Diff line
@@ -588,24 +588,27 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
     */
    public static void actionHandleFolder(Context context, Bundle extras) {
        Intent intent = new Intent(context, MessageList.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.putExtras(extras);
        intent.putExtra(EXTRA_RETURN_FROM_MESSAGE_VIEW, true);
        context.startActivity(intent);
    }

    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);
    }

    public static Intent actionHandleFolderIntent(Context context, Account account, String folder) {
        Intent intent = new Intent(context, MessageList.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP |
                Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.putExtra(EXTRA_ACCOUNT, account.getUuid());

        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) {
        Intent intent = new Intent(context, MessageList.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.putExtra(EXTRA_QUERY, queryString);
        if (flags != null) {
            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_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);
    }

@@ -992,19 +993,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
        return (ActivityState) super.getLastNonConfigurationInstance();
    }

    @Override
    public void onBackPressed() {
        if (K9.manageBack()) {
            if (mQueryString == null) {
                onShowFolderList();
            } else {
                onAccounts();
            }
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // Shortcuts that work no matter what is selected
Loading