Skip to content

Instantly share code, notes, and snippets.

@nanopc
nanopc / PermissionUtil.java
Created January 17, 2017 09:19 — forked from andhie/PermissionUtil.java
Marshmallow Permission Level
public static void printPermissions(Context context) {
PackageInfo android;
try {
android = context.getPackageManager().getPackageInfo("android", PackageManager.GET_PERMISSIONS);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return;
}
PermissionInfo[] permissions = android.permissions;
@nanopc
nanopc / gist:7b693607e673c4bcafed701b5d3f54ab
Last active May 12, 2019 09:11
SVG-VectorDrawable as Maps Marker icon on Android
BitmapDescriptor markerIcon = vectorToBitmap(R.drawable.vectordrawableicon,
ContextCompat.getColor(getApplicationContext(),
R.color.marker));
mMap.addMarker(new MarkerOptions()
.icon(markerIcon)
.position(LatLng())
);
private BitmapDescriptor vectorToBitmap(@DrawableRes int id, @ColorInt int color) {
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="material_red50">#ffffebee</color>
<color name="material_red100">#ffffcdd2</color>
<color name="material_red200">#ffef9a9a</color>
<color name="material_red300">#ffe57373</color>
<color name="material_red400">#ffef5350</color>
<color name="material_red500">#fff44336</color>
<color name="material_red600">#ffe53935</color>
<color name="material_red700">#ffd32f2f</color>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="material_red50">#ffffebee</color>
<color name="material_red100">#ffffcdd2</color>
<color name="material_red200">#ffef9a9a</color>
<color name="material_red300">#ffe57373</color>
<color name="material_red400">#ffef5350</color>
<color name="material_red500">#fff44336</color>
<color name="material_red600">#ffe53935</color>
<color name="material_red700">#ffd32f2f</color>