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

Commit

Permalink
[android] - modularise the sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun committed Jul 27, 2018
1 parent 94ad8e2 commit b73d3ca
Show file tree
Hide file tree
Showing 47 changed files with 1,424 additions and 503 deletions.
3 changes: 1 addition & 2 deletions platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
}
implementation dependenciesList.supportAnnotations
implementation dependenciesList.supportFragmentV4
implementation dependenciesList.timber
implementation dependenciesList.okhttp3
testImplementation dependenciesList.junit
testImplementation dependenciesList.mockito
Expand Down Expand Up @@ -159,4 +158,4 @@ apply from: "${rootDir}/gradle/gradle-javadoc.gradle"
apply from: "${rootDir}/gradle/gradle-publish.gradle"
apply from: "${rootDir}/gradle/gradle-checkstyle.gradle"
apply from: "${rootDir}/gradle/gradle-tests-staticblockremover.gradle"
apply from: "${rootDir}/gradle/gradle-dependencies-graph.gradle"
apply from: "${rootDir}/gradle/gradle-dependencies-graph.gradle"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.mapbox.mapboxsdk;

import timber.log.Timber;
import com.mapbox.mapboxsdk.log.Logger;

/**
* Loads the mapbox-gl shared library
Expand All @@ -11,6 +11,8 @@
*/
public abstract class LibraryLoader {

private static final String TAG = "LibraryLoader";

private static final LibraryLoader DEFAULT = new LibraryLoader() {
@Override
public void load(String name) {
Expand Down Expand Up @@ -39,7 +41,7 @@ public static void load() {
try {
loader.load("mapbox-gl");
} catch (UnsatisfiedLinkError error) {
Timber.e(error, "Failed to load native shared library.");
Logger.e(TAG, "Failed to load native shared library.", error);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
import android.support.annotation.UiThread;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException;
import com.mapbox.mapboxsdk.maps.Telemetry;
import com.mapbox.mapboxsdk.log.Logger;
import com.mapbox.mapboxsdk.maps.TelemetryBase;
import com.mapbox.mapboxsdk.module.ModuleProvider;
import com.mapbox.mapboxsdk.net.ConnectivityReceiver;
import timber.log.Timber;

import static android.content.ContentValues.TAG;

/**
* The entry point to initialize the Mapbox Android SDK.
Expand All @@ -29,6 +32,7 @@ public final class Mapbox {
private Context context;
private String accessToken;
private Boolean connected;
private TelemetryBase telemetry;

/**
* Get an instance of Mapbox.
Expand Down Expand Up @@ -116,12 +120,22 @@ public static synchronized Boolean isConnected() {
*/
private static void initializeTelemetry() {
try {
Telemetry.initialize();
INSTANCE.telemetry = ModuleProvider.injectTelemetry();
} catch (Exception exception) {
Timber.e(exception);
Logger.e(TAG, "Error occured while initializing telemetry", exception);
}
}

/**
* Get an instance of Telemetry if initialised
*
* @return instance of telemetry
*/
@Nullable
public static TelemetryBase getTelemetry() {
return INSTANCE.telemetry;
}

/**
* Runtime validation of Mapbox creation.
*/
Expand All @@ -145,4 +159,4 @@ static boolean isAccessTokenValid(String accessToken) {
accessToken = accessToken.trim().toLowerCase(MapboxConstants.MAPBOX_LOCALE);
return accessToken.length() != 0 && (accessToken.startsWith("pk.") || accessToken.startsWith("sk."));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.mapbox.mapboxsdk.constants;

public class TelemetryConstants {

public static final String TWO_FINGER_TAP = "TwoFingerTap";
public static final String DOUBLE_TAP = "DoubleTap";
public static final String SINGLE_TAP = "SingleTap";
public static final String PAN = "Pan";
public static final String PINCH = "Pinch";
public static final String ROTATION = "Rotation";
public static final String PITCH = "Pitch";

}

This file was deleted.

Loading

0 comments on commit b73d3ca

Please sign in to comment.