commit
67669eb859
6 changed files with 33 additions and 16 deletions
|
@ -496,6 +496,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
public void start() {
|
public void start() {
|
||||||
setupRouteCalculationProgressBar(pb);
|
setupRouteCalculationProgressBar(pb);
|
||||||
mapRouteInfoMenu.routeCalculationStarted();
|
mapRouteInfoMenu.routeCalculationStarted();
|
||||||
|
RoutingHelper routingHelper = getRoutingHelper();
|
||||||
|
if (routingHelper.isPublicTransportMode() || !routingHelper.isOsmandRouting()) {
|
||||||
|
dashboardOnMap.updateRouteCalculationProgress(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -588,8 +592,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
? mapLayers.getRouteLayer().getRouteLineColor(nightMode)
|
? mapLayers.getRouteLayer().getRouteLineColor(nightMode)
|
||||||
: ContextCompat.getColor(this, R.color.wikivoyage_active_light);
|
: ContextCompat.getColor(this, R.color.wikivoyage_active_light);
|
||||||
|
|
||||||
|
RoutingHelper routingHelper = getRoutingHelper();
|
||||||
pb.setProgressDrawable(AndroidUtils.createProgressDrawable(bgColor, progressColor));
|
pb.setProgressDrawable(AndroidUtils.createProgressDrawable(bgColor, progressColor));
|
||||||
pb.setIndeterminate(getRoutingHelper().isPublicTransportMode());
|
pb.setIndeterminate(routingHelper.isPublicTransportMode() || !routingHelper.isOsmandRouting());
|
||||||
pb.getIndeterminateDrawable().setColorFilter(progressColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
pb.getIndeterminateDrawable().setColorFilter(progressColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,8 +848,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
if (intent.hasExtra(EditProfileFragment.OPEN_SETTINGS)) {
|
if (intent.hasExtra(EditProfileFragment.OPEN_SETTINGS)) {
|
||||||
String settingsType = intent.getStringExtra(EditProfileFragment.OPEN_SETTINGS);
|
String settingsType = intent.getStringExtra(EditProfileFragment.OPEN_SETTINGS);
|
||||||
|
String appMode = intent.getStringExtra(EditProfileFragment.SELECTED_ITEM);
|
||||||
if (EditProfileFragment.OPEN_CONFIG_PROFILE.equals(settingsType)) {
|
if (EditProfileFragment.OPEN_CONFIG_PROFILE.equals(settingsType)) {
|
||||||
BaseSettingsFragment.showInstance(this, SettingsScreenType.CONFIGURE_PROFILE);
|
BaseSettingsFragment.showInstance(this, SettingsScreenType.CONFIGURE_PROFILE, ApplicationMode.valueOfStringKey(appMode, null));
|
||||||
}
|
}
|
||||||
setIntent(null);
|
setIntent(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,16 +369,13 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
if (dataChanged) {
|
if (dataChanged) {
|
||||||
needSaveDialog();
|
needSaveDialog();
|
||||||
} else if (getSettings() != null) {
|
} else if (getSettings() != null) {
|
||||||
activateMode(mode);
|
|
||||||
getSettings().APPLICATION_MODE.set(mode);
|
|
||||||
|
|
||||||
if (activity instanceof EditProfileActivity) {
|
if (activity instanceof EditProfileActivity) {
|
||||||
Intent i = new Intent(getActivity(), MapActivity.class);
|
Intent i = new Intent(getActivity(), MapActivity.class);
|
||||||
i.putExtra(OPEN_SETTINGS, OPEN_CONFIG_PROFILE);
|
i.putExtra(OPEN_SETTINGS, OPEN_CONFIG_PROFILE);
|
||||||
i.putExtra(SELECTED_ITEM, profile.stringKey);
|
i.putExtra(SELECTED_ITEM, profile.stringKey);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
} else {
|
} else {
|
||||||
BaseSettingsFragment.showInstance(activity, SettingsScreenType.CONFIGURE_PROFILE);
|
BaseSettingsFragment.showInstance(activity, SettingsScreenType.CONFIGURE_PROFILE, ApplicationMode.valueOfStringKey(profile.stringKey, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,11 +149,14 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
||||||
View mainView = getMainView();
|
View mainView = getMainView();
|
||||||
if (mainView != null) {
|
if (mainView != null) {
|
||||||
View progressBar = mainView.findViewById(R.id.progress_bar);
|
View progressBar = mainView.findViewById(R.id.progress_bar);
|
||||||
|
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||||
boolean progressVisible = progressBar != null && progressBar.getVisibility() == View.VISIBLE;
|
boolean progressVisible = progressBar != null && progressBar.getVisibility() == View.VISIBLE;
|
||||||
boolean routeCalculating = app.getRoutingHelper().isRouteBeingCalculated() || app.getTransportRoutingHelper().isRouteBeingCalculated();
|
boolean routeCalculating = routingHelper.isRouteBeingCalculated() || app.getTransportRoutingHelper().isRouteBeingCalculated();
|
||||||
if (progressVisible && !routeCalculating) {
|
if (progressVisible && !routeCalculating) {
|
||||||
hideRouteCalculationProgressBar();
|
hideRouteCalculationProgressBar();
|
||||||
openMenuHalfScreen();
|
openMenuHalfScreen();
|
||||||
|
} else if (!progressVisible && routeCalculating && !routingHelper.isOsmandRouting()) {
|
||||||
|
updateRouteCalculationProgress(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu.addTargetPointListener();
|
menu.addTargetPointListener();
|
||||||
|
@ -360,6 +363,11 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
||||||
return app != null && app.getRoutingHelper().isPublicTransportMode();
|
return app != null && app.getRoutingHelper().isPublicTransportMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isOsmandRouting() {
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
|
return app != null && app.getRoutingHelper().isOsmandRouting();
|
||||||
|
}
|
||||||
|
|
||||||
public void updateRouteCalculationProgress(int progress) {
|
public void updateRouteCalculationProgress(int progress) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
View mainView = getMainView();
|
View mainView = getMainView();
|
||||||
|
@ -367,11 +375,11 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
||||||
if (mapActivity == null || mainView == null || view == null) {
|
if (mapActivity == null || mainView == null || view == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean publicTransportMode = isPublicTransportMode();
|
boolean indeterminate = isPublicTransportMode() || !isOsmandRouting();
|
||||||
ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.progress_bar);
|
ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.progress_bar);
|
||||||
if (progressBar != null) {
|
if (progressBar != null) {
|
||||||
if (progress == 0) {
|
if (progress == 0) {
|
||||||
progressBar.setIndeterminate(publicTransportMode);
|
progressBar.setIndeterminate(indeterminate);
|
||||||
}
|
}
|
||||||
if (progressBar.getVisibility() != View.VISIBLE) {
|
if (progressBar.getVisibility() != View.VISIBLE) {
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
@ -383,10 +391,10 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
||||||
if (progressBarButton.getVisibility() != View.VISIBLE) {
|
if (progressBarButton.getVisibility() != View.VISIBLE) {
|
||||||
progressBarButton.setVisibility(View.VISIBLE);
|
progressBarButton.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
progressBarButton.setProgress(publicTransportMode ? 0 : progress);
|
progressBarButton.setProgress(indeterminate ? 0 : progress);
|
||||||
}
|
}
|
||||||
TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr);
|
TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr);
|
||||||
textViewExProgress.percent = publicTransportMode ? 0 : progress / 100f;
|
textViewExProgress.percent = indeterminate ? 0 : progress / 100f;
|
||||||
textViewExProgress.invalidate();
|
textViewExProgress.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1073,8 +1073,8 @@ public class RoutingHelper {
|
||||||
RouteRecalculationThread newThread = new RouteRecalculationThread(
|
RouteRecalculationThread newThread = new RouteRecalculationThread(
|
||||||
"Calculating route", params, paramsChanged); //$NON-NLS-1$
|
"Calculating route", params, paramsChanged); //$NON-NLS-1$
|
||||||
currentRunningJob = newThread;
|
currentRunningJob = newThread;
|
||||||
|
startProgress(params);
|
||||||
if (updateProgress) {
|
if (updateProgress) {
|
||||||
startProgress(params);
|
|
||||||
updateProgress(params);
|
updateProgress(params);
|
||||||
}
|
}
|
||||||
if (prevRunningJob != null) {
|
if (prevRunningJob != null) {
|
||||||
|
@ -1165,6 +1165,10 @@ public class RoutingHelper {
|
||||||
return mode.isDerivedRoutingFrom(ApplicationMode.PUBLIC_TRANSPORT);
|
return mode.isDerivedRoutingFrom(ApplicationMode.PUBLIC_TRANSPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isOsmandRouting() {
|
||||||
|
return mode.getRouteService() == RouteService.OSMAND;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRouteBeingCalculated() {
|
public boolean isRouteBeingCalculated() {
|
||||||
return currentRunningJob instanceof RouteRecalculationThread || waitingNextJob;
|
return currentRunningJob instanceof RouteRecalculationThread || waitingNextJob;
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,11 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
||||||
try {
|
try {
|
||||||
FragmentManager fragmentManager = activity.getSupportFragmentManager();
|
FragmentManager fragmentManager = activity.getSupportFragmentManager();
|
||||||
if (fragmentManager != null) {
|
if (fragmentManager != null) {
|
||||||
settings.APPLICATION_MODE.set(getSelectedAppMode());
|
ApplicationMode selectedMode = getSelectedAppMode();
|
||||||
|
if (!ApplicationMode.values(app).contains(selectedMode)) {
|
||||||
|
ApplicationMode.changeProfileAvailability(selectedMode, true, app);
|
||||||
|
}
|
||||||
|
settings.APPLICATION_MODE.set(selectedMode);
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.remove(this)
|
.remove(this)
|
||||||
.addToBackStack(TAG)
|
.addToBackStack(TAG)
|
||||||
|
|
|
@ -98,8 +98,6 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
|
||||||
if (app == null) {
|
if (app == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ApplicationMode selectedMode = getSelectedAppMode();
|
|
||||||
|
|
||||||
ApplicationMode[] appModes = ApplicationMode.values(app).toArray(new ApplicationMode[0]);
|
ApplicationMode[] appModes = ApplicationMode.values(app).toArray(new ApplicationMode[0]);
|
||||||
String[] entries = new String[appModes.length];
|
String[] entries = new String[appModes.length];
|
||||||
String[] entryValues = new String[appModes.length];
|
String[] entryValues = new String[appModes.length];
|
||||||
|
@ -109,7 +107,7 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPreferenceEx defaultApplicationMode = (ListPreferenceEx) findPreference(settings.DEFAULT_APPLICATION_MODE.getId());
|
ListPreferenceEx defaultApplicationMode = (ListPreferenceEx) findPreference(settings.DEFAULT_APPLICATION_MODE.getId());
|
||||||
defaultApplicationMode.setIcon(getContentIcon(selectedMode.getIconRes()));
|
defaultApplicationMode.setIcon(getContentIcon(settings.DEFAULT_APPLICATION_MODE.get().getIconRes()));
|
||||||
defaultApplicationMode.setEntries(entries);
|
defaultApplicationMode.setEntries(entries);
|
||||||
defaultApplicationMode.setEntryValues(entryValues);
|
defaultApplicationMode.setEntryValues(entryValues);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue