Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] - revert java8 support in the SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun committed Mar 6, 2018
1 parent 19d08db commit 9909994
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 37 deletions.
4 changes: 2 additions & 2 deletions platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

lintOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ public boolean onMultiFingerTap(MultiFingerTapGestureDetector detector, int poin
}
}

private Animator createScaleAnimator(double currentZoom, double zoomAddition, PointF animationFocalPoint,
private Animator createScaleAnimator(double currentZoom, double zoomAddition, final PointF animationFocalPoint,
long animationTime) {
ValueAnimator animator = ValueAnimator.ofFloat((float) currentZoom, (float) (currentZoom + zoomAddition));
animator.setDuration(animationTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,14 @@ public void onSurfaceCreated(GL10 gl, EGLConfig config) {

private void onSurfaceCreated() {
hasSurface = true;
post(() -> {
// Initialise only when not destroyed and only once
if (!destroyed && mapboxMap == null) {
initialiseMap();
mapboxMap.onStart();
post(new Runnable() {
@Override
public void run() {
// Initialise only when not destroyed and only once
if (!destroyed && mapboxMap == null) {
MapView.this.initialiseMap();
mapboxMap.onStart();
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void setZoom(double zoom, @NonNull PointF focalPoint) {
setZoom(zoom, focalPoint, 0);
}

void setZoom(double zoom, @NonNull PointF focalPoint, long duration) {
void setZoom(double zoom, @NonNull PointF focalPoint, final long duration) {
if (mapView != null) {
mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.mapbox.mapboxsdk.LibraryLoader;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.storage.FileSource;
Expand Down Expand Up @@ -250,9 +249,12 @@ public void setObserver(@Nullable final OfflineRegionObserver observer) {
@Override
public void onStatusChanged(final OfflineRegionStatus status) {
if (deliverMessages()) {
handler.post(() -> {
if (observer != null) {
observer.onStatusChanged(status);
handler.post(new Runnable() {
@Override
public void run() {
if (observer != null) {
observer.onStatusChanged(status);
}
}
});
}
Expand All @@ -261,9 +263,12 @@ public void onStatusChanged(final OfflineRegionStatus status) {
@Override
public void onError(final OfflineRegionError error) {
if (deliverMessages()) {
handler.post(() -> {
if (observer != null) {
observer.onError(error);
handler.post(new Runnable() {
@Override
public void run() {
if (observer != null) {
observer.onError(error);
}
}
});
}
Expand All @@ -272,9 +277,12 @@ public void onError(final OfflineRegionError error) {
@Override
public void mapboxTileCountLimitExceeded(final long limit) {
if (deliverMessages()) {
handler.post(() -> {
if (observer != null) {
observer.mapboxTileCountLimitExceeded(limit);
handler.post(new Runnable() {
@Override
public void run() {
if (observer != null) {
observer.mapboxTileCountLimitExceeded(limit);
}
}
});
}
Expand Down Expand Up @@ -313,17 +321,23 @@ public void getStatus(@NonNull final OfflineRegionStatusCallback callback) {
getOfflineRegionStatus(new OfflineRegionStatusCallback() {
@Override
public void onStatus(final OfflineRegionStatus status) {
handler.post(() -> {
callback.onStatus(status);
FileSource.getInstance(Mapbox.getApplicationContext()).deactivate();
handler.post(new Runnable() {
@Override
public void run() {
callback.onStatus(status);
FileSource.getInstance(Mapbox.getApplicationContext()).deactivate();
}
});
}

@Override
public void onError(final String error) {
handler.post(() -> {
callback.onError(error);
FileSource.getInstance(Mapbox.getApplicationContext()).deactivate();
handler.post(new Runnable() {
@Override
public void run() {
callback.onError(error);
FileSource.getInstance(Mapbox.getApplicationContext()).deactivate();
}
});
}
});
Expand Down Expand Up @@ -353,19 +367,25 @@ public void delete(@NonNull final OfflineRegionDeleteCallback callback) {
deleteOfflineRegion(new OfflineRegionDeleteCallback() {
@Override
public void onDelete() {
handler.post((Runnable) () -> {
callback.onDelete();
FileSource.getInstance(Mapbox.getApplicationContext()).deactivate();
OfflineRegion.this.finalize();
handler.post(new Runnable() {
@Override
public void run() {
callback.onDelete();
FileSource.getInstance(Mapbox.getApplicationContext()).deactivate();
OfflineRegion.this.finalize();
}
});
}

@Override
public void onError(final String error) {
handler.post(() -> {
isDeleted = false;
FileSource.getInstance(Mapbox.getApplicationContext()).deactivate();
callback.onError(error);
handler.post(new Runnable() {
@Override
public void run() {
isDeleted = false;
FileSource.getInstance(Mapbox.getApplicationContext()).deactivate();
callback.onError(error);
}
});
}
});
Expand All @@ -386,15 +406,23 @@ public void updateMetadata(@NonNull final byte[] bytes, @NonNull final OfflineRe
updateOfflineRegionMetadata(bytes, new OfflineRegionUpdateMetadataCallback() {
@Override
public void onUpdate(final byte[] metadata) {
handler.post(() -> {
OfflineRegion.this.metadata = metadata;
callback.onUpdate(metadata);
handler.post(new Runnable() {
@Override
public void run() {
OfflineRegion.this.metadata = metadata;
callback.onUpdate(metadata);
}
});
}

@Override
public void onError(final String error) {
handler.post(() -> callback.onError(error));
handler.post(new Runnable() {
@Override
public void run() {
callback.onError(error);
}
});
}
});
}
Expand Down

0 comments on commit 9909994

Please sign in to comment.