Search in sources :

Example 56 with Fragment

use of androidx.fragment.app.Fragment 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)

Example 57 with Fragment

use of androidx.fragment.app.Fragment in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SettingsActivity method onActivityResult.

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    final List<Fragment> fragments = getSupportFragmentManager().getFragments();
    if (fragments != null) {
        for (Fragment fragment : fragments) {
            if (fragment instanceof OnActivityResultListener) {
                fragment.onActivityResult(requestCode, resultCode, data);
            }
        }
    }
}
Also used : OnActivityResultListener(com.android.settings.core.OnActivityResultListener) Fragment(androidx.fragment.app.Fragment)

Example 58 with Fragment

use of androidx.fragment.app.Fragment in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DisableDevSettingsDialogFragment method onClick.

@Override
public void onClick(DialogInterface dialog, int which) {
    Fragment fragment = getTargetFragment();
    if (!(fragment instanceof DevelopmentSettingsDashboardFragment)) {
        Log.e(TAG, "getTargetFragment return unexpected type");
    }
    final DevelopmentSettingsDashboardFragment host = (DevelopmentSettingsDashboardFragment) fragment;
    if (which == DialogInterface.BUTTON_POSITIVE) {
        host.onDisableDevelopmentOptionsConfirmed();
        PowerManager pm = getContext().getSystemService(PowerManager.class);
        pm.reboot(null);
    } else {
        host.onDisableDevelopmentOptionsRejected();
    }
}
Also used : PowerManager(android.os.PowerManager) Fragment(androidx.fragment.app.Fragment) InstrumentedDialogFragment(com.android.settings.core.instrumentation.InstrumentedDialogFragment)

Example 59 with Fragment

use of androidx.fragment.app.Fragment in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class HighPowerDetail method onDismiss.

@Override
public void onDismiss(DialogInterface dialog) {
    super.onDismiss(dialog);
    Fragment target = getTargetFragment();
    if (target != null && target.getActivity() != null) {
        target.onActivityResult(getTargetRequestCode(), 0, null);
    }
}
Also used : Fragment(androidx.fragment.app.Fragment) InstrumentedDialogFragment(com.android.settings.core.instrumentation.InstrumentedDialogFragment)

Example 60 with Fragment

use of androidx.fragment.app.Fragment in project SeriesGuide by UweTrottmann.

the class HistoryActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_singlepane);
    setupActionBar();
    if (savedInstanceState == null) {
        int historyType = getIntent().getIntExtra(InitBundle.HISTORY_TYPE, -1);
        Fragment f;
        if (historyType == DISPLAY_EPISODE_HISTORY) {
            f = new UserEpisodeStreamFragment();
        } else if (historyType == DISPLAY_MOVIE_HISTORY) {
            f = new UserMovieStreamFragment();
        } else {
            // default to episode history
            Timber.w("onCreate: did not specify a valid HistoryType in the launch intent.");
            f = new UserEpisodeStreamFragment();
        }
        f.setArguments(getIntent().getExtras());
        getSupportFragmentManager().beginTransaction().add(R.id.content_frame, f).commit();
    }
}
Also used : Fragment(androidx.fragment.app.Fragment) AddShowDialogFragment(com.battlelancer.seriesguide.ui.search.AddShowDialogFragment)

Aggregations

Fragment (androidx.fragment.app.Fragment)239 FragmentTransaction (androidx.fragment.app.FragmentTransaction)54 Bundle (android.os.Bundle)46 FragmentManager (androidx.fragment.app.FragmentManager)38 FileFragment (com.owncloud.android.ui.fragment.FileFragment)23 DialogFragment (androidx.fragment.app.DialogFragment)22 View (android.view.View)21 FileDetailFragment (com.owncloud.android.ui.fragment.FileDetailFragment)20 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)20 Intent (android.content.Intent)19 SortingOrderDialogFragment (com.owncloud.android.ui.dialog.SortingOrderDialogFragment)19 GalleryFragment (com.owncloud.android.ui.fragment.GalleryFragment)18 TaskRetainerFragment (com.owncloud.android.ui.fragment.TaskRetainerFragment)18 UnifiedSearchFragment (com.owncloud.android.ui.fragment.UnifiedSearchFragment)18 PreviewImageFragment (com.owncloud.android.ui.preview.PreviewImageFragment)18 PreviewMediaFragment (com.owncloud.android.ui.preview.PreviewMediaFragment)18 PreviewTextFileFragment (com.owncloud.android.ui.preview.PreviewTextFileFragment)18 PreviewTextFragment (com.owncloud.android.ui.preview.PreviewTextFragment)18 PreviewTextStringFragment (com.owncloud.android.ui.preview.PreviewTextStringFragment)18 PreviewPdfFragment (com.owncloud.android.ui.preview.pdf.PreviewPdfFragment)18