Search in sources :

Example 66 with FragmentTransaction

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();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 67 with FragmentTransaction

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");
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 68 with FragmentTransaction

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();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Bundle(android.os.Bundle) Intent(android.content.Intent) Fragment(androidx.fragment.app.Fragment) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 69 with FragmentTransaction

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);
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Bundle(android.os.Bundle) Test(org.junit.Test)

Example 70 with FragmentTransaction

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();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Bundle(android.os.Bundle) Test(org.junit.Test)

Aggregations

FragmentTransaction (androidx.fragment.app.FragmentTransaction)186 Fragment (androidx.fragment.app.Fragment)58 FragmentManager (androidx.fragment.app.FragmentManager)53 Bundle (android.os.Bundle)28 Test (org.junit.Test)14 DialogFragment (androidx.fragment.app.DialogFragment)10 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)6 Intent (android.content.Intent)5 View (android.view.View)5 ActionBar (androidx.appcompat.app.ActionBar)4 Toolbar (androidx.appcompat.widget.Toolbar)4 SwipeRefreshListFragment (eu.siacs.conversations.ui.widget.SwipeRefreshListFragment)4 File (java.io.File)4 MediaGalleryFragment (org.thoughtcrime.securesms.mediasend.v2.gallery.MediaGalleryFragment)4 SuppressLint (android.annotation.SuppressLint)3 Activity (android.app.Activity)3 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)3 ProcessViewerFragment (com.amaze.filemanager.ui.fragments.ProcessViewerFragment)3 SslUntrustedCertDialog (com.owncloud.android.ui.dialog.SslUntrustedCertDialog)3 TargetApi (android.annotation.TargetApi)2