Merge pull request #6443 from osmandapp/kolomiets_branch
Kolomiets branch - osmand and bugfixing (search filter)
This commit is contained in:
commit
2c2e4f540a
30 changed files with 689 additions and 166 deletions
|
@ -554,13 +554,15 @@ public class BinaryMapIndexReader {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TransportStop> searchTransportIndex(SearchRequest<TransportStop> req) throws IOException {
|
public List<TransportStop> searchTransportIndex(SearchRequest<TransportStop> req) throws IOException {
|
||||||
for (TransportIndex index : transportIndexes) {
|
for (TransportIndex index : transportIndexes) {
|
||||||
if (index.stopsFileLength == 0 || index.right < req.left || index.left > req.right || index.top > req.bottom
|
if (index.stopsFileLength == 0 || index.right < req.left || index.left > req.right || index.top > req.bottom
|
||||||
|| index.bottom < req.top) {
|
|| index.bottom < req.top) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (req.stringTable != null) {
|
||||||
|
req.stringTable.clear();
|
||||||
|
}
|
||||||
codedIS.seek(index.stopsFileOffset);
|
codedIS.seek(index.stopsFileOffset);
|
||||||
int oldLimit = codedIS.pushLimit(index.stopsFileLength);
|
int oldLimit = codedIS.pushLimit(index.stopsFileLength);
|
||||||
int offset = req.searchResults.size();
|
int offset = req.searchResults.size();
|
||||||
|
@ -875,6 +877,8 @@ public class BinaryMapIndexReader {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// lazy initializing trees
|
// lazy initializing trees
|
||||||
if (index.trees == null) {
|
if (index.trees == null) {
|
||||||
index.trees = new ArrayList<MapTree>();
|
index.trees = new ArrayList<MapTree>();
|
||||||
|
|
|
@ -402,12 +402,12 @@ public class BinaryMapTransportReaderAdapter {
|
||||||
int oldLimit = codedIS.pushLimit(ind.stringTable.length);
|
int oldLimit = codedIS.pushLimit(ind.stringTable.length);
|
||||||
int current = 0;
|
int current = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < values.length) {
|
while (i < values.length && codedIS.getBytesUntilLimit() > 0) {
|
||||||
int t = codedIS.readTag();
|
int t = codedIS.readTag();
|
||||||
int tag = WireFormat.getTagFieldNumber(t);
|
int tag = WireFormat.getTagFieldNumber(t);
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
return;
|
||||||
case OsmandOdb.StringTable.S_FIELD_NUMBER:
|
case OsmandOdb.StringTable.S_FIELD_NUMBER:
|
||||||
if (current == values[i]) {
|
if (current == values[i]) {
|
||||||
String value = codedIS.readString();
|
String value = codedIS.readString();
|
||||||
|
|
|
@ -163,24 +163,12 @@
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="content"/>
|
||||||
<data android:scheme="file"/>
|
<data android:scheme="file"/>
|
||||||
<data android:host="*"/>
|
<data android:scheme="data"/>
|
||||||
<data android:pathPattern=".*\\.kml" />
|
|
||||||
<data android:pathPattern=".*\\..*\\.kml" />
|
|
||||||
<data android:pathPattern=".*\\..*\\..*\\.kml" />
|
|
||||||
<data android:pathPattern=".*\\..*\\..*\\..*\\.kml" />
|
|
||||||
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.kml" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:priority="50">
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:scheme="file"/>
|
|
||||||
<data android:host="*"/>
|
<data android:host="*"/>
|
||||||
<data android:mimeType="*/*"/>
|
<data android:mimeType="*/*"/>
|
||||||
|
<data android:pathPattern="*.kml"/>
|
||||||
<data android:pathPattern=".*\\.kml" />
|
<data android:pathPattern=".*\\.kml" />
|
||||||
<data android:pathPattern=".*\\..*\\.kml" />
|
<data android:pathPattern=".*\\..*\\.kml" />
|
||||||
<data android:pathPattern=".*\\..*\\..*\\.kml" />
|
<data android:pathPattern=".*\\..*\\..*\\.kml" />
|
||||||
|
@ -271,9 +259,12 @@
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="content"/>
|
||||||
<data android:scheme="file"/>
|
<data android:scheme="file"/>
|
||||||
|
<data android:scheme="data"/>
|
||||||
<data android:host="*"/>
|
<data android:host="*"/>
|
||||||
<data android:mimeType="*/*"/>
|
<data android:mimeType="*/*"/>
|
||||||
|
<data android:pathPattern="*.sqlitedb" />
|
||||||
<data android:pathPattern=".*\\.sqlitedb" />
|
<data android:pathPattern=".*\\.sqlitedb" />
|
||||||
<data android:pathPattern=".*\\..*\\.sqlitedb" />
|
<data android:pathPattern=".*\\..*\\.sqlitedb" />
|
||||||
<data android:pathPattern=".*\\..*\\..*\\.sqlitedb" />
|
<data android:pathPattern=".*\\..*\\..*\\.sqlitedb" />
|
||||||
|
|
74
OsmAnd/res/layout/dash_restore_osmand_fragment.xml
Normal file
74
OsmAnd/res/layout/dash_restore_osmand_fragment.xml
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/bg_card"
|
||||||
|
android:layout_marginTop="@dimen/dash_margin"
|
||||||
|
android:layout_marginBottom="@dimen/dash_margin"
|
||||||
|
android:layout_marginLeft="@dimen/dash_margin_h"
|
||||||
|
android:layout_marginRight="@dimen/dash_margin_h"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/run_full_osmand_header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dashSearchPaddingTop"
|
||||||
|
android:layout_marginBottom="@dimen/dashSearchPaddingBot"
|
||||||
|
android:layout_marginRight="@dimen/subHeaderMarginRight"
|
||||||
|
android:layout_marginStart="@dimen/subHeaderMarginLeft"
|
||||||
|
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
|
||||||
|
android:layout_marginEnd="@dimen/subHeaderMarginRight"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:text="@string/run_full_osmand_header"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/run_full_osmand_message"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="@dimen/subHeaderPadding"
|
||||||
|
android:layout_marginBottom="@dimen/dashSearchPaddingBot"
|
||||||
|
android:layout_marginRight="@dimen/subHeaderMarginRight"
|
||||||
|
android:layout_marginStart="@dimen/subHeaderMarginLeft"
|
||||||
|
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
|
||||||
|
android:layout_marginEnd="@dimen/subHeaderMarginRight"
|
||||||
|
android:layout_weight="1"
|
||||||
|
tools:text="@string/lorem_ipsum"/>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="@dimen/list_header_height"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancel_full_osmand_btn"
|
||||||
|
style="@style/DashboardGeneralButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/shared_string_cancel"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/launch_full_osmand_btn"
|
||||||
|
style="@style/DashboardGeneralButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/shared_string_launch"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1,10 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.DrawerLayout
|
<android.support.v4.widget.DrawerLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/drawer_layout"
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/mapBackground">
|
android:background="?attr/mapBackground"
|
||||||
|
android:layout_gravity="start">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -103,10 +105,10 @@
|
||||||
android:id="@+id/menuItems"
|
android:id="@+id/menuItems"
|
||||||
android:layout_width="280dp"
|
android:layout_width="280dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="left"
|
|
||||||
android:background="?attr/bg_color"
|
android:background="?attr/bg_color"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:drawSelectorOnTop="true" />
|
android:drawSelectorOnTop="true"
|
||||||
|
android:layout_gravity="start"/>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/drawer_footer_layout"
|
android:id="@+id/drawer_footer_layout"
|
||||||
|
@ -114,6 +116,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_gravity="start"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<include layout="@layout/powered_by_osmand_item"/>
|
<include layout="@layout/powered_by_osmand_item"/>
|
||||||
|
|
|
@ -12,10 +12,13 @@
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:drawablePadding="24dp"
|
android:drawablePadding="24dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight = "16dp"
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
tools:drawableLeft="@drawable/ic_action_search_dark"
|
tools:drawableStart="@drawable/ic_action_search_dark"
|
||||||
tools:text="@string/layer_poi"/>
|
tools:text="@string/layer_poi"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
<dimen name="subHeaderPadding">2dp</dimen>
|
<dimen name="subHeaderPadding">2dp</dimen>
|
||||||
<dimen name="subHeaderMarginLeft">15dp</dimen>
|
<dimen name="subHeaderMarginLeft">15dp</dimen>
|
||||||
|
<dimen name = "subHeaderMarginRight">15dp</dimen>
|
||||||
<dimen name="showAllButtonMarginRight">14dp</dimen>
|
<dimen name="showAllButtonMarginRight">14dp</dimen>
|
||||||
<dimen name="showAllButtonHeight">36dp</dimen>
|
<dimen name="showAllButtonHeight">36dp</dimen>
|
||||||
<dimen name="dashFavIconSize">28dp</dimen>
|
<dimen name="dashFavIconSize">28dp</dimen>
|
||||||
|
|
|
@ -1162,6 +1162,7 @@
|
||||||
<string name="shared_string_audio">Audio</string>
|
<string name="shared_string_audio">Audio</string>
|
||||||
<string name="shared_string_video">Video</string>
|
<string name="shared_string_video">Video</string>
|
||||||
<string name="shared_string_photo">Photo</string>
|
<string name="shared_string_photo">Photo</string>
|
||||||
|
<string name="shared_string_launch">Launch</string>
|
||||||
<string name="route_points">Route points</string>
|
<string name="route_points">Route points</string>
|
||||||
<string name="track_segments">Track segments</string>
|
<string name="track_segments">Track segments</string>
|
||||||
<string name="track_points">Track points</string>
|
<string name="track_points">Track points</string>
|
||||||
|
@ -2963,4 +2964,6 @@
|
||||||
<string name="wiki_article_not_found">Article not found</string>
|
<string name="wiki_article_not_found">Article not found</string>
|
||||||
<string name="how_to_open_wiki_title">How to open Wikipedia articles?</string>
|
<string name="how_to_open_wiki_title">How to open Wikipedia articles?</string>
|
||||||
<string name="test_voice_desrc">Tap a button and listen to the corresponding voice prompt to identify missing or faulty prompts.</string>
|
<string name="test_voice_desrc">Tap a button and listen to the corresponding voice prompt to identify missing or faulty prompts.</string>
|
||||||
|
<string name="run_full_osmand_msg">You are using {0} Map which is powered by OsmAnd. Do you want to launch OsmAnd full version?</string>
|
||||||
|
<string name="run_full_osmand_header">Launch OsmAnd?</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -6,4 +6,6 @@ interface IOsmAndAidlCallback {
|
||||||
void onSearchComplete(in List<SearchResult> resultSet);
|
void onSearchComplete(in List<SearchResult> resultSet);
|
||||||
|
|
||||||
void onUpdate();
|
void onUpdate();
|
||||||
|
|
||||||
|
void onAppInitialized();
|
||||||
}
|
}
|
|
@ -54,6 +54,8 @@ import net.osmand.aidl.gpx.RemoveGpxParams;
|
||||||
import net.osmand.aidl.maplayer.point.ShowMapPointParams;
|
import net.osmand.aidl.maplayer.point.ShowMapPointParams;
|
||||||
|
|
||||||
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
|
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
|
||||||
|
import net.osmand.aidl.navdrawer.NavDrawerFooterParams;
|
||||||
|
import net.osmand.aidl.navdrawer.NavDrawerHeaderParams;
|
||||||
|
|
||||||
import net.osmand.aidl.navigation.PauseNavigationParams;
|
import net.osmand.aidl.navigation.PauseNavigationParams;
|
||||||
import net.osmand.aidl.navigation.ResumeNavigationParams;
|
import net.osmand.aidl.navigation.ResumeNavigationParams;
|
||||||
|
@ -74,6 +76,10 @@ import net.osmand.aidl.gpx.AGpxFile;
|
||||||
import net.osmand.aidl.gpx.AGpxFileDetails;
|
import net.osmand.aidl.gpx.AGpxFileDetails;
|
||||||
import net.osmand.aidl.tiles.ASqliteDbFile;
|
import net.osmand.aidl.tiles.ASqliteDbFile;
|
||||||
|
|
||||||
|
import net.osmand.aidl.plugins.PluginParams;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Add new methods at the end of file!!!
|
// NOTE: Add new methods at the end of file!!!
|
||||||
|
|
||||||
|
@ -161,9 +167,12 @@ interface IOsmAndAidlInterface {
|
||||||
boolean showSqliteDbFile(String fileName);
|
boolean showSqliteDbFile(String fileName);
|
||||||
boolean hideSqliteDbFile(String fileName);
|
boolean hideSqliteDbFile(String fileName);
|
||||||
|
|
||||||
boolean setNavDrawerLogoWithParams(in String imageUri, String packageName, String intent);
|
boolean setNavDrawerLogoWithParams(in NavDrawerHeaderParams params);
|
||||||
boolean setNavDrawerFooterParams(in String packageName, String intent, String appName);
|
boolean setNavDrawerFooterWithParams(in NavDrawerFooterParams params);
|
||||||
|
|
||||||
boolean restoreOsmand();
|
boolean restoreOsmand();
|
||||||
|
|
||||||
|
boolean changePluginState(in PluginParams params);
|
||||||
|
|
||||||
|
boolean registerForOsmandInitListener(in IOsmAndAidlCallback callback);
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
@ -36,12 +37,16 @@ import net.osmand.aidl.maplayer.AMapLayer;
|
||||||
import net.osmand.aidl.maplayer.point.AMapPoint;
|
import net.osmand.aidl.maplayer.point.AMapPoint;
|
||||||
import net.osmand.aidl.mapmarker.AMapMarker;
|
import net.osmand.aidl.mapmarker.AMapMarker;
|
||||||
import net.osmand.aidl.mapwidget.AMapWidget;
|
import net.osmand.aidl.mapwidget.AMapWidget;
|
||||||
|
import net.osmand.aidl.navdrawer.NavDrawerFooterParams;
|
||||||
|
import net.osmand.aidl.plugins.PluginParams;
|
||||||
import net.osmand.aidl.search.SearchResult;
|
import net.osmand.aidl.search.SearchResult;
|
||||||
import net.osmand.aidl.tiles.ASqliteDbFile;
|
import net.osmand.aidl.tiles.ASqliteDbFile;
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.AppInitializer;
|
import net.osmand.plus.AppInitializer;
|
||||||
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
|
import net.osmand.plus.AppInitializer.InitEvents;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuItem;
|
import net.osmand.plus.ContextMenuItem;
|
||||||
|
@ -1641,6 +1646,30 @@ public class OsmandAidlApi {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean registerForOsmandInitialization(final OsmandAppInitCallback callback)
|
||||||
|
throws RemoteException {
|
||||||
|
if (app.isApplicationInitializing()) {
|
||||||
|
app.getAppInitializer().addListener(new AppInitializeListener() {
|
||||||
|
@Override
|
||||||
|
public void onProgress(AppInitializer init, InitEvents event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish(AppInitializer init) {
|
||||||
|
try {
|
||||||
|
LOG.debug("AIDL App registerForOsmandInitialization");
|
||||||
|
callback.onAppInitialized();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
callback.onAppInitialized();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
boolean setNavDrawerItems(String appPackage, List<net.osmand.aidl.navdrawer.NavDrawerItem> items) {
|
boolean setNavDrawerItems(String appPackage, List<net.osmand.aidl.navdrawer.NavDrawerItem> items) {
|
||||||
if (!TextUtils.isEmpty(appPackage) && items != null) {
|
if (!TextUtils.isEmpty(appPackage) && items != null) {
|
||||||
if (items.isEmpty()) {
|
if (items.isEmpty()) {
|
||||||
|
@ -1862,18 +1891,23 @@ public class OsmandAidlApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean setNavDrawerLogoWithParams(
|
boolean setNavDrawerLogoWithParams(
|
||||||
@Nullable String uri, @Nullable String packageName, @Nullable String intent) {
|
String uri, @Nullable String packageName, @Nullable String intent) {
|
||||||
return app.getAppCustomization().setNavDrawerLogoWithParams(uri, packageName, intent);
|
return app.getAppCustomization().setNavDrawerLogoWithParams(uri, packageName, intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean setNavDrawerFooterParams(@Nullable String packageName, @Nullable String intent, @Nullable String appName) {
|
boolean setNavDrawerFooterWithParams(@NonNull NavDrawerFooterParams params) {
|
||||||
return app.getAppCustomization().setNavDrawerFooterAction(packageName, intent, appName);
|
return app.getAppCustomization().setNavDrawerFooterParams(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean restoreOsmand() {
|
boolean restoreOsmand() {
|
||||||
return app.getAppCustomization().restoreOsmand();
|
return app.getAppCustomization().restoreOsmand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean changePluginState(PluginParams params) {
|
||||||
|
return app.getAppCustomization().changePluginStatus(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) {
|
private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) {
|
||||||
return new AGpxFileDetails(a.totalDistance, a.totalTracks, a.startTime, a.endTime,
|
return new AGpxFileDetails(a.totalDistance, a.totalTracks, a.startTime, a.endTime,
|
||||||
|
@ -1945,4 +1979,8 @@ public class OsmandAidlApi {
|
||||||
public interface SearchCompleteCallback {
|
public interface SearchCompleteCallback {
|
||||||
void onSearchComplete(List<SearchResult> resultSet);
|
void onSearchComplete(List<SearchResult> resultSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OsmandAppInitCallback {
|
||||||
|
void onAppInitialized();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.os.RemoteException;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.aidl.OsmandAidlApi.OsmandAppInitCallback;
|
||||||
import net.osmand.aidl.OsmandAidlApi.SearchCompleteCallback;
|
import net.osmand.aidl.OsmandAidlApi.SearchCompleteCallback;
|
||||||
import net.osmand.aidl.calculateroute.CalculateRouteParams;
|
import net.osmand.aidl.calculateroute.CalculateRouteParams;
|
||||||
import net.osmand.aidl.customization.OsmandSettingsParams;
|
import net.osmand.aidl.customization.OsmandSettingsParams;
|
||||||
|
@ -43,6 +44,8 @@ import net.osmand.aidl.mapmarker.UpdateMapMarkerParams;
|
||||||
import net.osmand.aidl.mapwidget.AddMapWidgetParams;
|
import net.osmand.aidl.mapwidget.AddMapWidgetParams;
|
||||||
import net.osmand.aidl.mapwidget.RemoveMapWidgetParams;
|
import net.osmand.aidl.mapwidget.RemoveMapWidgetParams;
|
||||||
import net.osmand.aidl.mapwidget.UpdateMapWidgetParams;
|
import net.osmand.aidl.mapwidget.UpdateMapWidgetParams;
|
||||||
|
import net.osmand.aidl.navdrawer.NavDrawerFooterParams;
|
||||||
|
import net.osmand.aidl.navdrawer.NavDrawerHeaderParams;
|
||||||
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
|
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
|
||||||
import net.osmand.aidl.navigation.MuteNavigationParams;
|
import net.osmand.aidl.navigation.MuteNavigationParams;
|
||||||
import net.osmand.aidl.navigation.NavigateGpxParams;
|
import net.osmand.aidl.navigation.NavigateGpxParams;
|
||||||
|
@ -56,6 +59,7 @@ import net.osmand.aidl.note.StartAudioRecordingParams;
|
||||||
import net.osmand.aidl.note.StartVideoRecordingParams;
|
import net.osmand.aidl.note.StartVideoRecordingParams;
|
||||||
import net.osmand.aidl.note.StopRecordingParams;
|
import net.osmand.aidl.note.StopRecordingParams;
|
||||||
import net.osmand.aidl.note.TakePhotoNoteParams;
|
import net.osmand.aidl.note.TakePhotoNoteParams;
|
||||||
|
import net.osmand.aidl.plugins.PluginParams;
|
||||||
import net.osmand.aidl.search.SearchParams;
|
import net.osmand.aidl.search.SearchParams;
|
||||||
import net.osmand.aidl.search.SearchResult;
|
import net.osmand.aidl.search.SearchResult;
|
||||||
import net.osmand.aidl.tiles.ASqliteDbFile;
|
import net.osmand.aidl.tiles.ASqliteDbFile;
|
||||||
|
@ -773,15 +777,17 @@ public class OsmandAidlService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setNavDrawerLogoWithParams(String imageUri, String packageName, String intent) throws RemoteException {
|
public boolean setNavDrawerLogoWithParams(NavDrawerHeaderParams params) throws RemoteException {
|
||||||
OsmandAidlApi api = getApi("setNavDrawerLogoWithParams");
|
OsmandAidlApi api = getApi("setNavDrawerLogoWithParams");
|
||||||
return api != null && api.setNavDrawerLogoWithParams(imageUri, packageName, intent);
|
return api != null && api.setNavDrawerLogoWithParams(
|
||||||
|
params.getImageUri(), params.getPackageName(), params.getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setNavDrawerFooterParams(String packageName, String intent, String appName) throws RemoteException {
|
public boolean setNavDrawerFooterWithParams(NavDrawerFooterParams params)
|
||||||
|
throws RemoteException {
|
||||||
OsmandAidlApi api = getApi("setNavDrawerFooterParams");
|
OsmandAidlApi api = getApi("setNavDrawerFooterParams");
|
||||||
return api != null && api.setNavDrawerFooterParams(packageName, intent, appName);
|
return api != null && api.setNavDrawerFooterWithParams(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -790,5 +796,31 @@ public class OsmandAidlService extends Service {
|
||||||
return api != null && api.restoreOsmand();
|
return api != null && api.restoreOsmand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean changePluginState(PluginParams params) {
|
||||||
|
OsmandAidlApi api = getApi("changePluginState");
|
||||||
|
return api != null && api.changePluginState(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean registerForOsmandInitListener(final IOsmAndAidlCallback callback)
|
||||||
|
throws RemoteException {
|
||||||
|
try {
|
||||||
|
OsmandAidlApi api = getApi("registerForOsmandInitListener");
|
||||||
|
return api != null && api.registerForOsmandInitialization(new OsmandAppInitCallback() {
|
||||||
|
@Override
|
||||||
|
public void onAppInitialized() {
|
||||||
|
try {
|
||||||
|
callback.onAppInitialized();
|
||||||
|
} catch (Exception e) {
|
||||||
|
handleException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
handleException(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package net.osmand.aidl.navdrawer;
|
||||||
|
|
||||||
|
parcelable NavDrawerFooterParams;
|
|
@ -0,0 +1,68 @@
|
||||||
|
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 NavDrawerFooterParams implements Parcelable {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String packageName;
|
||||||
|
@Nullable
|
||||||
|
private String intent;
|
||||||
|
@Nullable
|
||||||
|
private String appName;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public String getPackageName() {
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getIntent() {
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getAppName() {
|
||||||
|
return appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NavDrawerFooterParams(@NonNull String packageName, @Nullable String intent,
|
||||||
|
@Nullable String appName) {
|
||||||
|
this.packageName = packageName;
|
||||||
|
this.intent = intent;
|
||||||
|
this.appName = appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NavDrawerFooterParams(Parcel in) {
|
||||||
|
packageName = in.readString();
|
||||||
|
intent = in.readString();
|
||||||
|
appName = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeString(packageName);
|
||||||
|
dest.writeString(intent);
|
||||||
|
dest.writeString(appName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<NavDrawerFooterParams> CREATOR = new Creator<NavDrawerFooterParams>() {
|
||||||
|
@Override
|
||||||
|
public NavDrawerFooterParams createFromParcel(Parcel in) {
|
||||||
|
return new NavDrawerFooterParams(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NavDrawerFooterParams[] newArray(int size) {
|
||||||
|
return new NavDrawerFooterParams[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package net.osmand.aidl.navdrawer;
|
||||||
|
|
||||||
|
parcelable NavDrawerHeaderParams;
|
|
@ -0,0 +1,68 @@
|
||||||
|
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 NavDrawerHeaderParams implements Parcelable {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String imageUri;
|
||||||
|
@NonNull
|
||||||
|
private String packageName;
|
||||||
|
@Nullable
|
||||||
|
private String intent;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public String getImageUri() {
|
||||||
|
return imageUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public String getPackageName() {
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getIntent() {
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NavDrawerHeaderParams(@NonNull String imageUri, @NonNull String packageName,
|
||||||
|
@Nullable String intent) {
|
||||||
|
this.imageUri = imageUri;
|
||||||
|
this.packageName = packageName;
|
||||||
|
this.intent = intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NavDrawerHeaderParams(Parcel in) {
|
||||||
|
imageUri = in.readString();
|
||||||
|
packageName = in.readString();
|
||||||
|
intent = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeString(imageUri);
|
||||||
|
dest.writeString(packageName);
|
||||||
|
dest.writeString(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<NavDrawerHeaderParams> CREATOR = new Creator<NavDrawerHeaderParams>() {
|
||||||
|
@Override
|
||||||
|
public NavDrawerHeaderParams createFromParcel(Parcel in) {
|
||||||
|
return new NavDrawerHeaderParams(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NavDrawerHeaderParams[] newArray(int size) {
|
||||||
|
return new NavDrawerHeaderParams[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
5
OsmAnd/src/net/osmand/aidl/plugins/PluginParams.aidl
Normal file
5
OsmAnd/src/net/osmand/aidl/plugins/PluginParams.aidl
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// PluginParams.aidl
|
||||||
|
package net.osmand.aidl.plugins;
|
||||||
|
|
||||||
|
parcelable PluginParams;
|
||||||
|
|
51
OsmAnd/src/net/osmand/aidl/plugins/PluginParams.java
Normal file
51
OsmAnd/src/net/osmand/aidl/plugins/PluginParams.java
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
package net.osmand.aidl.plugins;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
public class PluginParams implements Parcelable {
|
||||||
|
|
||||||
|
private String pluginId;
|
||||||
|
private int newState; //0- off, 1 - on
|
||||||
|
|
||||||
|
public PluginParams(String pluginId, int newState) {
|
||||||
|
this.pluginId = pluginId;
|
||||||
|
this.newState = newState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPluginId() {
|
||||||
|
return pluginId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNewState() {
|
||||||
|
return newState;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PluginParams(Parcel in) {
|
||||||
|
pluginId = in.readString();
|
||||||
|
newState = in.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeString(pluginId);
|
||||||
|
dest.writeInt(newState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<PluginParams> CREATOR = new Creator<PluginParams>() {
|
||||||
|
@Override
|
||||||
|
public PluginParams createFromParcel(Parcel in) {
|
||||||
|
return new PluginParams(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PluginParams[] newArray(int size) {
|
||||||
|
return new PluginParams[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
|
@ -19,7 +19,7 @@ public class ApplicationMode {
|
||||||
private static List<ApplicationMode> values = new ArrayList<>();
|
private static List<ApplicationMode> values = new ArrayList<>();
|
||||||
private static List<ApplicationMode> cachedFilteredValues = new ArrayList<>();
|
private static List<ApplicationMode> cachedFilteredValues = new ArrayList<>();
|
||||||
/*
|
/*
|
||||||
* DEFAULT("Browse map"), CAR("Car"), BICYCLE("Bicycle"), PEDESTRIAN("Pedestrian");
|
* DEFAULT("Browse map"), CAR("Car"), BICYCLE("Bicycle"), PEDESTRIAN("Pedestrian"); NAUTICAL("boat")
|
||||||
*/
|
*/
|
||||||
public static final ApplicationMode DEFAULT = create(R.string.app_mode_default, "default").speed(1.5f, 5).arrivalDistance(90).defLocation().
|
public static final ApplicationMode DEFAULT = create(R.string.app_mode_default, "default").speed(1.5f, 5).arrivalDistance(90).defLocation().
|
||||||
icon(R.drawable.map_world_globe_dark, R.drawable.ic_world_globe_dark).reg();
|
icon(R.drawable.map_world_globe_dark, R.drawable.ic_world_globe_dark).reg();
|
||||||
|
@ -36,7 +36,7 @@ public class ApplicationMode {
|
||||||
public static final ApplicationMode AIRCRAFT = create(R.string.app_mode_aircraft, "aircraft").speed(40f, 100).carLocation().
|
public static final ApplicationMode AIRCRAFT = create(R.string.app_mode_aircraft, "aircraft").speed(40f, 100).carLocation().
|
||||||
icon(R.drawable.map_action_aircraft, R.drawable.ic_action_aircraft).reg();
|
icon(R.drawable.map_action_aircraft, R.drawable.ic_action_aircraft).reg();
|
||||||
|
|
||||||
public static final ApplicationMode BOAT = create(R.string.app_mode_boat, "boat").speed(5.5f, 20).carLocation().
|
public static final ApplicationMode BOAT = create(R.string.app_mode_boat, "boat").speed(5.5f, 20).carLocation().nauticalLocation().
|
||||||
icon(R.drawable.map_action_sail_boat_dark, R.drawable.ic_action_sail_boat_dark).reg();
|
icon(R.drawable.map_action_sail_boat_dark, R.drawable.ic_action_sail_boat_dark).reg();
|
||||||
|
|
||||||
public static final ApplicationMode HIKING = create(R.string.app_mode_hiking, "hiking").speed(1.5f, 5).parent(PEDESTRIAN).
|
public static final ApplicationMode HIKING = create(R.string.app_mode_hiking, "hiking").speed(1.5f, 5).parent(PEDESTRIAN).
|
||||||
|
@ -159,6 +159,16 @@ public class ApplicationMode {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApplicationModeBuilder nauticalLocation() {
|
||||||
|
applicationMode.bearingIconDay = R.drawable.map_nautical_bearing;
|
||||||
|
applicationMode.bearingIconNight = R.drawable.map_nautical_bearing_night;
|
||||||
|
applicationMode.headingIconDay = R.drawable.map_nautical_location_view_angle;
|
||||||
|
applicationMode.headingIconNight = R.drawable.map_nautical_location_view_angle_night;
|
||||||
|
applicationMode.locationIconDay = R.drawable.map_nautical_location;
|
||||||
|
applicationMode.locationIconNight = R.drawable.map_nautical_location_night;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ApplicationModeBuilder speed(float defSpeed, int distForTurn) {
|
public ApplicationModeBuilder speed(float defSpeed, int distForTurn) {
|
||||||
applicationMode.defaultSpeed = defSpeed;
|
applicationMode.defaultSpeed = defSpeed;
|
||||||
applicationMode.minDistanceForTurn = distForTurn;
|
applicationMode.minDistanceForTurn = distForTurn;
|
||||||
|
|
|
@ -14,6 +14,9 @@ import android.text.TextUtils;
|
||||||
|
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
|
import net.osmand.aidl.navdrawer.NavDrawerFooterParams;
|
||||||
|
import net.osmand.aidl.navdrawer.NavDrawerHeaderParams;
|
||||||
|
import net.osmand.aidl.plugins.PluginParams;
|
||||||
import net.osmand.data.LocationPoint;
|
import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.PluginsActivity;
|
import net.osmand.plus.activities.PluginsActivity;
|
||||||
|
@ -45,6 +48,7 @@ public class OsmAndAppCustomization {
|
||||||
|
|
||||||
private Bitmap navDrawerLogo;
|
private Bitmap navDrawerLogo;
|
||||||
private ArrayList<String> navDrawerParams;
|
private ArrayList<String> navDrawerParams;
|
||||||
|
private NavDrawerFooterParams navDrawerFooterParams;
|
||||||
|
|
||||||
private Set<String> featuresEnabledIds = new HashSet<>();
|
private Set<String> featuresEnabledIds = new HashSet<>();
|
||||||
private Set<String> featuresDisabledIds = new HashSet<>();
|
private Set<String> featuresDisabledIds = new HashSet<>();
|
||||||
|
@ -207,7 +211,7 @@ public class OsmAndAppCustomization {
|
||||||
@Nullable
|
@Nullable
|
||||||
public ArrayList<String> getNavDrawerLogoParams() {return navDrawerParams; }
|
public ArrayList<String> getNavDrawerLogoParams() {return navDrawerParams; }
|
||||||
|
|
||||||
public boolean setNavDrawerLogo(@Nullable String uri, @Nullable String packageName, @Nullable String intent) {
|
public boolean setNavDrawerLogo(String uri, @Nullable String packageName, @Nullable String intent) {
|
||||||
if (TextUtils.isEmpty(uri)) {
|
if (TextUtils.isEmpty(uri)) {
|
||||||
navDrawerLogo = null;
|
navDrawerLogo = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -232,7 +236,14 @@ public class OsmAndAppCustomization {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean setNavDrawerFooterParams(NavDrawerFooterParams params) {
|
||||||
|
navDrawerFooterParams = params;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NavDrawerFooterParams getNavFooterParams() {
|
||||||
|
return navDrawerFooterParams;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFeaturesEnabledIds(@NonNull Collection<String> ids) {
|
public void setFeaturesEnabledIds(@NonNull Collection<String> ids) {
|
||||||
featuresEnabledIds.clear();
|
featuresEnabledIds.clear();
|
||||||
|
@ -288,16 +299,33 @@ public class OsmAndAppCustomization {
|
||||||
return set.contains(appMode);
|
return set.contains(appMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setNavDrawerLogoWithParams(String uri, @Nullable String packageName, @Nullable String intent) {
|
public boolean setNavDrawerLogoWithParams(String imageUri, @Nullable String packageName,
|
||||||
LOG.info("setNavDrawerLogoWithParams called");
|
@Nullable String intent) {
|
||||||
return setNavDrawerLogo(uri, packageName, intent);
|
return setNavDrawerLogo(imageUri, packageName, intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) {
|
public boolean changePluginStatus(PluginParams params) {
|
||||||
//todo implement custom action to "Powered by Osmand" action in NavDrawer
|
if (params.getNewState() == 0) {
|
||||||
|
for (OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
|
||||||
|
if (plugin.getId().equals(params.getPluginId())) {
|
||||||
|
plugin.setActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.getNewState() == 1) {
|
||||||
|
for (OsmandPlugin plugin : OsmandPlugin.getAvailablePlugins()) {
|
||||||
|
if (plugin.getId().equals(params.getPluginId())) {
|
||||||
|
plugin.setActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private HashSet<ApplicationMode> getAppModesSet(@Nullable List<String> appModeKeys) {
|
private HashSet<ApplicationMode> getAppModesSet(@Nullable List<String> appModeKeys) {
|
||||||
HashSet<ApplicationMode> set = new HashSet<>();
|
HashSet<ApplicationMode> set = new HashSet<>();
|
||||||
|
|
|
@ -71,22 +71,33 @@ public interface OsmAndCustomizationConstants {
|
||||||
String ZOOM_IN_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_id";
|
String ZOOM_IN_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_id";
|
||||||
String ZOOM_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out";
|
String ZOOM_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out";
|
||||||
|
|
||||||
//Point's Context Action Menu:
|
//Map Context Menu Actions:
|
||||||
String POINTS_ACTION_MENU = "point.actions.";
|
String MAP_CONTEXT_MENU_ACTIONS = "point.actions.";
|
||||||
String POINT_DIRECTIONS_FROM_ID = POINTS_ACTION_MENU + "directions_from";
|
String MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID = MAP_CONTEXT_MENU_ACTIONS + "directions_from";
|
||||||
String POINT_SEARCH_NEARBY = POINTS_ACTION_MENU + "search_nearby";
|
String MAP_CONTEXT_MENU_SEARCH_NEARBY = MAP_CONTEXT_MENU_ACTIONS + "search_nearby";
|
||||||
String POINT_CHANGE_MARKER_POSITION = POINTS_ACTION_MENU + "change_m_position";
|
String MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION = MAP_CONTEXT_MENU_ACTIONS + "change_m_position";
|
||||||
String POINT_MARK_AS_PARKING_LOC = POINTS_ACTION_MENU + "mark_as_parking";
|
String MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC = MAP_CONTEXT_MENU_ACTIONS + "mark_as_parking";
|
||||||
String POINT_MEASURE_DISTANCE = POINTS_ACTION_MENU + "measure_distance";
|
String MAP_CONTEXT_MENU_MEASURE_DISTANCE = MAP_CONTEXT_MENU_ACTIONS + "measure_distance";
|
||||||
String POINT_EDIT_GPX_WP = POINTS_ACTION_MENU + "edit_gpx_waypoint";
|
String MAP_CONTEXT_MENU_EDIT_GPX_WP = MAP_CONTEXT_MENU_ACTIONS + "edit_gpx_waypoint";
|
||||||
String POINT_ADD_GPX_WAYPOINT = POINTS_ACTION_MENU + "add_gpx_waypoint";
|
String MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT = MAP_CONTEXT_MENU_ACTIONS + "add_gpx_waypoint";
|
||||||
String POINT_UPDATE_MAP = POINTS_ACTION_MENU + "update_map";
|
String MAP_CONTEXT_MENU_UPDATE_MAP = MAP_CONTEXT_MENU_ACTIONS + "update_map";
|
||||||
String POINT_DOWNLOAD_MAP = POINTS_ACTION_MENU + "download_map";
|
String MAP_CONTEXT_MENU_DOWNLOAD_MAP = MAP_CONTEXT_MENU_ACTIONS + "download_map";
|
||||||
String POINT_MODIFY_POI = POINTS_ACTION_MENU + "modify_poi";
|
String MAP_CONTEXT_MENU_MODIFY_POI = MAP_CONTEXT_MENU_ACTIONS + "modify_poi";
|
||||||
String POINT_MODIFY_OSM_CHANGE = POINTS_ACTION_MENU + "modify_osm_change";
|
String MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE = MAP_CONTEXT_MENU_ACTIONS + "modify_osm_change";
|
||||||
String POINT_CREATE_POI = POINTS_ACTION_MENU + "create_poi";
|
String MAP_CONTEXT_MENU_CREATE_POI = MAP_CONTEXT_MENU_ACTIONS + "create_poi";
|
||||||
String POINT_MODIFY_OSM_NOTE = POINTS_ACTION_MENU + "modify_osm_note";
|
String MAP_CONTEXT_MENU_MODIFY_OSM_NOTE = MAP_CONTEXT_MENU_ACTIONS + "modify_osm_note";
|
||||||
String POINT_OPEN_OSM_NOTE = POINTS_ACTION_MENU + "open_osm_note";
|
String MAP_CONTEXT_MENU_OPEN_OSM_NOTE = MAP_CONTEXT_MENU_ACTIONS + "open_osm_note";
|
||||||
|
|
||||||
|
//Plug-in's IDs:
|
||||||
|
String PLUGIN_OSMAND_MONITOR = "osmand.monitoring";
|
||||||
|
String PLUGIN_MAPILLARY = "osmand.mapillary";
|
||||||
|
String PLUGIN_OSMAND_DEV = "osmand.development";
|
||||||
|
String PLUGIN_AUDIO_VIDEO_NOTES = "osmand.audionotes";
|
||||||
|
String PLUGIN_NAUTICAL = "nauticalPlugin.plugin";
|
||||||
|
String PLUGIN_OSMAND_EDITING = "osm.editing";
|
||||||
|
String PLUGIN_PARKING_POSITION = "osmand.parking.position";
|
||||||
|
String PLUGIN_RASTER_MAPS = "osmand.rastermaps";
|
||||||
|
String PLUGIN_SKI_MAPS = "skimaps.plugin";
|
||||||
|
String PLUGIN_SRTM = "osmand.srtm";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,7 +568,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
if (dashboardOnMap.onBackPressed()) {
|
if (dashboardOnMap.onBackPressed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
|
if (drawerLayout.isDrawerOpen(Gravity.START)) {
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1574,7 +1574,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
public void openDrawer() {
|
public void openDrawer() {
|
||||||
mapActions.updateDrawerMenu();
|
mapActions.updateDrawerMenu();
|
||||||
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
||||||
drawerLayout.openDrawer(Gravity.LEFT, animate);
|
drawerLayout.openDrawer(Gravity.START, animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableDrawer() {
|
public void disableDrawer() {
|
||||||
|
@ -1598,7 +1598,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
||||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
|
if (drawerLayout.isDrawerOpen(Gravity.START)) {
|
||||||
int width = AndroidUtils.dpToPx(this, 280);
|
int width = AndroidUtils.dpToPx(this, 280);
|
||||||
if (event.getRawX() > width) {
|
if (event.getRawX() > width) {
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
|
@ -1612,11 +1612,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
public void closeDrawer() {
|
public void closeDrawer() {
|
||||||
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
||||||
drawerLayout.closeDrawer(Gravity.LEFT, animate);
|
drawerLayout.closeDrawer(Gravity.START, animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleDrawer() {
|
public void toggleDrawer() {
|
||||||
if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
|
if (drawerLayout.isDrawerOpen(Gravity.START)) {
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
} else {
|
} else {
|
||||||
openDrawer();
|
openDrawer();
|
||||||
|
|
|
@ -51,6 +51,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||||
|
import net.osmand.plus.activities.actions.OsmandRestoreOrExitDialog;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
|
@ -79,8 +80,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_ADD_GPX_WAYPOINT;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_DIRECTIONS_FROM_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
||||||
|
@ -96,11 +97,12 @@ import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_PLUGINS_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SEARCH_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SEARCH_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_TRAVEL_GUIDES_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_TRAVEL_GUIDES_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_EDIT_GPX_WP;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MEASURE_DISTANCE;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MEASURE_DISTANCE;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_SEARCH_NEARBY;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_SEARCH_NEARBY;
|
||||||
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
||||||
|
|
||||||
|
|
||||||
public class MapActivityActions implements DialogProvider {
|
public class MapActivityActions implements DialogProvider {
|
||||||
private static final Log LOG = PlatformUtil.getLog(MapActivityActions.class);
|
private static final Log LOG = PlatformUtil.getLog(MapActivityActions.class);
|
||||||
public static final String KEY_LONGITUDE = "longitude";
|
public static final String KEY_LONGITUDE = "longitude";
|
||||||
|
@ -142,7 +144,8 @@ public class MapActivityActions implements DialogProvider {
|
||||||
settings = mapActivity.getMyApplication().getSettings();
|
settings = mapActivity.getMyApplication().getSettings();
|
||||||
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
||||||
drawerLogoHeader = new ImageView(mapActivity);
|
drawerLogoHeader = new ImageView(mapActivity);
|
||||||
drawerLogoHeader.setPadding(-AndroidUtils.dpToPx(mapActivity, 8f), AndroidUtils.dpToPx(mapActivity, 16f), 0,0);
|
drawerLogoHeader.setPadding(-AndroidUtils.dpToPx(mapActivity, 8f), AndroidUtils.dpToPx(mapActivity, 16f), 0,
|
||||||
|
0);
|
||||||
drawerOsmAndFooter = mapActivity.getLayoutInflater().inflate(R.layout.powered_by_osmand_item, null);
|
drawerOsmAndFooter = mapActivity.getLayoutInflater().inflate(R.layout.powered_by_osmand_item, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,20 +327,20 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
adapter.addItem(itemBuilder
|
adapter.addItem(itemBuilder
|
||||||
.setTitleId(R.string.context_menu_item_directions_from, mapActivity)
|
.setTitleId(R.string.context_menu_item_directions_from, mapActivity)
|
||||||
.setId(POINT_DIRECTIONS_FROM_ID)
|
.setId(MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID)
|
||||||
.setIcon(R.drawable.ic_action_route_direction_from_here)
|
.setIcon(R.drawable.ic_action_route_direction_from_here)
|
||||||
.setOrder(DIRECTIONS_FROM_ITEM_ORDER)
|
.setOrder(DIRECTIONS_FROM_ITEM_ORDER)
|
||||||
.createItem());
|
.createItem());
|
||||||
adapter.addItem(itemBuilder
|
adapter.addItem(itemBuilder
|
||||||
.setTitleId(R.string.context_menu_item_search, mapActivity)
|
.setTitleId(R.string.context_menu_item_search, mapActivity)
|
||||||
.setId(POINT_SEARCH_NEARBY)
|
.setId(MAP_CONTEXT_MENU_SEARCH_NEARBY)
|
||||||
.setIcon(R.drawable.ic_action_search_dark)
|
.setIcon(R.drawable.ic_action_search_dark)
|
||||||
.setOrder(SEARCH_NEAR_ITEM_ORDER)
|
.setOrder(SEARCH_NEAR_ITEM_ORDER)
|
||||||
.createItem());
|
.createItem());
|
||||||
|
|
||||||
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||||
|
|
||||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
ItemClickListener listener = new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
if (resId == R.string.context_menu_item_add_waypoint) {
|
if (resId == R.string.context_menu_item_add_waypoint) {
|
||||||
|
@ -351,17 +354,17 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
if (selectedObj instanceof WptPt
|
if (selectedObj instanceof WptPt
|
||||||
&& getMyApplication().getSelectedGpxHelper().getSelectedGPXFile((WptPt) selectedObj) != null) {
|
&& getMyApplication().getSelectedGpxHelper().getSelectedGPXFile((WptPt) selectedObj) != null) {
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ItemBuilder()
|
||||||
.setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity)
|
.setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity)
|
||||||
.setId(POINT_EDIT_GPX_WP)
|
.setId(MAP_CONTEXT_MENU_EDIT_GPX_WP)
|
||||||
.setIcon(R.drawable.ic_action_edit_dark)
|
.setIcon(R.drawable.ic_action_edit_dark)
|
||||||
.setOrder(EDIT_GPX_WAYPOINT_ITEM_ORDER)
|
.setOrder(EDIT_GPX_WAYPOINT_ITEM_ORDER)
|
||||||
.setListener(listener).createItem());
|
.setListener(listener).createItem());
|
||||||
} else if (!getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles().isEmpty()
|
} else if (!getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles().isEmpty()
|
||||||
|| (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) {
|
|| (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) {
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ItemBuilder()
|
||||||
.setTitleId(R.string.context_menu_item_add_waypoint, mapActivity)
|
.setTitleId(R.string.context_menu_item_add_waypoint, mapActivity)
|
||||||
.setId(POINT_ADD_GPX_WAYPOINT)
|
.setId(MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT)
|
||||||
.setIcon(R.drawable.ic_action_gnew_label_dark)
|
.setIcon(R.drawable.ic_action_gnew_label_dark)
|
||||||
.setOrder(ADD_GPX_WAYPOINT_ITEM_ORDER)
|
.setOrder(ADD_GPX_WAYPOINT_ITEM_ORDER)
|
||||||
.setListener(listener).createItem());
|
.setListener(listener).createItem());
|
||||||
|
@ -369,7 +372,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
adapter.addItem(itemBuilder
|
adapter.addItem(itemBuilder
|
||||||
.setTitleId(R.string.measurement_tool, mapActivity)
|
.setTitleId(R.string.measurement_tool, mapActivity)
|
||||||
.setId(POINT_MEASURE_DISTANCE)
|
.setId(MAP_CONTEXT_MENU_MEASURE_DISTANCE)
|
||||||
.setIcon(R.drawable.ic_action_ruler)
|
.setIcon(R.drawable.ic_action_ruler)
|
||||||
.setOrder(MEASURE_DISTANCE_ITEM_ORDER)
|
.setOrder(MEASURE_DISTANCE_ITEM_ORDER)
|
||||||
.createItem());
|
.createItem());
|
||||||
|
@ -685,7 +688,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.home, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.home, mapActivity)
|
||||||
.setId(DRAWER_DASHBOARD_ID)
|
.setId(DRAWER_DASHBOARD_ID)
|
||||||
.setIcon(R.drawable.map_dashboard)
|
.setIcon(R.drawable.map_dashboard)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_dashboard_open");
|
app.logEvent(mapActivity, "drawer_dashboard_open");
|
||||||
|
@ -699,7 +702,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.map_markers, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.map_markers, mapActivity)
|
||||||
.setId(DRAWER_MAP_MARKERS_ID)
|
.setId(DRAWER_MAP_MARKERS_ID)
|
||||||
.setIcon(R.drawable.ic_action_flag_dark)
|
.setIcon(R.drawable.ic_action_flag_dark)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_markers_open");
|
app.logEvent(mapActivity, "drawer_markers_open");
|
||||||
|
@ -712,7 +715,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_my_places, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_my_places, mapActivity)
|
||||||
.setId(DRAWER_MY_PLACES_ID)
|
.setId(DRAWER_MY_PLACES_ID)
|
||||||
.setIcon(R.drawable.ic_action_fav_dark)
|
.setIcon(R.drawable.ic_action_fav_dark)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_myplaces_open");
|
app.logEvent(mapActivity, "drawer_myplaces_open");
|
||||||
|
@ -727,7 +730,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.search_button, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.search_button, mapActivity)
|
||||||
.setId(DRAWER_SEARCH_ID)
|
.setId(DRAWER_SEARCH_ID)
|
||||||
.setIcon(R.drawable.ic_action_search_dark)
|
.setIcon(R.drawable.ic_action_search_dark)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_search_open");
|
app.logEvent(mapActivity, "drawer_search_open");
|
||||||
|
@ -740,7 +743,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.get_directions, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.get_directions, mapActivity)
|
||||||
.setId(DRAWER_DIRECTIONS_ID)
|
.setId(DRAWER_DIRECTIONS_ID)
|
||||||
.setIcon(R.drawable.ic_action_gdirections_dark)
|
.setIcon(R.drawable.ic_action_gdirections_dark)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_directions_open");
|
app.logEvent(mapActivity, "drawer_directions_open");
|
||||||
|
@ -765,10 +768,10 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}).createItem());
|
}).createItem());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
|
||||||
.setId(DRAWER_CONFIGURE_MAP_ID)
|
.setId(DRAWER_CONFIGURE_MAP_ID)
|
||||||
.setIcon(R.drawable.ic_action_layers_dark)
|
.setIcon(R.drawable.ic_action_layers_dark)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_config_map_open");
|
app.logEvent(mapActivity, "drawer_config_map_open");
|
||||||
|
@ -788,7 +791,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.welmode_download_maps, null)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.welmode_download_maps, null)
|
||||||
.setId(DRAWER_DOWNLOAD_MAPS_ID)
|
.setId(DRAWER_DOWNLOAD_MAPS_ID)
|
||||||
.setTitle(d).setIcon(R.drawable.ic_type_archive)
|
.setTitle(d).setIcon(R.drawable.ic_type_archive)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_download_maps_open");
|
app.logEvent(mapActivity, "drawer_download_maps_open");
|
||||||
|
@ -804,7 +807,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.osm_live, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.osm_live, mapActivity)
|
||||||
.setId(DRAWER_OSMAND_LIVE_ID)
|
.setId(DRAWER_OSMAND_LIVE_ID)
|
||||||
.setIcon(R.drawable.ic_action_osm_live)
|
.setIcon(R.drawable.ic_action_osm_live)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_osm_live_open");
|
app.logEvent(mapActivity, "drawer_osm_live_open");
|
||||||
|
@ -836,10 +839,10 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).createItem());
|
}).createItem());
|
||||||
|
|
||||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.measurement_tool, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.measurement_tool, mapActivity)
|
||||||
.setId(DRAWER_MEASURE_DISTANCE_ID)
|
.setId(DRAWER_MEASURE_DISTANCE_ID)
|
||||||
.setIcon(R.drawable.ic_action_ruler)
|
.setIcon(R.drawable.ic_action_ruler)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
|
||||||
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager());
|
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager());
|
||||||
|
@ -852,7 +855,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.layer_map_appearance, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.layer_map_appearance, mapActivity)
|
||||||
.setId(DRAWER_CONFIGURE_SCREEN_ID)
|
.setId(DRAWER_CONFIGURE_SCREEN_ID)
|
||||||
.setIcon(R.drawable.ic_configure_screen_dark)
|
.setIcon(R.drawable.ic_configure_screen_dark)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_config_screen_open");
|
app.logEvent(mapActivity, "drawer_config_screen_open");
|
||||||
|
@ -880,7 +883,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_settings, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_settings, mapActivity)
|
||||||
.setId(DRAWER_SETTINGS_ID)
|
.setId(DRAWER_SETTINGS_ID)
|
||||||
.setIcon(R.drawable.ic_action_settings)
|
.setIcon(R.drawable.ic_action_settings)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_settings_open");
|
app.logEvent(mapActivity, "drawer_settings_open");
|
||||||
|
@ -908,7 +911,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_help, mapActivity)
|
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_help, mapActivity)
|
||||||
.setId(DRAWER_HELP_ID)
|
.setId(DRAWER_HELP_ID)
|
||||||
.setIcon(R.drawable.ic_action_help)
|
.setIcon(R.drawable.ic_action_help)
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.logEvent(mapActivity, "drawer_help_open");
|
app.logEvent(mapActivity, "drawer_help_open");
|
||||||
|
@ -1057,7 +1060,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
} else {
|
} else {
|
||||||
position -= menuItemsListView.getHeaderViewsCount();
|
position -= menuItemsListView.getHeaderViewsCount();
|
||||||
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
||||||
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
|
ItemClickListener click = item.getItemClickListener();
|
||||||
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
|
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
|
||||||
position, false, AndroidUtils.getCenterViewCoordinates(view))) {
|
position, false, AndroidUtils.getCenterViewCoordinates(view))) {
|
||||||
mapActivity.closeDrawer();
|
mapActivity.closeDrawer();
|
||||||
|
@ -1089,8 +1092,13 @@ public class MapActivityActions implements DialogProvider {
|
||||||
footerLayout.setOnClickListener(new View.OnClickListener() {
|
footerLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(navDrawerLogoParams!=null) showReturnConfirmationDialog(navDrawerLogoParams.get(0));
|
if (navDrawerLogoParams != null) {
|
||||||
else restoreOsmand();
|
mapActivity.closeDrawer();
|
||||||
|
}
|
||||||
|
new OsmandRestoreOrExitDialog()
|
||||||
|
.show(mapActivity.getSupportFragmentManager(), "dialog");
|
||||||
|
//showReturnConfirmationDialog(navDrawerLogoParams.get(0));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package net.osmand.plus.activities.actions;
|
||||||
|
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||||
|
import net.osmand.plus.helpers.FontCache;
|
||||||
|
|
||||||
|
public class OsmandRestoreOrExitDialog extends BottomSheetDialogFragment {
|
||||||
|
|
||||||
|
private String clientAppTitle = "";
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater()
|
||||||
|
.inflate(R.layout.dash_restore_osmand_fragment, container, false);
|
||||||
|
try {
|
||||||
|
clientAppTitle = getMyApplication().getAppCustomization().getNavFooterParams().getAppName();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
String msg = MessageFormat.format(getString(R.string.run_full_osmand_msg), clientAppTitle);
|
||||||
|
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||||
|
Typeface typefaceReg = FontCache.getRobotoRegular(getActivity());
|
||||||
|
TextView header = view.findViewById(R.id.run_full_osmand_header);
|
||||||
|
header.setTypeface(typeface);
|
||||||
|
|
||||||
|
TextView message = view.findViewById(R.id.run_full_osmand_message);
|
||||||
|
message.setTypeface(typefaceReg);
|
||||||
|
message.setText(msg);
|
||||||
|
|
||||||
|
Button cancelBtn = view.findViewById(R.id.cancel_full_osmand_btn);
|
||||||
|
cancelBtn.setTypeface(typeface);
|
||||||
|
cancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button launchBtn = view.findViewById(R.id.launch_full_osmand_btn);
|
||||||
|
launchBtn.setTypeface(typeface);
|
||||||
|
launchBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
getMyApplication().getAppCustomization().restoreOsmand();
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,11 +47,11 @@ import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_CREATE_POI;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CREATE_POI;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_OSM_CHANGE;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_OSM_NOTE;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_OSM_NOTE;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_POI;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_POI;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_OPEN_OSM_NOTE;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_OPEN_OSM_NOTE;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.OSM_NOTES;
|
import static net.osmand.plus.OsmAndCustomizationConstants.OSM_NOTES;
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,21 +235,21 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
if (isEditable) {
|
if (isEditable) {
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify, mapActivity)
|
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify, mapActivity)
|
||||||
.setId(POINT_MODIFY_POI)
|
.setId(MAP_CONTEXT_MENU_MODIFY_POI)
|
||||||
.setIcon(R.drawable.ic_action_edit_dark)
|
.setIcon(R.drawable.ic_action_edit_dark)
|
||||||
.setOrder(MODIFY_POI_ITEM_ORDER)
|
.setOrder(MODIFY_POI_ITEM_ORDER)
|
||||||
.setListener(listener)
|
.setListener(listener)
|
||||||
.createItem());
|
.createItem());
|
||||||
} else if (selectedObj instanceof OpenstreetmapPoint && ((OpenstreetmapPoint) selectedObj).getAction() != Action.DELETE) {
|
} else if (selectedObj instanceof OpenstreetmapPoint && ((OpenstreetmapPoint) selectedObj).getAction() != Action.DELETE) {
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify_osm_change, mapActivity)
|
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify_osm_change, mapActivity)
|
||||||
.setId(POINT_MODIFY_OSM_CHANGE)
|
.setId(MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE)
|
||||||
.setIcon(R.drawable.ic_action_edit_dark)
|
.setIcon(R.drawable.ic_action_edit_dark)
|
||||||
.setOrder(MODIFY_OSM_CHANGE_ITEM_ORDER)
|
.setOrder(MODIFY_OSM_CHANGE_ITEM_ORDER)
|
||||||
.setListener(listener)
|
.setListener(listener)
|
||||||
.createItem());
|
.createItem());
|
||||||
} else {
|
} else {
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_create_poi, mapActivity)
|
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_create_poi, mapActivity)
|
||||||
.setId(POINT_CREATE_POI)
|
.setId(MAP_CONTEXT_MENU_CREATE_POI)
|
||||||
.setIcon(R.drawable.ic_action_plus_dark)
|
.setIcon(R.drawable.ic_action_plus_dark)
|
||||||
.setOrder(CREATE_POI_ITEM_ORDER)
|
.setOrder(CREATE_POI_ITEM_ORDER)
|
||||||
.setListener(listener)
|
.setListener(listener)
|
||||||
|
@ -257,14 +257,14 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
if (selectedObj instanceof OsmNotesPoint) {
|
if (selectedObj instanceof OsmNotesPoint) {
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_modify_note, mapActivity)
|
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_modify_note, mapActivity)
|
||||||
.setId(POINT_MODIFY_OSM_NOTE)
|
.setId(MAP_CONTEXT_MENU_MODIFY_OSM_NOTE)
|
||||||
.setIcon(R.drawable.ic_action_edit_dark)
|
.setIcon(R.drawable.ic_action_edit_dark)
|
||||||
.setOrder(MODIFY_OSM_NOTE_ITEM_ORDER)
|
.setOrder(MODIFY_OSM_NOTE_ITEM_ORDER)
|
||||||
.setListener(listener)
|
.setListener(listener)
|
||||||
.createItem());
|
.createItem());
|
||||||
} else {
|
} else {
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_open_note, mapActivity)
|
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_open_note, mapActivity)
|
||||||
.setId(POINT_OPEN_OSM_NOTE)
|
.setId(MAP_CONTEXT_MENU_OPEN_OSM_NOTE)
|
||||||
.setIcon(R.drawable.ic_action_bug_dark)
|
.setIcon(R.drawable.ic_action_bug_dark)
|
||||||
.setOrder(OPEN_OSM_NOTE_ITEM_ORDER)
|
.setOrder(OPEN_OSM_NOTE_ITEM_ORDER)
|
||||||
.setListener(listener)
|
.setListener(listener)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package net.osmand.plus.parkingpoint;
|
package net.osmand.plus.parkingpoint;
|
||||||
|
|
||||||
|
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MARK_AS_PARKING_LOC;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -235,7 +235,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
};
|
};
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setTitleId(R.string.context_menu_item_add_parking_point, mapActivity)
|
.setTitleId(R.string.context_menu_item_add_parking_point, mapActivity)
|
||||||
.setId(POINT_MARK_AS_PARKING_LOC)
|
.setId(MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC)
|
||||||
.setIcon(R.drawable.ic_action_parking_dark)
|
.setIcon(R.drawable.ic_action_parking_dark)
|
||||||
.setOrder(MARK_AS_PARKING_POS_ITEM_ORDER)
|
.setOrder(MARK_AS_PARKING_POS_ITEM_ORDER)
|
||||||
.setListener(addListener)
|
.setListener(addListener)
|
||||||
|
|
|
@ -46,10 +46,10 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_DOWNLOAD_MAP;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_DOWNLOAD_MAP;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.OVERLAY_MAP;
|
import static net.osmand.plus.OsmAndCustomizationConstants.OVERLAY_MAP;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.UNDERLAY_MAP;
|
import static net.osmand.plus.OsmAndCustomizationConstants.UNDERLAY_MAP;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_UPDATE_MAP;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_UPDATE_MAP;
|
||||||
|
|
||||||
public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
public static final String ID = "osmand.rastermaps";
|
public static final String ID = "osmand.rastermaps";
|
||||||
|
@ -380,13 +380,13 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
};
|
};
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setTitleId(R.string.context_menu_item_update_map, mapActivity)
|
.setTitleId(R.string.context_menu_item_update_map, mapActivity)
|
||||||
.setId(POINT_UPDATE_MAP)
|
.setId(MAP_CONTEXT_MENU_UPDATE_MAP)
|
||||||
.setIcon(R.drawable.ic_action_refresh_dark)
|
.setIcon(R.drawable.ic_action_refresh_dark)
|
||||||
.setOrder(UPDATE_MAP_ITEM_ORDER)
|
.setOrder(UPDATE_MAP_ITEM_ORDER)
|
||||||
.setListener(listener).createItem());
|
.setListener(listener).createItem());
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setTitleId(R.string.shared_string_download_map, mapActivity)
|
.setTitleId(R.string.shared_string_download_map, mapActivity)
|
||||||
.setId(POINT_DOWNLOAD_MAP)
|
.setId(MAP_CONTEXT_MENU_DOWNLOAD_MAP)
|
||||||
.setIcon(R.drawable.ic_action_import)
|
.setIcon(R.drawable.ic_action_import)
|
||||||
.setOrder(DOWNLOAD_MAP_ITEM_ORDER)
|
.setOrder(DOWNLOAD_MAP_ITEM_ORDER)
|
||||||
.setListener(listener).createItem());
|
.setListener(listener).createItem());
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
@ -68,7 +69,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
boolean isLightTheme = getMyApplication().getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
boolean isLightTheme =
|
||||||
|
getMyApplication().getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||||
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
||||||
setStyle(STYLE_NO_FRAME, themeId);
|
setStyle(STYLE_NO_FRAME, themeId);
|
||||||
}
|
}
|
||||||
|
@ -135,11 +137,19 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
bottomBar.setOnClickListener(new View.OnClickListener() {
|
bottomBar.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
dismiss();
|
||||||
|
if (!editMode) {
|
||||||
dismiss();
|
dismiss();
|
||||||
QuickSearchDialogFragment quickSearchDialogFragment = getQuickSearchDialogFragment();
|
QuickSearchDialogFragment quickSearchDialogFragment = getQuickSearchDialogFragment();
|
||||||
if (quickSearchDialogFragment != null) {
|
if (quickSearchDialogFragment != null) {
|
||||||
quickSearchDialogFragment.showFilter(filterId);
|
quickSearchDialogFragment.showFilter(filterId);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
QuickSearchPoiFilterFragment quickSearchPoiFilterFragment = getQuickSearchPoiFilterFragment();
|
||||||
|
if(quickSearchPoiFilterFragment!= null) {
|
||||||
|
quickSearchPoiFilterFragment.refreshList();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -177,6 +187,15 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private QuickSearchPoiFilterFragment getQuickSearchPoiFilterFragment() {
|
||||||
|
Fragment parent = getParentFragment();
|
||||||
|
if (parent instanceof QuickSearchPoiFilterFragment) {
|
||||||
|
return (QuickSearchPoiFilterFragment) parent;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int getIconId(PoiCategory category) {
|
private int getIconId(PoiCategory category) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
String id = null;
|
String id = null;
|
||||||
|
@ -203,6 +222,7 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CategoryListAdapter extends ArrayAdapter<PoiCategory> {
|
private class CategoryListAdapter extends ArrayAdapter<PoiCategory> {
|
||||||
|
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
|
|
||||||
CategoryListAdapter(OsmandApplication app, List<PoiCategory> items) {
|
CategoryListAdapter(OsmandApplication app, List<PoiCategory> items) {
|
||||||
|
@ -213,7 +233,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
LayoutInflater inflater = (LayoutInflater) app.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) app
|
||||||
|
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
View row = convertView;
|
View row = convertView;
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
row = inflater.inflate(R.layout.list_item_icon24_and_menu, parent, false);
|
row = inflater.inflate(R.layout.list_item_icon24_and_menu, parent, false);
|
||||||
|
@ -221,7 +242,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
PoiCategory category = getItem(position);
|
PoiCategory category = getItem(position);
|
||||||
if (category != null) {
|
if (category != null) {
|
||||||
AppCompatImageView iconView = (AppCompatImageView) row.findViewById(R.id.icon);
|
AppCompatImageView iconView = (AppCompatImageView) row.findViewById(R.id.icon);
|
||||||
AppCompatImageView secondaryIconView = (AppCompatImageView) row.findViewById(R.id.secondary_icon);
|
AppCompatImageView secondaryIconView = (AppCompatImageView) row
|
||||||
|
.findViewById(R.id.secondary_icon);
|
||||||
AppCompatTextView titleView = (AppCompatTextView) row.findViewById(R.id.title);
|
AppCompatTextView titleView = (AppCompatTextView) row.findViewById(R.id.title);
|
||||||
AppCompatTextView descView = (AppCompatTextView) row.findViewById(R.id.description);
|
AppCompatTextView descView = (AppCompatTextView) row.findViewById(R.id.description);
|
||||||
SwitchCompat check = (SwitchCompat) row.findViewById(R.id.toggle_item);
|
SwitchCompat check = (SwitchCompat) row.findViewById(R.id.toggle_item);
|
||||||
|
@ -239,7 +261,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
iconView.setImageDrawable(null);
|
iconView.setImageDrawable(null);
|
||||||
}
|
}
|
||||||
secondaryIconView.setImageDrawable(
|
secondaryIconView.setImageDrawable(
|
||||||
ic.getIcon(R.drawable.ic_action_additional_option, app.getSettings().isLightContent() ? R.color.icon_color_light : 0));
|
ic.getIcon(R.drawable.ic_action_additional_option,
|
||||||
|
app.getSettings().isLightContent() ? R.color.icon_color_light : 0));
|
||||||
check.setOnCheckedChangeListener(null);
|
check.setOnCheckedChangeListener(null);
|
||||||
check.setChecked(filter.isTypeAccepted(category));
|
check.setChecked(filter.isTypeAccepted(category));
|
||||||
String textString = category.getTranslation();
|
String textString = category.getTranslation();
|
||||||
|
@ -262,7 +285,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
} else {
|
} else {
|
||||||
descView.setVisibility(View.GONE);
|
descView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
row.findViewById(R.id.divider).setVisibility(position == getCount() - 1 ? View.GONE : View.VISIBLE);
|
row.findViewById(R.id.divider)
|
||||||
|
.setVisibility(position == getCount() - 1 ? View.GONE : View.VISIBLE);
|
||||||
addRowListener(category, check);
|
addRowListener(category, check);
|
||||||
}
|
}
|
||||||
return (row);
|
return (row);
|
||||||
|
@ -291,7 +315,18 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
bottomBarShadow.setVisibility(View.GONE);
|
bottomBarShadow.setVisibility(View.GONE);
|
||||||
bottomBar.setVisibility(View.GONE);
|
bottomBar.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
barTitle.setText(getContext().getString(R.string.selected_categories) + ": " + filter.getAcceptedTypesCount());
|
barTitle.setText(getContext().getString(R.string.selected_categories) + ": " + filter
|
||||||
|
.getAcceptedTypesCount());
|
||||||
|
bottomBarShadow.setVisibility(View.VISIBLE);
|
||||||
|
bottomBar.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (filter.isEmpty()) {
|
||||||
|
bottomBarShadow.setVisibility(View.GONE);
|
||||||
|
bottomBar.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
barTitle.setText(getContext().getString(R.string.selected_categories) + ": " + filter
|
||||||
|
.getAcceptedTypesCount());
|
||||||
bottomBarShadow.setVisibility(View.VISIBLE);
|
bottomBarShadow.setVisibility(View.VISIBLE);
|
||||||
bottomBar.setVisibility(View.VISIBLE);
|
bottomBar.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -351,14 +386,16 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
builder.setCustomTitle(titleView);
|
builder.setCustomTitle(titleView);
|
||||||
|
|
||||||
builder.setCancelable(true);
|
builder.setCancelable(true);
|
||||||
builder.setNegativeButton(getContext().getText(R.string.shared_string_cancel), new DialogInterface.OnClickListener() {
|
builder.setNegativeButton(getContext().getText(R.string.shared_string_cancel),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setPositiveButton(getContext().getText(R.string.shared_string_apply), new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(getContext().getText(R.string.shared_string_apply),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
@ -381,7 +418,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.setMultiChoiceItems(visibleNames, selected, new DialogInterface.OnMultiChoiceClickListener() {
|
builder.setMultiChoiceItems(visibleNames, selected,
|
||||||
|
new DialogInterface.OnMultiChoiceClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int item, boolean isChecked) {
|
public void onClick(DialogInterface dialog, int item, boolean isChecked) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -405,6 +406,11 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void refreshList() {
|
||||||
|
initListItems();
|
||||||
|
updateListView();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateListView() {
|
private void updateListView() {
|
||||||
adapter.setListItems(getListItems());
|
adapter.setListItems(getListItems());
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import gnu.trove.list.array.TIntArrayList;
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_CHANGE_MARKER_POSITION;
|
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION;
|
||||||
import static net.osmand.plus.mapcontextmenu.controllers.TransportStopController.SHOW_STOPS_RADIUS_METERS;
|
import static net.osmand.plus.mapcontextmenu.controllers.TransportStopController.SHOW_STOPS_RADIUS_METERS;
|
||||||
|
|
||||||
public class ContextMenuLayer extends OsmandMapLayer {
|
public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
@ -280,7 +280,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
};
|
};
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setTitleId(R.string.change_markers_position, activity)
|
.setTitleId(R.string.change_markers_position, activity)
|
||||||
.setId(POINT_CHANGE_MARKER_POSITION)
|
.setId(MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION)
|
||||||
.setIcon(R.drawable.ic_show_on_map)
|
.setIcon(R.drawable.ic_show_on_map)
|
||||||
.setOrder(MapActivityActions.CHANGE_POSITION_ITEM_ORDER)
|
.setOrder(MapActivityActions.CHANGE_POSITION_ITEM_ORDER)
|
||||||
.setClickable(isObjectMoveable(o))
|
.setClickable(isObjectMoveable(o))
|
||||||
|
|
Loading…
Reference in a new issue