use of androidx.navigation.NavController in project Signal-Android by signalapp.
the class PaymentsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState, boolean ready) {
dynamicTheme.onCreate(this);
setContentView(R.layout.payments_activity);
NavController controller = Navigation.findNavController(this, R.id.nav_host_fragment);
controller.setGraph(R.navigation.payments_preferences);
int startingAction = getIntent().getIntExtra(EXTRA_PAYMENTS_STARTING_ACTION, R.id.paymentsHome);
if (startingAction != R.id.paymentsHome) {
SafeNavigation.safeNavigate(controller, startingAction, getIntent().getBundleExtra(EXTRA_STARTING_ARGUMENTS));
}
}
use of androidx.navigation.NavController in project Signal-Android by WhisperSystems.
the class PaymentsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState, boolean ready) {
dynamicTheme.onCreate(this);
setContentView(R.layout.payments_activity);
NavController controller = Navigation.findNavController(this, R.id.nav_host_fragment);
controller.setGraph(R.navigation.payments_preferences);
int startingAction = getIntent().getIntExtra(EXTRA_PAYMENTS_STARTING_ACTION, R.id.paymentsHome);
if (startingAction != R.id.paymentsHome) {
SafeNavigation.safeNavigate(controller, startingAction, getIntent().getBundleExtra(EXTRA_STARTING_ARGUMENTS));
}
}
use of androidx.navigation.NavController in project Signal-Android by WhisperSystems.
the class OldDeviceTransferActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState, boolean ready) {
dynamicTheme.onCreate(this);
setContentView(R.layout.old_device_transfer_activity);
NavController controller = Navigation.findNavController(this, R.id.nav_host_fragment);
controller.setGraph(R.navigation.old_device_transfer);
}
use of androidx.navigation.NavController in project Signal-Android by WhisperSystems.
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);
}
}
}
use of androidx.navigation.NavController in project Signal-Android by signalapp.
the class EnterPhoneNumberFragment method requestVerificationCode.
private void requestVerificationCode(@NonNull Mode mode) {
NavController navController = NavHostFragment.findNavController(this);
Disposable request = viewModel.requestVerificationCode(mode).doOnSubscribe(unused -> SignalStore.account().setRegistered(false)).observeOn(AndroidSchedulers.mainThread()).subscribe(processor -> {
if (processor.hasResult()) {
SafeNavigation.safeNavigate(navController, EnterPhoneNumberFragmentDirections.actionEnterVerificationCode());
} else if (processor.localRateLimit()) {
Log.i(TAG, "Unable to request sms code due to local rate limit");
SafeNavigation.safeNavigate(navController, EnterPhoneNumberFragmentDirections.actionEnterVerificationCode());
} else if (processor.captchaRequired()) {
Log.i(TAG, "Unable to request sms code due to captcha required");
SafeNavigation.safeNavigate(navController, EnterPhoneNumberFragmentDirections.actionRequestCaptcha());
} else if (processor.rateLimit()) {
Log.i(TAG, "Unable to request sms code due to rate limit");
Toast.makeText(register.getContext(), R.string.RegistrationActivity_rate_limited_to_service, Toast.LENGTH_LONG).show();
} else if (processor.isImpossibleNumber()) {
Log.w(TAG, "Impossible number", processor.getError());
Dialogs.showAlertDialog(requireContext(), getString(R.string.RegistrationActivity_invalid_number), String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid), viewModel.getNumber().getFullFormattedNumber()));
} else if (processor.isNonNormalizedNumber()) {
handleNonNormalizedNumberError(processor.getOriginalNumber(), processor.getNormalizedNumber(), mode);
} else {
Log.i(TAG, "Unknown error during verification code request", processor.getError());
Toast.makeText(register.getContext(), R.string.RegistrationActivity_unable_to_connect_to_service, Toast.LENGTH_LONG).show();
}
cancelSpinning(register);
enableAllEntries();
});
disposables.add(request);
}
Aggregations