use of androidx.fragment.app.FragmentTransaction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiDppConfiguratorActivity method showQrCodeGeneratorFragment.
private void showQrCodeGeneratorFragment() {
WifiDppQrCodeGeneratorFragment fragment = (WifiDppQrCodeGeneratorFragment) mFragmentManager.findFragmentByTag(WifiDppUtils.TAG_FRAGMENT_QR_CODE_GENERATOR);
if (fragment == null) {
fragment = new WifiDppQrCodeGeneratorFragment();
} else {
if (fragment.isVisible()) {
return;
}
// When the fragment in back stack but not on top of the stack, we can simply pop
// stack because current fragment transactions are arranged in an order
mFragmentManager.popBackStackImmediate();
return;
}
final FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, fragment, WifiDppUtils.TAG_FRAGMENT_QR_CODE_GENERATOR);
fragmentTransaction.commit();
}
use of androidx.fragment.app.FragmentTransaction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiDppChooseSavedWifiNetworkFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null) {
actionBar.hide();
}
/**
* Embeded WifiNetworkListFragment as child fragment within
* WifiDppChooseSavedWifiNetworkFragment.
*/
final FragmentManager fragmentManager = getChildFragmentManager();
final WifiNetworkListFragment fragment = new WifiNetworkListFragment();
final Bundle args = getArguments();
if (args != null) {
fragment.setArguments(args);
}
final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.wifi_network_list_container, fragment, TAG_FRAGMENT_WIFI_NETWORK_LIST);
fragmentTransaction.commit();
}
use of androidx.fragment.app.FragmentTransaction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDetailsButtonsControllerTest method forgetDialog.
@Test
public void forgetDialog() {
showScreen(mController);
FragmentManager fragmentManager = mock(FragmentManager.class);
when(mFragment.getFragmentManager()).thenReturn(fragmentManager);
FragmentTransaction ft = mock(FragmentTransaction.class);
when(fragmentManager.beginTransaction()).thenReturn(ft);
mForgetButton.callOnClick();
ArgumentCaptor<ForgetDeviceDialogFragment> dialogCaptor = ArgumentCaptor.forClass(ForgetDeviceDialogFragment.class);
verify(ft).add(dialogCaptor.capture(), anyString());
ForgetDeviceDialogFragment dialogFragment = dialogCaptor.getValue();
assertThat(dialogFragment).isNotNull();
}
use of androidx.fragment.app.FragmentTransaction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AutomaticStorageManagementSwitchPreferenceControllerTest method togglingOnShouldNotTriggerWarningFragmentIfEnabledByDefault.
@Test
public void togglingOnShouldNotTriggerWarningFragmentIfEnabledByDefault() {
final FragmentTransaction transaction = mock(FragmentTransaction.class);
when(mFragmentManager.beginTransaction()).thenReturn(transaction);
SystemProperties.set(AutomaticStorageManagementSwitchPreferenceController.STORAGE_MANAGER_ENABLED_BY_DEFAULT_PROPERTY, "true");
mController.onSwitchToggled(true);
verify(transaction, never()).add(any(), eq(ActivationWarningFragment.TAG));
}
use of androidx.fragment.app.FragmentTransaction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InstantAppButtonsPreferenceControllerTest method clickClearAppButton_shouldLaunchInstantAppButtonDialogFragment.
@Test
public void clickClearAppButton_shouldLaunchInstantAppButtonDialogFragment() {
final FragmentManager fragmentManager = mock(FragmentManager.class);
final FragmentTransaction fragmentTransaction = mock(FragmentTransaction.class);
when(mFragment.getFragmentManager()).thenReturn(fragmentManager);
when(fragmentManager.beginTransaction()).thenReturn(fragmentTransaction);
mController.displayPreference(mScreen);
mClearAppButton.callOnClick();
verify(fragmentTransaction).add(any(InstantAppButtonDialogFragment.class), eq("instant_app_buttons"));
}
Aggregations