use of android.support.v4.app.FragmentManager in project SeriesGuide by UweTrottmann.
the class AddListDialogFragment method showAddListDialog.
/**
* Display a dialog which allows to edit the title of this list or remove it.
*/
public static void showAddListDialog(FragmentManager fm) {
// DialogFragment.show() will take care of adding the fragment
// in a transaction. We also want to remove any currently showing
// dialog, so make our own transaction and take care of that here.
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag("addlistdialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
// Create and show the dialog.
DialogFragment newFragment = AddListDialogFragment.newInstance();
newFragment.show(ft, "addlistdialog");
}
use of android.support.v4.app.FragmentManager in project Signal-Android by WhisperSystems.
the class ApplicationPreferencesActivity method onSupportNavigateUp.
@Override
public boolean onSupportNavigateUp() {
FragmentManager fragmentManager = getSupportFragmentManager();
if (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStack();
} else {
Intent intent = new Intent(this, ConversationListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
return true;
}
use of android.support.v4.app.FragmentManager in project ViewPagerIndicator by LuckyJayce.
the class FirstLayerFragment method onCreateViewLazy.
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
setContentView(R.layout.fragment_tabmain);
Resources res = getResources();
Bundle bundle = getArguments();
tabName = bundle.getString(INTENT_STRING_TABNAME);
index = bundle.getInt(INTENT_INT_INDEX);
ViewPager viewPager = (ViewPager) findViewById(R.id.fragment_tabmain_viewPager);
Indicator indicator = (Indicator) findViewById(R.id.fragment_tabmain_indicator);
switch(index) {
case 0:
indicator.setScrollBar(new ColorBar(getApplicationContext(), Color.RED, 5));
break;
case 1:
indicator.setScrollBar(new ColorBar(getApplicationContext(), Color.RED, 0, Gravity.CENTENT_BACKGROUND));
break;
case 2:
indicator.setScrollBar(new ColorBar(getApplicationContext(), Color.RED, 5, Gravity.TOP));
break;
case 3:
indicator.setScrollBar(new LayoutBar(getApplicationContext(), R.layout.layout_slidebar, Gravity.CENTENT_BACKGROUND));
break;
}
float unSelectSize = 16;
float selectSize = unSelectSize * 1.2f;
int selectColor = res.getColor(R.color.tab_top_text_2);
int unSelectColor = res.getColor(R.color.tab_top_text_1);
indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(selectColor, unSelectColor).setSize(selectSize, unSelectSize));
viewPager.setOffscreenPageLimit(4);
indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
inflate = LayoutInflater.from(getApplicationContext());
// 注意这里 的FragmentManager 是 getChildFragmentManager(); 因为是在Fragment里面
// 而在activity里面用FragmentManager 是 getSupportFragmentManager()
indicatorViewPager.setAdapter(new MyAdapter(getChildFragmentManager()));
Log.d("cccc", "Fragment 将要创建View " + this);
}
use of android.support.v4.app.FragmentManager in project Fragmentation by YoKeyword.
the class FragmentationDelegate method replaceTransaction.
/**
* replace事务, 主要用于子Fragment之间的replace
*/
void replaceTransaction(FragmentManager fragmentManager, int containerId, SupportFragment to, boolean addToBack) {
fragmentManager = checkFragmentManager(fragmentManager, null);
if (fragmentManager == null)
return;
checkNotNull(to, "toFragment == null");
bindContainerId(containerId, to);
FragmentTransaction ft = fragmentManager.beginTransaction();
ft.replace(containerId, to, to.getClass().getName());
if (addToBack) {
ft.addToBackStack(to.getClass().getName());
}
Bundle bundle = to.getArguments();
bundle.putBoolean(FRAGMENTATION_ARG_IS_ROOT, true);
supportCommit(fragmentManager, ft);
}
use of android.support.v4.app.FragmentManager in project Fragmentation by YoKeyword.
the class FragmentationDelegate method handleLaunchMode.
/**
* handle LaunchMode
*/
private boolean handleLaunchMode(FragmentManager fragmentManager, SupportFragment toFragment, String toFragmentTag, int launchMode) {
SupportFragment topFragment = getTopFragment(fragmentManager);
if (topFragment == null)
return false;
Fragment stackToFragment = findStackFragment(toFragment.getClass(), toFragmentTag, fragmentManager);
if (stackToFragment == null)
return false;
if (launchMode == SupportFragment.SINGLETOP) {
// 在栈顶
if (toFragment == topFragment || toFragment.getClass().getName().equals(topFragment.getClass().getName())) {
handleNewBundle(toFragment, stackToFragment);
return true;
}
} else if (launchMode == SupportFragment.SINGLETASK) {
popToFix(toFragmentTag, 0, fragmentManager);
handleNewBundle(toFragment, stackToFragment);
return true;
}
return false;
}
Aggregations