Merge pull request #4446 from k9mail/navigation_main
Add NavController to MessageList
This commit is contained in:
commit
f98d6c95b3
2 changed files with 29 additions and 2 deletions
|
@ -20,6 +20,8 @@ import androidx.fragment.app.FragmentTransaction;
|
|||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.navigation.NavController;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -60,7 +62,6 @@ import com.fsck.k9.ui.managefolders.ManageFoldersActivity;
|
|||
import com.fsck.k9.ui.messagelist.DefaultFolderProvider;
|
||||
import com.fsck.k9.ui.messageview.MessageViewFragment;
|
||||
import com.fsck.k9.ui.messageview.MessageViewFragment.MessageViewFragmentListener;
|
||||
import com.fsck.k9.ui.onboarding.OnboardingActivity;
|
||||
import com.fsck.k9.view.ViewSwitcher;
|
||||
import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener;
|
||||
import com.mikepenz.materialdrawer.Drawer.OnDrawerListener;
|
||||
|
@ -215,15 +216,18 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
*/
|
||||
private boolean messageListWasDisplayed = false;
|
||||
private ViewSwitcher viewSwitcher;
|
||||
private NavController navController;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
navController = createNavController();
|
||||
|
||||
List<Account> accounts = preferences.getAccounts();
|
||||
if (accounts.isEmpty()) {
|
||||
OnboardingActivity.launch(this);
|
||||
navController.navigate(R.id.action_global_onboardingScreen);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
@ -1638,4 +1642,10 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
drawer.deselect();
|
||||
}
|
||||
}
|
||||
|
||||
private NavController createNavController() {
|
||||
NavController navController = new NavController(this);
|
||||
navController.setGraph(R.navigation.navigation_main);
|
||||
return navController;
|
||||
}
|
||||
}
|
||||
|
|
17
app/ui/src/main/res/navigation/navigation_main.xml
Normal file
17
app/ui/src/main/res/navigation/navigation_main.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/navigation_main"
|
||||
app:startDestination="@id/onboardingScreen">
|
||||
|
||||
<activity
|
||||
android:id="@+id/onboardingScreen"
|
||||
android:name="com.fsck.k9.ui.onboarding.OnboardingActivity"
|
||||
tools:layout="@layout/activity_onboarding"/>
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_onboardingScreen"
|
||||
app:destination="@id/onboardingScreen" />
|
||||
|
||||
</navigation>
|
Loading…
Reference in a new issue