use of com.google.android.material.navigation.NavigationBarView in project LSPosed by naicfeng.
the class MainActivity method handleIntent.
private void handleIntent(Intent intent) {
if (intent == null) {
return;
}
NavHostFragment navHostFragment = (NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
if (navHostFragment == null) {
return;
}
NavController navController = navHostFragment.getNavController();
var nav = (NavigationBarView) binding.nav;
if (intent.getAction() != null && intent.getAction().equals("android.intent.action.APPLICATION_PREFERENCES")) {
nav.setSelectedItemId(R.id.settings_fragment);
} else if (ConfigManager.isBinderAlive()) {
if (!TextUtils.isEmpty(intent.getDataString())) {
switch(intent.getDataString()) {
case "modules":
nav.setSelectedItemId(R.id.modules_nav);
break;
// break;
case "repo":
if (ConfigManager.isMagiskInstalled()) {
nav.setSelectedItemId(R.id.repo_nav);
}
break;
case "settings":
nav.setSelectedItemId(R.id.settings_fragment);
break;
default:
var data = intent.getData();
if (data != null && data.getScheme().equals("module")) {
navController.navigate(new Uri.Builder().scheme("lsposed").authority("module").appendQueryParameter("modulePackageName", data.getHost()).appendQueryParameter("moduleUserId", String.valueOf(data.getPort())).build(), new NavOptions.Builder().setEnterAnim(R.anim.fragment_enter).setExitAnim(R.anim.fragment_exit).setPopEnterAnim(R.anim.fragment_enter_pop).setPopExitAnim(R.anim.fragment_exit_pop).setLaunchSingleTop(true).setPopUpTo(navController.getGraph().getStartDestinationId(), false, true).build());
}
}
}
}
}
Aggregations