summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java34
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java59
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java107
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java8
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java37
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java16
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java59
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java10
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java20
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java21
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java24
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java13
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java7
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java30
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java13
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java5
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java3
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java12
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java15
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java22
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java7
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java11
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java44
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java25
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/NavigationDrawerActivity.java72
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java46
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java38
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java37
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java82
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java16
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java8
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java17
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java26
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java56
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java33
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java96
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java14
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java6
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/constants/AppConstant.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java11
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java7
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java52
51 files changed, 676 insertions, 583 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java
index de5af8f170..c3ade57986 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java
@@ -63,7 +63,7 @@ public class FeatureOverviewActivity extends AppCompatActivity {
ItemClickSupport.addTo(recyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
- public void onItemClicked(RecyclerView recyclerView, int position, View v) {
+ public void onItemClicked(RecyclerView recyclerView, int position, View view) {
if (!sectionAdapter.isSectionHeaderPosition(position)) {
int itemPosition = sectionAdapter.getConvertedPosition(position);
Feature feature = features.get(itemPosition);
@@ -87,9 +87,11 @@ public class FeatureOverviewActivity extends AppCompatActivity {
private void loadFeatures() {
try {
- new LoadFeatureTask().execute(getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA));
- } catch (PackageManager.NameNotFoundException e) {
- Log.e(MapboxConstants.TAG, "Could not resolve package info", e);
+ new LoadFeatureTask().execute(
+ getPackageManager().getPackageInfo(getPackageName(),
+ PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA));
+ } catch (PackageManager.NameNotFoundException exception) {
+ Log.e(MapboxConstants.TAG, "Could not resolve package info", exception);
}
}
@@ -107,7 +109,8 @@ public class FeatureOverviewActivity extends AppCompatActivity {
}
FeatureSectionAdapter.Section[] dummy = new FeatureSectionAdapter.Section[sections.size()];
- sectionAdapter = new FeatureSectionAdapter(this, R.layout.section_main_layout, R.id.section_text, new FeatureAdapter(features));
+ sectionAdapter = new FeatureSectionAdapter(
+ this, R.layout.section_main_layout, R.id.section_text, new FeatureAdapter(features));
sectionAdapter.setSections(sections.toArray(dummy));
recyclerView.setAdapter(sectionAdapter);
}
@@ -119,9 +122,12 @@ public class FeatureOverviewActivity extends AppCompatActivity {
}
private boolean requestLocationPermission(final int positionInList) {
- if ((ContextCompat.checkSelfPermission(FeatureOverviewActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) ||
- (ContextCompat.checkSelfPermission(FeatureOverviewActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- ActivityCompat.requestPermissions(FeatureOverviewActivity.this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, positionInList);
+ if ((ContextCompat.checkSelfPermission(FeatureOverviewActivity.this,
+ Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
+ || (ContextCompat.checkSelfPermission(FeatureOverviewActivity.this,
+ Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
+ ActivityCompat.requestPermissions(FeatureOverviewActivity.this, new String[]{
+ Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, positionInList);
return true;
} else {
return false;
@@ -129,11 +135,14 @@ public class FeatureOverviewActivity extends AppCompatActivity {
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startFeature(features.get(requestCode));
} else {
- Snackbar.make(findViewById(android.R.id.content), "Can't open without accepting the location permission.", Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(
+ findViewById(android.R.id.content),
+ "Can't open without accepting the location permission.",
+ Snackbar.LENGTH_SHORT).show();
}
}
@@ -153,7 +162,8 @@ public class FeatureOverviewActivity extends AppCompatActivity {
String packageName = getApplicationContext().getPackageName();
String metaDataKey = getString(R.string.category);
for (ActivityInfo info : app.activities) {
- if (info.labelRes != 0 && info.name.startsWith(packageName) && !info.name.equals(FeatureOverviewActivity.class.getName())) {
+ if (info.labelRes != 0 && info.name.startsWith(packageName)
+ && !info.name.equals(FeatureOverviewActivity.class.getName())) {
String label = getString(info.labelRes);
String description = resolveString(info.descriptionRes);
String category = resolveMetaData(info.metaData, metaDataKey);
@@ -190,7 +200,7 @@ public class FeatureOverviewActivity extends AppCompatActivity {
private String resolveString(@StringRes int stringRes) {
try {
return getString(stringRes);
- } catch (Resources.NotFoundException e) {
+ } catch (Resources.NotFoundException exception) {
return "-";
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java
index 282ac9b18c..569d5298a4 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java
@@ -31,7 +31,7 @@ import java.util.Random;
public class AnimatedMarkerActivity extends AppCompatActivity {
- private MapView mMapView;
+ private MapView mapView;
private MapboxMap mapboxMap;
private LatLng dupontCircle = new LatLng(38.90962, -77.04341);
@@ -53,9 +53,9 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull final MapboxMap mapboxMap) {
@@ -75,9 +75,9 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
private void setupMap() {
CameraPosition cameraPosition = new CameraPosition.Builder()
- .target(dupontCircle)
- .zoom(15)
- .build();
+ .target(dupontCircle)
+ .zoom(15)
+ .build();
mapboxMap.setCameraPosition(cameraPosition);
}
@@ -86,10 +86,10 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
if (passengerMarker == null) {
Icon icon = IconFactory.getInstance(AnimatedMarkerActivity.this)
- .fromResource(R.drawable.ic_directions_run_black_24dp);
+ .fromResource(R.drawable.ic_directions_run_black_24dp);
passengerMarker = mapboxMap.addMarker(new MarkerViewOptions()
- .position(randomLatLng)
- .icon(icon));
+ .position(randomLatLng)
+ .icon(icon));
} else {
passengerMarker.setPosition(randomLatLng);
}
@@ -139,7 +139,8 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
private ValueAnimator animateMoveMarker(final MarkerView marker, LatLng to) {
marker.setRotation((float) getBearing(marker.getPosition(), to));
- final ValueAnimator markerAnimator = ObjectAnimator.ofObject(marker, "position", new LatLngEvaluator(), marker.getPosition(), to);
+ final ValueAnimator markerAnimator = ObjectAnimator.ofObject(
+ marker, "position", new LatLngEvaluator(), marker.getPosition(), to);
markerAnimator.setDuration((long) (10 * marker.getPosition().distanceTo(to)));
markerAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
@@ -151,12 +152,12 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
private MarkerView createCarMarker(LatLng start, @DrawableRes int carResource) {
Icon icon = IconFactory.getInstance(AnimatedMarkerActivity.this)
- .fromResource(carResource);
+ .fromResource(carResource);
//View Markers
return mapboxMap.addMarker(new MarkerViewOptions()
- .position(start)
- .icon(icon));
+ .position(start)
+ .icon(icon));
//GL Markers
// return mapboxMap.addMarker(new MarkerOptions()
@@ -168,8 +169,10 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
private LatLng getLatLngInBounds() {
LatLngBounds bounds = mapboxMap.getProjection().getVisibleRegion().latLngBounds;
Random generator = new Random();
- double randomLat = bounds.getLatSouth() + generator.nextDouble() * (bounds.getLatNorth() - bounds.getLatSouth());
- double randomLon = bounds.getLonWest() + generator.nextDouble() * (bounds.getLonEast() - bounds.getLonWest());
+ double randomLat = bounds.getLatSouth() + generator.nextDouble()
+ * (bounds.getLatNorth() - bounds.getLatSouth());
+ double randomLon = bounds.getLonWest() + generator.nextDouble()
+ * (bounds.getLonEast() - bounds.getLonWest());
return new LatLng(randomLat, randomLon);
}
@@ -187,31 +190,31 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
/**
@@ -219,13 +222,15 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
*/
private static class LatLngEvaluator implements TypeEvaluator<LatLng> {
- private LatLng mLatLng = new LatLng();
+ private LatLng latLng = new LatLng();
@Override
public LatLng evaluate(float fraction, LatLng startValue, LatLng endValue) {
- mLatLng.setLatitude(startValue.getLatitude() + ((endValue.getLatitude() - startValue.getLatitude()) * fraction));
- mLatLng.setLongitude(startValue.getLongitude() + ((endValue.getLongitude() - startValue.getLongitude()) * fraction));
- return mLatLng;
+ latLng.setLatitude(startValue.getLatitude()
+ + ((endValue.getLatitude() - startValue.getLatitude()) * fraction));
+ latLng.setLongitude(startValue.getLongitude()
+ + ((endValue.getLongitude() - startValue.getLongitude()) * fraction));
+ return latLng;
}
}
@@ -238,8 +243,8 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
double lat1 = degrees2radians * from.getLatitude();
double lat2 = degrees2radians * to.getLatitude();
double a = Math.sin(lon2 - lon1) * Math.cos(lat2);
- double b = Math.cos(lat1) * Math.sin(lat2) -
- Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
+ double b = Math.cos(lat1) * Math.sin(lat2)
+ - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
return radians2degrees * Math.atan2(a, b);
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java
index 8e2766c075..148207bab9 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java
@@ -44,9 +44,9 @@ import java.util.Random;
public class BulkMarkerActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private MapboxMap mapboxMap;
- private MapView mMapView;
- private boolean mCustomMarkerView;
- private List<LatLng> mLocations;
+ private MapView mapView;
+ private boolean customMarkerView;
+ private List<LatLng> locations;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -63,15 +63,16 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
BulkMarkerActivity.this.mapboxMap = mapboxMap;
if (actionBar != null) {
- ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(), R.array.bulk_marker_list, android.R.layout.simple_spinner_item);
+ ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(
+ actionBar.getThemedContext(), R.array.bulk_marker_list, android.R.layout.simple_spinner_item);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setAdapter(spinnerAdapter);
@@ -89,7 +90,7 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
int amount = Integer.valueOf(getResources().getStringArray(R.array.bulk_marker_list)[position]);
- if (mLocations == null) {
+ if (locations == null) {
new LoadLocationTask(this, amount).execute();
} else {
showMarkers(amount);
@@ -97,18 +98,18 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
}
private void onLatLngListLoaded(List<LatLng> latLngs, int amount) {
- mLocations = latLngs;
+ locations = latLngs;
showMarkers(amount);
}
private void showMarkers(int amount) {
mapboxMap.clear();
- if (mLocations.size() < amount) {
- amount = mLocations.size();
+ if (locations.size() < amount) {
+ amount = locations.size();
}
- if (mCustomMarkerView) {
+ if (customMarkerView) {
showViewMarkers(amount);
} else {
showGlMarkers(amount);
@@ -127,13 +128,13 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
List<MarkerViewOptions> markerOptionsList = new ArrayList<>();
for (int i = 0; i < amount; i++) {
- randomIndex = random.nextInt(mLocations.size());
- LatLng latLng = mLocations.get(randomIndex);
+ randomIndex = random.nextInt(locations.size());
+ LatLng latLng = locations.get(randomIndex);
MarkerViewOptions markerOptions = new MarkerViewOptions()
- .position(latLng)
- .icon(icon)
- .title(String.valueOf(i))
- .snippet(formatter.format(latLng.getLatitude()) + ", " + formatter.format(latLng.getLongitude()));
+ .position(latLng)
+ .icon(icon)
+ .title(String.valueOf(i))
+ .snippet(formatter.format(latLng.getLatitude()) + ", " + formatter.format(latLng.getLongitude()));
markerOptionsList.add(markerOptions);
}
mapboxMap.addMarkerViews(markerOptionsList);
@@ -146,12 +147,12 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
int randomIndex;
for (int i = 0; i < amount; i++) {
- randomIndex = random.nextInt(mLocations.size());
- LatLng latLng = mLocations.get(randomIndex);
+ randomIndex = random.nextInt(locations.size());
+ LatLng latLng = locations.get(randomIndex);
markerOptionsList.add(new MarkerOptions()
- .position(latLng)
- .title(String.valueOf(i))
- .snippet(formatter.format(latLng.getLatitude()) + ", " + formatter.format(latLng.getLongitude())));
+ .position(latLng)
+ .title(String.valueOf(i))
+ .snippet(formatter.format(latLng.getLatitude()) + ", " + formatter.format(latLng.getLongitude())));
}
mapboxMap.addMarkers(markerOptionsList);
@@ -165,31 +166,31 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
@@ -207,7 +208,7 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
@Override
public void onClick(final View v) {
if (mapboxMap != null) {
- mCustomMarkerView = true;
+ customMarkerView = true;
// remove fab
v.animate().alpha(0).setListener(new AnimatorListenerAdapter() {
@@ -221,29 +222,35 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
// reload markers
Spinner spinner = (Spinner) findViewById(R.id.spinner);
if (spinner != null) {
- int amount = Integer.valueOf(getResources().getStringArray(R.array.bulk_marker_list)[spinner.getSelectedItemPosition()]);
+ int amount = Integer.valueOf(
+ getResources().getStringArray(R.array.bulk_marker_list)[spinner.getSelectedItemPosition()]);
showMarkers(amount);
}
- mMapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
+ mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
@Override
public void onMapChanged(@MapView.MapChange int change) {
if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) {
if (!mapboxMap.getMarkerViewManager().getMarkerViewAdapters().isEmpty()) {
TextView viewCountView = (TextView) findViewById(R.id.countView);
- viewCountView.setText("ViewCache size " + (mMapView.getChildCount() - 5));
+ viewCountView.setText("ViewCache size " + (mapView.getChildCount() - 5));
}
}
}
});
- mapboxMap.getMarkerViewManager().setOnMarkerViewClickListener(new MapboxMap.OnMarkerViewClickListener() {
- @Override
- public boolean onMarkerClick(@NonNull Marker marker, @NonNull View view, @NonNull MapboxMap.MarkerViewAdapter adapter) {
- Toast.makeText(BulkMarkerActivity.this, "Hello " + marker.getId(), Toast.LENGTH_SHORT).show();
- return false;
- }
- });
+ mapboxMap.getMarkerViewManager().setOnMarkerViewClickListener(
+ new MapboxMap.OnMarkerViewClickListener() {
+ @Override
+ public boolean onMarkerClick(
+ @NonNull Marker marker, @NonNull View view, @NonNull MapboxMap.MarkerViewAdapter adapter) {
+ Toast.makeText(
+ BulkMarkerActivity.this,
+ "Hello " + marker.getId(),
+ Toast.LENGTH_SHORT).show();
+ return false;
+ }
+ });
}
}
}
@@ -251,23 +258,23 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
private static class LoadLocationTask extends AsyncTask<Void, Integer, List<LatLng>> {
private static final String TAG = "LoadLocationTask";
- private BulkMarkerActivity mActivity;
- private ProgressDialog mProgressDialog;
- private int mAmount;
+ private BulkMarkerActivity activity;
+ private ProgressDialog progressDialog;
+ private int amount;
public LoadLocationTask(BulkMarkerActivity activity, int amount) {
- mAmount = amount;
- mActivity = activity;
- mProgressDialog = ProgressDialog.show(activity, "Loading", "Fetching markers", false);
+ this.amount = amount;
+ this.activity = activity;
+ progressDialog = ProgressDialog.show(activity, "Loading", "Fetching markers", false);
}
@Override
protected List<LatLng> doInBackground(Void... params) {
try {
- String json = GeoParseUtil.loadStringFromAssets(mActivity.getApplicationContext(), "points.geojson");
+ String json = GeoParseUtil.loadStringFromAssets(activity.getApplicationContext(), "points.geojson");
return GeoParseUtil.parseGeoJSONCoordinates(json);
- } catch (IOException | JSONException e) {
- Log.e(TAG, "Could not add markers,", e);
+ } catch (IOException | JSONException exception) {
+ Log.e(TAG, "Could not add markers,", exception);
return null;
}
}
@@ -275,8 +282,8 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
@Override
protected void onPostExecute(List<LatLng> locations) {
super.onPostExecute(locations);
- mActivity.onLatLngListLoaded(locations, mAmount);
- mProgressDialog.hide();
+ activity.onLatLngListLoaded(locations, amount);
+ progressDialog.hide();
}
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java
index 53909dc051..431908017f 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java
@@ -69,7 +69,7 @@ public class DynamicMarkerChangeActivity extends AppCompatActivity {
fab.setColorFilter(ContextCompat.getColor(this, R.color.primary));
fab.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
if (mapboxMap != null) {
updateMarker();
}
@@ -85,8 +85,10 @@ public class DynamicMarkerChangeActivity extends AppCompatActivity {
// update marker
marker.setPosition(first ? LAT_LNG_CHELSEA : LAT_LNG_ARSENAL);
marker.setIcon(iconFactory.fromResource(first ? R.drawable.ic_chelsea : R.drawable.ic_arsenal));
- marker.setTitle(first ? getString(R.string.dynamic_marker_chelsea_title) : getString(R.string.dynamic_marker_arsenal_title));
- marker.setSnippet(first ? getString(R.string.dynamic_marker_chelsea_snippet) : getString(R.string.dynamic_marker_arsenal_snippet));
+ marker.setTitle(first
+ ? getString(R.string.dynamic_marker_chelsea_title) : getString(R.string.dynamic_marker_arsenal_title));
+ marker.setSnippet(first
+ ? getString(R.string.dynamic_marker_chelsea_snippet) : getString(R.string.dynamic_marker_arsenal_snippet));
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java
index ce86a78099..ccce727130 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java
@@ -42,15 +42,16 @@ import java.util.Random;
public class MarkerViewActivity extends AppCompatActivity {
private MapboxMap mapboxMap;
- private MapView mMapView;
+ private MapView mapView;
- private MarkerView movingMarkerOne, movingMarkerTwo;
+ private MarkerView movingMarkerOne;
+ private MarkerView movingMarkerTwo;
private Random randomAnimator = new Random();
private Handler locationUpdateHandler = new Handler();
private Runnable moveMarkerRunnable = new MoveMarkerRunnable();
private int rotation = 0;
- private final static LatLng[] LAT_LNGS = new LatLng[]{
+ private static final LatLng[] LAT_LNGS = new LatLng[]{
new LatLng(38.897424, -77.036508),
new LatLng(38.909698, -77.029642),
new LatLng(38.907227, -77.036530),
@@ -74,9 +75,9 @@ public class MarkerViewActivity extends AppCompatActivity {
}
final TextView viewCountView = (TextView) findViewById(R.id.countView);
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
MarkerViewActivity.this.mapboxMap = mapboxMap;
@@ -131,12 +132,12 @@ public class MarkerViewActivity extends AppCompatActivity {
markerViewManager.addMarkerViewAdapter(new TextAdapter(MarkerViewActivity.this, mapboxMap));
// add a change listener to validate the size of amount of child views
- mMapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
+ mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
@Override
public void onMapChanged(@MapView.MapChange int change) {
if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) {
if (!markerViewManager.getMarkerViewAdapters().isEmpty() && viewCountView != null) {
- viewCountView.setText("ViewCache size " + (mMapView.getChildCount() - 5));
+ viewCountView.setText("ViewCache size " + (mapView.getChildCount() - 5));
}
}
}
@@ -153,13 +154,13 @@ public class MarkerViewActivity extends AppCompatActivity {
movingMarkerOne = MarkerViewActivity.this.mapboxMap.addMarker(new MarkerViewOptions()
.position(CarLocation.CAR_0_LNGS[0])
- .icon(IconFactory.getInstance(mMapView.getContext())
+ .icon(IconFactory.getInstance(mapView.getContext())
.fromResource(R.drawable.ic_chelsea))
);
movingMarkerTwo = mapboxMap.addMarker(new MarkerViewOptions()
.position(CarLocation.CAR_1_LNGS[0])
- .icon(IconFactory.getInstance(mMapView.getContext())
+ .icon(IconFactory.getInstance(mapView.getContext())
.fromResource(R.drawable.ic_arsenal))
);
}
@@ -227,7 +228,8 @@ public class MarkerViewActivity extends AppCompatActivity {
}
@Override
- public boolean onSelect(@NonNull final CountryMarkerView marker, @NonNull final View convertView, boolean reselectionForViewReuse) {
+ public boolean onSelect(
+ @NonNull final CountryMarkerView marker, @NonNull final View convertView, boolean reselectionForViewReuse) {
convertView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
ObjectAnimator rotateAnimator = ObjectAnimator.ofFloat(convertView, View.ROTATION, 0, 360);
rotateAnimator.setDuration(reselectionForViewReuse ? 0 : 350);
@@ -295,7 +297,8 @@ public class MarkerViewActivity extends AppCompatActivity {
}
@Override
- public boolean onSelect(@NonNull final TextMarkerView marker, @NonNull final View convertView, boolean reselectionForViewReuse) {
+ public boolean onSelect(
+ @NonNull final TextMarkerView marker, @NonNull final View convertView, boolean reselectionForViewReuse) {
animateGrow(marker, convertView, 0);
// false indicates that we are calling selectMarker after our animation ourselves
@@ -366,31 +369,31 @@ public class MarkerViewActivity extends AppCompatActivity {
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java
index bd183b9ab9..e4a3b3b2cb 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java
@@ -42,8 +42,8 @@ public class MarkerViewScaleActivity extends AppCompatActivity implements OnMapR
}
final SeekBar xBar = (SeekBar) findViewById(R.id.seekbar_factor);
- TextView xText = (TextView) findViewById(R.id.textview_factor);
- xBar.setOnSeekBarChangeListener(new FactorChangeListener(xText));
+ TextView textView = (TextView) findViewById(R.id.textview_factor);
+ xBar.setOnSeekBarChangeListener(new FactorChangeListener(textView));
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
@@ -56,12 +56,12 @@ public class MarkerViewScaleActivity extends AppCompatActivity implements OnMapR
Icon icon = IconFactory.getInstance(MarkerViewScaleActivity.this)
.fromResource(R.drawable.ic_circle);
- MarkerView mMarker = mapboxMap.addMarker(new MarkerViewOptions()
+ MarkerView marker = mapboxMap.addMarker(new MarkerViewOptions()
.position(new LatLng(38.907192, -77.036871))
.icon(icon)
.flat(true));
- markerView = mapboxMap.getMarkerViewManager().getView(mMarker);
+ markerView = mapboxMap.getMarkerViewManager().getView(marker);
}
@Override
@@ -107,16 +107,16 @@ public class MarkerViewScaleActivity extends AppCompatActivity implements OnMapR
private class FactorChangeListener implements SeekBar.OnSeekBarChangeListener {
- private TextView xText;
+ private TextView textView;
- public FactorChangeListener(TextView xText) {
- this.xText = xText;
+ public FactorChangeListener(TextView textView) {
+ this.textView = textView;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
float newScale = getScale(progress);
- xText.setText(String.format(Locale.US, "Scale: %.1f", newScale));
+ textView.setText(String.format(Locale.US, "Scale: %.1f", newScale));
if (MarkerViewScaleActivity.this.markerView != null) {
markerView.setScaleX(newScale);
markerView.setScaleY(newScale);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java
index d2b00e3335..6638f8a2de 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java
@@ -43,13 +43,15 @@ public class PolygonActivity extends AppCompatActivity implements OnMapReadyCall
add(new LatLng(45.510677, -122.648792));
add(new LatLng(45.515008, -122.664070));
add(new LatLng(45.502496, -122.669048));
- }};
+ }
+ };
private List<LatLng> ADDITIONAL_POINTS = new ArrayList<LatLng>() {{
add(new LatLng(45.515369, -122.678489));
add(new LatLng(45.506346, -122.702007));
add(new LatLng(45.522585, -122.685699));
- }};
+ }
+ };
private MapView mapView;
private MapboxMap mapboxMap;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java
index 7dec4e9038..dabac927d9 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java
@@ -37,9 +37,9 @@ public class PolylineActivity extends AppCompatActivity {
private static final float PARTIAL_ALPHA = 0.5f;
private static final float NO_ALPHA = 0.0f;
- private List<Polyline> mPolylines;
- private ArrayList<PolylineOptions> mPolylineOptions = new ArrayList<>();
- private MapView mMapView;
+ private List<Polyline> polylines;
+ private ArrayList<PolylineOptions> polylineOptions = new ArrayList<>();
+ private MapView mapView;
private MapboxMap mapboxMap;
private boolean fullAlpha = true;
@@ -62,18 +62,18 @@ public class PolylineActivity extends AppCompatActivity {
}
if (savedInstanceState != null) {
- mPolylineOptions = savedInstanceState.getParcelableArrayList(STATE_POLYLINE_OPTIONS);
+ polylineOptions = savedInstanceState.getParcelableArrayList(STATE_POLYLINE_OPTIONS);
} else {
- mPolylineOptions.addAll(getAllPolylines());
+ polylineOptions.addAll(getAllPolylines());
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
PolylineActivity.this.mapboxMap = mapboxMap;
- mPolylines = mapboxMap.addPolylines(mPolylineOptions);
+ polylines = mapboxMap.addPolylines(polylineOptions);
}
});
@@ -81,20 +81,20 @@ public class PolylineActivity extends AppCompatActivity {
if (fab != null) {
fab.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
if (mapboxMap != null) {
- if (mPolylines != null && mPolylines.size() > 0) {
- if (mPolylines.size() == 1) {
+ if (polylines != null && polylines.size() > 0) {
+ if (polylines.size() == 1) {
// test for removing annotation
- mapboxMap.removeAnnotation(mPolylines.get(0));
+ mapboxMap.removeAnnotation(polylines.get(0));
} else {
// test for removing annotations
- mapboxMap.removeAnnotations(mPolylines);
+ mapboxMap.removeAnnotations(polylines);
}
}
- mPolylineOptions.clear();
- mPolylineOptions.addAll(getRandomLine());
- mPolylines = mapboxMap.addPolylines(mPolylineOptions);
+ polylineOptions.clear();
+ polylineOptions.addAll(getRandomLine());
+ polylines = mapboxMap.addPolylines(polylineOptions);
}
}
@@ -126,38 +126,39 @@ public class PolylineActivity extends AppCompatActivity {
Collections.shuffle(randomLines);
return new ArrayList<PolylineOptions>() {{
add(randomLines.get(0));
- }};
+ }
+ };
}
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
- outState.putParcelableArrayList(STATE_POLYLINE_OPTIONS, mPolylineOptions);
+ mapView.onSaveInstanceState(outState);
+ outState.putParcelableArrayList(STATE_POLYLINE_OPTIONS, polylineOptions);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
@@ -171,34 +172,34 @@ public class PolylineActivity extends AppCompatActivity {
switch (item.getItemId()) {
case R.id.action_id_remove:
// test to remove all annotations
- mPolylineOptions.clear();
+ polylineOptions.clear();
mapboxMap.clear();
return true;
case R.id.action_id_alpha:
fullAlpha = !fullAlpha;
- for (Polyline p : mPolylines) {
+ for (Polyline p : polylines) {
p.setAlpha(fullAlpha ? FULL_ALPHA : PARTIAL_ALPHA);
}
return true;
case R.id.action_id_color:
color = !color;
- for (Polyline p : mPolylines) {
+ for (Polyline p : polylines) {
p.setColor(color ? Color.RED : Color.BLUE);
}
return true;
case R.id.action_id_width:
width = !width;
- for (Polyline p : mPolylines) {
+ for (Polyline p : polylines) {
p.setWidth(width ? 3.0f : 5.0f);
}
return true;
case R.id.action_id_visible:
visible = !visible;
- for (Polyline p : mPolylines) {
+ for (Polyline p : polylines) {
p.setAlpha(visible ? (fullAlpha ? FULL_ALPHA : PARTIAL_ALPHA) : NO_ALPHA);
}
return true;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java
index 6784ac0914..f5030ba649 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java
@@ -24,7 +24,7 @@ public class PressForMarkerActivity extends AppCompatActivity {
private MapView mapView;
private MapboxMap mapboxMap;
- private ArrayList<MarkerOptions> mMarkerList = new ArrayList<>();
+ private ArrayList<MarkerOptions> markerList = new ArrayList<>();
private static final DecimalFormat LAT_LON_FORMATTER = new DecimalFormat("#.#####");
@@ -65,14 +65,14 @@ public class PressForMarkerActivity extends AppCompatActivity {
.title(title)
.snippet(snippet);
- mMarkerList.add(marker);
+ markerList.add(marker);
mapboxMap.addMarker(marker);
}
});
if (savedInstanceState != null) {
- mMarkerList = savedInstanceState.getParcelableArrayList(STATE_MARKER_LIST);
- mapboxMap.addMarkers(mMarkerList);
+ markerList = savedInstanceState.getParcelableArrayList(STATE_MARKER_LIST);
+ mapboxMap.addMarkers(markerList);
}
}
});
@@ -96,7 +96,7 @@ public class PressForMarkerActivity extends AppCompatActivity {
super.onSaveInstanceState(outState);
mapView.onSaveInstanceState(outState);
- outState.putParcelableArrayList(STATE_MARKER_LIST, mMarkerList);
+ outState.putParcelableArrayList(STATE_MARKER_LIST, markerList);
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java
index 6494fff9f5..91f2a2d69b 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java
@@ -95,13 +95,19 @@ public class CameraAnimationTypeActivity extends AppCompatActivity implements On
@Override
public void onCancel() {
Log.i(TAG, "Duration onCancel Callback called.");
- Toast.makeText(CameraAnimationTypeActivity.this, "Ease onCancel Callback called.", Toast.LENGTH_LONG).show();
+ Toast.makeText(
+ CameraAnimationTypeActivity.this,
+ "Ease onCancel Callback called.",
+ Toast.LENGTH_LONG).show();
}
@Override
public void onFinish() {
Log.i(TAG, "Duration onFinish Callback called.");
- Toast.makeText(CameraAnimationTypeActivity.this, "Ease onFinish Callback called.", Toast.LENGTH_LONG).show();
+ Toast.makeText(
+ CameraAnimationTypeActivity.this,
+ "Ease onFinish Callback called.",
+ Toast.LENGTH_LONG).show();
}
};
@@ -126,13 +132,19 @@ public class CameraAnimationTypeActivity extends AppCompatActivity implements On
@Override
public void onCancel() {
Log.i(TAG, "Duration onCancel Callback called.");
- Toast.makeText(CameraAnimationTypeActivity.this, "Duration onCancel Callback called.", Toast.LENGTH_LONG).show();
+ Toast.makeText(
+ CameraAnimationTypeActivity.this,
+ "Duration onCancel Callback called.",
+ Toast.LENGTH_LONG).show();
}
@Override
public void onFinish() {
Log.i(TAG, "Duration onFinish Callback called.");
- Toast.makeText(CameraAnimationTypeActivity.this, "Duration onFinish Callback called.", Toast.LENGTH_LONG).show();
+ Toast.makeText(
+ CameraAnimationTypeActivity.this,
+ "Duration onFinish Callback called.",
+ Toast.LENGTH_LONG).show();
}
};
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java
index 3f4763ba48..925244b4a4 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java
@@ -62,17 +62,23 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe
public void onClick(View v) {
Context context = v.getContext();
final View dialogContent = LayoutInflater.from(context).inflate(R.layout.dialog_camera_position, null);
- AlertDialog.Builder builder = new AlertDialog.Builder(context, com.mapbox.mapboxsdk.R.style.AttributionAlertDialogStyle);
+ AlertDialog.Builder builder = new AlertDialog.Builder(
+ context, com.mapbox.mapboxsdk.R.style.AttributionAlertDialogStyle);
builder.setTitle(R.string.dialog_camera_position);
builder.setView(onInflateDialogContent(dialogContent));
builder.setPositiveButton("Animate", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- double latitude = Double.parseDouble(((TextView) dialogContent.findViewById(R.id.value_lat)).getText().toString());
- double longitude = Double.parseDouble(((TextView) dialogContent.findViewById(R.id.value_lon)).getText().toString());
- double zoom = Double.parseDouble(((TextView) dialogContent.findViewById(R.id.value_zoom)).getText().toString());
- double bearing = Double.parseDouble(((TextView) dialogContent.findViewById(R.id.value_bearing)).getText().toString());
- double tilt = Double.parseDouble(((TextView) dialogContent.findViewById(R.id.value_tilt)).getText().toString());
+ double latitude = Double.parseDouble(
+ ((TextView) dialogContent.findViewById(R.id.value_lat)).getText().toString());
+ double longitude = Double.parseDouble(
+ ((TextView) dialogContent.findViewById(R.id.value_lon)).getText().toString());
+ double zoom = Double.parseDouble(
+ ((TextView) dialogContent.findViewById(R.id.value_zoom)).getText().toString());
+ double bearing = Double.parseDouble(
+ ((TextView) dialogContent.findViewById(R.id.value_bearing)).getText().toString());
+ double tilt = Double.parseDouble(
+ ((TextView) dialogContent.findViewById(R.id.value_tilt)).getText().toString());
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(new LatLng(latitude, longitude))
@@ -136,7 +142,8 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe
return view;
}
- private void linkTextView(View view, @IdRes int textViewRes, @IdRes int seekBarRes, ValueChangeListener listener, int defaultValue) {
+ private void linkTextView(
+ View view, @IdRes int textViewRes, @IdRes int seekBarRes, ValueChangeListener listener, int defaultValue) {
final TextView value = (TextView) view.findViewById(textViewRes);
SeekBar seekBar = (SeekBar) view.findViewById(seekBarRes);
listener.setLinkedValueView(value);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java
index 477ef64e86..740efd5536 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java
@@ -21,7 +21,7 @@ import com.mapbox.mapboxsdk.testapp.R;
public class ManualZoomActivity extends AppCompatActivity {
private MapboxMap mapboxMap;
- private MapView mMapView;
+ private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -37,10 +37,10 @@ public class ManualZoomActivity extends AppCompatActivity {
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.setStyleUrl(Style.SATELLITE);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.setStyleUrl(Style.SATELLITE);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull final MapboxMap mapboxMap) {
ManualZoomActivity.this.mapboxMap = mapboxMap;
@@ -53,7 +53,6 @@ public class ManualZoomActivity extends AppCompatActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
-// findViewById(R.id.)
getMenuInflater().inflate(R.menu.menu_zoom, menu);
return true;
}
@@ -83,7 +82,8 @@ public class ManualZoomActivity extends AppCompatActivity {
case R.id.action_zoom_to_point:
View view = getWindow().getDecorView();
- mapboxMap.animateCamera(CameraUpdateFactory.zoomBy(1, new Point(view.getMeasuredWidth() / 4, view.getMeasuredHeight() / 4)));
+ mapboxMap.animateCamera(
+ CameraUpdateFactory.zoomBy(1, new Point(view.getMeasuredWidth() / 4, view.getMeasuredHeight() / 4)));
return true;
default:
@@ -94,30 +94,30 @@ public class ManualZoomActivity extends AppCompatActivity {
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java
index 1154cccb6e..e3dc849ce0 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java
@@ -26,7 +26,8 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal
private MapView mapView;
private MapboxMap mapboxMap;
- private SeekBar xBar, yBar;
+ private SeekBar xBar;
+ private SeekBar yBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -120,18 +121,18 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal
private static class PixelBarChangeListener implements SeekBar.OnSeekBarChangeListener {
@StringRes
- private int mPrefixTextResource;
- private TextView mValueView;
+ private int prefixTextResource;
+ private TextView valueView;
public PixelBarChangeListener(@NonNull TextView textView, @StringRes int textRes) {
- mValueView = textView;
- mPrefixTextResource = textRes;
+ valueView = textView;
+ prefixTextResource = textRes;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int value = progress * ScrollByActivity.MULTIPLIER_PER_PIXEL;
- mValueView.setText(String.format(seekBar.getResources().getString(mPrefixTextResource), value));
+ valueView.setText(String.format(seekBar.getResources().getString(prefixTextResource), value));
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java
index 213b85b6c3..a1aced6eaa 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java
@@ -13,11 +13,10 @@ import android.view.View;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.style.layers.CustomLayer;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
-import com.mapbox.mapboxsdk.style.layers.Layer;
+import com.mapbox.mapboxsdk.style.layers.CustomLayer;
import com.mapbox.mapboxsdk.style.layers.NoSuchLayerException;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.model.customlayer.ExampleCustomLayer;
@@ -54,7 +53,7 @@ public class CustomLayerActivity extends AppCompatActivity {
fab.setColorFilter(ContextCompat.getColor(this, R.color.primary));
fab.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
if (mapboxMap != null) {
swapCustomLayer();
}
@@ -67,7 +66,7 @@ public class CustomLayerActivity extends AppCompatActivity {
if (isShowingCustomLayer) {
try {
mapboxMap.removeLayer("custom");
- } catch (NoSuchLayerException e) {
+ } catch (NoSuchLayerException noSuchLayerException) {
Log.e(TAG, "No custom layer to remove");
}
fab.setImageResource(R.drawable.ic_layers_24dp);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java
index c725d9a7d7..6d5d63dbf7 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java
@@ -32,9 +32,9 @@ import retrofit2.Response;
public class DirectionsActivity extends AppCompatActivity {
- private final static String LOG_TAG = "DirectionsActivity";
+ private static final String LOG_TAG = "DirectionsActivity";
- private MapView mMapView;
+ private MapView mapView;
private MapboxMap mapboxMap;
@Override
@@ -51,9 +51,9 @@ public class DirectionsActivity extends AppCompatActivity {
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
DirectionsActivity.this.mapboxMap = mapboxMap;
@@ -105,8 +105,8 @@ public class DirectionsActivity extends AppCompatActivity {
md.enqueueCall(new Callback<DirectionsResponse>() {
@Override
- public void onFailure(Call<DirectionsResponse> call, Throwable t) {
- Log.e(LOG_TAG, "Error: " + t.getMessage());
+ public void onFailure(Call<DirectionsResponse> call, Throwable throwable) {
+ Log.e(LOG_TAG, "Error: " + throwable.getMessage());
}
@Override
@@ -123,9 +123,9 @@ public class DirectionsActivity extends AppCompatActivity {
}
});
- } catch (ServicesException e) {
- Log.e(LOG_TAG, "Error displaying route: " + e.toString());
- e.printStackTrace();
+ } catch (ServicesException servicesException) {
+ Log.e(LOG_TAG, "Error displaying route: " + servicesException.toString());
+ servicesException.printStackTrace();
}
}
@@ -148,31 +148,31 @@ public class DirectionsActivity extends AppCompatActivity {
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java
index 532bb1c18c..f9a067daf0 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java
@@ -31,7 +31,6 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity {
public MapView mapView;
private MapboxMap mapboxMap;
- private Marker marker;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -64,7 +63,10 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity {
List<Feature> features = mapboxMap.queryRenderedFeatures(box);
//Show count
- Toast.makeText(QueryRenderedFeaturesBoxCountActivity.this, String.format("%s features in box", features.size()), Toast.LENGTH_SHORT).show();
+ Toast.makeText(
+ QueryRenderedFeaturesBoxCountActivity.this,
+ String.format("%s features in box", features.size()),
+ Toast.LENGTH_SHORT).show();
//Debug output
debugOutput(features);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java
index a993feebf9..1e8f91857b 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java
@@ -35,7 +35,6 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity
public MapView mapView;
private MapboxMap mapboxMap;
- private Marker marker;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -58,7 +57,7 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity
selectionBox.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
//Query
int top = selectionBox.getTop() - mapView.getTop();
int left = selectionBox.getLeft() - mapView.getLeft();
@@ -67,19 +66,23 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity
List<Feature> features = mapboxMap.queryRenderedFeatures(box, "building");
//Show count
- Toast.makeText(QueryRenderedFeaturesBoxHighlightActivity.this, String.format("%s features in box", features.size()), Toast.LENGTH_SHORT).show();
+ Toast.makeText(
+ QueryRenderedFeaturesBoxHighlightActivity.this,
+ String.format("%s features in box", features.size()),
+ Toast.LENGTH_SHORT).show();
//remove layer / source if already added
try {
mapboxMap.removeSource("highlighted-shapes-source");
mapboxMap.removeLayer("highlighted-shapes-layer");
- } catch (Exception e) {
+ } catch (Exception exception) {
//that's ok
}
//Add layer / source
mapboxMap.addSource(new GeoJsonSource("highlighted-shapes-source", FeatureCollection.fromFeatures(features)));
- mapboxMap.addLayer(new FillLayer("highlighted-shapes-layer", "highlighted-shapes-source").withProperties(fillColor(Color.RED)));
+ mapboxMap.addLayer(new FillLayer("highlighted-shapes-layer", "highlighted-shapes-source")
+ .withProperties(fillColor(Color.RED)));
}
});
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java
index 7ce1a68a79..8abf638d16 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java
@@ -64,7 +64,10 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity {
public void onMapClick(@NonNull LatLng point) {
//Query
final PointF pixel = mapboxMap.getProjection().toScreenLocation(point);
- Log.i(TAG, String.format("Requesting features for %sx%s (%sx%s adjusted for density)", pixel.x, pixel.y, pixel.x / density, pixel.y / density));
+ Log.i(TAG, String.format(
+ "Requesting features for %sx%s (%sx%s adjusted for density)",
+ pixel.x, pixel.y, pixel.x / density, pixel.y / density)
+ );
List<Feature> features = mapboxMap.queryRenderedFeatures(pixel);
//Debug output
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java
index 8233e59fd4..e97f21327e 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java
@@ -48,9 +48,6 @@ public class MapFragmentActivity extends AppCompatActivity implements OnMapReady
options.rotateGesturesEnabled(false);
options.debugActive(false);
-// options.compassEnabled(false);
-// options.attributionEnabled(false);
-// options.logoEnabled(false);
LatLng dc = new LatLng(38.90252, -77.02291);
@@ -75,7 +72,8 @@ public class MapFragmentActivity extends AppCompatActivity implements OnMapReady
@Override
public void onMapReady(MapboxMap map) {
mapboxMap = map;
- mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder().tilt(45.0).build()), 10000);
+ mapboxMap.animateCamera(
+ CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder().tilt(45.0).build()), 10000);
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java
index cb3db5f2d3..03444a871d 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java
@@ -75,7 +75,8 @@ public class SupportMapFragmentActivity extends AppCompatActivity implements OnM
@Override
public void onMapReady(MapboxMap map) {
mapboxMap = map;
- mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder().tilt(45.0).build()), 10000);
+ mapboxMap.animateCamera(
+ CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder().tilt(45.0).build()), 10000);
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java
index bc1d742113..6cd3fd62a1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java
@@ -1,7 +1,6 @@
package com.mapbox.mapboxsdk.testapp.activity.fragment;
import android.os.Bundle;
-import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
@@ -9,24 +8,13 @@ import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
-import android.util.Log;
-import android.view.Menu;
import android.view.MenuItem;
-import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import com.mapbox.mapboxsdk.constants.MyLocationTracking;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapFragment;
-import com.mapbox.mapboxsdk.maps.MapView;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.MapboxMapOptions;
-import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.maps.SupportMapFragment;
-import com.mapbox.mapboxsdk.maps.TrackingSettings;
import com.mapbox.mapboxsdk.testapp.R;
public class ViewPagerActivity extends AppCompatActivity {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java
index 42cc5d8618..baa020fe95 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java
@@ -67,7 +67,8 @@ public class GeocoderActivity extends AppCompatActivity implements OnMapReadyCal
dropPinView = new ImageView(this);
dropPinView.setImageResource(R.drawable.ic_droppin_24dp);
- FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);
+ FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);
dropPinView.setLayoutParams(params);
mapView.addView(dropPinView);
mapView.getMapAsync(this);
@@ -149,14 +150,14 @@ public class GeocoderActivity extends AppCompatActivity implements OnMapReadyCal
}
@Override
- public void onFailure(Call<GeocodingResponse> call, Throwable t) {
- setError(t.getMessage());
+ public void onFailure(Call<GeocodingResponse> call, Throwable throwable) {
+ setError(throwable.getMessage());
}
});
- } catch (ServicesException e) {
- Log.e(LOG_TAG, "Error geocoding: " + e.toString());
- e.printStackTrace();
- setError(e.getMessage());
+ } catch (ServicesException servicesException) {
+ Log.e(LOG_TAG, "Error geocoding: " + servicesException.toString());
+ servicesException.printStackTrace();
+ setError(servicesException.getMessage());
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java
index 935851c445..18353003d1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java
@@ -17,7 +17,7 @@ import com.mapbox.mapboxsdk.testapp.R;
public class PrintActivity extends AppCompatActivity implements MapboxMap.SnapshotReadyCallback {
- private MapView mMapView;
+ private MapView mapView;
private MapboxMap mapboxMap;
@Override
@@ -34,9 +34,9 @@ public class PrintActivity extends AppCompatActivity implements MapboxMap.Snapsh
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
PrintActivity.this.mapboxMap = mapboxMap;
@@ -47,8 +47,8 @@ public class PrintActivity extends AppCompatActivity implements MapboxMap.Snapsh
if (fab != null) {
fab.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
- if(mapboxMap !=null) {
+ public void onClick(View view) {
+ if (mapboxMap != null) {
mapboxMap.snapshot(PrintActivity.this);
}
}
@@ -66,31 +66,31 @@ public class PrintActivity extends AppCompatActivity implements MapboxMap.Snapsh
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java
index 356bf6677b..ab4188fd52 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java
@@ -54,7 +54,7 @@ public class SnapshotActivity extends AppCompatActivity implements OnMapReadyCal
}
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
final long startTime = System.nanoTime();
mapboxMap.snapshot(new MapboxMap.SnapshotReadyCallback() {
@Override
@@ -63,7 +63,10 @@ public class SnapshotActivity extends AppCompatActivity implements OnMapReadyCal
long duration = (long) ((endTime - startTime) / 1e6);
ImageView snapshotView = (ImageView) findViewById(R.id.imageView);
snapshotView.setImageBitmap(snapshot);
- Toast.makeText(SnapshotActivity.this, String.format("Snapshot taken in %d ms", duration), Toast.LENGTH_LONG).show();
+ Toast.makeText(
+ SnapshotActivity.this,
+ String.format("Snapshot taken in %d ms", duration),
+ Toast.LENGTH_LONG).show();
}
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java
index 7ff0acdb29..113c46c3e5 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java
@@ -17,7 +17,9 @@ import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.maps.MapView;
import java.text.DecimalFormat;
-public class InfoWindowActivity extends AppCompatActivity implements OnMapReadyCallback, MapboxMap.OnInfoWindowCloseListener, MapboxMap.OnMapLongClickListener, MapboxMap.OnInfoWindowClickListener, MapboxMap.OnInfoWindowLongClickListener {
+public class InfoWindowActivity extends AppCompatActivity
+ implements OnMapReadyCallback, MapboxMap.OnInfoWindowCloseListener, MapboxMap.OnMapLongClickListener,
+ MapboxMap.OnInfoWindowClickListener, MapboxMap.OnInfoWindowLongClickListener {
private MapboxMap mapboxMap;
private MapView mapView;
@@ -67,7 +69,9 @@ public class InfoWindowActivity extends AppCompatActivity implements OnMapReadyC
Marker marker = mapboxMap.addMarker(new MarkerOptions()
.title("White House")
- .snippet("The official residence and principal workplace of the President of the United States, located at 1600 Pennsylvania Avenue NW in Washington, D.C. It has been the residence of every U.S. president since John Adams in 1800.")
+ .snippet("The official residence and principal workplace of the President of the United States, "
+ + "located at 1600 Pennsylvania Avenue NW in Washington, D.C. It has been the residence of every"
+ + "U.S. president since John Adams in 1800.")
.position(new LatLng(38.897705003219784, -77.03655168667463)));
// open InfoWindow at startup
@@ -118,7 +122,8 @@ public class InfoWindowActivity extends AppCompatActivity implements OnMapReadyC
// Add marker on long click location with default marker image
customMarker = mapboxMap.addMarker(new MarkerOptions()
.title("Custom Marker")
- .snippet(new DecimalFormat("#.#####").format(point.getLatitude()) + ", " + new DecimalFormat("#.#####").format(point.getLongitude()))
+ .snippet(new DecimalFormat("#.#####").format(point.getLatitude()) + ", "
+ + new DecimalFormat("#.#####").format(point.getLongitude()))
.position(point));
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
index 760501c17c..377d5d18f0 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
@@ -63,7 +63,7 @@ public class DebugModeActivity extends AppCompatActivity {
FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabDebug);
fabDebug.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
if (mapboxMap != null) {
Log.d(TAG, "Debug FAB: isDebug Active? " + mapboxMap.isDebugActive());
mapboxMap.cycleDebugOptions();
@@ -74,7 +74,7 @@ public class DebugModeActivity extends AppCompatActivity {
FloatingActionButton fabStyles = (FloatingActionButton) findViewById(R.id.fabStyles);
fabStyles.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
if (mapboxMap != null) {
currentStyleIndex++;
if (currentStyleIndex == STYLES.length) {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java
index ffea7594d9..b34962a792 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java
@@ -67,7 +67,7 @@ public class DoubleMapActivity extends AppCompatActivity {
try {
TrackingSettings settings = mapboxMap.getTrackingSettings();
settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
- } catch (SecurityException e) {
+ } catch (SecurityException securityException) {
// permission is handled in MainActivity
finish();
}
@@ -76,8 +76,8 @@ public class DoubleMapActivity extends AppCompatActivity {
public static class DoubleMapFragment extends Fragment {
private DoubleMapActivity activity;
- private MapView mMapView;
- private MapView mMapViewMini;
+ private MapView mapView;
+ private MapView mapViewMini;
@Override
public void onAttach(Context context) {
@@ -95,9 +95,9 @@ public class DoubleMapActivity extends AppCompatActivity {
super.onViewCreated(view, savedInstanceState);
// MapView large
- mMapView = (MapView) view.findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) view.findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
if (activity != null) {
@@ -107,9 +107,9 @@ public class DoubleMapActivity extends AppCompatActivity {
});
// MapView mini
- mMapViewMini = (MapView) view.findViewById(R.id.mini_map);
- mMapViewMini.onCreate(savedInstanceState);
- mMapViewMini.getMapAsync(new OnMapReadyCallback() {
+ mapViewMini = (MapView) view.findViewById(R.id.mini_map);
+ mapViewMini.onCreate(savedInstanceState);
+ mapViewMini.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
mapboxMap.setStyleUrl(Style.LIGHT);
@@ -124,7 +124,7 @@ public class DoubleMapActivity extends AppCompatActivity {
try {
TrackingSettings settings = mapboxMap.getTrackingSettings();
settings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
- } catch (SecurityException e) {
+ } catch (SecurityException securityException) {
// permission is handled in MainActivity
getActivity().finish();
}
@@ -133,49 +133,49 @@ public class DoubleMapActivity extends AppCompatActivity {
@Override
public void onMapClick(@NonNull LatLng point) {
// test if we can open 2 activities after each other
- startActivity(new Intent(mMapViewMini.getContext(), DoubleMapActivity.class));
+ startActivity(new Intent(mapViewMini.getContext(), DoubleMapActivity.class));
}
});
}
});
- SurfaceView surfaceViewMini = (SurfaceView) mMapViewMini.findViewById(R.id.surfaceView);
+ SurfaceView surfaceViewMini = (SurfaceView) mapViewMini.findViewById(R.id.surfaceView);
surfaceViewMini.setZOrderMediaOverlay(true);
}
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
- mMapViewMini.onResume();
+ mapView.onResume();
+ mapViewMini.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
- mMapViewMini.onPause();
+ mapView.onPause();
+ mapViewMini.onPause();
}
@Override
public void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
- mMapViewMini.onDestroy();
+ mapView.onDestroy();
+ mapViewMini.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
- mMapViewMini.onLowMemory();
+ mapView.onLowMemory();
+ mapViewMini.onLowMemory();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
- mMapViewMini.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
+ mapViewMini.onSaveInstanceState(outState);
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java
index f90741ee83..114262220a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java
@@ -21,7 +21,7 @@ import com.mapbox.mapboxsdk.testapp.R;
public class MapPaddingActivity extends AppCompatActivity {
- private MapView mMapView;
+ private MapView mapView;
private MapboxMap mapboxMap;
@Override
@@ -38,11 +38,11 @@ public class MapPaddingActivity extends AppCompatActivity {
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.setTag(true);
- mMapView.onCreate(savedInstanceState);
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.setTag(true);
+ mapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
MapPaddingActivity.this.mapboxMap = mapboxMap;
@@ -60,31 +60,31 @@ public class MapPaddingActivity extends AppCompatActivity {
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
@@ -100,8 +100,9 @@ public class MapPaddingActivity extends AppCompatActivity {
TrackingSettings trackingSettings = mapboxMap.getTrackingSettings();
trackingSettings.setDismissTrackingOnGesture(false);
- trackingSettings.setMyLocationTrackingMode(enable ? MyLocationTracking.TRACKING_FOLLOW : MyLocationTracking.TRACKING_NONE);
- } catch (SecurityException e) {
+ trackingSettings.setMyLocationTrackingMode(
+ enable ? MyLocationTracking.TRACKING_FOLLOW : MyLocationTracking.TRACKING_NONE);
+ } catch (SecurityException securityException) {
// permission not granted is handled in FeatureOverviewActivity
finish();
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/NavigationDrawerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/NavigationDrawerActivity.java
index 46afd11674..76363ef808 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/NavigationDrawerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/NavigationDrawerActivity.java
@@ -100,15 +100,15 @@ public class NavigationDrawerActivity extends AppCompatActivity {
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
- private ActionBarDrawerToggle mDrawerToggle;
+ private ActionBarDrawerToggle drawerToggle;
- private DrawerLayout mDrawerLayout;
- private ListView mDrawerListView;
- private View mFragmentContainerView;
+ private DrawerLayout drawerLayout;
+ private ListView drawerListView;
+ private View fragmentContainerView;
- private int mCurrentSelectedPosition = 0;
- private boolean mFromSavedInstanceState;
- private boolean mUserLearnedDrawer;
+ private int currentSelectedPosition = 0;
+ private boolean fromSavedInstanceState;
+ private boolean userLearnedDrawer;
public NavigationDrawerFragment() {
}
@@ -117,13 +117,13 @@ public class NavigationDrawerActivity extends AppCompatActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
- mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
+ userLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
if (savedInstanceState != null) {
- mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
- mFromSavedInstanceState = true;
+ currentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
+ fromSavedInstanceState = true;
}
- selectItem(mCurrentSelectedPosition);
+ selectItem(currentSelectedPosition);
}
@Override
@@ -135,15 +135,15 @@ public class NavigationDrawerActivity extends AppCompatActivity {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- mDrawerListView = (ListView) inflater.inflate(
+ drawerListView = (ListView) inflater.inflate(
R.layout.drawer_navigation_drawer, container, false);
- mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
}
});
- mDrawerListView.setAdapter(new ArrayAdapter<>(
+ drawerListView.setAdapter(new ArrayAdapter<>(
inflater.getContext(),
android.R.layout.simple_list_item_activated_1,
android.R.id.text1,
@@ -151,8 +151,8 @@ public class NavigationDrawerActivity extends AppCompatActivity {
getString(R.string.title_section1),
getString(R.string.title_section2)
}));
- mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
- return mDrawerListView;
+ drawerListView.setItemChecked(currentSelectedPosition, true);
+ return drawerListView;
}
/**
@@ -162,16 +162,16 @@ public class NavigationDrawerActivity extends AppCompatActivity {
* @param drawerLayout The DrawerLayout containing this fragment's UI.
*/
public void setUp(Activity activity, int fragmentId, DrawerLayout drawerLayout, ActionBar actionBar) {
- mFragmentContainerView = activity.findViewById(fragmentId);
- mDrawerLayout = drawerLayout;
-// mDrawerLayout.setScrimColor(Color.TRANSPARENT);
+ fragmentContainerView = activity.findViewById(fragmentId);
+ this.drawerLayout = drawerLayout;
+ // drawerLayout.setScrimColor(Color.TRANSPARENT);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
- mDrawerToggle = new ActionBarDrawerToggle(
+ drawerToggle = new ActionBarDrawerToggle(
activity,
- mDrawerLayout,
+ NavigationDrawerFragment.this.drawerLayout,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close
) {
@@ -191,8 +191,8 @@ public class NavigationDrawerActivity extends AppCompatActivity {
return;
}
- if (!mUserLearnedDrawer) {
- mUserLearnedDrawer = true;
+ if (!userLearnedDrawer) {
+ userLearnedDrawer = true;
SharedPreferences sp = PreferenceManager
.getDefaultSharedPreferences(getActivity());
sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply();
@@ -201,25 +201,25 @@ public class NavigationDrawerActivity extends AppCompatActivity {
}
};
- if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
- mDrawerLayout.openDrawer(mFragmentContainerView);
+ if (!userLearnedDrawer && !fromSavedInstanceState) {
+ this.drawerLayout.openDrawer(fragmentContainerView);
}
- mDrawerLayout.post(new Runnable() {
+ this.drawerLayout.post(new Runnable() {
@Override
public void run() {
- mDrawerToggle.syncState();
+ drawerToggle.syncState();
}
});
- mDrawerLayout.setDrawerListener(mDrawerToggle);
+ this.drawerLayout.setDrawerListener(drawerToggle);
}
private void selectItem(int position) {
- mCurrentSelectedPosition = position;
- if (mDrawerListView != null) {
- mDrawerListView.setItemChecked(position, true);
+ currentSelectedPosition = position;
+ if (drawerListView != null) {
+ drawerListView.setItemChecked(position, true);
}
- if (mDrawerLayout != null) {
- mDrawerLayout.closeDrawer(mFragmentContainerView);
+ if (drawerLayout != null) {
+ drawerLayout.closeDrawer(fragmentContainerView);
}
Activity activity = getActivity();
@@ -232,18 +232,18 @@ public class NavigationDrawerActivity extends AppCompatActivity {
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
+ outState.putInt(STATE_SELECTED_POSITION, currentSelectedPosition);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
- mDrawerToggle.onConfigurationChanged(newConfig);
+ drawerToggle.onConfigurationChanged(newConfig);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- if (mDrawerToggle.onOptionsItemSelected(item)) {
+ if (drawerToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java
index ed87d75ca0..43b4264661 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java
@@ -21,7 +21,7 @@ import javax.microedition.khronos.opengles.GL10;
public class SurfaceViewMediaControlActivity extends AppCompatActivity implements OnMapReadyCallback {
- private MapView mMapView;
+ private MapView mapView;
private MapboxMap mapboxMap;
@Override
@@ -38,9 +38,9 @@ public class SurfaceViewMediaControlActivity extends AppCompatActivity implement
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(this);
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(this);
// add another SurfaceView to the Layout
FrameLayout container = (FrameLayout) findViewById(R.id.container);
@@ -57,31 +57,31 @@ public class SurfaceViewMediaControlActivity extends AppCompatActivity implement
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
@@ -103,18 +103,18 @@ public class SurfaceViewMediaControlActivity extends AppCompatActivity implement
class ClearGLSurfaceView extends GLSurfaceView {
- private ClearRenderer mRenderer;
+ private ClearRenderer renderer;
public ClearGLSurfaceView(Context context) {
super(context);
- mRenderer = new ClearRenderer();
- setRenderer(mRenderer);
+ renderer = new ClearRenderer();
+ setRenderer(renderer);
}
public boolean onTouchEvent(final MotionEvent event) {
queueEvent(new Runnable() {
public void run() {
- mRenderer.setColor(event.getRawX() / getWidth(),
+ renderer.setColor(event.getRawX() / getWidth(),
event.getRawY() / getHeight(), 1.0f);
}
});
@@ -124,27 +124,27 @@ public class SurfaceViewMediaControlActivity extends AppCompatActivity implement
class ClearRenderer implements GLSurfaceView.Renderer {
- private float mRed;
- private float mGreen;
- private float mBlue;
+ private float red;
+ private float green;
+ private float blue;
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
// Do nothing special.
}
- public void onSurfaceChanged(GL10 gl, int w, int h) {
- gl.glViewport(0, 0, w, h);
+ public void onSurfaceChanged(GL10 gl, int width, int height) {
+ gl.glViewport(0, 0, width, height);
}
public void onDrawFrame(GL10 gl) {
- gl.glClearColor(mRed, mGreen, mBlue, 1.0f);
+ gl.glClearColor(red, green, blue, 1.0f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
}
- public void setColor(float r, float g, float b) {
- mRed = r;
- mGreen = g;
- mBlue = b;
+ public void setColor(float red, float green, float blue) {
+ this.red = red;
+ this.green = green;
+ this.blue = blue;
}
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java
index 5f2f5b0421..a40ec0534c 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java
@@ -34,7 +34,7 @@ public class CarDrivingActivity extends AppCompatActivity implements MapboxMap.O
private static final int PERMISSIONS_LOCATION = 0;
- private MapView mMapView;
+ private MapView mapView;
private MapboxMap mapboxMap;
private Location location;
@@ -52,9 +52,9 @@ public class CarDrivingActivity extends AppCompatActivity implements MapboxMap.O
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
CarDrivingActivity.this.mapboxMap = mapboxMap;
@@ -88,9 +88,13 @@ public class CarDrivingActivity extends AppCompatActivity implements MapboxMap.O
@UiThread
public void toggleGps(boolean enableGps) {
if (enableGps) {
- if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) ||
- (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
+ if ((ContextCompat.checkSelfPermission(this,
+ Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
+ || (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
+ != PackageManager.PERMISSION_GRANTED)) {
+ ActivityCompat.requestPermissions(this, new String[]{
+ Manifest.permission.ACCESS_COARSE_LOCATION,
+ Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
} else {
enableLocation(true);
}
@@ -112,12 +116,10 @@ public class CarDrivingActivity extends AppCompatActivity implements MapboxMap.O
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
- switch (requestCode) {
- case PERMISSIONS_LOCATION: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- enableLocation(true);
- }
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ if (requestCode == PERMISSIONS_LOCATION) {
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ enableLocation(true);
}
}
}
@@ -146,31 +148,31 @@ public class CarDrivingActivity extends AppCompatActivity implements MapboxMap.O
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java
index 7cce3d4a8e..be5498babb 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java
@@ -93,11 +93,13 @@ public class LocationPickerActivity extends AppCompatActivity {
mapboxMap = map;
//Add user marker
- mapboxMap.getMarkerViewManager().addMarkerViewAdapter(new PulseMarkerViewAdapter(LocationPickerActivity.this));
+ mapboxMap.getMarkerViewManager().addMarkerViewAdapter(
+ new PulseMarkerViewAdapter(LocationPickerActivity.this));
userMarker = createCustomUserMarker(new LatLng(0, 0));
//Fix the focal point to the center of the map
- PointF focalPoint = new PointF((mapView.getX() + mapView.getWidth() / 2), (mapView.getY() + mapView.getHeight() / 2));
+ PointF focalPoint = new PointF(
+ (mapView.getX() + mapView.getWidth() / 2), (mapView.getY() + mapView.getHeight() / 2));
mapboxMap.getUiSettings().setFocalPoint(focalPoint);
//Track camera updates to animate the user location views
@@ -125,7 +127,8 @@ public class LocationPickerActivity extends AppCompatActivity {
zoomInOn(location);
userMarker.setPosition(new LatLng(location));
} else {
- final ProgressDialog loadingDialog = ProgressDialog.show(LocationPickerActivity.this, "Loading", "Getting user location", false);
+ final ProgressDialog loadingDialog = ProgressDialog.show(
+ LocationPickerActivity.this, "Loading", "Getting user location", false);
locationServices.addLocationListener(new LocationListener() {
@Override
public void onLocationChanged(@Nullable Location location) {
@@ -222,7 +225,7 @@ public class LocationPickerActivity extends AppCompatActivity {
clearDisplayViewButton = (ImageButton) findViewById(R.id.clearDisplayViewButton);
clearDisplayViewButton.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
removeAddressPin();
hide(clearDisplayViewButton);
showDropPin();
@@ -236,7 +239,7 @@ public class LocationPickerActivity extends AppCompatActivity {
selectLocationButton.setOnClickListener(
new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
Log.i(TAG, "Location Selected!");
if (mapboxMap != null) {
//Control button's state
@@ -272,7 +275,8 @@ public class LocationPickerActivity extends AppCompatActivity {
dropPinView = new ImageView(this);
dropPinView.setImageResource(R.drawable.ic_droppin_24dp);
- FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);
+ FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);
params.bottomMargin = (int) (12 * density);
dropPinView.setLayoutParams(params);
@@ -333,14 +337,14 @@ public class LocationPickerActivity extends AppCompatActivity {
}
@Override
- public void onFailure(Call<GeocodingResponse> call, Throwable t) {
- Log.e(TAG, "Geocoding Failure: " + t.getMessage());
- callbacks.onFailure(t);
+ public void onFailure(Call<GeocodingResponse> call, Throwable throwable) {
+ Log.e(TAG, "Geocoding Failure: " + throwable.getMessage());
+ callbacks.onFailure(throwable);
}
});
- } catch (ServicesException e) {
- Log.e(TAG, "Error geocoding: " + e.toString());
- callbacks.onFailure(e);
+ } catch (ServicesException servicesException) {
+ Log.e(TAG, "Error geocoding: " + servicesException.toString());
+ callbacks.onFailure(servicesException);
}
}
@@ -379,11 +383,12 @@ public class LocationPickerActivity extends AppCompatActivity {
}
private boolean arePermissionsGranted() {
- if (Build.VERSION.SDK_INT >= 23 &&
- checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
- checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+ if (Build.VERSION.SDK_INT >= 23
+ && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
+ && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
Log.i(TAG, "Requesting permissions");
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSIONS);
+ ActivityCompat.requestPermissions(this, new String[]{
+ Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSIONS);
return false;
}
Log.i(TAG, "Permissions already granted");
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java
index 4d5e2552fd..139d5ae0b5 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java
@@ -37,18 +37,18 @@ import java.util.ArrayList;
public class OfflineActivity extends AppCompatActivity
implements OfflineDownloadRegionDialog.DownloadRegionDialogListener {
- private final static String LOG_TAG = "OfflineActivity";
+ private static final String LOG_TAG = "OfflineActivity";
// JSON encoding/decoding
- public final static String JSON_CHARSET = "UTF-8";
- public final static String JSON_FIELD_REGION_NAME = "FIELD_REGION_NAME";
+ public static final String JSON_CHARSET = "UTF-8";
+ public static final String JSON_FIELD_REGION_NAME = "FIELD_REGION_NAME";
/*
* UI elements
*/
- private MapView mMapView;
+ private MapView mapView;
private MapboxMap mapboxMap;
- private ProgressBar mProgressBar;
+ private ProgressBar progressBar;
private Button downloadRegion;
private Button listRegions;
@@ -57,8 +57,8 @@ public class OfflineActivity extends AppCompatActivity
/*
* Offline objects
*/
- private OfflineManager mOfflineManager;
- private OfflineRegion mOfflineRegion;
+ private OfflineManager offlineManager;
+ private OfflineRegion offlineRegion;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -75,10 +75,10 @@ public class OfflineActivity extends AppCompatActivity
}
// Set up map
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.setStyleUrl(Style.MAPBOX_STREETS);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.setStyleUrl(Style.MAPBOX_STREETS);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
Log.d(LOG_TAG, "Map is ready");
@@ -96,13 +96,13 @@ public class OfflineActivity extends AppCompatActivity
});
// The progress bar
- mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
+ progressBar = (ProgressBar) findViewById(R.id.progress_bar);
// Set up button listeners
downloadRegion = (Button) findViewById(R.id.button_download_region);
downloadRegion.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
handleDownloadRegion();
}
});
@@ -110,43 +110,43 @@ public class OfflineActivity extends AppCompatActivity
listRegions = (Button) findViewById(R.id.button_list_regions);
listRegions.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
handleListRegions();
}
});
// Set up the OfflineManager
- mOfflineManager = OfflineManager.getInstance(this);
+ offlineManager = OfflineManager.getInstance(this);
}
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
@@ -176,7 +176,7 @@ public class OfflineActivity extends AppCompatActivity
Log.d(LOG_TAG, "handleListRegions");
// Query the DB asynchronously
- mOfflineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
+ offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
@Override
public void onList(OfflineRegion[] offlineRegions) {
// Check result
@@ -214,8 +214,8 @@ public class OfflineActivity extends AppCompatActivity
String json = new String(metadata, JSON_CHARSET);
JSONObject jsonObject = new JSONObject(json);
regionName = jsonObject.getString(JSON_FIELD_REGION_NAME);
- } catch (Exception e) {
- Log.e(LOG_TAG, "Failed to decode metadata: " + e.getMessage());
+ } catch (Exception exception) {
+ Log.e(LOG_TAG, "Failed to decode metadata: " + exception.getMessage());
regionName = "Region " + offlineRegion.getID();
}
@@ -240,13 +240,13 @@ public class OfflineActivity extends AppCompatActivity
startProgress();
// Definition
- String styleURL = mapboxMap.getStyleUrl();
+ String styleUrl = mapboxMap.getStyleUrl();
LatLngBounds bounds = mapboxMap.getProjection().getVisibleRegion().latLngBounds;
double minZoom = mapboxMap.getCameraPosition().zoom;
double maxZoom = mapboxMap.getMaxZoom();
float pixelRatio = this.getResources().getDisplayMetrics().density;
OfflineTilePyramidRegionDefinition definition = new OfflineTilePyramidRegionDefinition(
- styleURL, bounds, minZoom, maxZoom, pixelRatio);
+ styleUrl, bounds, minZoom, maxZoom, pixelRatio);
// Sample way of encoding metadata from a JSONObject
byte[] metadata;
@@ -255,17 +255,17 @@ public class OfflineActivity extends AppCompatActivity
jsonObject.put(JSON_FIELD_REGION_NAME, regionName);
String json = jsonObject.toString();
metadata = json.getBytes(JSON_CHARSET);
- } catch (Exception e) {
- Log.e(LOG_TAG, "Failed to encode metadata: " + e.getMessage());
+ } catch (Exception exception) {
+ Log.e(LOG_TAG, "Failed to encode metadata: " + exception.getMessage());
metadata = null;
}
// Create region
- mOfflineManager.createOfflineRegion(definition, metadata, new OfflineManager.CreateOfflineRegionCallback() {
+ offlineManager.createOfflineRegion(definition, metadata, new OfflineManager.CreateOfflineRegionCallback() {
@Override
public void onCreate(OfflineRegion offlineRegion) {
Log.d(LOG_TAG, "Offline region created: " + regionName);
- mOfflineRegion = offlineRegion;
+ OfflineActivity.this.offlineRegion = offlineRegion;
launchDownload();
}
@@ -278,12 +278,12 @@ public class OfflineActivity extends AppCompatActivity
private void launchDownload() {
// Set an observer
- mOfflineRegion.setObserver(new OfflineRegion.OfflineRegionObserver() {
+ offlineRegion.setObserver(new OfflineRegion.OfflineRegionObserver() {
@Override
public void onStatusChanged(OfflineRegionStatus status) {
// Compute a percentage
- double percentage = status.getRequiredResourceCount() >= 0 ?
- (100.0 * status.getCompletedResourceCount() / status.getRequiredResourceCount()) :
+ double percentage = status.getRequiredResourceCount() >= 0
+ ? (100.0 * status.getCompletedResourceCount() / status.getRequiredResourceCount()) :
0.0;
if (status.isComplete()) {
@@ -315,7 +315,7 @@ public class OfflineActivity extends AppCompatActivity
});
// Change the region state
- mOfflineRegion.setDownloadState(OfflineRegion.STATE_ACTIVE);
+ offlineRegion.setDownloadState(OfflineRegion.STATE_ACTIVE);
}
/*
@@ -329,18 +329,20 @@ public class OfflineActivity extends AppCompatActivity
// Start and show the progress bar
isEndNotified = false;
- mProgressBar.setIndeterminate(true);
- mProgressBar.setVisibility(View.VISIBLE);
+ progressBar.setIndeterminate(true);
+ progressBar.setVisibility(View.VISIBLE);
}
private void setPercentage(final int percentage) {
- mProgressBar.setIndeterminate(false);
- mProgressBar.setProgress(percentage);
+ progressBar.setIndeterminate(false);
+ progressBar.setProgress(percentage);
}
private void endProgress(final String message) {
// Don't notify more than once
- if (isEndNotified) return;
+ if (isEndNotified) {
+ return;
+ }
// Enable buttons
downloadRegion.setEnabled(true);
@@ -348,8 +350,8 @@ public class OfflineActivity extends AppCompatActivity
// Stop and hide the progress bar
isEndNotified = true;
- mProgressBar.setIndeterminate(false);
- mProgressBar.setVisibility(View.GONE);
+ progressBar.setIndeterminate(false);
+ progressBar.setVisibility(View.GONE);
// Show a toast
Toast.makeText(OfflineActivity.this, message, Toast.LENGTH_LONG).show();
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java
index dd4a10e88c..44380ae5b5 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java
@@ -13,7 +13,6 @@ import android.view.MenuItem;
import android.view.View;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
@@ -68,8 +67,11 @@ public class CircleLayerActivity extends AppCompatActivity {
// first time
try {
mapboxMap.addSource(new GeoJsonSource("point", new URL("https://gist.githubusercontent.com/anonymous/87eca90e80a72b1b42be9d0201ec3c8e/raw/acbb46384fd56044a504f122950d0637d98b4e7a/map.geojson")));
- } catch (MalformedURLException e) {
- Log.e(MapboxConstants.TAG, "That's not an url... " + e.getMessage());
+ } catch (MalformedURLException malformedUrlException) {
+ Log.e(
+ MapboxConstants.TAG,
+ "That's not an url... " + malformedUrlException.getMessage()
+ );
}
circleLayer = new CircleLayer("circleLayer", "point");
@@ -84,8 +86,12 @@ public class CircleLayerActivity extends AppCompatActivity {
// change size and color
circleLayer = mapboxMap.getLayer("circleLayer");
circleLayer.setProperties(
- circleRadius(mapView.getTag() == null ? getResources().getDimension(R.dimen.activity_horizontal_margin) : getResources().getDimension(R.dimen.circle_size)),
- circleColor(mapView.getTag() == null ? ResourcesCompat.getColor(getResources(), R.color.blue_accent, getTheme()) : ResourcesCompat.getColor(getResources(), R.color.green_accent, getTheme())));
+ circleRadius(mapView.getTag() == null
+ ? getResources().getDimension(R.dimen.activity_horizontal_margin)
+ : getResources().getDimension(R.dimen.circle_size)),
+ circleColor(mapView.getTag() == null ? ResourcesCompat.getColor(
+ getResources(), R.color.blue_accent, getTheme()) : ResourcesCompat.getColor(
+ getResources(), R.color.green_accent, getTheme())));
mapView.setTag(mapView.getTag() == null ? mapboxMap : null);
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java
index 74f2e5806c..ca4460eac2 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java
@@ -115,8 +115,8 @@ public class GeoJsonClusteringActivity extends AppCompatActivity {
.withClusterMaxZoom(14)
.withClusterRadius(50)
);
- } catch (MalformedURLException e) {
- Log.e(TAG, "That's not an url... " + e.getMessage());
+ } catch (MalformedURLException malformedUrlException) {
+ Log.e(TAG, "That's not an url... " + malformedUrlException.getMessage());
}
//Add unclustered layer
@@ -138,8 +138,8 @@ public class GeoJsonClusteringActivity extends AppCompatActivity {
circleRadius(18f)
);
circles.setFilter(
- i == 0 ?
- gte("point_count", layers[i][0]) :
+ i == 0
+ ? gte("point_count", layers[i][0]) :
all(gte("point_count", layers[i][0]), lt("point_count", layers[i - 1][0]))
);
mapboxMap.addLayer(circles);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
index c36b6b49fa..d8a82168fd 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
@@ -39,7 +39,8 @@ import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
-import static com.mapbox.mapboxsdk.style.layers.Filter.*;
+import static com.mapbox.mapboxsdk.style.layers.Filter.all;
+import static com.mapbox.mapboxsdk.style.layers.Filter.eq;
import static com.mapbox.mapboxsdk.style.layers.Function.Stop;
import static com.mapbox.mapboxsdk.style.layers.Function.stop;
import static com.mapbox.mapboxsdk.style.layers.Function.zoom;
@@ -219,8 +220,8 @@ public class RuntimeStyleActivity extends AppCompatActivity {
//Zoom to see buildings first
try {
mapboxMap.removeLayer("building");
- } catch (NoSuchLayerException e) {
- Toast.makeText(RuntimeStyleActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
+ } catch (NoSuchLayerException noSuchLayerException) {
+ Toast.makeText(RuntimeStyleActivity.this, noSuchLayerException.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@@ -229,8 +230,11 @@ public class RuntimeStyleActivity extends AppCompatActivity {
Source source;
try {
source = new GeoJsonSource("amsterdam-spots", readRawResource(R.raw.amsterdam));
- } catch (IOException e) {
- Toast.makeText(RuntimeStyleActivity.this, "Couldn't add source: " + e.getMessage(), Toast.LENGTH_SHORT).show();
+ } catch (IOException ioException) {
+ Toast.makeText(
+ RuntimeStyleActivity.this,
+ "Couldn't add source: " + ioException.getMessage(),
+ Toast.LENGTH_SHORT).show();
return;
}
@@ -292,7 +296,8 @@ public class RuntimeStyleActivity extends AppCompatActivity {
layer.setMaxZoom(15);
layer = (LineLayer) mapboxMap.getLayer("terrainLayer");
- Toast.makeText(this, String.format("Set min/max zoom to %s - %s", layer.getMinZoom(), layer.getMaxZoom()), Toast.LENGTH_SHORT).show();
+ Toast.makeText(this, String.format(
+ "Set min/max zoom to %s - %s", layer.getMinZoom(), layer.getMaxZoom()), Toast.LENGTH_SHORT).show();
}
private void addSatelliteLayer() {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java
index 9463cfcf08..83378148ae 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java
@@ -11,8 +11,10 @@ import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.sources.VectorSource;
import com.mapbox.mapboxsdk.testapp.R;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
+import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility;
/**
* Test activity for unit test execution
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java
index d19e55d508..72abd95ba8 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java
@@ -33,8 +33,6 @@ public class MyLocationDrawableActivity extends AppCompatActivity implements Loc
private MapView mapView;
private MapboxMap mapboxMap;
- private Location location;
- private boolean firstRun;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -61,8 +59,8 @@ public class MyLocationDrawableActivity extends AppCompatActivity implements Loc
mapboxMapOptions.myLocationForegroundTintColor(Color.GREEN);
mapboxMapOptions.myLocationBackgroundTintColor(Color.YELLOW);
mapboxMapOptions.myLocationBackgroundPadding(new int[]{0, 0,
- (int) getResources().getDimension(R.dimen.locationview_background_drawable_padding),
- (int) getResources().getDimension(R.dimen.locationview_background_drawable_padding)});
+ (int) getResources().getDimension(R.dimen.locationview_background_drawable_padding),
+ (int) getResources().getDimension(R.dimen.locationview_background_drawable_padding)});
mapboxMapOptions.myLocationAccuracyTint(Color.RED);
mapboxMapOptions.myLocationAccuracyAlpha(155);
@@ -84,9 +82,13 @@ public class MyLocationDrawableActivity extends AppCompatActivity implements Loc
public void toggleGps(boolean enableGps) {
if (enableGps) {
- if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) ||
- (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
+ if ((ContextCompat.checkSelfPermission(this,
+ Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
+ || (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
+ != PackageManager.PERMISSION_GRANTED)) {
+ ActivityCompat.requestPermissions(this, new String[]{
+ Manifest.permission.ACCESS_COARSE_LOCATION,
+ Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
} else {
enableLocation(true);
}
@@ -110,12 +112,10 @@ public class MyLocationDrawableActivity extends AppCompatActivity implements Loc
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
- switch (requestCode) {
- case PERMISSIONS_LOCATION: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- enableLocation(true);
- }
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ if (requestCode == PERMISSIONS_LOCATION) {
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ enableLocation(true);
}
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java
index 3fc793ad1d..937994ccd9 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java
@@ -60,29 +60,44 @@ public class MyLocationTintActivity extends AppCompatActivity implements Locatio
final MyLocationViewSettings myLocationViewSettings = mapboxMap.getMyLocationViewSettings();
// handle default button clicks
- ViewUtils.attachClickListener(MyLocationTintActivity.this, R.id.default_user_dot_coloring_button, new View.OnClickListener() {
+ ViewUtils.attachClickListener(
+ MyLocationTintActivity.this,
+ R.id.default_user_dot_coloring_button,
+ new View.OnClickListener() {
@Override
public void onClick(View view) {
- myLocationViewSettings.setAccuracyTintColor(ContextCompat.getColor(MyLocationTintActivity.this, R.color.my_location_ring));
- myLocationViewSettings.setForegroundTintColor(ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_blue));
+ myLocationViewSettings.setAccuracyTintColor(ContextCompat.getColor(
+ MyLocationTintActivity.this, R.color.my_location_ring));
+ myLocationViewSettings.setForegroundTintColor(ContextCompat.getColor(
+ MyLocationTintActivity.this, R.color.mapbox_blue));
}
});
// handle tint user dot button clicks
- ViewUtils.attachClickListener(MyLocationTintActivity.this, R.id.tint_user_dot_button, new View.OnClickListener() {
+ ViewUtils.attachClickListener(
+ MyLocationTintActivity.this,
+ R.id.tint_user_dot_button,
+ new View.OnClickListener() {
@Override
public void onClick(View view) {
- myLocationViewSettings.setAccuracyTintColor(ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_green));
- myLocationViewSettings.setForegroundTintColor(ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_green));
+ myLocationViewSettings.setAccuracyTintColor(
+ ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_green));
+ myLocationViewSettings.setForegroundTintColor(
+ ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_green));
}
});
// handle tint accuracy ring button clicks
- ViewUtils.attachClickListener(MyLocationTintActivity.this, R.id.user_accuracy_ring_tint_button, new View.OnClickListener() {
+ ViewUtils.attachClickListener(
+ MyLocationTintActivity.this,
+ R.id.user_accuracy_ring_tint_button,
+ new View.OnClickListener() {
@Override
public void onClick(View view) {
- myLocationViewSettings.setAccuracyTintColor(ContextCompat.getColor(MyLocationTintActivity.this, R.color.accent));
- myLocationViewSettings.setForegroundTintColor(ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_blue));
+ myLocationViewSettings.setAccuracyTintColor(
+ ContextCompat.getColor(MyLocationTintActivity.this, R.color.accent));
+ myLocationViewSettings.setForegroundTintColor(
+ ContextCompat.getColor(MyLocationTintActivity.this, R.color.mapbox_blue));
}
});
}
@@ -154,9 +169,13 @@ public class MyLocationTintActivity extends AppCompatActivity implements Locatio
@UiThread
public void toggleGps(boolean enableGps) {
if (enableGps) {
- if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) ||
- (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
+ if ((ContextCompat.checkSelfPermission(this,
+ Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
+ || (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
+ != PackageManager.PERMISSION_GRANTED)) {
+ ActivityCompat.requestPermissions(this, new String[]{
+ Manifest.permission.ACCESS_COARSE_LOCATION,
+ Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
} else {
enableLocation(true);
}
@@ -179,19 +198,18 @@ public class MyLocationTintActivity extends AppCompatActivity implements Locatio
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
- switch (requestCode) {
- case PERMISSIONS_LOCATION: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- enableLocation(true);
- }
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ if (requestCode == PERMISSIONS_LOCATION) {
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ enableLocation(true);
}
}
}
private static class ViewUtils {
- public static void attachClickListener(@NonNull Activity activity, @IdRes int buttonId, @Nullable View.OnClickListener clickListener) {
+ public static void attachClickListener(
+ @NonNull Activity activity, @IdRes int buttonId, @Nullable View.OnClickListener clickListener) {
View view = activity.findViewById(buttonId);
if (view != null) {
view.setOnClickListener(clickListener);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java
index b92bb5937c..c2498223a2 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java
@@ -16,7 +16,6 @@ import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
@@ -27,7 +26,7 @@ public class MyLocationToggleActivity extends AppCompatActivity {
private MapView mapView;
private MapboxMap mapboxMap;
- private FloatingActionButton locationToggleFAB;
+ private FloatingActionButton locationToggleFab;
private static final int PERMISSIONS_LOCATION = 0;
@@ -55,10 +54,10 @@ public class MyLocationToggleActivity extends AppCompatActivity {
}
});
- locationToggleFAB = (FloatingActionButton) findViewById(R.id.fabLocationToggle);
- locationToggleFAB.setOnClickListener(new View.OnClickListener() {
+ locationToggleFab = (FloatingActionButton) findViewById(R.id.fabLocationToggle);
+ locationToggleFab.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
if (mapboxMap != null) {
toggleGps(!mapboxMap.isMyLocationEnabled());
}
@@ -111,9 +110,13 @@ public class MyLocationToggleActivity extends AppCompatActivity {
@UiThread
public void toggleGps(boolean enableGps) {
if (enableGps) {
- if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) ||
- (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
+ if ((ContextCompat.checkSelfPermission(this,
+ Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
+ || (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
+ != PackageManager.PERMISSION_GRANTED)) {
+ ActivityCompat.requestPermissions(this, new String[]{
+ Manifest.permission.ACCESS_COARSE_LOCATION,
+ Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
} else {
enableLocation(true);
}
@@ -138,21 +141,19 @@ public class MyLocationToggleActivity extends AppCompatActivity {
}
}
});
- locationToggleFAB.setImageResource(R.drawable.ic_location_disabled_24dp);
+ locationToggleFab.setImageResource(R.drawable.ic_location_disabled_24dp);
} else {
- locationToggleFAB.setImageResource(R.drawable.ic_my_location_24dp);
+ locationToggleFab.setImageResource(R.drawable.ic_my_location_24dp);
}
mapboxMap.setMyLocationEnabled(enabled);
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
- switch (requestCode) {
- case PERMISSIONS_LOCATION: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- enableLocation(true);
- }
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ if (requestCode == PERMISSIONS_LOCATION) {
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ enableLocation(true);
}
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java
index d65eeda9f0..d89f3e2cf8 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java
@@ -32,12 +32,14 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.maps.TrackingSettings;
import com.mapbox.mapboxsdk.testapp.R;
-public class MyLocationTrackingModeActivity extends AppCompatActivity implements MapboxMap.OnMyLocationChangeListener, AdapterView.OnItemSelectedListener {
+public class MyLocationTrackingModeActivity extends AppCompatActivity
+ implements MapboxMap.OnMyLocationChangeListener, AdapterView.OnItemSelectedListener {
- private MapView mMapView;
+ private MapView mapView;
private MapboxMap mapboxMap;
- private Spinner mLocationSpinner, mBearingSpinner;
- private Location mLocation;
+ private Spinner locationSpinner;
+ private Spinner bearingSpinner;
+ private Location location;
private static final int PERMISSIONS_LOCATION = 0;
@Override
@@ -55,9 +57,9 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
actionBar.setDisplayShowHomeEnabled(true);
}
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.onCreate(savedInstanceState);
- mMapView.getMapAsync(new OnMapReadyCallback() {
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
MyLocationTrackingModeActivity.this.mapboxMap = mapboxMap;
@@ -69,25 +71,27 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
mapboxMap.setOnMyLocationChangeListener(MyLocationTrackingModeActivity.this);
- ArrayAdapter<CharSequence> locationTrackingAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(), R.array.user_tracking_mode, android.R.layout.simple_spinner_item);
+ ArrayAdapter<CharSequence> locationTrackingAdapter = ArrayAdapter.createFromResource(
+ actionBar.getThemedContext(), R.array.user_tracking_mode, android.R.layout.simple_spinner_item);
locationTrackingAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- mLocationSpinner = (Spinner) findViewById(R.id.spinner_location);
- mLocationSpinner.setAdapter(locationTrackingAdapter);
- mLocationSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
+ locationSpinner = (Spinner) findViewById(R.id.spinner_location);
+ locationSpinner.setAdapter(locationTrackingAdapter);
+ locationSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
- ArrayAdapter<CharSequence> bearingTrackingAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(), R.array.user_bearing_mode, android.R.layout.simple_spinner_item);
+ ArrayAdapter<CharSequence> bearingTrackingAdapter = ArrayAdapter.createFromResource(
+ actionBar.getThemedContext(), R.array.user_bearing_mode, android.R.layout.simple_spinner_item);
bearingTrackingAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- mBearingSpinner = (Spinner) findViewById(R.id.spinner_bearing);
- mBearingSpinner.setAdapter(bearingTrackingAdapter);
- mBearingSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
+ bearingSpinner = (Spinner) findViewById(R.id.spinner_bearing);
+ bearingSpinner.setAdapter(bearingTrackingAdapter);
+ bearingSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
mapboxMap.setOnMyLocationTrackingModeChangeListener(new MapboxMap.OnMyLocationTrackingModeChangeListener() {
@Override
public void onMyLocationTrackingModeChange(@MyLocationTracking.Mode int myLocationTrackingMode) {
if (MyLocationTracking.TRACKING_NONE == myLocationTrackingMode) {
- mLocationSpinner.setOnItemSelectedListener(null);
- mLocationSpinner.setSelection(0);
- mLocationSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
+ locationSpinner.setOnItemSelectedListener(null);
+ locationSpinner.setSelection(0);
+ locationSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
}
}
});
@@ -96,9 +100,9 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
@Override
public void onMyBearingTrackingModeChange(@MyBearingTracking.Mode int myBearingTrackingMode) {
if (MyBearingTracking.NONE == myBearingTrackingMode) {
- mBearingSpinner.setOnItemSelectedListener(null);
- mBearingSpinner.setSelection(0);
- mBearingSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
+ bearingSpinner.setOnItemSelectedListener(null);
+ bearingSpinner.setSelection(0);
+ bearingSpinner.setOnItemSelectedListener(MyLocationTrackingModeActivity.this);
}
}
});
@@ -113,9 +117,13 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
@UiThread
public void toggleGps(boolean enableGps) {
if (enableGps) {
- if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) ||
- (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
+ if ((ContextCompat.checkSelfPermission(this,
+ Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
+ || (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
+ != PackageManager.PERMISSION_GRANTED)) {
+ ActivityCompat.requestPermissions(this, new String[]{
+ Manifest.permission.ACCESS_COARSE_LOCATION,
+ Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
} else {
enableLocation(true);
}
@@ -137,12 +145,10 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
- switch (requestCode) {
- case PERMISSIONS_LOCATION: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- enableLocation(true);
- }
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ if (requestCode == PERMISSIONS_LOCATION) {
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ enableLocation(true);
}
}
}
@@ -150,18 +156,18 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
private void setInitialPosition(LatLng latLng) {
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14));
mapboxMap.setMyLocationEnabled(true);
- mLocationSpinner.setEnabled(true);
- mBearingSpinner.setEnabled(true);
+ locationSpinner.setEnabled(true);
+ bearingSpinner.setEnabled(true);
}
@Override
public void onMyLocationChange(@Nullable Location location) {
if (location != null) {
- if (mLocation == null) {
+ if (this.location == null) {
// initial location to reposition map
setInitialPosition(new LatLng(location));
}
- mLocation = location;
+ this.location = location;
showSnackBar();
}
}
@@ -169,16 +175,16 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
private void showSnackBar() {
String desc = "Loc Chg: ";
boolean noInfo = true;
- if (mLocation.hasSpeed()) {
- desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Spd = %.1f km/h ", mLocation.getSpeed() * 3.6f);
+ if (location.hasSpeed()) {
+ desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Spd = %.1f km/h ", location.getSpeed() * 3.6f);
noInfo = false;
}
- if (mLocation.hasAltitude()) {
- desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Alt = %.0f m ", mLocation.getAltitude());
+ if (location.hasAltitude()) {
+ desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Alt = %.0f m ", location.getAltitude());
noInfo = false;
}
- if (mLocation.hasAccuracy()) {
- desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Acc = %.0f m", mLocation.getAccuracy());
+ if (location.hasAccuracy()) {
+ desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Acc = %.0f m", location.getAccuracy());
}
if (noInfo) {
@@ -225,31 +231,31 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements
@Override
public void onResume() {
super.onResume();
- mMapView.onResume();
+ mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
- mMapView.onPause();
+ mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mMapView.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mMapView.onDestroy();
+ mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
- mMapView.onLowMemory();
+ mapView.onLowMemory();
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java
index fac7e34ce1..71adba8ac7 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java
@@ -22,12 +22,12 @@ public class FeatureAdapter extends RecyclerView.Adapter<FeatureAdapter.ViewHold
public TextView labelView;
public TextView descriptionView;
- public ViewHolder(View v) {
- super(v);
- Typeface typeface = FontCache.get("Roboto-Regular.ttf",v.getContext());
- labelView = (TextView) v.findViewById(R.id.nameView);
+ public ViewHolder(View view) {
+ super(view);
+ Typeface typeface = FontCache.get("Roboto-Regular.ttf",view.getContext());
+ labelView = (TextView) view.findViewById(R.id.nameView);
labelView.setTypeface(typeface);
- descriptionView = (TextView) v.findViewById(R.id.descriptionView);
+ descriptionView = (TextView) view.findViewById(R.id.descriptionView);
descriptionView.setTypeface(typeface);
}
}
@@ -38,8 +38,8 @@ public class FeatureAdapter extends RecyclerView.Adapter<FeatureAdapter.ViewHold
@Override
public FeatureAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
- View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main_feature, parent, false);
- return new ViewHolder(v);
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main_feature, parent, false);
+ return new ViewHolder(view);
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java
index e0141586e4..4eabb0a3bb 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java
@@ -4,15 +4,15 @@ import com.mapbox.mapboxsdk.annotations.Marker;
public class CityStateMarker extends Marker {
- private String mInfoWindowBackgroundColor;
+ private String infoWindowBackgroundColor;
public CityStateMarker(CityStateMarkerOptions cityStateOptions, String color) {
super(cityStateOptions);
- mInfoWindowBackgroundColor = color;
+ infoWindowBackgroundColor = color;
}
public String getInfoWindowBackgroundColor() {
- return mInfoWindowBackgroundColor;
+ return infoWindowBackgroundColor;
}
} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java
index a716518c22..a4c32da92c 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarkerOptions.java
@@ -11,10 +11,10 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
public class CityStateMarkerOptions extends BaseMarkerOptions<CityStateMarker, CityStateMarkerOptions> {
- private String mInfoWindowBackgroundColor;
+ private String infoWindowBackgroundColor;
public CityStateMarkerOptions infoWindowBackground(String color) {
- mInfoWindowBackgroundColor = color;
+ infoWindowBackgroundColor = color;
return getThis();
}
@@ -38,7 +38,7 @@ public class CityStateMarkerOptions extends BaseMarkerOptions<CityStateMarker, C
@Override
public CityStateMarker getMarker() {
- return new CityStateMarker(this, mInfoWindowBackgroundColor);
+ return new CityStateMarker(this, infoWindowBackgroundColor);
}
public static final Parcelable.Creator<CityStateMarkerOptions> CREATOR
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java
index a1df434ebc..9059b5978b 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java
@@ -7,7 +7,6 @@ import android.os.Parcelable;
import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.IconFactory;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
import com.mapbox.mapboxsdk.geometry.LatLng;
public class CountryMarkerViewOptions extends BaseMarkerViewOptions<CountryMarkerView, CountryMarkerViewOptions> {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java
index a8622e9790..a91ec5e541 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java
@@ -7,7 +7,6 @@ import android.os.Parcelable;
import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.IconFactory;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
import com.mapbox.mapboxsdk.geometry.LatLng;
public class TextMarkerViewOptions extends BaseMarkerViewOptions<TextMarkerView, TextMarkerViewOptions> {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/constants/AppConstant.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/constants/AppConstant.java
index 60ed6168cb..095e47a3d2 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/constants/AppConstant.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/constants/AppConstant.java
@@ -2,5 +2,5 @@ package com.mapbox.mapboxsdk.testapp.model.constants;
public class AppConstant {
- public final static int STYLE_VERSION = 9;
+ public static final int STYLE_VERSION = 9;
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java
index 3c2d1cab5e..493153d1c1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineDownloadRegionDialog.java
@@ -12,23 +12,20 @@ import android.widget.EditText;
import com.mapbox.mapboxsdk.testapp.R;
-/**
- * Created by antonio on 2/17/16.
- */
public class OfflineDownloadRegionDialog extends DialogFragment {
- private final static String LOG_TAG = "OfflineDownloadRegionDialog";
+ private static final String LOG_TAG = "OfflineDownloadRegionDialog";
public interface DownloadRegionDialogListener {
void onDownloadRegionDialogPositiveClick(String regionName);
}
- DownloadRegionDialogListener mListener;
+ DownloadRegionDialogListener listener;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
- mListener = (DownloadRegionDialogListener) activity;
+ listener = (DownloadRegionDialogListener) activity;
}
@NonNull
@@ -46,7 +43,7 @@ public class OfflineDownloadRegionDialog extends DialogFragment {
@Override
public void onClick(DialogInterface dialog, int which) {
String regionName = regionNameEdit.getText().toString();
- mListener.onDownloadRegionDialogPositiveClick(regionName);
+ listener.onDownloadRegionDialogPositiveClick(regionName);
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java
index e00465a9b1..2a5de869a5 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java
@@ -12,14 +12,11 @@ import com.mapbox.mapboxsdk.testapp.R;
import java.util.ArrayList;
-/**
- * Created by antonio on 2/17/16.
- */
public class OfflineListRegionsDialog extends DialogFragment {
- private final static String LOG_TAG = "OfflineListRegionsDialog";
+ private static final String LOG_TAG = "OfflineListRegionsDialog";
- public final static String ITEMS = "ITEMS";
+ public static final String ITEMS = "ITEMS";
@NonNull
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java
index 46552fb7ae..97bfb90d41 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java
@@ -18,7 +18,7 @@ public class FontCache {
try {
tf = Typeface.createFromAsset(context.getAssets(), name);
fontCache.put(name, tf);
- } catch (Exception e) {
+ } catch (Exception exception) {
Log.e(MapboxConstants.TAG, "Font not found");
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java
index 51e09f3593..ba74d1d837 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java
@@ -6,37 +6,37 @@ import android.view.View;
import com.mapbox.mapboxsdk.testapp.R;
public class ItemClickSupport {
- private final RecyclerView mRecyclerView;
- private OnItemClickListener mOnItemClickListener;
- private OnItemLongClickListener mOnItemLongClickListener;
- private View.OnClickListener mOnClickListener = new View.OnClickListener() {
+ private final RecyclerView recyclerView;
+ private OnItemClickListener onItemClickListener;
+ private OnItemLongClickListener onItemLongClickListener;
+ private View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
- public void onClick(View v) {
- if (mOnItemClickListener != null) {
- RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v);
- mOnItemClickListener.onItemClicked(mRecyclerView, holder.getAdapterPosition(), v);
+ public void onClick(View view) {
+ if (onItemClickListener != null) {
+ RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(view);
+ onItemClickListener.onItemClicked(recyclerView, holder.getAdapterPosition(), view);
}
}
};
- private View.OnLongClickListener mOnLongClickListener = new View.OnLongClickListener() {
+ private View.OnLongClickListener onLongClickListener = new View.OnLongClickListener() {
@Override
- public boolean onLongClick(View v) {
- if (mOnItemLongClickListener != null) {
- RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v);
- return mOnItemLongClickListener.onItemLongClicked(mRecyclerView, holder.getAdapterPosition(), v);
+ public boolean onLongClick(View view) {
+ if (onItemLongClickListener != null) {
+ RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(view);
+ return onItemLongClickListener.onItemLongClicked(recyclerView, holder.getAdapterPosition(), view);
}
return false;
}
};
- private RecyclerView.OnChildAttachStateChangeListener mAttachListener
+ private RecyclerView.OnChildAttachStateChangeListener attachListener
= new RecyclerView.OnChildAttachStateChangeListener() {
@Override
public void onChildViewAttachedToWindow(View view) {
- if (mOnItemClickListener != null) {
- view.setOnClickListener(mOnClickListener);
+ if (onItemClickListener != null) {
+ view.setOnClickListener(onClickListener);
}
- if (mOnItemLongClickListener != null) {
- view.setOnLongClickListener(mOnLongClickListener);
+ if (onItemLongClickListener != null) {
+ view.setOnLongClickListener(onLongClickListener);
}
}
@@ -47,9 +47,9 @@ public class ItemClickSupport {
};
private ItemClickSupport(RecyclerView recyclerView) {
- mRecyclerView = recyclerView;
- mRecyclerView.setTag(R.id.item_click_support, this);
- mRecyclerView.addOnChildAttachStateChangeListener(mAttachListener);
+ this.recyclerView = recyclerView;
+ this.recyclerView.setTag(R.id.item_click_support, this);
+ this.recyclerView.addOnChildAttachStateChangeListener(attachListener);
}
public static ItemClickSupport addTo(RecyclerView view) {
@@ -69,27 +69,27 @@ public class ItemClickSupport {
}
public ItemClickSupport setOnItemClickListener(OnItemClickListener listener) {
- mOnItemClickListener = listener;
+ onItemClickListener = listener;
return this;
}
public ItemClickSupport setOnItemLongClickListener(OnItemLongClickListener listener) {
- mOnItemLongClickListener = listener;
+ onItemLongClickListener = listener;
return this;
}
private void detach(RecyclerView view) {
- view.removeOnChildAttachStateChangeListener(mAttachListener);
+ view.removeOnChildAttachStateChangeListener(attachListener);
view.setTag(R.id.item_click_support, null);
}
public interface OnItemClickListener {
- void onItemClicked(RecyclerView recyclerView, int position, View v);
+ void onItemClicked(RecyclerView recyclerView, int position, View view);
}
public interface OnItemLongClickListener {
- boolean onItemLongClicked(RecyclerView recyclerView, int position, View v);
+ boolean onItemLongClicked(RecyclerView recyclerView, int position, View view);
}
} \ No newline at end of file