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

Commit

Permalink
Adding ClickToAddImageActivity example to MainActivity (#923)
Browse files Browse the repository at this point in the history
* additions

* added null check
  • Loading branch information
Langston Smith authored Mar 29, 2019
1 parent 1f2ca89 commit 5933ab2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,14 @@ private void initializeModels() {
null,
R.string.activity_style_image_source_url, false, BuildConfig.MIN_SDK_VERSION
));
exampleItemModels.add(new ExampleItemModel(
R.id.nav_styles,
R.string.activity_styles_click_to_add_image_title,
R.string.activity_styles_click_to_add_image_description,
new Intent(MainActivity.this, ClickToAddImageActivity.class),
null,
R.string.activity_styles_click_to_add_image_url, false, BuildConfig.MIN_SDK_VERSION
));
exampleItemModels.add(new ExampleItemModel(
R.id.nav_styles,
R.string.activity_style_image_source_time_lapse_title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public void run() {
markerIconCurrentLocation = (LatLng) markerIconAnimator.getAnimatedValue();
markerIconAnimator.cancel();
}

if (latLngEvaluator != null) {
markerIconAnimator = ObjectAnimator
.ofObject(latLngEvaluator, count == 0 ? new LatLng(37.61501, -122.385374)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public class ClickToAddImageActivity extends AppCompatActivity implements
private static final String ID_IMAGE_SOURCE = "source-id";
private static final String CIRCLE_SOURCE_ID = "circle-source-id";
private static final String ID_IMAGE_LAYER = "layer-id";
private static int PHOTO_PICK_CODE = 4;
private MapView mapView;
private MapboxMap mapboxMap;
private LatLngQuad quad;
private List<Feature> boundsFeatureList;
private List<Point> boundsCirclePointList;
private static int PHOTO_PICK_CODE = 4;
private int imageCountIndex;

@Override
Expand Down Expand Up @@ -99,7 +99,7 @@ public boolean onMapClick(@NonNull LatLng point) {

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

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

Style style = mapboxMap.getStyle();
Expand Down Expand Up @@ -130,7 +130,6 @@ public boolean onMapClick(@NonNull LatLng point) {
pickPhotoIntent.setType("image/*");
startActivityForResult(pickPhotoIntent, PHOTO_PICK_CODE);
}

return true;
}

Expand Down Expand Up @@ -172,7 +171,7 @@ public void onActivityResult(int requestCode, int resultCode, final Intent data)
@Override
public void onStyleLoaded(@NonNull Style style) {
Uri selectedImage = data.getData();
InputStream imageStream = null;
InputStream imageStream;
try {
imageStream = getContentResolver().openInputStream(selectedImage);

Expand Down

0 comments on commit 5933ab2

Please sign in to comment.