Merge pull request #5753 from osmandapp/api_drawer

Api drawer
This commit is contained in:
Alexander Sytnyk 2018-07-31 21:44:13 +03:00 committed by GitHub
commit 9f67d84440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 445 additions and 177 deletions

View file

@ -30,6 +30,16 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="main_activity"
android:scheme="osmand_telegram" />
</intent-filter>
</activity>
<service

View file

@ -53,7 +53,7 @@ import net.osmand.aidl.gpx.RemoveGpxParams;
import net.osmand.aidl.maplayer.point.ShowMapPointParams;
import net.osmand.aidl.navdrawer.AddOpenAppNavDrawerItemParams;
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
// NOTE: Add new methods at the end of file!!!
@ -108,5 +108,5 @@ interface IOsmAndAidlInterface {
boolean showMapPoint(in ShowMapPointParams params);
boolean addOpenAppNavDrawerItem(in AddOpenAppNavDrawerItemParams params);
boolean setNavDrawerItems(in SetNavDrawerItemsParams params);
}

View file

@ -1,3 +0,0 @@
package net.osmand.aidl.navdrawer;
parcelable AddOpenAppNavDrawerItemParams;

View file

@ -1,63 +0,0 @@
package net.osmand.aidl.navdrawer;
import android.os.Parcel;
import android.os.Parcelable;
public class AddOpenAppNavDrawerItemParams implements Parcelable {
private String itemName;
private String appPackage;
private int flags;
public AddOpenAppNavDrawerItemParams(String itemName, String appPackage) {
this(itemName, appPackage, -1);
}
public AddOpenAppNavDrawerItemParams(String itemName, String appPackage, int flags) {
this.itemName = itemName;
this.appPackage = appPackage;
this.flags = flags;
}
protected AddOpenAppNavDrawerItemParams(Parcel in) {
itemName = in.readString();
appPackage = in.readString();
flags = in.readInt();
}
public String getItemName() {
return itemName;
}
public String getAppPackage() {
return appPackage;
}
public int getFlags() {
return flags;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(itemName);
dest.writeString(appPackage);
dest.writeInt(flags);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<AddOpenAppNavDrawerItemParams> CREATOR = new Creator<AddOpenAppNavDrawerItemParams>() {
@Override
public AddOpenAppNavDrawerItemParams createFromParcel(Parcel in) {
return new AddOpenAppNavDrawerItemParams(in);
}
@Override
public AddOpenAppNavDrawerItemParams[] newArray(int size) {
return new AddOpenAppNavDrawerItemParams[size];
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.navdrawer;
parcelable NavDrawerItem;

View file

@ -0,0 +1,73 @@
package net.osmand.aidl.navdrawer;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
public class NavDrawerItem implements Parcelable {
private String name;
private String uri;
private String iconName;
private int flags;
public NavDrawerItem(@NonNull String name, @NonNull String uri, @Nullable String iconName) {
this(name, uri, iconName, -1);
}
public NavDrawerItem(@NonNull String name, @NonNull String uri, @Nullable String iconName, int flags) {
this.name = name;
this.uri = uri;
this.iconName = iconName;
this.flags = flags;
}
protected NavDrawerItem(Parcel in) {
name = in.readString();
uri = in.readString();
iconName = in.readString();
flags = in.readInt();
}
public String getName() {
return name;
}
public String getUri() {
return uri;
}
public String getIconName() {
return iconName;
}
public int getFlags() {
return flags;
}
@Override
public void writeToParcel(Parcel dest, int f) {
dest.writeString(name);
dest.writeString(uri);
dest.writeString(iconName);
dest.writeInt(flags);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<NavDrawerItem> CREATOR = new Creator<NavDrawerItem>() {
@Override
public NavDrawerItem createFromParcel(Parcel in) {
return new NavDrawerItem(in);
}
@Override
public NavDrawerItem[] newArray(int size) {
return new NavDrawerItem[size];
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.navdrawer;
parcelable SetNavDrawerItemsParams;

View file

@ -0,0 +1,56 @@
package net.osmand.aidl.navdrawer;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
public class SetNavDrawerItemsParams implements Parcelable {
private String appPackage;
private List<NavDrawerItem> items;
public SetNavDrawerItemsParams(@NonNull String appPackage, @NonNull List<NavDrawerItem> items) {
this.appPackage = appPackage;
this.items = items;
}
protected SetNavDrawerItemsParams(Parcel in) {
appPackage = in.readString();
items = new ArrayList<>();
in.readTypedList(items, NavDrawerItem.CREATOR);
}
public String getAppPackage() {
return appPackage;
}
public List<NavDrawerItem> getItems() {
return items;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(appPackage);
dest.writeTypedList(new ArrayList<>(items));
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<SetNavDrawerItemsParams> CREATOR = new Creator<SetNavDrawerItemsParams>() {
@Override
public SetNavDrawerItemsParams createFromParcel(Parcel in) {
return new SetNavDrawerItemsParams(in);
}
@Override
public SetNavDrawerItemsParams[] newArray(int size) {
return new SetNavDrawerItemsParams[size];
}
};
}

View file

@ -41,12 +41,18 @@ class TelegramApplication : Application(), OsmandHelperListener {
settings = TelegramSettings(this)
uiUtils = UiUtils(this)
osmandAidlHelper = OsmandAidlHelper(this)
osmandAidlHelper.listener = object : OsmandAidlHelper.OsmandHelperListener {
osmandAidlHelper.listener = object : OsmandAidlHelper.OsmandHelperListener {
override fun onOsmandConnectionStateChanged(connected: Boolean) {
if (connected) {
val basePackage = "net.osmand.telegram"
val appPackage = if (BuildConfig.DEBUG) "$basePackage.debug" else basePackage
osmandAidlHelper.addOpenAppNavDrawerItem(getString(R.string.app_name), appPackage, -1)
osmandAidlHelper.setNavDrawerItems(
appPackage,
listOf(getString(R.string.app_name)),
listOf("osmand_telegram://main_activity"),
listOf("ic_action_travel"),
listOf(-1)
)
}
}
}

View file

@ -33,7 +33,8 @@ import net.osmand.aidl.mapwidget.AMapWidget
import net.osmand.aidl.mapwidget.AddMapWidgetParams
import net.osmand.aidl.mapwidget.RemoveMapWidgetParams
import net.osmand.aidl.mapwidget.UpdateMapWidgetParams
import net.osmand.aidl.navdrawer.AddOpenAppNavDrawerItemParams
import net.osmand.aidl.navdrawer.NavDrawerItem
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams
import net.osmand.aidl.navigation.NavigateGpxParams
import net.osmand.aidl.navigation.NavigateParams
import net.osmand.aidl.note.StartAudioRecordingParams
@ -868,10 +869,14 @@ class OsmandAidlHelper(private val app: Application) {
return false
}
fun addOpenAppNavDrawerItem(itemName: String, appPackage: String, flags: Int): Boolean {
fun setNavDrawerItems(appPackage: String, names: List<String>, uris: List<String>, iconNames: List<String>, flags: List<Int>): Boolean {
if (mIOsmAndAidlInterface != null) {
try {
return mIOsmAndAidlInterface!!.addOpenAppNavDrawerItem(AddOpenAppNavDrawerItemParams(itemName, appPackage, flags))
val items = mutableListOf<NavDrawerItem>()
for (i in names.indices) {
items.add(NavDrawerItem(names[i], uris[i], iconNames[i], flags[i]))
}
return mIOsmAndAidlInterface!!.setNavDrawerItems(SetNavDrawerItemsParams(appPackage, items))
} catch (e: RemoteException) {
e.printStackTrace()
}

View file

@ -53,7 +53,7 @@ import net.osmand.aidl.gpx.RemoveGpxParams;
import net.osmand.aidl.maplayer.point.ShowMapPointParams;
import net.osmand.aidl.navdrawer.AddOpenAppNavDrawerItemParams;
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
// NOTE: Add new methods at the end of file!!!
@ -108,5 +108,5 @@ interface IOsmAndAidlInterface {
boolean showMapPoint(in ShowMapPointParams params);
boolean addOpenAppNavDrawerItem(in AddOpenAppNavDrawerItemParams params);
boolean setNavDrawerItems(in SetNavDrawerItemsParams params);
}

View file

@ -6,10 +6,12 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.View;
@ -42,7 +44,6 @@ import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
@ -60,6 +61,9 @@ import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayInputStream;
import java.io.File;
@ -69,6 +73,9 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@ -121,6 +128,8 @@ public class OsmandAidlApi {
private static final int DEFAULT_ZOOM = 15;
private static final int MAX_NAV_DRAWER_ITEMS_PER_APP = 3;
private OsmandApplication app;
private Map<String, AMapWidget> widgets = new ConcurrentHashMap<>();
private Map<String, TextInfoWidget> widgetControls = new ConcurrentHashMap<>();
@ -1192,40 +1201,142 @@ public class OsmandAidlApi {
return true;
}
boolean addOpenAppNavDrawerItem(String itemName, String appPackage, int flags) {
if (!TextUtils.isEmpty(itemName) && !TextUtils.isEmpty(appPackage)) {
OsmandSettings settings = app.getSettings();
settings.API_NAV_DRAWER_ITEM_NAME.set(itemName);
settings.API_NAV_DRAWER_ITEM_APP_PACKAGE.set(appPackage);
settings.API_NAV_DRAWER_ITEM_FLAGS.set(flags);
return true;
boolean setNavDrawerItems(String appPackage, List<net.osmand.aidl.navdrawer.NavDrawerItem> items) {
if (!TextUtils.isEmpty(appPackage) && items != null) {
if (items.isEmpty()) {
clearNavDrawerItems(appPackage);
return true;
}
List<NavDrawerItem> newItems = new ArrayList<>(MAX_NAV_DRAWER_ITEMS_PER_APP);
boolean success = true;
for (int i = 0; i < items.size() && i <= MAX_NAV_DRAWER_ITEMS_PER_APP; i++) {
net.osmand.aidl.navdrawer.NavDrawerItem item = items.get(i);
String name = item.getName();
String uri = item.getUri();
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(uri)) {
newItems.add(new NavDrawerItem(name, uri, item.getIconName(), item.getFlags()));
} else {
success = false;
break;
}
}
if (success) {
saveNavDrawerItems(appPackage, newItems);
}
return success;
}
return false;
}
public void registerNavDrawerItem(final Activity activity, ContextMenuAdapter adapter) {
final OsmandSettings settings = app.getSettings();
final String itemName = settings.API_NAV_DRAWER_ITEM_NAME.get();
final String appPackage = settings.API_NAV_DRAWER_ITEM_APP_PACKAGE.get();
if (!TextUtils.isEmpty(itemName) && !TextUtils.isEmpty(appPackage)) {
final Intent intent = activity.getPackageManager().getLaunchIntentForPackage(appPackage);
if (intent != null) {
int flags = settings.API_NAV_DRAWER_ITEM_FLAGS.get();
if (flags != -1) {
intent.addFlags(flags);
public void registerNavDrawerItems(final Activity activity, ContextMenuAdapter adapter) {
PackageManager pm = activity.getPackageManager();
for (Map.Entry<String, List<NavDrawerItem>> entry : getNavDrawerItems().entrySet()) {
String appPackage = entry.getKey();
for (NavDrawerItem item : entry.getValue()) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(item.uri));
if (intent.resolveActivity(pm) == null) {
intent = pm.getLaunchIntentForPackage(appPackage);
}
if (intent != null) {
if (item.flags != -1) {
intent.addFlags(item.flags);
}
final Intent finalIntent = intent;
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitle(item.name)
.setIcon(getIconId(item.iconName))
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
activity.startActivity(finalIntent);
return true;
}
})
.createItem());
}
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitle(itemName)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
activity.startActivity(intent);
return true;
}
})
.createItem());
}
}
}
private int getIconId(@Nullable String iconName) {
if (!TextUtils.isEmpty(iconName)) {
int id = app.getResources().getIdentifier(iconName, "drawable", app.getPackageName());
return id == 0 ? -1 : id;
}
return -1;
}
private void clearNavDrawerItems(String appPackage) {
try {
JSONObject allItems = new JSONObject(app.getSettings().API_NAV_DRAWER_ITEMS_JSON.get());
allItems.put(appPackage, null);
app.getSettings().API_NAV_DRAWER_ITEMS_JSON.set(allItems.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
private void saveNavDrawerItems(String appPackage, List<NavDrawerItem> items) {
try {
JSONArray jArray = new JSONArray();
for (NavDrawerItem item : items) {
JSONObject obj = new JSONObject();
obj.put(NavDrawerItem.NAME_KEY, item.name);
obj.put(NavDrawerItem.URI_KEY, item.uri);
obj.put(NavDrawerItem.ICON_NAME_KEY, item.iconName);
obj.put(NavDrawerItem.FLAGS_KEY, item.flags);
jArray.put(obj);
}
JSONObject allItems = new JSONObject(app.getSettings().API_NAV_DRAWER_ITEMS_JSON.get());
allItems.put(appPackage, jArray);
app.getSettings().API_NAV_DRAWER_ITEMS_JSON.set(allItems.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
private Map<String, List<NavDrawerItem>> getNavDrawerItems() {
Map<String, List<NavDrawerItem>> res = new LinkedHashMap<>();
try {
JSONObject allItems = new JSONObject(app.getSettings().API_NAV_DRAWER_ITEMS_JSON.get());
for (Iterator<?> it = allItems.keys(); it.hasNext(); ) {
String appPackage = (String) it.next();
JSONArray jArray = allItems.getJSONArray(appPackage);
List<NavDrawerItem> list = new ArrayList<>();
for (int i = 0; i < jArray.length(); i++) {
JSONObject obj = jArray.getJSONObject(i);
list.add(new NavDrawerItem(
obj.optString(NavDrawerItem.NAME_KEY),
obj.optString(NavDrawerItem.URI_KEY),
obj.optString(NavDrawerItem.ICON_NAME_KEY),
obj.optInt(NavDrawerItem.FLAGS_KEY, -1)
));
}
res.put(appPackage, list);
}
} catch (JSONException e) {
e.printStackTrace();
}
return res;
}
private static class NavDrawerItem {
static final String NAME_KEY = "name";
static final String URI_KEY = "uri";
static final String ICON_NAME_KEY = "icon_name";
static final String FLAGS_KEY = "flags";
private String name;
private String uri;
private String iconName;
private int flags;
NavDrawerItem(String name, String uri, String iconName, int flags) {
this.name = name;
this.uri = uri;
this.iconName = iconName;
this.flags = flags;
}
}
}

View file

@ -34,7 +34,7 @@ import net.osmand.aidl.mapmarker.UpdateMapMarkerParams;
import net.osmand.aidl.mapwidget.AddMapWidgetParams;
import net.osmand.aidl.mapwidget.RemoveMapWidgetParams;
import net.osmand.aidl.mapwidget.UpdateMapWidgetParams;
import net.osmand.aidl.navdrawer.AddOpenAppNavDrawerItemParams;
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
import net.osmand.aidl.navigation.NavigateGpxParams;
import net.osmand.aidl.navigation.NavigateParams;
import net.osmand.aidl.note.StartAudioRecordingParams;
@ -460,9 +460,9 @@ public class OsmandAidlService extends Service {
}
@Override
public boolean addOpenAppNavDrawerItem(AddOpenAppNavDrawerItemParams params) throws RemoteException {
public boolean setNavDrawerItems(SetNavDrawerItemsParams params) throws RemoteException {
try {
return params != null && getApi("addOpenAppNavDrawerItem").addOpenAppNavDrawerItem(params.getItemName(), params.getAppPackage(), params.getFlags());
return params != null && getApi("setNavDrawerItems").setNavDrawerItems(params.getAppPackage(), params.getItems());
} catch (Exception e) {
handleException(e);
return false;

View file

@ -1,3 +0,0 @@
package net.osmand.aidl.navdrawer;
parcelable AddOpenAppNavDrawerItemParams;

View file

@ -1,63 +0,0 @@
package net.osmand.aidl.navdrawer;
import android.os.Parcel;
import android.os.Parcelable;
public class AddOpenAppNavDrawerItemParams implements Parcelable {
private String itemName;
private String appPackage;
private int flags;
public AddOpenAppNavDrawerItemParams(String itemName, String appPackage) {
this(itemName, appPackage, -1);
}
public AddOpenAppNavDrawerItemParams(String itemName, String appPackage, int flags) {
this.itemName = itemName;
this.appPackage = appPackage;
this.flags = flags;
}
protected AddOpenAppNavDrawerItemParams(Parcel in) {
itemName = in.readString();
appPackage = in.readString();
flags = in.readInt();
}
public String getItemName() {
return itemName;
}
public String getAppPackage() {
return appPackage;
}
public int getFlags() {
return flags;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(itemName);
dest.writeString(appPackage);
dest.writeInt(flags);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<AddOpenAppNavDrawerItemParams> CREATOR = new Creator<AddOpenAppNavDrawerItemParams>() {
@Override
public AddOpenAppNavDrawerItemParams createFromParcel(Parcel in) {
return new AddOpenAppNavDrawerItemParams(in);
}
@Override
public AddOpenAppNavDrawerItemParams[] newArray(int size) {
return new AddOpenAppNavDrawerItemParams[size];
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.navdrawer;
parcelable NavDrawerItem;

View file

@ -0,0 +1,73 @@
package net.osmand.aidl.navdrawer;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
public class NavDrawerItem implements Parcelable {
private String name;
private String uri;
private String iconName;
private int flags;
public NavDrawerItem(@NonNull String name, @NonNull String uri, @Nullable String iconName) {
this(name, uri, iconName, -1);
}
public NavDrawerItem(@NonNull String name, @NonNull String uri, @Nullable String iconName, int flags) {
this.name = name;
this.uri = uri;
this.iconName = iconName;
this.flags = flags;
}
protected NavDrawerItem(Parcel in) {
name = in.readString();
uri = in.readString();
iconName = in.readString();
flags = in.readInt();
}
public String getName() {
return name;
}
public String getUri() {
return uri;
}
public String getIconName() {
return iconName;
}
public int getFlags() {
return flags;
}
@Override
public void writeToParcel(Parcel dest, int f) {
dest.writeString(name);
dest.writeString(uri);
dest.writeString(iconName);
dest.writeInt(flags);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<NavDrawerItem> CREATOR = new Creator<NavDrawerItem>() {
@Override
public NavDrawerItem createFromParcel(Parcel in) {
return new NavDrawerItem(in);
}
@Override
public NavDrawerItem[] newArray(int size) {
return new NavDrawerItem[size];
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.navdrawer;
parcelable SetNavDrawerItemsParams;

View file

@ -0,0 +1,56 @@
package net.osmand.aidl.navdrawer;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
public class SetNavDrawerItemsParams implements Parcelable {
private String appPackage;
private List<NavDrawerItem> items;
public SetNavDrawerItemsParams(@NonNull String appPackage, @NonNull List<NavDrawerItem> items) {
this.appPackage = appPackage;
this.items = items;
}
protected SetNavDrawerItemsParams(Parcel in) {
appPackage = in.readString();
items = new ArrayList<>();
in.readTypedList(items, NavDrawerItem.CREATOR);
}
public String getAppPackage() {
return appPackage;
}
public List<NavDrawerItem> getItems() {
return items;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(appPackage);
dest.writeTypedList(new ArrayList<>(items));
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<SetNavDrawerItemsParams> CREATOR = new Creator<SetNavDrawerItemsParams>() {
@Override
public SetNavDrawerItemsParams createFromParcel(Parcel in) {
return new SetNavDrawerItemsParams(in);
}
@Override
public SetNavDrawerItemsParams[] newArray(int size) {
return new SetNavDrawerItemsParams[size];
}
};
}

View file

@ -742,9 +742,7 @@ public class OsmandSettings {
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", false).makeGlobal();
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference("show_dashboard_on_map_screen", false).makeGlobal();
public final CommonPreference<String> API_NAV_DRAWER_ITEM_NAME = new StringPreference("api_nav_drawer_item_name", "").makeGlobal();
public final CommonPreference<String> API_NAV_DRAWER_ITEM_APP_PACKAGE = new StringPreference("api_nav_drawer_item_app_package", "").makeGlobal();
public final CommonPreference<Integer> API_NAV_DRAWER_ITEM_FLAGS = new IntPreference("api_nav_drawer_item_flags", -1).makeGlobal();
public final CommonPreference<String> API_NAV_DRAWER_ITEMS_JSON = new StringPreference("api_nav_drawer_items_json", "{}").makeGlobal();
public final CommonPreference<Integer> NUMBER_OF_STARTS_FIRST_XMAS_SHOWN = new IntPreference("number_of_starts_first_xmas_shown", 0).makeGlobal();

View file

@ -795,7 +795,7 @@ public class MapActivityActions implements DialogProvider {
}
}).createItem());
app.getAidlApi().registerNavDrawerItem(mapActivity, optionsMenuHelper);
app.getAidlApi().registerNavDrawerItems(mapActivity, optionsMenuHelper);
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.layer_map_appearance, mapActivity)
.setIcon(R.drawable.ic_configure_screen_dark)