Search in sources :

Example 96 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project zype-android by zype.

the class BaseVideoActivity method showFragment.

private void showFragment(Fragment fragment) {
    Logger.d("showFragment()");
    hideProgress();
    if (mInterface != null) {
        mInterface.stop();
    }
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    if (fragment instanceof MediaControlInterface) {
        mInterface = (MediaControlInterface) fragment;
    }
    fragmentTransaction.replace(R.id.video_container, fragment, FRAGMENT_TAG_PLAYER);
    fragmentTransaction.commit();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) MediaControlInterface(com.zype.android.ui.video_details.fragments.video.MediaControlInterface) FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Example 97 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project IITB-App by wncc.

the class MainActivity method updateFragment.

/**
 * Change the active fragment to the supplied one
 */
public void updateFragment(Fragment fragment) {
    if (session.isLoggedIn() && currentUser == null) {
        currentUser = session.getCurrentUser();
    }
    Bundle bundle = fragment.getArguments();
    if (bundle == null) {
        bundle = new Bundle();
    }
    bundle.putString(Constants.SESSION_ID, session.pref.getString(Constants.SESSION_ID, ""));
    if (fragment instanceof MessMenuFragment)
        bundle.putString(Constants.USER_HOSTEL, session.isLoggedIn() && currentUser.getHostel() != null ? currentUser.getHostel() : "1");
    if (fragment instanceof SettingsFragment && session.isLoggedIn())
        bundle.putString(Constants.USER_ID, currentUser.getUserID());
    if (fragment instanceof ComplaintsFragment && session.isLoggedIn()) {
        bundle.putString(Constants.USER_ID, currentUser.getUserID());
        bundle.putString(Constants.CURRENT_USER_PROFILE_PICTURE, currentUser.getUserProfilePictureUrl());
    }
    fragment.setArguments(bundle);
    FragmentManager manager = getSupportFragmentManager();
    if (fragment instanceof FeedFragment)
        manager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    FragmentTransaction transaction = manager.beginTransaction();
    /* Animate only for UserFragment */
    if (fragment instanceof UserFragment) {
        transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.fade_out, R.anim.fade_in, R.anim.slide_out_down);
    }
    transaction.replace(R.id.framelayout_for_fragment, fragment, Utils.getTag(fragment));
    transaction.addToBackStack(Utils.getTag(fragment)).commit();
}
Also used : SettingsFragment(app.insti.fragment.SettingsFragment) FragmentManager(androidx.fragment.app.FragmentManager) ComplaintsFragment(app.insti.fragment.ComplaintsFragment) FragmentTransaction(androidx.fragment.app.FragmentTransaction) UserFragment(app.insti.fragment.UserFragment) Bundle(android.os.Bundle) MessMenuFragment(app.insti.fragment.MessMenuFragment) FeedFragment(app.insti.fragment.FeedFragment)

Example 98 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project zype-android by zype.

the class VideoDetailActivity method showThumbnailFragment.

private void showThumbnailFragment() {
    Logger.d("showThumbnailView()");
    Fragment fragment = ThumbnailFragment.newInstance();
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.replace(R.id.player_container, fragment, PlayerFragment.TAG);
    fragmentTransaction.commit();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Fragment(androidx.fragment.app.Fragment) ThumbnailFragment(com.zype.android.ui.player.ThumbnailFragment) SummaryFragment(com.zype.android.ui.video_details.fragments.summary.SummaryFragment) PlayerFragment(com.zype.android.ui.player.v2.PlayerFragment)

Example 99 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project zype-android by zype.

the class VideoDetailActivity method showPlayerFragment.

private void showPlayerFragment() {
    showProgress();
    PlayerFragment fragment = PlayerFragment.newInstance(getIntent().getStringExtra(EXTRA_VIDEO_ID));
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.replace(R.id.player_container, fragment, PlayerFragment.TAG);
    fragmentTransaction.commit();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) PlayerFragment(com.zype.android.ui.player.v2.PlayerFragment)

Example 100 with FragmentTransaction

use of androidx.fragment.app.FragmentTransaction in project IITB-App by wncc.

the class WebViewFragment method openEvent.

private void openEvent(Event event) {
    Utils.eventCache.updateCache(event);
    String eventJson = new Gson().toJson(event);
    Bundle bundle = getArguments();
    if (bundle == null)
        bundle = new Bundle();
    bundle.putString(Constants.EVENT_JSON, eventJson);
    EventFragment eventFragment = new EventFragment();
    eventFragment.setArguments(bundle);
    FragmentManager manager = getActivity().getSupportFragmentManager();
    FragmentTransaction transaction = manager.beginTransaction();
    transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.fade_out, R.anim.fade_in, R.anim.slide_out_down);
    transaction.replace(R.id.framelayout_for_fragment, eventFragment, eventFragment.getTag());
    transaction.addToBackStack(eventFragment.getTag()).commit();
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Bundle(android.os.Bundle) Gson(com.google.gson.Gson)

Aggregations

FragmentTransaction (androidx.fragment.app.FragmentTransaction)168 Fragment (androidx.fragment.app.Fragment)54 FragmentManager (androidx.fragment.app.FragmentManager)47 Bundle (android.os.Bundle)25 Test (org.junit.Test)14 DialogFragment (androidx.fragment.app.DialogFragment)9 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)6 View (android.view.View)5 Intent (android.content.Intent)4 ActionBar (androidx.appcompat.app.ActionBar)4 Toolbar (androidx.appcompat.widget.Toolbar)4 SwipeRefreshListFragment (eu.siacs.conversations.ui.widget.SwipeRefreshListFragment)4 MediaGalleryFragment (org.thoughtcrime.securesms.mediasend.v2.gallery.MediaGalleryFragment)4 SuppressLint (android.annotation.SuppressLint)3 Activity (android.app.Activity)3 FragmentActivity (androidx.fragment.app.FragmentActivity)3 SslUntrustedCertDialog (com.owncloud.android.ui.dialog.SslUntrustedCertDialog)3 TargetApi (android.annotation.TargetApi)2 PreferenceFrameLayout (android.preference.PreferenceFrameLayout)2 VisibleForTesting (androidx.annotation.VisibleForTesting)2