Search in sources :

Example 26 with FragmentActivity

use of androidx.fragment.app.FragmentActivity in project Signal-Android by WhisperSystems.

the class WelcomeFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    viewModel = ViewModelProviders.of(requireActivity()).get(RegistrationViewModel.class);
    if (viewModel.isReregister()) {
        if (viewModel.hasRestoreFlowBeenShown()) {
            Log.i(TAG, "We've come back to the home fragment on a restore, user must be backing out");
            if (!Navigation.findNavController(view).popBackStack()) {
                FragmentActivity activity = requireActivity();
                activity.finish();
                ActivityNavigator.applyPopAnimationsToPendingTransition(activity);
            }
            return;
        }
        initializeNumber();
        Log.i(TAG, "Skipping restore because this is a reregistration.");
        viewModel.setWelcomeSkippedOnRestore();
        SafeNavigation.safeNavigate(Navigation.findNavController(view), WelcomeFragmentDirections.actionSkipRestore());
    } else {
        setDebugLogSubmitMultiTapView(view.findViewById(R.id.image));
        setDebugLogSubmitMultiTapView(view.findViewById(R.id.title));
        continueButton = view.findViewById(R.id.welcome_continue_button);
        continueButton.setOnClickListener(this::continueClicked);
        Button restoreFromBackup = view.findViewById(R.id.welcome_transfer_or_restore);
        restoreFromBackup.setOnClickListener(this::restoreFromBackupClicked);
        TextView welcomeTermsButton = view.findViewById(R.id.welcome_terms_button);
        welcomeTermsButton.setOnClickListener(v -> onTermsClicked());
        if (!canUserSelectBackup()) {
            restoreFromBackup.setText(R.string.registration_activity__transfer_account);
        }
    }
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) Button(android.widget.Button) CircularProgressButton(com.dd.CircularProgressButton) TextView(android.widget.TextView) RegistrationViewModel(org.thoughtcrime.securesms.registration.viewmodel.RegistrationViewModel)

Example 27 with FragmentActivity

use of androidx.fragment.app.FragmentActivity in project Signal-Android by WhisperSystems.

the class MediaKeyboard method initView.

private void initView() {
    if (!isInitialised) {
        LayoutInflater.from(getContext()).inflate(R.layout.media_keyboard, this, true);
        if (fragmentManager == null) {
            FragmentActivity activity = resolveActivity(getContext());
            fragmentManager = activity.getSupportFragmentManager();
        }
        keyboardPagerFragment = new KeyboardPagerFragment();
        fragmentManager.beginTransaction().replace(R.id.media_keyboard_fragment_container, keyboardPagerFragment).commitNowAllowingStateLoss();
        keyboardState = State.NORMAL;
        latestKeyboardHeight = -1;
        isInitialised = true;
    }
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) KeyboardPagerFragment(org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment)

Example 28 with FragmentActivity

use of androidx.fragment.app.FragmentActivity in project Signal-Android by WhisperSystems.

the class GroupsV1MigrationSuggestionsDialog method display.

