Skip to content

Commit

Permalink
Move map with own position changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sh123 committed Jul 4, 2023
1 parent 968a213 commit 7e6e0bc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;

import com.radio.codec2talkie.BuildConfig;
import com.radio.codec2talkie.R;
import com.radio.codec2talkie.protocol.Aprs;
import com.radio.codec2talkie.protocol.aprs.tools.AprsSymbolTable;
import com.radio.codec2talkie.settings.PreferenceKeys;

Expand All @@ -30,6 +32,9 @@
public class MapActivity extends AppCompatActivity {
private static final String TAG = MapActivity.class.getSimpleName();

private static final double MAP_STARTUP_ZOOM = 5.0;
private static final double MAP_FOLLOW_ZOOM = 14.0;

private MapView _mapView;
private IMapController _mapController;
private MyLocationNewOverlay _myLocationNewOverlay;
Expand All @@ -47,7 +52,7 @@ protected void onCreate(Bundle savedInstanceState) {
if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true);

Context context = getApplicationContext();
Configuration.getInstance().setUserAgentValue("C2T");
Configuration.getInstance().setUserAgentValue(Aprs.APRS_ID + " " + BuildConfig.VERSION_NAME);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);

// my symbol
Expand All @@ -61,7 +66,7 @@ protected void onCreate(Bundle savedInstanceState) {

// controller
_mapController = _mapView.getController();
_mapController.zoomTo(5.0);
_mapController.zoomTo(MAP_STARTUP_ZOOM);

// compass
InternalCompassOrientationProvider compassOrientationProvider = new InternalCompassOrientationProvider(context) {
Expand Down Expand Up @@ -149,7 +154,18 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
_mapStations.showMovingStations(showMoving);
return true;
} else if (itemId == R.id.map_menu_move_map) {
if (item.isChecked()) {
item.setChecked(false);
_myLocationNewOverlay.disableFollowLocation();
} else {
item.setChecked(true);
_myLocationNewOverlay.enableFollowLocation();
_mapController.zoomTo(MAP_FOLLOW_ZOOM);
}
return true;
}

return super.onOptionsItemSelected(item);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public void run() {
}

private String getLoginCommand() {
String cmd = "user " + new AX25Callsign(_callsign, _ssid).toString() + " pass " + _passcode + " vers " + "C2T " + BuildConfig.VERSION_NAME;
String cmd = "user " + new AX25Callsign(_callsign, _ssid).toString() + " pass " + _passcode + " vers " + Aprs.APRS_ID + " " + BuildConfig.VERSION_NAME;
if (_filterRadius > 0) {
cmd += " filter m/" + _filterRadius;
}
Expand Down
5 changes: 5 additions & 0 deletions codec2talkie/src/main/res/menu/map_menu.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/map_menu_move_map"
android:title="@string/map_menu_move_map"
android:checkable="true"
android:checked="false"/>
<item
android:id="@+id/map_menu_rotate_map"
android:title="@string/map_menu_rotate_map"
Expand Down
1 change: 1 addition & 0 deletions codec2talkie/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -369,4 +369,5 @@
<string name="map_menu_show_moving">Show moving stations</string>
<string name="aprs_text_packets_enable_title">Enable text packets</string>
<string name="aprs_text_packets_enable_summary">Send lora aprs compatible text packets (0x3c,0xff,0x01 prefix)</string>
<string name="map_menu_move_map">Move map with own position</string>
</resources>

0 comments on commit 7e6e0bc

Please sign in to comment.