Search in sources :

Example 41 with FragmentTransaction

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

the class ChromecastFragment method showTracksChooserDialog.

private void showTracksChooserDialog() throws TransientNetworkDisconnectionException, NoConnectionException {
    FragmentTransaction transaction = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag(DIALOG_TAG);
    if (prev != null) {
        transaction.remove(prev);
    }
    transaction.addToBackStack(null);
    // Create and show the dialog.
    TracksChooserDialog dialogFragment = TracksChooserDialog.newInstance(mCastManager.getRemoteMediaInformation());
    dialogFragment.show(transaction, DIALOG_TAG);
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) TracksChooserDialog(com.google.android.libraries.cast.companionlibrary.cast.tracks.ui.TracksChooserDialog) Fragment(androidx.fragment.app.Fragment) BaseFragment(com.zype.android.ui.base.BaseFragment)

Example 42 with FragmentTransaction

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

the class LoginActivity method showDialog.

void showDialog() {
    DialogFragment newFragment = CustomAlertDialog.newInstance(R.string.alert_dialog_title_auth_failed, R.string.alert_dialog_message_auth_failed);
    // newFragment.show(getSupportFragmentManager(), "dialog");
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.add(newFragment, "Error credentials dialog");
    transaction.commitAllowingStateLoss();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) DialogFragment(androidx.fragment.app.DialogFragment)

Example 43 with FragmentTransaction

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

the class ComplaintsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_complaints, container, false);
    Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
    toolbar.setTitle("Complaints/Suggestions");
    Utils.setSelectedMenuItem(getActivity(), R.id.nav_complaint);
    Bundle bundle = getArguments();
    userID = bundle.getString(Constants.USER_ID);
    userProfileUrl = bundle.getString(Constants.CURRENT_USER_PROFILE_PICTURE);
    CollapsingToolbarLayout collapsingToolbarLayout = view.findViewById(R.id.collapsing_toolbar);
    collapsingToolbarLayout.setTitleEnabled(false);
    ViewPager viewPager = view.findViewById(R.id.tab_viewpager);
    slidingTabLayout = view.findViewById(R.id.sliding_tab_layout);
    Button buttonVentIssues = view.findViewById(R.id.buttonVentIssues);
    buttonVentIssues.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            FileComplaintFragment fileComplaintFragment = new FileComplaintFragment();
            fileComplaintFragment.setArguments(getArguments());
            FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
            fragmentTransaction.replace(R.id.framelayout_for_fragment, fileComplaintFragment, Utils.getTag(fileComplaintFragment));
            fragmentTransaction.addToBackStack("Complaint Fragment").commit();
        }
    });
    slidingTabLayout = view.findViewById(R.id.sliding_tab_layout);
    if (viewPager != null) {
        setupViewPager(viewPager);
    }
    return view;
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) Button(android.widget.Button) Bundle(android.os.Bundle) CollapsingToolbarLayout(com.google.android.material.appbar.CollapsingToolbarLayout) View(android.view.View) ViewPager(androidx.viewpager.widget.ViewPager) Toolbar(androidx.appcompat.widget.Toolbar)

Example 44 with FragmentTransaction

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

the class Utils method changeTheme.

public static void changeTheme(SettingsFragment fragment, boolean darkTheme) {
    isDarkTheme = darkTheme;
    FragmentActivity fragmentActivity = fragment.getActivity();
    fragmentActivity.setTheme(darkTheme ? R.style.AppThemeDark : R.style.AppTheme);
    // Set background color of activity
    fragmentActivity.findViewById(R.id.drawer_layout).setBackgroundColor(getAttrColor(fragmentActivity, R.attr.themeColor));
    // Put in a new settings fragment
    Fragment newFragment = new SettingsFragment();
    newFragment.setArguments(fragment.getArguments());
    FragmentManager fm = fragmentActivity.getSupportFragmentManager();
    fm.popBackStack();
    FragmentTransaction ft = fm.beginTransaction();
    ft.addToBackStack(getTag(fragment));
    ft.replace(R.id.framelayout_for_fragment, newFragment, getTag(fragment)).commit();
}
Also used : SettingsFragment(app.insti.fragment.SettingsFragment) FragmentManager(androidx.fragment.app.FragmentManager) FragmentActivity(androidx.fragment.app.FragmentActivity) FragmentTransaction(androidx.fragment.app.FragmentTransaction) TransitionTargetFragment(app.insti.fragment.TransitionTargetFragment) Fragment(androidx.fragment.app.Fragment) EventFragment(app.insti.fragment.EventFragment) SettingsFragment(app.insti.fragment.SettingsFragment) BodyFragment(app.insti.fragment.BodyFragment) UserFragment(app.insti.fragment.UserFragment)

Example 45 with FragmentTransaction

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

the class Utils method updateSharedElementFragment.

public static void updateSharedElementFragment(final Fragment fragment, final Fragment currentFragment, Map<View, String> sharedElements) {
    FragmentTransaction ft = currentFragment.getActivity().getSupportFragmentManager().beginTransaction();
    Transition transition = new DetailsTransition();
    /* Set up transitions */
    fragment.setSharedElementEnterTransition(transition);
    fragment.setEnterTransition(new Slide());
    currentFragment.setExitTransition(new Fade());
    fragment.setSharedElementReturnTransition(transition);
    /* Set transition for parent in case it is a child */
    if (currentFragment instanceof TransitionTargetChild) {
        ((TransitionTargetChild) currentFragment).getParent().setExitTransition(new Fade());
    }
    transition.addListener(new Transition.TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            if (fragment instanceof TransitionTargetFragment) {
                ((TransitionTargetFragment) fragment).transitionEnd();
            }
            if (currentFragment instanceof TransitionTargetFragment) {
                ((TransitionTargetFragment) currentFragment).transitionEnd();
            }
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
    /* Add all shared elements */
    for (Map.Entry<View, String> entry : sharedElements.entrySet()) {
        ft.addSharedElement(entry.getKey(), entry.getValue());
    }
    /* Update the fragment */
    ft.replace(R.id.framelayout_for_fragment, fragment, getTag(fragment)).addToBackStack(getTag(fragment)).commit();
}
Also used : NavigationView(com.google.android.material.navigation.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) FragmentTransaction(androidx.fragment.app.FragmentTransaction) TransitionTargetChild(app.insti.fragment.TransitionTargetChild) TransitionTargetFragment(app.insti.fragment.TransitionTargetFragment) Slide(androidx.transition.Slide) Transition(androidx.transition.Transition) Fade(androidx.transition.Fade) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

FragmentTransaction (androidx.fragment.app.FragmentTransaction)176 Fragment (androidx.fragment.app.Fragment)57 FragmentManager (androidx.fragment.app.FragmentManager)53 Bundle (android.os.Bundle)25 Test (org.junit.Test)14 DialogFragment (androidx.fragment.app.DialogFragment)10 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