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