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()]));
}
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);
}
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);
}
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");
}
}
}
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);
}
Aggregations