use of android.support.v4.app.Fragment in project UltimateAndroid by cymcsg.
the class BasicUtils method addFragmentToActivity.
/**
* The {@code fragment} is added to the container view with id {@code frameId}. The operation is
* performed by the {@code fragmentManager}.
*/
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, int frameId) {
Preconditions.checkNotNull(fragmentManager);
Preconditions.checkNotNull(fragment);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.add(frameId, fragment);
transaction.commit();
}
use of android.support.v4.app.Fragment in project android-betterpickers by code-troopers.
the class SampleNumberUsingFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.frame_layout);
Fragment fragment = new SampleNumberFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.frame, fragment);
transaction.commit();
}
use of android.support.v4.app.Fragment in project Android-PanesLibrary by cricklet.
the class PhoneDelegate method setMenuFragment.
@Override
public void setMenuFragment(Fragment f) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.menu_frame, f);
ft.commit();
wMenuFragment = new WeakReference<Fragment>(f);
}
use of android.support.v4.app.Fragment in project Android-PanesLibrary by cricklet.
the class PhoneDelegate method getMenuFragment.
@Override
public Fragment getMenuFragment() {
Fragment f = wMenuFragment.get();
if (f == null) {
f = getSupportFragmentManager().findFragmentById(R.id.menu_frame);
wMenuFragment = new WeakReference<Fragment>(f);
}
return f;
}
use of android.support.v4.app.Fragment in project Android-PanesLibrary by cricklet.
the class TabletDelegate method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
if (findViewById(R.id.content_frame) == null) {
setContentView(R.layout.panes_layout);
} else {
View.inflate(getActivity(), R.layout.panes_layout, (ViewGroup) findViewById(R.id.content_frame));
}
panesLayout = (PanesLayout) findViewById(R.id.panes);
panesLayout.setOnIndexChangedListener(this);
if (savedInstanceState != null) {
int[] panesType = savedInstanceState.getIntArray("PanesLayout_panesType");
boolean[] panesFocused = savedInstanceState.getBooleanArray("PanesLayout_panesFocused");
int currentIndex = savedInstanceState.getInt("PanesLayout_currentIndex");
for (int i = 0; i < panesType.length; i++) {
panesLayout.addPane(panesType[i], panesFocused[i]);
}
panesLayout.setIndex(currentIndex);
}
if (savedInstanceState != null) {
FragmentManager fm = getSupportFragmentManager();
for (int index = 0; index < panesLayout.getNumPanes(); index++) {
int id = panesLayout.getPane(index).getInnerId();
Fragment f = fm.findFragmentById(id);
fragmentStack.add(f);
}
}
}
Aggregations