Merge pull request #7000 from kconger/master

Add WunderLINQ support, handlebar control of your smartphone
This commit is contained in:
Alexey 2019-06-07 15:16:25 +03:00 committed by GitHub
commit db15e8aa30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 0 deletions

View file

@ -2373,6 +2373,8 @@
<string name="i_am_here">I am here</string>
<string name="zoom_by_trackball_descr">Change map zooming by horizontal trackball movement.</string>
<string name="zoom_by_trackball">Use trackball for zoom control</string>
<string name="zoom_by_wunderlinq_descr">Change map zooming by scrolling the wheel up and down. Escape returns you to the WunderLINQ App.</string>
<string name="zoom_by_wunderlinq">Use WunderLINQ for control</string>
<string name="accessibility_preferences_descr">Accessibility related preferences.</string>
<string name="arrival_distance_factor_early">Early</string>
<string name="arrival_distance_factor_normally">Normal</string>

View file

@ -103,6 +103,8 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball,
R.string.zoom_by_trackball_descr));
cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_WUNDERLINQ, R.string.zoom_by_wunderlinq,
R.string.zoom_by_wunderlinq_descr));
}

View file

@ -1029,6 +1029,10 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> ZOOM_BY_TRACKBALL =
new BooleanAccessibilityPreference("zoom_by_trackball", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> ZOOM_BY_WUNDERLINQ =
new BooleanAccessibilityPreference("zoom_by_wunderlinq", false).makeGlobal();
// magnetic field doesn'torkmost of the time on some phones
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeGlobal().cache();

View file

@ -1480,6 +1480,21 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
changeZoom(1);
return true;
}
} else if (settings.ZOOM_BY_WUNDERLINQ.get()) {
// WunderLINQ device, motorcycle smart phone control
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
changeZoom(-1);
return true;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
changeZoom(1);
return true;
} else if (keyCode == KeyEvent.KEYCODE_ESCAPE) {
String callingApp = "wunderlinq://datagrid";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(callingApp));
startActivity(intent);
return true;
}
} else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT
|| keyCode == KeyEvent.KEYCODE_DPAD_DOWN || keyCode == KeyEvent.KEYCODE_DPAD_UP) {
int dx = keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ? 15 : (keyCode == KeyEvent.KEYCODE_DPAD_LEFT ? -15 : 0);
@ -2163,4 +2178,5 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return this != NEW && this != NEW_IF_EXPIRED && this != CURRENT;
}
}
}

View file

@ -940,6 +940,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
clickRouteGo();
}
});
startButton.setFocusable(true);
startButton.requestFocus();
View cancelButton = mainView.findViewById(R.id.cancel_button);
TextView cancelButtonText = (TextView) mainView.findViewById(R.id.cancel_button_descr);
if (helper.isRouteCalculated() || helper.isRouteBeingCalculated() || isTransportRouteCalculated()) {