Search in sources :

Example 31 with FragmentManager

use of androidx.fragment.app.FragmentManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ClearAdbKeysWarningDialog method show.

public static void show(Fragment host) {
    final FragmentManager manager = host.getActivity().getSupportFragmentManager();
    if (manager.findFragmentByTag(TAG) == null) {
        final ClearAdbKeysWarningDialog dialog = new ClearAdbKeysWarningDialog();
        dialog.setTargetFragment(host, 0);
        dialog.show(manager, TAG);
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager)

Example 32 with FragmentManager

use of androidx.fragment.app.FragmentManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WirelessAdbWarningDialog method show.

public static void show(Fragment host) {
    final FragmentManager manager = host.getActivity().getSupportFragmentManager();
    if (manager.findFragmentByTag(TAG) == null) {
        final WirelessAdbWarningDialog dialog = new WirelessAdbWarningDialog();
        dialog.setTargetFragment(host, 0);
        dialog.show(manager, TAG);
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager)

Example 33 with FragmentManager

use of androidx.fragment.app.FragmentManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ZenModeScheduleRuleSettings method onCreateInternal.

@Override
protected void onCreateInternal() {
    final PreferenceScreen root = getPreferenceScreen();
    mDays = root.findPreference(KEY_DAYS);
    mDays.setOnPreferenceClickListener(new OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            showDaysDialog();
            return true;
        }
    });
    final FragmentManager mgr = getFragmentManager();
    mStart = new TimePickerPreference(getPrefContext(), mgr);
    mStart.setKey(KEY_START_TIME);
    mStart.setTitle(R.string.zen_mode_start_time);
    mStart.setCallback(new TimePickerPreference.Callback() {

        @Override
        public boolean onSetTime(final int hour, final int minute) {
            if (mDisableListeners)
                return true;
            if (!ZenModeConfig.isValidHour(hour))
                return false;
            if (!ZenModeConfig.isValidMinute(minute))
                return false;
            if (hour == mSchedule.startHour && minute == mSchedule.startMinute) {
                return true;
            }
            if (DEBUG)
                Log.d(TAG, "onPrefChange start h=" + hour + " m=" + minute);
            mSchedule.startHour = hour;
            mSchedule.startMinute = minute;
            updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
            return true;
        }
    });
    root.addPreference(mStart);
    mStart.setDependency(mDays.getKey());
    mEnd = new TimePickerPreference(getPrefContext(), mgr);
    mEnd.setKey(KEY_END_TIME);
    mEnd.setTitle(R.string.zen_mode_end_time);
    mEnd.setCallback(new TimePickerPreference.Callback() {

        @Override
        public boolean onSetTime(final int hour, final int minute) {
            if (mDisableListeners)
                return true;
            if (!ZenModeConfig.isValidHour(hour))
                return false;
            if (!ZenModeConfig.isValidMinute(minute))
                return false;
            if (hour == mSchedule.endHour && minute == mSchedule.endMinute) {
                return true;
            }
            if (DEBUG)
                Log.d(TAG, "onPrefChange end h=" + hour + " m=" + minute);
            mSchedule.endHour = hour;
            mSchedule.endMinute = minute;
            updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
            return true;
        }
    });
    root.addPreference(mEnd);
    mEnd.setDependency(mDays.getKey());
    mExitAtAlarm = (SwitchPreference) root.findPreference(KEY_EXIT_AT_ALARM);
    mExitAtAlarm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

        @Override
        public boolean onPreferenceChange(Preference preference, Object o) {
            mSchedule.exitAtAlarm = (Boolean) o;
            updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
            return true;
        }
    });
}
Also used : OnPreferenceClickListener(androidx.preference.Preference.OnPreferenceClickListener) FragmentManager(androidx.fragment.app.FragmentManager) PreferenceScreen(androidx.preference.PreferenceScreen) SwitchPreference(androidx.preference.SwitchPreference) Preference(androidx.preference.Preference)

Example 34 with FragmentManager

use of androidx.fragment.app.FragmentManager in project AndroidUtilCode by Blankj.

the class FragmentUtils method replace.

/**
 * Replace fragment.
 *
 * @param srcFragment    The source of fragment.
 * @param destFragment   The destination of fragment.
 * @param destTag        The destination of fragment's tag.
 * @param isAddStack     True to add fragment in stack, false otherwise.
 * @param sharedElements A View in a disappearing Fragment to match with a View in an
 *                       appearing Fragment.
 */
public static void replace(@NonNull final Fragment srcFragment, @NonNull final Fragment destFragment, final String destTag, final boolean isAddStack, final View... sharedElements) {
    FragmentManager fm = srcFragment.getFragmentManager();
    if (fm == null)
        return;
    Args args = getArgs(srcFragment);
    replace(fm, destFragment, args.id, destTag, isAddStack, sharedElements);
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager)

Example 35 with FragmentManager

use of androidx.fragment.app.FragmentManager in project AndroidUtilCode by Blankj.

the class FragmentUtils method replace.

/**
 * Replace fragment.
 *
 * @param srcFragment  The source of fragment.
 * @param destFragment The destination of fragment.
 * @param destTag      The destination of fragment's tag.
 * @param isAddStack   True to add fragment in stack, false otherwise.
 * @param enterAnim    An animation or animator resource ID used for the enter animation on the
 *                     view of the fragment being added or attached.
 * @param exitAnim     An animation or animator resource ID used for the exit animation on the
 *                     view of the fragment being removed or detached.
 * @param popEnterAnim An animation or animator resource ID used for the enter animation on the
 *                     view of the fragment being readded or reattached caused by
 *                     popBackStack() or similar methods.
 * @param popExitAnim  An animation or animator resource ID used for the enter animation on the
 *                     view of the fragment being removed or detached caused by
 *                     popBackStack() or similar methods.
 */
public static void replace(@NonNull final Fragment srcFragment, @NonNull final Fragment destFragment, final String destTag, final boolean isAddStack, @AnimatorRes @AnimRes final int enterAnim, @AnimatorRes @AnimRes final int exitAnim, @AnimatorRes @AnimRes final int popEnterAnim, @AnimatorRes @AnimRes final int popExitAnim) {
    FragmentManager fm = srcFragment.getFragmentManager();
    if (fm == null)
        return;
    Args args = getArgs(srcFragment);
    replace(fm, destFragment, args.id, destTag, isAddStack, enterAnim, exitAnim, popEnterAnim, popExitAnim);
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager)

Aggregations

FragmentManager (androidx.fragment.app.FragmentManager)170 FragmentTransaction (androidx.fragment.app.FragmentTransaction)55 Fragment (androidx.fragment.app.Fragment)42 Bundle (android.os.Bundle)28 Test (org.junit.Test)15 Intent (android.content.Intent)13 FragmentActivity (androidx.fragment.app.FragmentActivity)10 Activity (android.app.Activity)6 View (android.view.View)6 DialogFragment (androidx.fragment.app.DialogFragment)6 TaskRetainerFragment (com.owncloud.android.ui.fragment.TaskRetainerFragment)5 ArrayList (java.util.ArrayList)5 Context (android.content.Context)4 DialogInterface (android.content.DialogInterface)3 LayoutInflater (android.view.LayoutInflater)3 MenuInflater (android.view.MenuInflater)3 Window (android.view.Window)3 TextView (android.widget.TextView)3 ViewModelProvider (androidx.lifecycle.ViewModelProvider)3 SslUntrustedCertDialog (com.owncloud.android.ui.dialog.SslUntrustedCertDialog)3