use of android.app.FragmentTransaction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsActivity method startPreferenceFragment.
/**
* Start a new fragment.
*
* @param fragment The fragment to start
* @param push If true, the current fragment will be pushed onto the back stack. If false,
* the current fragment will be replaced.
*/
public void startPreferenceFragment(Fragment fragment, boolean push) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, fragment);
if (push) {
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
} else {
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
}
transaction.commitAllowingStateLoss();
}
use of android.app.FragmentTransaction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ExpandedDesktop method removeFragment.
private void removeFragment() {
FragmentManager fragmentManager = getChildFragmentManager();
Fragment fragment = fragmentManager.findFragmentByTag(EXPANDED_DESKTOP_PREFERENCE_TAG);
if (fragment != null) {
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.remove(fragment).commit();
}
}
use of android.app.FragmentTransaction in project android_frameworks_base by ResurrectionRemix.
the class BiDiTestActivity method onListItemClick.
private void onListItemClick(ListView lv, View v, int position, long id) {
// Show the test
Map<String, Object> map = (Map<String, Object>) lv.getItemAtPosition(position);
int fragmentId = (Integer) map.get(KEY_FRAGMENT_ID);
Fragment fragment = getFragmentManager().findFragmentById(fragmentId);
if (fragment == null) {
try {
// Create an instance of the test
Class<? extends Fragment> clazz = (Class<? extends Fragment>) map.get(KEY_CLASS);
fragment = clazz.newInstance();
// Replace the old test fragment with the new one
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.testframe, fragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
}
use of android.app.FragmentTransaction in project Android-IMSI-Catcher-Detector by CellularPrivacy.
the class MapPrefActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapPrefFragment settingsFragment = new MapPrefFragment();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(android.R.id.content, settingsFragment);
fragmentTransaction.commit();
}
use of android.app.FragmentTransaction in project Android-IMSI-Catcher-Detector by CellularPrivacy.
the class PrefActivity method loadFragment.
private void loadFragment() {
PrefFragment settingsFragment = new PrefFragment();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(android.R.id.content, settingsFragment);
fragmentTransaction.commit();
}
Aggregations