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);
}
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();
}
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;
}
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();
}
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();
}
Aggregations