use of com.peterlaurence.trekadvisor.menu.maplist.MapSettingsFragment in project TrekAdvisor by peterLaurence.
the class MainActivity method showMapSettingsFragment.
private void showMapSettingsFragment(String mapName) {
/* Remove single-usage fragments */
removeSingleUsageFragments();
/* Hide other fragments */
FragmentTransaction hideTransaction = fragmentManager.beginTransaction();
hideOtherFragments(hideTransaction, MAP_SETTINGS_FRAGMENT_TAG);
hideTransaction.commit();
FragmentTransaction transaction = fragmentManager.beginTransaction();
Fragment mapSettingsFragment = fragmentManager.findFragmentByTag(MAP_SETTINGS_FRAGMENT_TAG);
/* Show the map settings fragment if it exists */
if (mapSettingsFragment == null) {
mapSettingsFragment = createMapSettingsFragment(transaction, mapName);
} else {
/* If it already exists, set the Map */
((MapSettingsFragment) mapSettingsFragment).setMap(mapName);
}
transaction.show(mapSettingsFragment);
/* Manually manage the back action*/
mBackFragmentTag = MAP_LIST_FRAGMENT_TAG;
transaction.commit();
}
use of com.peterlaurence.trekadvisor.menu.maplist.MapSettingsFragment in project TrekAdvisor by peterLaurence.
the class MainActivity method removeSingleUsageFragments.
private void removeSingleUsageFragments() {
FragmentTransaction transaction = fragmentManager.beginTransaction();
/* Remove the calibration fragment */
Fragment mapCalibrationFragment = fragmentManager.findFragmentByTag(MAP_CALIBRATION_FRAGMENT_TAG);
if (mapCalibrationFragment != null) {
transaction.remove(mapCalibrationFragment);
}
/* Remove the fragment for tracks management */
Fragment tracksManageFragment = fragmentManager.findFragmentByTag(TRACKS_MANAGE_FRAGMENT_TAG);
if (tracksManageFragment != null) {
transaction.remove(tracksManageFragment);
}
/* Remove the fragment for marker management */
Fragment markerManageFragment = fragmentManager.findFragmentByTag(MARKER_MANAGE_FRAGMENT_TAG);
if (markerManageFragment != null) {
transaction.remove(markerManageFragment);
}
/* Remove the map-import fragment */
Fragment mapImportFragment = fragmentManager.findFragmentByTag(MAP_IMPORT_FRAGMENT_TAG);
if (mapImportFragment != null) {
transaction.remove(mapImportFragment);
}
/* Remove the map-settings fragment */
Fragment mapSettingsFragment = fragmentManager.findFragmentByTag(MAP_SETTINGS_FRAGMENT_TAG);
if (mapSettingsFragment != null) {
transaction.remove(mapSettingsFragment);
}
/* Remove the record fragment */
Fragment recordFragment = fragmentManager.findFragmentByTag(RECORD_FRAGMENT_TAG);
if (recordFragment != null) {
transaction.remove(recordFragment);
}
transaction.commit();
}
use of com.peterlaurence.trekadvisor.menu.maplist.MapSettingsFragment in project TrekAdvisor by peterLaurence.
the class MainActivity method createMapSettingsFragment.
private Fragment createMapSettingsFragment(FragmentTransaction transaction, String mapName) {
Fragment mapSettingsFragment = MapSettingsFragment.newInstance(mapName);
transaction.add(R.id.content_frame, mapSettingsFragment, MAP_SETTINGS_FRAGMENT_TAG);
return mapSettingsFragment;
}
Aggregations