use of androidx.fragment.app.FragmentManager 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"));
}
use of androidx.fragment.app.FragmentManager in project Presentation by StanKocken.
the class FormPresenter method onClickGoFormDialogFragment.
@Override
public void onClickGoFormDialogFragment() {
Activity activity = getActivity();
if (activity instanceof FragmentActivity) {
FragmentManager fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager();
new FormDialogFragment().show(fragmentManager, "");
}
}
use of androidx.fragment.app.FragmentManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothA2dpHwOffloadRebootDialog method show.
public static void show(DevelopmentSettingsDashboardFragment host, BluetoothA2dpHwOffloadPreferenceController controller) {
final FragmentManager manager = host.getActivity().getSupportFragmentManager();
if (manager.findFragmentByTag(TAG) == null) {
final BluetoothA2dpHwOffloadRebootDialog dialog = new BluetoothA2dpHwOffloadRebootDialog();
dialog.setTargetFragment(host, 0);
dialog.show(manager, TAG);
}
}
use of androidx.fragment.app.FragmentManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsHomepageActivity method showFragment.
private void showFragment(Fragment fragment, int id) {
final FragmentManager fragmentManager = getSupportFragmentManager();
final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
final Fragment showFragment = fragmentManager.findFragmentById(id);
if (showFragment == null) {
fragmentTransaction.add(id, fragment);
} else {
fragmentTransaction.show(showFragment);
}
fragmentTransaction.commit();
}
use of androidx.fragment.app.FragmentManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsPanelActivity method createOrUpdatePanel.
private void createOrUpdatePanel(boolean shouldForceCreation) {
final Intent callingIntent = getIntent();
if (callingIntent == null) {
Log.e(TAG, "Null intent, closing Panel Activity");
finish();
return;
}
// We will use it once media output switch panel support remote device.
final String mediaPackageName = callingIntent.getStringExtra(EXTRA_PACKAGE_NAME);
mBundle.putString(KEY_PANEL_TYPE_ARGUMENT, callingIntent.getAction());
mBundle.putString(KEY_CALLING_PACKAGE_NAME, getCallingPackage());
mBundle.putString(KEY_MEDIA_PACKAGE_NAME, mediaPackageName);
final FragmentManager fragmentManager = getSupportFragmentManager();
final Fragment fragment = fragmentManager.findFragmentById(R.id.main_content);
// If fragment already exists, we will need to update panel with animation.
if (!shouldForceCreation && fragment != null && fragment instanceof PanelFragment) {
final PanelFragment panelFragment = (PanelFragment) fragment;
panelFragment.setArguments(mBundle);
((PanelFragment) fragment).updatePanelWithAnimation();
} else {
setContentView(R.layout.settings_panel);
// Move the window to the bottom of screen, and make it take up the entire screen width.
final Window window = getWindow();
window.setGravity(Gravity.BOTTOM);
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
final PanelFragment panelFragment = new PanelFragment();
panelFragment.setArguments(mBundle);
fragmentManager.beginTransaction().add(R.id.main_content, panelFragment).commit();
}
}
Aggregations