Fix navigation crashes in registration and manage profile.

fork-5.53.8
Cody Henthorne 2021-09-29 13:03:35 -04:00 zatwierdzone przez Greyson Parrelli
rodzic 8d53c2392a
commit 641db1cbe2
3 zmienionych plików z 11 dodań i 6 usunięć

Wyświetl plik

@ -6,6 +6,7 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.NavController;
import androidx.navigation.NavDirections;
import androidx.navigation.NavGraph;
import androidx.navigation.Navigation;
@ -51,18 +52,22 @@ public class ManageProfileActivity extends PassphraseRequiredActivity implements
if (bundle == null) {
Bundle extras = getIntent().getExtras();
NavGraph graph = Navigation.findNavController(this, R.id.nav_host_fragment).getGraph();
Navigation.findNavController(this, R.id.nav_host_fragment).setGraph(graph, extras != null ? extras : new Bundle());
//noinspection ConstantConditions
NavController navController = ((NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment)).getNavController();
NavGraph graph = navController.getGraph();
navController.setGraph(graph, extras != null ? extras : new Bundle());
if (extras != null && extras.getBoolean(START_AT_USERNAME, false)) {
NavDirections action = ManageProfileFragmentDirections.actionManageUsername();
Navigation.findNavController(this, R.id.nav_host_fragment).navigate(action);
navController.navigate(action);
}
if (extras != null && extras.getBoolean(START_AT_AVATAR, false)) {
NavDirections action = ManageProfileFragmentDirections.actionManageProfileFragmentToAvatarPicker(null, null);
Navigation.findNavController(this, R.id.nav_host_fragment).navigate(action);
navController.navigate(action);
}
}
}

Wyświetl plik

@ -6,7 +6,7 @@
android:layout_height="match_parent"
tools:context=".registration.RegistrationNavigationActivity">
<fragment
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"

Wyświetl plik

@ -6,7 +6,7 @@
android:layout_height="match_parent"
tools:context=".profiles.edit.EditProfileActivity">
<fragment
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"