Search in sources :

Example 96 with Fragment

use of androidx.fragment.app.Fragment in project BaseProject by fly803.

the class FragmentUtils method hide.

/**
 * Hide fragment.
 *
 * @param fm The manager of fragment.
 */
public static void hide(@NonNull final FragmentManager fm) {
    List<Fragment> fragments = getFragments(fm);
    for (Fragment hide : fragments) {
        putArgs(hide, true);
    }
    operateNoAnim(fm, TYPE_HIDE_FRAGMENT, null, fragments.toArray(new Fragment[fragments.size()]));
}
Also used : Fragment(androidx.fragment.app.Fragment)

Example 97 with Fragment

use of androidx.fragment.app.Fragment in project Slide by ccrama.

the class DoEditorActions method doDraw.

public static void doDraw(final Activity a, final EditText editText, final FragmentManager fm) {
    final Intent intent = new Intent(a, Draw.class);
    KeyboardUtil.hideKeyboard(editText.getContext(), editText.getWindowToken(), 0);
    e = editText.getText();
    TedBottomPicker tedBottomPicker = new TedBottomPicker.Builder(editText.getContext()).setOnImageSelectedListener(new TedBottomPicker.OnImageSelectedListener() {

        @Override
        public void onImageSelected(List<Uri> uri) {
            Draw.uri = uri.get(0);
            Fragment auxiliary = new AuxiliaryFragment();
            sStart = editText.getSelectionStart();
            sEnd = editText.getSelectionEnd();
            fm.beginTransaction().add(auxiliary, "IMAGE_UPLOAD").commit();
            fm.executePendingTransactions();
            auxiliary.startActivityForResult(intent, 3333);
        }
    }).setLayoutResource(R.layout.image_sheet_dialog).setTitle("Choose a photo").create();
    tedBottomPicker.show(fm);
}
Also used : Intent(android.content.Intent) List(java.util.List) ArrayList(java.util.ArrayList) TedBottomPicker(gun0912.tedbottompicker.TedBottomPicker) Fragment(androidx.fragment.app.Fragment)

Example 98 with Fragment

use of androidx.fragment.app.Fragment in project Slide by ccrama.

the class FolderChooserDialogCreate method show.

public void show(final FragmentManager fragmentManager) {
    final String tag = getBuilder().tag;
    final Fragment frag = fragmentManager.findFragmentByTag(tag);
    if (frag != null) {
        ((DialogFragment) frag).dismiss();
        fragmentManager.beginTransaction().remove(frag).commit();
    }
    show(fragmentManager, tag);
}
Also used : DialogFragment(androidx.fragment.app.DialogFragment) Fragment(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment)

Example 99 with Fragment

use of androidx.fragment.app.Fragment in project Signal-Android by signalapp.

the class ConversationListFragment method updateNotificationProfileStatus.

private void updateNotificationProfileStatus(@NonNull List<NotificationProfile> notificationProfiles) {
    NotificationProfile activeProfile = NotificationProfiles.getActiveProfile(notificationProfiles);
    if (activeProfile != null) {
        if (activeProfile.getId() != SignalStore.notificationProfileValues().getLastProfilePopup()) {
            requireView().postDelayed(() -> {
                SignalStore.notificationProfileValues().setLastProfilePopup(activeProfile.getId());
                SignalStore.notificationProfileValues().setLastProfilePopupTime(System.currentTimeMillis());
                if (previousTopToastPopup != null && previousTopToastPopup.isShowing()) {
                    previousTopToastPopup.dismiss();
                }
                ViewGroup view = ((ViewGroup) requireView());
                Fragment fragment = getParentFragmentManager().findFragmentByTag(BottomSheetUtil.STANDARD_BOTTOM_SHEET_FRAGMENT_TAG);
                if (fragment != null && fragment.isAdded() && fragment.getView() != null) {
                    view = ((ViewGroup) fragment.requireView());
                }
                try {
                    previousTopToastPopup = TopToastPopup.show(view, R.drawable.ic_moon_16, getString(R.string.ConversationListFragment__s_on, activeProfile.getName()));
                } catch (Exception e) {
                    Log.w(TAG, "Unable to show toast popup", e);
                }
            }, 500L);
        }
        notificationProfileStatus.setVisibility(View.VISIBLE);
    } else {
        notificationProfileStatus.setVisibility(View.GONE);
    }
    if (!SignalStore.notificationProfileValues().getHasSeenTooltip() && Util.hasItems(notificationProfiles)) {
        View target = findOverflowMenuButton(getToolbar(requireView()));
        if (target != null) {
            TooltipPopup.forTarget(target).setText(R.string.ConversationListFragment__turn_your_notification_profile_on_or_off_here).setBackgroundTint(ContextCompat.getColor(requireContext(), R.color.signal_button_primary)).setTextColor(ContextCompat.getColor(requireContext(), R.color.signal_button_primary_text)).setOnDismissListener(() -> SignalStore.notificationProfileValues().setHasSeenTooltip(true)).show(POSITION_BELOW);
        } else {
            Log.w(TAG, "Unable to find overflow menu to show Notification Profile tooltip");
        }
    }
}
Also used : NotificationProfile(org.thoughtcrime.securesms.notifications.profiles.NotificationProfile) ViewGroup(android.view.ViewGroup) RecaptchaProofBottomSheetFragment(org.thoughtcrime.securesms.ratelimit.RecaptchaProofBottomSheetFragment) Fragment(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment) CantProcessSubscriptionPaymentBottomSheetDialogFragment(org.thoughtcrime.securesms.badges.self.expired.CantProcessSubscriptionPaymentBottomSheetDialogFragment) MainFragment(org.thoughtcrime.securesms.MainFragment) NotificationProfileSelectionFragment(org.thoughtcrime.securesms.components.settings.app.notifications.manual.NotificationProfileSelectionFragment) ConversationFragment(org.thoughtcrime.securesms.conversation.ConversationFragment) ExpiredBadgeBottomSheetDialogFragment(org.thoughtcrime.securesms.badges.self.expired.ExpiredBadgeBottomSheetDialogFragment) ImageView(android.widget.ImageView) ActionMenuView(androidx.appcompat.widget.ActionMenuView) ReminderView(org.thoughtcrime.securesms.components.reminder.ReminderView) UnreadPaymentsView(org.thoughtcrime.securesms.components.UnreadPaymentsView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) VoiceNotePlayerView(org.thoughtcrime.securesms.components.voice.VoiceNotePlayerView) TextView(android.widget.TextView) BadgeImageView(org.thoughtcrime.securesms.badges.BadgeImageView)

