use of androidx.fragment.app.FragmentTransaction in project LshUtils by SenhLinsh.
the class FragmentUtilsEx method replaceFragment.
/**
* 创建切换 replace
*
* @param fragment Fragment
* @param containerViewId 容器 id
* @param activity Activity
*/
public static void replaceFragment(Fragment fragment, int containerViewId, AppCompatActivity activity) {
if (fragment != null) {
FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
transaction.replace(containerViewId, fragment);
transaction.commit();
}
}
use of androidx.fragment.app.FragmentTransaction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BackgroundCheckSummary method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// initialize the inflater
mInflater = inflater;
View rootView = mInflater.inflate(R.layout.background_check_summary, container, false);
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
}
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.add(R.id.appops_content, new AppOpsCategory(AppOpsState.RUN_IN_BACKGROUND_TEMPLATE), "appops");
ft.commitAllowingStateLoss();
return rootView;
}
use of androidx.fragment.app.FragmentTransaction 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();
}
use of androidx.fragment.app.FragmentTransaction in project SeriesGuide by UweTrottmann.
the class StatsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_stats);
setupActionBar();
setupBottomNavigation(R.id.navigation_item_stats);
if (savedInstanceState == null) {
StatsFragment f = new StatsFragment();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.content_frame, f);
ft.commit();
}
}
use of androidx.fragment.app.FragmentTransaction in project AndroidUtilCode by Blankj.
the class FragmentUtils method add.
/**
* Add fragment.
*
* @param fm The manager of fragment.
* @param add The fragment will be add.
* @param containerId The id of container.
* @param isAddStack True to add fragment in stack, false otherwise.
* @param sharedElements A View in a disappearing Fragment to match with a View in an
* appearing Fragment.
*/
public static void add(@NonNull final FragmentManager fm, @NonNull final Fragment add, @IdRes final int containerId, final String tag, final boolean isAddStack, @NonNull final View... sharedElements) {
FragmentTransaction ft = fm.beginTransaction();
putArgs(add, new Args(containerId, tag, false, isAddStack));
addSharedElement(ft, sharedElements);
operate(TYPE_ADD_FRAGMENT, fm, ft, null, add);
}
Aggregations