This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onBackPressed() { | |
if (getChildFragmentManager().popBackStackImmediate()) { | |
BaseDialogFragment bdf = (BaseDialogFragment) getChildFragmentManager().getFragments() | |
.get(getChildFragmentManager().getFragments().size() — 1); | |
String title = getString(R.string.account_info); | |
if (bdf == null && getChildFragmentManager().findFragmentByTag(getString(R.string.order_history)) != null && getChildFragmentManager().findFragmentByTag(getString(R.string.order_history)).isVisible()) { | |
title = getString(R.string.order_history); | |
} | |
if (bdf != null) { | |
title = getNewTitle(bdf.getTitle()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (getDialog() != null) { | |
getDialog().setOnKeyListener(new OnKeyListener() { | |
@Override | |
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { | |
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { | |
onBackPressed(); | |
} | |
return true; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@color/white"> | |
<include layout="@layout/default_toolbar" /> | |
<FrameLayout | |
android:id="@+id/fragment_content" | |
android:layout_width="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void replaceFragment(DialogFragment replacementFragment, String tag, String pageTitle) { | |
FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); | |
transaction.setCustomAnimations(R.anim.slide_left_from_right, android.R.anim.fade_out, android.R.anim.fade_in, | |
R.anim.slide_out_right_from_left); | |
transaction.replace(R.id.fragment_content, replacementFragment, tag); | |
transaction.addToBackStack(tag); | |
transaction.commit(); | |
if (!TextUtils.isEmpty(pageTitle)) { | |
mToolbar.setTitle(pageTitle); | |
mToolbar.setNavigationIcon(R.drawable.ic_nav_back_green_selector); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.thredup.android.fragment; | |
import android.content.DialogInterface; | |
import android.content.DialogInterface.OnKeyListener; | |
import android.graphics.Typeface; | |
import android.os.Bundle; | |
import android.support.v4.app.DialogFragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentTransaction; | |
import android.support.v4.content.ContextCompat; |