Example 100 with Fragment

use of androidx.fragment.app.Fragment in project Signal-Android by signalapp.

the class SafetyNumberChangeDialog method showForDuringGroupCall.

public static void showForDuringGroupCall(@NonNull FragmentManager fragmentManager, @NonNull Collection<RecipientId> recipientIds) {
    Fragment previous = fragmentManager.findFragmentByTag(SAFETY_NUMBER_DIALOG);
    if (previous != null) {
        ((SafetyNumberChangeDialog) previous).updateRecipients(recipientIds);
        return;
    }
    List<String> ids = Stream.of(recipientIds).map(RecipientId::serialize).distinct().toList();
    Bundle arguments = new Bundle();
    arguments.putStringArray(RECIPIENT_IDS_EXTRA, ids.toArray(new String[0]));
    arguments.putInt(CONTINUE_TEXT_RESOURCE_EXTRA, R.string.safety_number_change_dialog__continue_call);
    arguments.putInt(CANCEL_TEXT_RESOURCE_EXTRA, R.string.safety_number_change_dialog__leave_call);
    SafetyNumberChangeDialog fragment = new SafetyNumberChangeDialog();
    fragment.setArguments(arguments);
    fragment.show(fragmentManager, SAFETY_NUMBER_DIALOG);
}
Also used : RecipientId(org.thoughtcrime.securesms.recipients.RecipientId) Bundle(android.os.Bundle) Fragment(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment)

Aggregations

Fragment (androidx.fragment.app.Fragment)239 FragmentTransaction (androidx.fragment.app.FragmentTransaction)54 Bundle (android.os.Bundle)46 FragmentManager (androidx.fragment.app.FragmentManager)38 FileFragment (com.owncloud.android.ui.fragment.FileFragment)23 DialogFragment (androidx.fragment.app.DialogFragment)22 View (android.view.View)21 FileDetailFragment (com.owncloud.android.ui.fragment.FileDetailFragment)20 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)20 Intent (android.content.Intent)19 SortingOrderDialogFragment (com.owncloud.android.ui.dialog.SortingOrderDialogFragment)19 GalleryFragment (com.owncloud.android.ui.fragment.GalleryFragment)18 TaskRetainerFragment (com.owncloud.android.ui.fragment.TaskRetainerFragment)18 UnifiedSearchFragment (com.owncloud.android.ui.fragment.UnifiedSearchFragment)18 PreviewImageFragment (com.owncloud.android.ui.preview.PreviewImageFragment)18 PreviewMediaFragment (com.owncloud.android.ui.preview.PreviewMediaFragment)18 PreviewTextFileFragment (com.owncloud.android.ui.preview.PreviewTextFileFragment)18 PreviewTextFragment (com.owncloud.android.ui.preview.PreviewTextFragment)18 PreviewTextStringFragment (com.owncloud.android.ui.preview.PreviewTextStringFragment)18 PreviewPdfFragment (com.owncloud.android.ui.preview.pdf.PreviewPdfFragment)18