Search in sources :

Example 21 with FragmentManager

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

Example 22 with FragmentManager

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, "");
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FormDialogFragment(com.skocken.presentation.sample.fragment.FormDialogFragment) FormWithFragmentActivity(com.skocken.presentation.sample.activity.FormWithFragmentActivity) FragmentActivity(androidx.fragment.app.FragmentActivity) FormActivity(com.skocken.presentation.sample.activity.FormActivity) FormWithFragmentActivity(com.skocken.presentation.sample.activity.FormWithFragmentActivity) Activity(android.app.Activity) FragmentActivity(androidx.fragment.app.FragmentActivity)

Example 23 with 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);
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager)

Example 24 with FragmentManager

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();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Fragment(androidx.fragment.app.Fragment) ContextualCardsFragment(com.android.settings.homepage.contextualcards.ContextualCardsFragment)

Example 25 with FragmentManager

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();
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) Window(android.view.Window) Intent(android.content.Intent) Fragment(androidx.fragment.app.Fragment)

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