~samwhited/oslp

d4477fa24c3597ad7b2dcd278956b4379c635ce2 — Sam Whited 3 years ago deff9c8
Deduplicate more map view setup
M src/main/java/com/samwhited/opensharelocationplugin/activities/LocationActivity.java => src/main/java/com/samwhited/opensharelocationplugin/activities/LocationActivity.java +4 -1
@@ 154,13 154,16 @@ protected Bitmap marker_icon;
		}
	}

	protected void setupMapView() {
	protected void setupMapView(final GeoPoint pos) {
		// Get map view and configure it.
		map = findViewById(R.id.map);
		map.setTileSource(SettingsHelper.getTileProvider(getApplicationContext(), getPreferences().getString("tile_provider", "OPEN_STREET_MAP")));
		map.setBuiltInZoomControls(false);
		map.setMultiTouchControls(true);
		map.setTilesScaledToDpi(getPreferences().getBoolean("scale_tiles_for_high_dpi", false));
		this.mapController = map.getController();
		mapController.setZoom(Config.INITIAL_ZOOM_LEVEL);
		mapController.setCenter(pos);
	}

	protected void gotoLoc() {

M src/main/java/com/samwhited/opensharelocationplugin/activities/ShareLocationActivity.java => src/main/java/com/samwhited/opensharelocationplugin/activities/ShareLocationActivity.java +1 -5
@@ 55,11 55,7 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_share_location);
		setupMapView();

		this.mapController = map.getController();
		mapController.setZoom(Config.INITIAL_ZOOM_LEVEL);
		mapController.setCenter(Config.INITIAL_POS);
		setupMapView(Config.INITIAL_POS);

		// Setup the cancel button
		final Button cancelButton = findViewById(R.id.cancel_button);

M src/main/java/com/samwhited/opensharelocationplugin/activities/ShowLocationActivity.java => src/main/java/com/samwhited/opensharelocationplugin/activities/ShowLocationActivity.java +1 -5
@@ 53,11 53,7 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi
		}

		setContentView(R.layout.activity_show_location);
		setupMapView();

		this.mapController = map.getController();
		mapController.setZoom(Config.INITIAL_ZOOM_LEVEL);
		mapController.setCenter(this.loc);
		setupMapView(this.loc);

		// Setup the fab button on v21+ devices
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {