Search in sources :

Example 61 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project BaseProject by fly803.

the class ActivityUtils method addFragmentToActivity.

/**
 * 将一个Fragment添加到Activity中
 * @param fragmentManager fragment管理器
 * @param fragment  需要添加的fragment
 * @param frameId  布局FrameLayout的Id
 */
public static void addFragmentToActivity(FragmentManager fragmentManager, Fragment fragment, int frameId) {
    if (null != fragmentManager && null != fragment) {
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.add(frameId, fragment);
        transaction.commit();
    }
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 62 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project BaseProject by fly803.

the class ActivityUtils method replaceFragmentFromActivity.

/**
 * 替换Activity中的Fragment
 * @param fragmentManager fragment管理器
 * @param fragment  需要替换到Activity的Fragment
 * @param frameId  布局FrameLayout的Id
 */
public static void replaceFragmentFromActivity(FragmentManager fragmentManager, Fragment fragment, int frameId) {
    if (null != fragmentManager && null != fragment) {
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.replace(frameId, fragment);
        transaction.commit();
    }
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 63 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project BaseProject by fly803.

the class FragmentUtils method add.

/**
 * Add fragment.
 *
 * @param fm           The manager of fragment.
 * @param containerId  The id of container.
 * @param add          The fragment will be add.
 * @param isAddStack   True to add fragment in stack, false otherwise.
 * @param enterAnim    An animation or animator resource ID used for the enter animation on the
 *                     view of the fragment being added or attached.
 * @param exitAnim     An animation or animator resource ID used for the exit animation on the
 *                     view of the fragment being removed or detached.
 * @param popEnterAnim An animation or animator resource ID used for the enter animation on the
 *                     view of the fragment being readded or reattached caused by
 *                     popBackStack() or similar methods.
 * @param popExitAnim  An animation or animator resource ID used for the enter animation on the
 *                     view of the fragment being removed or detached caused by
 *                     popBackStack() or similar methods.
 */
public static void add(@NonNull final FragmentManager fm, @NonNull final Fragment add, @IdRes final int containerId, final boolean isAddStack, @AnimRes final int enterAnim, @AnimRes final int exitAnim, @AnimRes final int popEnterAnim, @AnimRes final int popExitAnim) {
    FragmentTransaction ft = fm.beginTransaction();
    putArgs(add, new Args(containerId, false, isAddStack));
    addAnim(ft, enterAnim, exitAnim, popEnterAnim, popExitAnim);
    operate(TYPE_ADD_FRAGMENT, fm, ft, null, add);
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 64 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project Signal-Android by signalapp.

the class MmsPreferencesActivity method onCreate.

@Override
protected void onCreate(Bundle icicle, boolean ready) {
    assert getSupportActionBar() != null;
    this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    Fragment fragment = new MmsPreferencesFragment();
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.replace(android.R.id.content, fragment);
    fragmentTransaction.commit();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Fragment(androidx.fragment.app.Fragment)

Example 65 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project Signal-Android by signalapp.

the class AvatarSelectionActivity method onNavigateToCamera.

@Override
public void onNavigateToCamera() {
    if (isCameraFirst() && popToRoot()) {
        return;
    }
    Fragment fragment = CameraFragment.newInstanceForAvatarCapture();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment, IMAGE_CAPTURE);
    if (isGalleryFirst()) {
        transaction.addToBackStack(null);
    }
    transaction.commit();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) MediaGalleryFragment(org.thoughtcrime.securesms.mediasend.v2.gallery.MediaGalleryFragment) ImageEditorFragment(org.thoughtcrime.securesms.scribbles.ImageEditorFragment) Fragment(androidx.fragment.app.Fragment)

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