private void display() {
    AlertDialog dialog = new AlertDialog.Builder(fragmentActivity).setTitle(fragmentActivity.getResources().getQuantityString(R.plurals.GroupsV1MigrationSuggestionsDialog_add_members_question, suggestions.size())).setMessage(fragmentActivity.getResources().getQuantityString(R.plurals.GroupsV1MigrationSuggestionsDialog_these_members_couldnt_be_automatically_added, suggestions.size())).setView(R.layout.dialog_group_members).setPositiveButton(fragmentActivity.getResources().getQuantityString(R.plurals.GroupsV1MigrationSuggestionsDialog_add_members, suggestions.size()), (d, i) -> onAddClicked(d)).setNegativeButton(android.R.string.cancel, (d, i) -> d.dismiss()).show();
    GroupMemberListView memberListView = dialog.findViewById(R.id.list_members);
    memberListView.initializeAdapter(fragmentActivity);
    SimpleTask.run(() -> Recipient.resolvedList(suggestions), memberListView::setDisplayOnlyMembers);
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) SignalDatabase(org.thoughtcrime.securesms.database.SignalDatabase) AlertDialog(androidx.appcompat.app.AlertDialog) NonNull(androidx.annotation.NonNull) SimpleProgressDialog(org.thoughtcrime.securesms.util.views.SimpleProgressDialog) IOException(java.io.IOException) R(org.thoughtcrime.securesms.R) FragmentActivity(androidx.fragment.app.FragmentActivity) GroupMemberListView(org.thoughtcrime.securesms.groups.ui.GroupMemberListView) Log(org.signal.core.util.logging.Log) GroupManager(org.thoughtcrime.securesms.groups.GroupManager) List(java.util.List) GroupChangeFailedException(org.thoughtcrime.securesms.groups.GroupChangeFailedException) MembershipNotSuitableForV2Exception(org.thoughtcrime.securesms.groups.MembershipNotSuitableForV2Exception) RecipientId(org.thoughtcrime.securesms.recipients.RecipientId) GroupNotAMemberException(org.thoughtcrime.securesms.groups.GroupNotAMemberException) Toast(android.widget.Toast) GroupId(org.thoughtcrime.securesms.groups.GroupId) GroupInsufficientRightsException(org.thoughtcrime.securesms.groups.GroupInsufficientRightsException) Recipient(org.thoughtcrime.securesms.recipients.Recipient) GroupChangeBusyException(org.thoughtcrime.securesms.groups.GroupChangeBusyException) SimpleTask(org.thoughtcrime.securesms.util.concurrent.SimpleTask) DialogInterface(android.content.DialogInterface) SignalExecutors(org.signal.core.util.concurrent.SignalExecutors) GroupMemberListView(org.thoughtcrime.securesms.groups.ui.GroupMemberListView)

Example 29 with FragmentActivity

use of androidx.fragment.app.FragmentActivity in project mobile-center-sdk-android by Microsoft.

the class EditDateTimeFragment method showTime.

private void showTime() {
    FragmentActivity activity = getActivity();
    if (activity == null) {
        return;
    }
    Bundle bundle = new Bundle();
    bundle.putSerializable(TimePickerFragment.INITIAL_TIME, mDate);
    TimePickerFragment fragment = new TimePickerFragment();
    fragment.setArguments(bundle);
    fragment.setListener(this);
    fragment.show(getActivity().getSupportFragmentManager(), "timePicker");
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) Bundle(android.os.Bundle)

Example 30 with FragmentActivity

use of androidx.fragment.app.FragmentActivity in project mobile-center-sdk-android by Microsoft.

the class EditDateTimeFragment method showDate.

private void showDate() {
    FragmentActivity activity = getActivity();
    if (activity == null) {
        return;
    }
    Bundle bundle = new Bundle();
    bundle.putSerializable(DatePickerFragment.INITIAL_DATE, mDate);
    DatePickerFragment fragment = new DatePickerFragment();
    fragment.setArguments(bundle);
    fragment.setListener(this);
    fragment.show(activity.getSupportFragmentManager(), "datePicker");
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) Bundle(android.os.Bundle)

Aggregations

FragmentActivity (androidx.fragment.app.FragmentActivity)181 Test (org.junit.Test)71 Intent (android.content.Intent)25 Bundle (android.os.Bundle)19 View (android.view.View)11 Config (org.robolectric.annotation.Config)11 TextView (android.widget.TextView)10 Before (org.junit.Before)10 BroadcastReceiver (android.content.BroadcastReceiver)8 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)8 Resources (android.content.res.Resources)7 Fragment (androidx.fragment.app.Fragment)7 FragmentManager (androidx.fragment.app.FragmentManager)7 Activity (android.app.Activity)6 IntentFilter (android.content.IntentFilter)6 UserHandle (android.os.UserHandle)6 Preference (androidx.preference.Preference)6 SwitchPreference (androidx.preference.SwitchPreference)6 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)6 Tile (com.android.settingslib.drawer.Tile)6