Search in sources :

Example 1 with NavHostFragment

use of androidx.navigation.fragment.NavHostFragment in project Signal-Android by signalapp.

the class ManageProfileActivity method onCreate.

@Override
public void onCreate(Bundle bundle, boolean ready) {
    dynamicTheme.onCreate(this);
    setContentView(R.layout.manage_profile_activity);
    if (bundle == null) {
        Bundle extras = getIntent().getExtras();
        // 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();
            SafeNavigation.safeNavigate(navController, action);
        }
        if (extras != null && extras.getBoolean(START_AT_AVATAR, false)) {
            NavDirections action = ManageProfileFragmentDirections.actionManageProfileFragmentToAvatarPicker(null, null);
            SafeNavigation.safeNavigate(navController, action);
        }
    }
}
Also used : Bundle(android.os.Bundle) NavController(androidx.navigation.NavController) NavGraph(androidx.navigation.NavGraph) NavHostFragment(androidx.navigation.fragment.NavHostFragment) NavDirections(androidx.navigation.NavDirections)

Example 2 with NavHostFragment

use of androidx.navigation.fragment.NavHostFragment in project Signal-Android by signalapp.

the class ManageProfileActivity method onReactWithAnyEmojiSelected.

@Override
public void onReactWithAnyEmojiSelected(@NonNull String emoji) {
    NavHostFragment navHostFragment = (NavHostFragment) getSupportFragmentManager().getPrimaryNavigationFragment();
    Fragment activeFragment = navHostFragment.getChildFragmentManager().getPrimaryNavigationFragment();
    if (activeFragment instanceof EmojiController) {
        ((EmojiController) activeFragment).onEmojiSelected(emoji);
    }
}
Also used : NavHostFragment(androidx.navigation.fragment.NavHostFragment) Fragment(androidx.fragment.app.Fragment) ReactWithAnyEmojiBottomSheetDialogFragment(org.thoughtcrime.securesms.reactions.any.ReactWithAnyEmojiBottomSheetDialogFragment) NavHostFragment(androidx.navigation.fragment.NavHostFragment)

Example 3 with NavHostFragment

use of androidx.navigation.fragment.NavHostFragment in project Signal-Android by signalapp.

the class EditProfileActivity method onCreate.

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    dynamicTheme.onCreate(this);
    setContentView(R.layout.profile_create_activity);
    if (bundle == null) {
        NavHostFragment fragment = NavHostFragment.create(R.navigation.edit_profile, getIntent().getExtras());
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fragment).commit();
    }
}
Also used : NavHostFragment(androidx.navigation.fragment.NavHostFragment)

Example 4 with NavHostFragment

use of androidx.navigation.fragment.NavHostFragment in project Signal-Android by WhisperSystems.

the class EditProfileActivity method onCreate.

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    dynamicTheme.onCreate(this);
    setContentView(R.layout.profile_create_activity);
    if (bundle == null) {
        NavHostFragment fragment = NavHostFragment.create(R.navigation.edit_profile, getIntent().getExtras());
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fragment).commit();
    }
}
Also used : NavHostFragment(androidx.navigation.fragment.NavHostFragment)

Example 5 with NavHostFragment

use of androidx.navigation.fragment.NavHostFragment in project Signal-Android by WhisperSystems.

the class ManageProfileActivity method onReactWithAnyEmojiSelected.

@Override
public void onReactWithAnyEmojiSelected(@NonNull String emoji) {
    NavHostFragment navHostFragment = (NavHostFragment) getSupportFragmentManager().getPrimaryNavigationFragment();
    Fragment activeFragment = navHostFragment.getChildFragmentManager().getPrimaryNavigationFragment();
    if (activeFragment instanceof EmojiController) {
        ((EmojiController) activeFragment).onEmojiSelected(emoji);
    }
}
Also used : NavHostFragment(androidx.navigation.fragment.NavHostFragment) Fragment(androidx.fragment.app.Fragment) ReactWithAnyEmojiBottomSheetDialogFragment(org.thoughtcrime.securesms.reactions.any.ReactWithAnyEmojiBottomSheetDialogFragment) NavHostFragment(androidx.navigation.fragment.NavHostFragment)

Aggregations

NavHostFragment (androidx.navigation.fragment.NavHostFragment)8 Bundle (android.os.Bundle)2 Fragment (androidx.fragment.app.Fragment)2 NavController (androidx.navigation.NavController)2 NavDirections (androidx.navigation.NavDirections)2 NavGraph (androidx.navigation.NavGraph)2 ReactWithAnyEmojiBottomSheetDialogFragment (org.thoughtcrime.securesms.reactions.any.ReactWithAnyEmojiBottomSheetDialogFragment)2 RecipientId (org.thoughtcrime.securesms.recipients.RecipientId)2