use of androidx.fragment.app.FragmentTransaction in project Applozic-Android-SDK by AppLozic.
the class ContactSelectionActivity method addFragment.
public static void addFragment(FragmentActivity fragmentActivity, Fragment fragmentToAdd, String fragmentTag) {
FragmentManager supportFragmentManager = fragmentActivity.getSupportFragmentManager();
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.layout_child_activity, fragmentToAdd, fragmentTag);
if (supportFragmentManager.getBackStackEntryCount() > 1) {
supportFragmentManager.popBackStack();
}
fragmentTransaction.addToBackStack(fragmentTag);
fragmentTransaction.commitAllowingStateLoss();
supportFragmentManager.executePendingTransactions();
}
use of androidx.fragment.app.FragmentTransaction in project MTweaks-KernelAdiutorMOD by morogoku.
the class ViewUtils method showDialog.
public static void showDialog(FragmentManager manager, DialogFragment fragment) {
FragmentTransaction ft = manager.beginTransaction();
fragment.show(ft, "dialog");
}
use of androidx.fragment.app.FragmentTransaction in project android_packages_apps_Settings by omnirom.
the class MobileNetworkActivity method switchFragment.
@VisibleForTesting
void switchFragment(SubscriptionInfo subInfo) {
final FragmentManager fragmentManager = getSupportFragmentManager();
final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
final int subId = subInfo.getSubscriptionId();
final Intent intent = getIntent();
final Bundle bundle = new Bundle();
bundle.putInt(Settings.EXTRA_SUB_ID, subId);
if (intent != null && Settings.ACTION_MMS_MESSAGE_SETTING.equals(intent.getAction())) {
// highlight "mms_message" preference.
bundle.putString(EXTRA_FRAGMENT_ARG_KEY, "mms_message");
}
final String fragmentTag = buildFragmentTag(subId);
if (fragmentManager.findFragmentByTag(fragmentTag) != null) {
Log.d(TAG, "Construct fragment: " + fragmentTag);
}
final Fragment fragment = new MobileNetworkSettings();
fragment.setArguments(bundle);
fragmentTransaction.replace(R.id.content_frame, fragment, fragmentTag);
fragmentTransaction.commitAllowingStateLoss();
}
use of androidx.fragment.app.FragmentTransaction in project android_packages_apps_Settings by omnirom.
the class SavedAccessPointsWifiSettings2Test method onDestroy_shouldTerminateWorkerThread.
@Test
public void onDestroy_shouldTerminateWorkerThread() {
mSettings = new TestFragment();
final FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(mSettings, null);
fragmentTransaction.commit();
final Bundle bundle = new Bundle();
mSettings.onCreate(bundle);
mSettings.onDestroy();
assertThat(mSettings.mWorkerThread.getState()).isEqualTo(Thread.State.TERMINATED);
}
use of androidx.fragment.app.FragmentTransaction in project android_packages_apps_Settings by omnirom.
the class SavedAccessPointsWifiSettings2Test method onCreate_shouldNewSavedNetworkTracker.
@Test
public void onCreate_shouldNewSavedNetworkTracker() {
mSettings = new TestFragment();
final FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(mSettings, null);
fragmentTransaction.commit();
final Bundle bundle = new Bundle();
mSettings.onCreate(bundle);
assertThat(mSettings.mSavedNetworkTracker).isNotNull();
}
Aggregations