add compass drawable initialization in ui settings (#8695)
This commit is contained in:
@@ -14,6 +14,7 @@ import android.support.annotation.IntRange;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
|
||||
@@ -217,7 +218,7 @@ public class MapboxMapOptions implements Parcelable {
|
||||
Drawable compassDrawable = typedArray.getDrawable(
|
||||
R.styleable.mapbox_MapView_mapbox_uiCompassDrawable);
|
||||
if (compassDrawable == null) {
|
||||
compassDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_compass_icon);
|
||||
compassDrawable = ResourcesCompat.getDrawable(context.getResources(), R.drawable.mapbox_compass_icon, null);
|
||||
}
|
||||
mapboxMapOptions.compassImage(compassDrawable);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -149,6 +150,9 @@ public final class UiSettings {
|
||||
setCompassMargins(tenDp, tenDp, tenDp, tenDp);
|
||||
}
|
||||
setCompassFadeFacingNorth(options.getCompassFadeFacingNorth());
|
||||
if (options.getCompassImage() == null) {
|
||||
options.compassImage(ResourcesCompat.getDrawable(resources, R.drawable.mapbox_compass_icon, null));
|
||||
}
|
||||
setCompassImage(options.getCompassImage());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user