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();
}
}
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);
}
}
}
}
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();
}
}
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);
}
}
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();
}
}
Aggregations