Search in sources :

Example 6 with NavController

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));
    }
}
Also used : NavController(androidx.navigation.NavController)

Example 7 with NavController

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));
    }
}
Also used : NavController(androidx.navigation.NavController)

Example 8 with NavController

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);
}
Also used : NavController(androidx.navigation.NavController)

Example 9 with NavController

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);
        }
    }
}
Also used : Bundle(android.os.Bundle) NavController(androidx.navigation.NavController) NavGraph(androidx.navigation.NavGraph) NavHostFragment(androidx.navigation.fragment.NavHostFragment) NavDirections(androidx.navigation.NavDirections)

Example 10 with NavController

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);
}
Also used : LifecycleDisposable(org.thoughtcrime.securesms.util.LifecycleDisposable) Disposable(io.reactivex.rxjava3.disposables.Disposable) NavController(androidx.navigation.NavController)

Aggregations

NavController (androidx.navigation.NavController)10 Bundle (android.os.Bundle)4 View (android.view.View)2 NavDirections (androidx.navigation.NavDirections)2 NavGraph (androidx.navigation.NavGraph)2 NavHostFragment (androidx.navigation.fragment.NavHostFragment)2 Disposable (io.reactivex.rxjava3.disposables.Disposable)2 LifecycleDisposable (org.thoughtcrime.securesms.util.LifecycleDisposable)2 LayoutInflater (android.view.LayoutInflater)1 ViewGroup (android.view.ViewGroup)1 NavDestination (androidx.navigation.NavDestination)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 FirebaseRecyclerOptions (com.firebase.ui.database.FirebaseRecyclerOptions)1 DatabaseReference (com.google.firebase.database.DatabaseReference)1 Query (com.google.firebase.database.Query)1 ActivityMainBinding (com.google.firebase.quickstart.database.databinding.ActivityMainBinding)1 Post (com.google.firebase.quickstart.database.java.models.Post)1 PostViewHolder (com.google.firebase.quickstart.database.java.viewholder.PostViewHolder)1