use of androidx.fragment.app.FragmentManager in project android_packages_apps_Settings by omnirom.
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 android_packages_apps_Settings by omnirom.
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 android_packages_apps_Settings by omnirom.
the class MDNHandlerFragment method switchToMainFragment.
private void switchToMainFragment(boolean turnoffSwitch) {
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, new SmartForwardingFragment(turnoffSwitch)).commit();
}
use of androidx.fragment.app.FragmentManager in project apps-android-commons by commons-app.
the class SearchActivity method onMediaClicked.
/**
* Open media detail pager fragment on click of image in search results
* @param index item index that should be opened
*/
@Override
public void onMediaClicked(int index) {
ViewUtil.hideKeyboard(this.findViewById(R.id.searchBox));
tabLayout.setVisibility(View.GONE);
viewPager.setVisibility(View.GONE);
mediaContainer.setVisibility(View.VISIBLE);
// to remove searchview when mediaDetails fragment open
searchView.setVisibility(View.GONE);
if (mediaDetails == null || !mediaDetails.isVisible()) {
// set isFeaturedImage true for featured images, to include author field on media detail
mediaDetails = new MediaDetailPagerFragment(false, true);
FragmentManager supportFragmentManager = getSupportFragmentManager();
supportFragmentManager.beginTransaction().hide(supportFragmentManager.getFragments().get(supportFragmentManager.getBackStackEntryCount())).add(R.id.mediaContainer, mediaDetails).addToBackStack(null).commit();
// Reason for using hide, add instead of replace is to maintain scroll position after
// coming back to the search activity. See https://github.com/commons-app/apps-android-commons/issues/1631
// https://stackoverflow.com/questions/11353075/how-can-i-maintain-fragment-state-when-added-to-the-back-stack/19022550#19022550
supportFragmentManager.executePendingTransactions();
}
mediaDetails.showImage(index);
}
use of androidx.fragment.app.FragmentManager in project apps-android-commons by commons-app.
the class WikidataItemDetailsActivity method onMediaClicked.
/**
* Shows media detail fragment when user clicks on any image in the list
*/
@Override
public void onMediaClicked(int position) {
tabLayout.setVisibility(View.GONE);
viewPager.setVisibility(View.GONE);
mediaContainer.setVisibility(View.VISIBLE);
if (mediaDetailPagerFragment == null || !mediaDetailPagerFragment.isVisible()) {
// set isFeaturedImage true for featured images, to include author field on media detail
mediaDetailPagerFragment = new MediaDetailPagerFragment(false, true);
FragmentManager supportFragmentManager = getSupportFragmentManager();
supportFragmentManager.beginTransaction().replace(R.id.mediaContainer, mediaDetailPagerFragment).addToBackStack(null).commit();
supportFragmentManager.executePendingTransactions();
}
mediaDetailPagerFragment.showImage(position);
}
Aggregations