Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 5933ab2

Browse files
author
Langston Smith
authored
Adding ClickToAddImageActivity example to MainActivity (#923)
* additions * added null check
1 parent 1f2ca89 commit 5933ab2

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

MapboxAndroidDemo/src/global/java/com/mapbox/mapboxandroiddemo/MainActivity.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,14 @@ private void initializeModels() {
556556
null,
557557
R.string.activity_style_image_source_url, false, BuildConfig.MIN_SDK_VERSION
558558
));
559+
exampleItemModels.add(new ExampleItemModel(
560+
R.id.nav_styles,
561+
R.string.activity_styles_click_to_add_image_title,
562+
R.string.activity_styles_click_to_add_image_description,
563+
new Intent(MainActivity.this, ClickToAddImageActivity.class),
564+
null,
565+
R.string.activity_styles_click_to_add_image_url, false, BuildConfig.MIN_SDK_VERSION
566+
));
559567
exampleItemModels.add(new ExampleItemModel(
560568
R.id.nav_styles,
561569
R.string.activity_style_image_source_time_lapse_title,

MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/labs/MarkerFollowingRouteActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ public void run() {
127127
markerIconCurrentLocation = (LatLng) markerIconAnimator.getAnimatedValue();
128128
markerIconAnimator.cancel();
129129
}
130-
131130
if (latLngEvaluator != null) {
132131
markerIconAnimator = ObjectAnimator
133132
.ofObject(latLngEvaluator, count == 0 ? new LatLng(37.61501, -122.385374)

MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/styles/ClickToAddImageActivity.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public class ClickToAddImageActivity extends AppCompatActivity implements
4747
private static final String ID_IMAGE_SOURCE = "source-id";
4848
private static final String CIRCLE_SOURCE_ID = "circle-source-id";
4949
private static final String ID_IMAGE_LAYER = "layer-id";
50+
private static int PHOTO_PICK_CODE = 4;
5051
private MapView mapView;
5152
private MapboxMap mapboxMap;
5253
private LatLngQuad quad;
5354
private List<Feature> boundsFeatureList;
5455
private List<Point> boundsCirclePointList;
55-
private static int PHOTO_PICK_CODE = 4;
5656
private int imageCountIndex;
5757

5858
@Override
@@ -99,7 +99,7 @@ public boolean onMapClick(@NonNull LatLng point) {
9999

100100
boundsFeatureList.add(Feature.fromGeometry(Point.fromLngLat(point.getLongitude(), point.getLatitude())));
101101

102-
// Add the click point to the circle layer and update the display of the circle layer data
102+
// Add the click point to the CircleLayer and update the display of the CircleLayer data
103103
boundsCirclePointList.add(Point.fromLngLat(point.getLongitude(), point.getLatitude()));
104104

105105
Style style = mapboxMap.getStyle();
@@ -130,7 +130,6 @@ public boolean onMapClick(@NonNull LatLng point) {
130130
pickPhotoIntent.setType("image/*");
131131
startActivityForResult(pickPhotoIntent, PHOTO_PICK_CODE);
132132
}
133-
134133
return true;
135134
}
136135

@@ -172,7 +171,7 @@ public void onActivityResult(int requestCode, int resultCode, final Intent data)
172171
@Override
173172
public void onStyleLoaded(@NonNull Style style) {
174173
Uri selectedImage = data.getData();
175-
InputStream imageStream = null;
174+
InputStream imageStream;
176175
try {
177176
imageStream = getContentResolver().openInputStream(selectedImage);
178177

0 commit comments

Comments
 (0)