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

Unverified Commit 01687890 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #4235 from k9mail/remove_folder_list_activity

Remove 'FolderList' activity
parents a2d11393 818239fa
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -193,15 +193,12 @@
            android:label="@string/ac_transfer_title"
            />

        <activity
        <!-- activity-alias so old launcher shortcuts work -->
        <!-- TODO: Remove after 2020-12-31 -->
        <activity-alias
            android:name=".activity.FolderList"
            android:configChanges="locale"
            android:uiOptions="splitActionBarWhenNarrow">
            <intent-filter>
                <!-- This action is only to allow an entry point for launcher shortcuts -->
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>
            android:targetActivity=".activity.MessageList"
            android:exported="true" />

        <activity
            android:name=".activity.MessageList"
@@ -299,6 +296,10 @@
            android:name=".activity.UpgradeDatabases"
            android:label="@string/upgrade_databases_title"/>

        <activity
            android:name=".activity.ManageFoldersActivity"
            android:label="@string/folders_action" />

        <activity
            android:name=".ui.settings.SettingsActivity"
            android:label="@string/prefs_title" />
+4 −12
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ import android.content.Intent
import com.fsck.k9.Account
import com.fsck.k9.Preferences
import com.fsck.k9.R
import com.fsck.k9.activity.FolderList
import com.fsck.k9.activity.MessageList
import com.fsck.k9.controller.MessagingController
import com.fsck.k9.search.LocalSearch
@@ -57,14 +56,8 @@ class UnreadWidgetDataProvider(
    }

    private fun getClickIntentForAccount(account: Account): Intent {
        if (account.autoExpandFolder == null) {
            return FolderList.actionHandleAccountIntent(context, account, false)
        }

        val search = LocalSearch(account.autoExpandFolder)
        search.addAllowedFolder(account.autoExpandFolder)
        search.addAccountUuid(account.uuid)
        return MessageList.intentDisplaySearch(context, search, false, true, true)
        val folderServerId = account.autoExpandFolder ?: account.inboxFolder
        return getClickIntentForFolder(account, folderServerId)
    }

    private fun loadFolderData(configuration: UnreadWidgetConfiguration): UnreadWidgetData? {
@@ -78,13 +71,12 @@ class UnreadWidgetDataProvider(

        val unreadCount = messagingController.getFolderUnreadMessageCount(account, folderServerId)

        val clickIntent = getClickIntentForFolder(accountUuid, folderServerId)
        val clickIntent = getClickIntentForFolder(account, folderServerId)

        return UnreadWidgetData(configuration, title, unreadCount, clickIntent)
    }

    private fun getClickIntentForFolder(accountUuid: String, folderServerId: String): Intent {
        val account = preferences.getAccount(accountUuid)
    private fun getClickIntentForFolder(account: Account, folderServerId: String): Intent {
        val search = LocalSearch(folderServerId)
        search.addAllowedFolder(folderServerId)
        search.addAccountUuid(account.uuid)
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ class UnreadWidgetDataProviderTest : AppRobolectricTest() {
    fun createAccount(): Account = mock {
        on { uuid } doReturn ACCOUNT_UUID
        on { description } doReturn ACCOUNT_DESCRIPTION
        on { autoExpandFolder } doReturn FOLDER_SERVER_ID
    }

    fun createPreferences(): Preferences = mock {
+2 −3
Original line number Diff line number Diff line
@@ -27,13 +27,12 @@ public class LauncherShortcuts extends AccountList {

    @Override
    protected void onAccountSelected(BaseAccount account) {
        Intent shortcutIntent = null;

        Intent shortcutIntent;
        if (account instanceof SearchAccount) {
            SearchAccount searchAccount = (SearchAccount) account;
            shortcutIntent = MessageList.shortcutIntent(this, searchAccount.getId());
        } else {
            shortcutIntent = FolderList.actionHandleAccountIntent(this, (Account) account, true);
            shortcutIntent = MessageList.shortcutIntentForAccount(this, (Account) account);
        }

        Intent intent = new Intent();
+12 −23
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ import timber.log.Timber;
 * Activity shows list of the Account's folders
 */

public class FolderList extends K9ListActivity {
public class ManageFoldersActivity extends K9ListActivity {
    private static final String EXTRA_ACCOUNT = "account";

    private static final String EXTRA_FROM_SHORTCUT = "fromShortcut";
@@ -87,7 +87,7 @@ public class FolderList extends K9ListActivity {
                public void run() {
                    actionBar.setTitle(R.string.folders_action);

                    String operation = adapter.activityListener.getOperation(FolderList.this);
                    String operation = adapter.activityListener.getOperation(ManageFoldersActivity.this);
                    if (operation.length() < 1) {
                        actionBar.setSubtitle(account.getEmail());
                    } else {
@@ -158,20 +158,9 @@ public class FolderList extends K9ListActivity {
        }
    }

    public static Intent actionHandleAccountIntent(Context context, Account account, boolean fromShortcut) {
        Intent intent = new Intent(context, FolderList.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    public static void launch(Context context, Account account) {
        Intent intent = new Intent(context, ManageFoldersActivity.class);
        intent.putExtra(EXTRA_ACCOUNT, account.getUuid());

        if (fromShortcut) {
            intent.putExtra(EXTRA_FROM_SHORTCUT, true);
        }

        return intent;
    }

    public static void actionHandleAccount(Context context, Account account) {
        Intent intent = actionHandleAccountIntent(context, account, false);
        context.startActivity(intent);
    }

@@ -193,7 +182,7 @@ public class FolderList extends K9ListActivity {
        listView.setScrollingCacheEnabled(false);
        listView.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                FolderSettings.actionSettings(FolderList.this, account, ((FolderInfoHolder) adapter.getItem(position)).serverId);
                FolderSettings.actionSettings(ManageFoldersActivity.this, account, ((FolderInfoHolder) adapter.getItem(position)).serverId);
            }
        });

@@ -455,7 +444,7 @@ public class FolderList extends K9ListActivity {
        private ActivityListener activityListener = new ActivityListener() {
            @Override
            public void listFoldersStarted(Account account) {
                if (account.equals(FolderList.this.account)) {
                if (account.equals(ManageFoldersActivity.this.account)) {
                    handler.progress(true);
                }
                super.listFoldersStarted(account);
@@ -464,7 +453,7 @@ public class FolderList extends K9ListActivity {

            @Override
            public void listFoldersFailed(Account account, String message) {
                if (account.equals(FolderList.this.account)) {
                if (account.equals(ManageFoldersActivity.this.account)) {
                    handler.progress(false);
                    runOnUiThread(new Runnable() {
                        @Override
@@ -479,7 +468,7 @@ public class FolderList extends K9ListActivity {

            @Override
            public void listFoldersFinished(Account account) {
                if (account.equals(FolderList.this.account)) {
                if (account.equals(ManageFoldersActivity.this.account)) {

                    handler.progress(false);
                    MessagingController.getInstance(getApplication()).refreshListener(adapter.activityListener);
@@ -491,7 +480,7 @@ public class FolderList extends K9ListActivity {

            @Override
            public void listFolders(Account account, List<LocalFolder> folders) {
                if (account.equals(FolderList.this.account)) {
                if (account.equals(ManageFoldersActivity.this.account)) {

                    List<FolderInfoHolder> newFolders = new LinkedList<>();
                    List<FolderInfoHolder> topFolders = new LinkedList<>();
@@ -516,9 +505,9 @@ public class FolderList extends K9ListActivity {
                        }

                        if (holder == null) {
                            holder = new FolderInfoHolder(folder, FolderList.this.account, -1);
                            holder = new FolderInfoHolder(folder, ManageFoldersActivity.this.account, -1);
                        } else {
                            holder.populate(folder, FolderList.this.account, -1);
                            holder.populate(folder, ManageFoldersActivity.this.account, -1);

                        }
                        if (folder.isInTopGroup()) {
@@ -537,7 +526,7 @@ public class FolderList extends K9ListActivity {

            @Override
            public void accountSizeChanged(Account account, long oldSize, long newSize) {
                if (account.equals(FolderList.this.account)) {
                if (account.equals(ManageFoldersActivity.this.account)) {
                    handler.accountSizeChanged(oldSize, newSize);
                }
            }
Loading