Redirect all profile settings menu to new MainSettingsFragment
This commit is contained in:
parent
be9d72b620
commit
1edd6f3bbb
4 changed files with 22 additions and 20 deletions
|
@ -133,6 +133,7 @@ import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
||||||
import net.osmand.plus.settings.BaseSettingsFragment;
|
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||||
import net.osmand.plus.settings.BaseSettingsFragment.SettingsScreenType;
|
import net.osmand.plus.settings.BaseSettingsFragment.SettingsScreenType;
|
||||||
import net.osmand.plus.settings.DataStorageFragment;
|
import net.osmand.plus.settings.DataStorageFragment;
|
||||||
|
import net.osmand.plus.settings.MainSettingsFragment;
|
||||||
import net.osmand.plus.settings.ProfileAppearanceFragment;
|
import net.osmand.plus.settings.ProfileAppearanceFragment;
|
||||||
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
|
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
|
@ -683,6 +684,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MainSettingsFragment mainSettingsFragment = getMainSettingsFragment();
|
||||||
|
if (mainSettingsFragment != null) {
|
||||||
|
mainSettingsFragment.close();
|
||||||
|
}
|
||||||
if (mapContextMenu.isVisible() && mapContextMenu.isClosable()) {
|
if (mapContextMenu.isVisible() && mapContextMenu.isClosable()) {
|
||||||
if (mapContextMenu.getCurrentMenuState() != MenuState.HEADER_ONLY && !isLandscapeLayout()) {
|
if (mapContextMenu.getCurrentMenuState() != MenuState.HEADER_ONLY && !isLandscapeLayout()) {
|
||||||
mapContextMenu.openMenuHeaderOnly();
|
mapContextMenu.openMenuHeaderOnly();
|
||||||
|
@ -2415,6 +2420,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
return getFragment(QuickActionListFragment.TAG);
|
return getFragment(QuickActionListFragment.TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MainSettingsFragment getMainSettingsFragment() {
|
||||||
|
return getFragment(MainSettingsFragment.TAG);
|
||||||
|
}
|
||||||
|
|
||||||
<T> T getFragment(String fragmentTag){
|
<T> T getFragment(String fragmentTag){
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
Fragment fragment = getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
||||||
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (T) fragment : null;
|
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (T) fragment : null;
|
||||||
|
|
|
@ -59,7 +59,6 @@ import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
|
||||||
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
|
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
|
||||||
import net.osmand.plus.measurementtool.MeasurementToolFragment;
|
import net.osmand.plus.measurementtool.MeasurementToolFragment;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.profiles.SettingsProfileActivity;
|
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.routepreparationmenu.WaypointsFragment;
|
import net.osmand.plus.routepreparationmenu.WaypointsFragment;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
|
@ -706,9 +705,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.setListener(new ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
|
||||||
Intent intent = new Intent(app, SettingsProfileActivity.class);
|
BaseSettingsFragment.showInstance(mapActivity, BaseSettingsFragment.SettingsScreenType.MAIN_SETTINGS);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
app.startActivity(intent);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -19,7 +19,6 @@ import android.support.transition.Transition;
|
||||||
import android.support.transition.TransitionListenerAdapter;
|
import android.support.transition.TransitionListenerAdapter;
|
||||||
import android.support.transition.TransitionManager;
|
import android.support.transition.TransitionManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.widget.AppCompatImageView;
|
import android.support.v7.widget.AppCompatImageView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -70,9 +69,6 @@ import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenuFragment;
|
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenuFragment;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkerSelectionFragment;
|
import net.osmand.plus.mapmarkers.MapMarkerSelectionFragment;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.profiles.AppModesBottomSheetDialogFragment;
|
|
||||||
import net.osmand.plus.profiles.AppModesBottomSheetDialogFragment.UpdateMapRouteMenuListener;
|
|
||||||
import net.osmand.plus.profiles.ConfigureAppModesBottomSheetDialogFragment;
|
|
||||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidPTTypesRoutingParameter;
|
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidPTTypesRoutingParameter;
|
||||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidRoadsRoutingParameter;
|
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidRoadsRoutingParameter;
|
||||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameter;
|
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameter;
|
||||||
|
@ -98,6 +94,7 @@ import net.osmand.plus.routing.IRouteInformationListener;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.routing.TransportRoutingHelper;
|
import net.osmand.plus.routing.TransportRoutingHelper;
|
||||||
import net.osmand.plus.search.QuickSearchHelper;
|
import net.osmand.plus.search.QuickSearchHelper;
|
||||||
|
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||||
import net.osmand.plus.widgets.TextViewExProgress;
|
import net.osmand.plus.widgets.TextViewExProgress;
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
import net.osmand.router.GeneralRouter.RoutingParameter;
|
import net.osmand.router.GeneralRouter.RoutingParameter;
|
||||||
|
@ -796,16 +793,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showProfileBottomSheetDialog() {
|
private void showProfileBottomSheetDialog() {
|
||||||
final AppModesBottomSheetDialogFragment fragment = new ConfigureAppModesBottomSheetDialogFragment();
|
BaseSettingsFragment.showInstance(mapActivity, BaseSettingsFragment.SettingsScreenType.MAIN_SETTINGS);
|
||||||
fragment.setUsedOnMap(true);
|
|
||||||
fragment.setUpdateMapRouteMenuListener(new UpdateMapRouteMenuListener() {
|
|
||||||
@Override
|
|
||||||
public void updateAppModeMenu() {
|
|
||||||
updateApplicationModes();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
getMapActivity().getSupportFragmentManager().beginTransaction()
|
|
||||||
.add(fragment, ConfigureAppModesBottomSheetDialogFragment.TAG).commitAllowingStateLoss();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateApplicationMode(ApplicationMode mode, ApplicationMode next) {
|
private void updateApplicationMode(ApplicationMode mode, ApplicationMode next) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.profiles.ProfileDataObject;
|
import net.osmand.plus.profiles.ProfileDataObject;
|
||||||
import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment;
|
import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment.SelectProfileListener;
|
import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment.SelectProfileListener;
|
||||||
|
@ -38,7 +39,7 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
||||||
private static final String APP_PROFILES = "app_profiles";
|
private static final String APP_PROFILES = "app_profiles";
|
||||||
private static final String SELECTED_PROFILE = "selected_profile";
|
private static final String SELECTED_PROFILE = "selected_profile";
|
||||||
private static final String CREATE_PROFILE = "create_profile";
|
private static final String CREATE_PROFILE = "create_profile";
|
||||||
private static final String IMPORT_PROFILE = "import_profile";
|
// private static final String IMPORT_PROFILE = "import_profile";
|
||||||
private static final String REORDER_PROFILES = "reorder_profiles";
|
private static final String REORDER_PROFILES = "reorder_profiles";
|
||||||
|
|
||||||
private List<ApplicationMode> allAppModes;
|
private List<ApplicationMode> allAppModes;
|
||||||
|
@ -136,7 +137,7 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
||||||
Preference createProfile = findPreference(CREATE_PROFILE);
|
Preference createProfile = findPreference(CREATE_PROFILE);
|
||||||
createProfile.setIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_plus,
|
createProfile.setIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_plus,
|
||||||
isNightMode() ? R.color.active_color_primary_dark : R.color.active_color_primary_light));
|
isNightMode() ? R.color.active_color_primary_dark : R.color.active_color_primary_light));
|
||||||
Preference importProfile = findPreference(IMPORT_PROFILE);
|
// Preference importProfile = findPreference(IMPORT_PROFILE);
|
||||||
// importProfile.setIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_import,
|
// importProfile.setIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_import,
|
||||||
// isNightMode() ? R.color.active_color_primary_dark : R.color.active_color_primary_light));
|
// isNightMode() ? R.color.active_color_primary_dark : R.color.active_color_primary_light));
|
||||||
Preference reorderProfiles = findPreference(REORDER_PROFILES);
|
Preference reorderProfiles = findPreference(REORDER_PROFILES);
|
||||||
|
@ -198,4 +199,11 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
return selectProfileListener;
|
return selectProfileListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity != null) {
|
||||||
|
mapActivity.getMapRouteInfoMenu().updateMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue