Search in sources :

Example 26 with FragmentTransaction

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();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 27 with FragmentTransaction

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();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Bundle(android.os.Bundle) ActionBar(android.app.ActionBar)

Example 28 with FragmentTransaction

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();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Test(org.junit.Test)

Example 29 with FragmentTransaction

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));
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) Test(org.junit.Test)

Example 30 with FragmentTransaction

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"));
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Test(org.junit.Test)

Aggregations

FragmentTransaction (androidx.fragment.app.FragmentTransaction)176 Fragment (androidx.fragment.app.Fragment)57 FragmentManager (androidx.fragment.app.FragmentManager)53 Bundle (android.os.Bundle)25 Test (org.junit.Test)14 DialogFragment (androidx.fragment.app.DialogFragment)10 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)6 View (android.view.View)5 Intent (android.content.Intent)4 ActionBar (androidx.appcompat.app.ActionBar)4 Toolbar (androidx.appcompat.widget.Toolbar)4 SwipeRefreshListFragment (eu.siacs.conversations.ui.widget.SwipeRefreshListFragment)4 MediaGalleryFragment (org.thoughtcrime.securesms.mediasend.v2.gallery.MediaGalleryFragment)4 SuppressLint (android.annotation.SuppressLint)3 Activity (android.app.Activity)3 FragmentActivity (androidx.fragment.app.FragmentActivity)3 SslUntrustedCertDialog (com.owncloud.android.ui.dialog.SslUntrustedCertDialog)3 TargetApi (android.annotation.TargetApi)2 PreferenceFrameLayout (android.preference.PreferenceFrameLayout)2 VisibleForTesting (androidx.annotation.VisibleForTesting)2