Use NavController in 'WelcomeFragment' to start 'MessageList'

This commit is contained in:
cketti 2019-11-03 17:43:03 +01:00
parent 7c40f0f3d2
commit 336542daa5
2 changed files with 10 additions and 12 deletions

View file

@ -8,9 +8,6 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.fsck.k9.Preferences
import com.fsck.k9.activity.MessageList
import com.fsck.k9.search.LocalSearch
import com.fsck.k9.ui.R
import com.fsck.k9.ui.helper.HtmlToSpanned
import com.fsck.k9.ui.observeNotNull
@ -21,7 +18,6 @@ import org.koin.android.ext.android.inject
class WelcomeFragment : Fragment() {
private val htmlToSpanned: HtmlToSpanned by inject()
private val preferences: Preferences by inject()
private val importResultViewModel: SettingsImportResultViewModel by sharedViewModel()
@ -56,14 +52,7 @@ class WelcomeFragment : Fragment() {
}
private fun launchMessageList() {
//TODO: Remove this and use NavController to navigate to MessageList once GH-4230 has been implemented
val account = preferences.defaultAccount
val folder = account.autoExpandFolder ?: account.inboxFolder
val search = LocalSearch(folder)
search.addAllowedFolder(folder)
search.addAccountUuid(account.uuid)
MessageList.actionDisplaySearch(requireActivity(), search, false, true)
findNavController().navigate(R.id.action_welcomeScreen_to_messageListScreen)
requireActivity().finish()
}
}

View file

@ -19,6 +19,10 @@
android:id="@+id/action_welcomeScreen_to_addAccountScreen"
app:destination="@id/addAccountScreen" />
<action
android:id="@+id/action_welcomeScreen_to_messageListScreen"
app:destination="@id/messageListScreen" />
</fragment>
<fragment
@ -33,4 +37,9 @@
android:label="@string/account_setup_basics_title"
tools:layout="@layout/account_setup_basics"/>
<activity
android:id="@+id/messageListScreen"
android:name="com.fsck.k9.activity.MessageList"
tools:layout="@layout/message_list"/>
</navigation>