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;
|
||||
}
|
||||
|
||||
public List<TransportStop> searchTransportIndex(SearchRequest<TransportStop> req) throws IOException {
|
||||
for (TransportIndex index : transportIndexes) {
|
||||
if (index.stopsFileLength == 0 || index.right < req.left || index.left > req.right || index.top > req.bottom
|
||||
|| index.bottom < req.top) {
|
||||
continue;
|
||||
}
|
||||
if (req.stringTable != null) {
|
||||
req.stringTable.clear();
|
||||
}
|
||||
codedIS.seek(index.stopsFileOffset);
|
||||
int oldLimit = codedIS.pushLimit(index.stopsFileLength);
|
||||
int offset = req.searchResults.size();
|
||||
|
@ -875,6 +877,8 @@ public class BinaryMapIndexReader {
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// lazy initializing trees
|
||||
if (index.trees == null) {
|
||||
index.trees = new ArrayList<MapTree>();
|
||||
|
|
|
@ -402,12 +402,12 @@ public class BinaryMapTransportReaderAdapter {
|
|||
int oldLimit = codedIS.pushLimit(ind.stringTable.length);
|
||||
int current = 0;
|
||||
int i = 0;
|
||||
while (i < values.length) {
|
||||
while (i < values.length && codedIS.getBytesUntilLimit() > 0) {
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
switch (tag) {
|
||||
case 0:
|
||||
break;
|
||||
return;
|
||||
case OsmandOdb.StringTable.S_FIELD_NUMBER:
|
||||
if (current == values[i]) {
|
||||
String value = codedIS.readString();
|
||||
|
|
|
@ -163,24 +163,12 @@
|
|||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="content"/>
|
||||
<data android:scheme="file"/>
|
||||
<data android:host="*"/>
|
||||
<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:scheme="data"/>
|
||||
<data android:host="*"/>
|
||||
<data android:mimeType="*/*"/>
|
||||
<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" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="content"/>
|
||||
<data android:scheme="file"/>
|
||||
<data android:scheme="data"/>
|
||||
<data android:host="*"/>
|
||||
<data android:mimeType="*/*"/>
|
||||
<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"?>
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/mapBackground">
|
||||
android:background="?attr/mapBackground"
|
||||
android:layout_gravity="start">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -103,10 +105,10 @@
|
|||
android:id="@+id/menuItems"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="left"
|
||||
android:background="?attr/bg_color"
|
||||
android:clipToPadding="false"
|
||||
android:drawSelectorOnTop="true" />
|
||||
android:drawSelectorOnTop="true"
|
||||
android:layout_gravity="start"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/drawer_footer_layout"
|
||||
|
@ -114,6 +116,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="start"
|
||||
android:visibility="gone">
|
||||
|
||||
<include layout="@layout/powered_by_osmand_item"/>
|
||||
|
|
|
@ -12,10 +12,13 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:drawablePadding="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight = "16dp"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
android:textStyle="normal"
|
||||
tools:drawableLeft="@drawable/ic_action_search_dark"
|
||||
tools:drawableStart="@drawable/ic_action_search_dark"
|
||||
tools:text="@string/layer_poi"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
<dimen name="subHeaderPadding">2dp</dimen>
|
||||
<dimen name="subHeaderMarginLeft">15dp</dimen>
|
||||
<dimen name = "subHeaderMarginRight">15dp</dimen>
|
||||
<dimen name="showAllButtonMarginRight">14dp</dimen>
|
||||
<dimen name="showAllButtonHeight">36dp</dimen>
|
||||
<dimen name="dashFavIconSize">28dp</dimen>
|
||||
|
|
|
@ -1162,6 +1162,7 @@
|
|||
<string name="shared_string_audio">Audio</string>
|
||||
<string name="shared_string_video">Video</string>
|
||||
<string name="shared_string_photo">Photo</string>
|
||||
<string name="shared_string_launch">Launch</string>
|
||||
<string name="route_points">Route points</string>
|
||||
<string name="track_segments">Track segments</string>
|
||||
<string name="track_points">Track points</string>
|
||||
|
@ -2963,4 +2964,6 @@
|
|||
<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="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>
|
||||
|
|
|
@ -6,4 +6,6 @@ interface IOsmAndAidlCallback {
|
|||
void onSearchComplete(in List<SearchResult> resultSet);
|
||||
|
||||
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.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.ResumeNavigationParams;
|
||||
|
@ -74,6 +76,10 @@ import net.osmand.aidl.gpx.AGpxFile;
|
|||
import net.osmand.aidl.gpx.AGpxFileDetails;
|
||||
import net.osmand.aidl.tiles.ASqliteDbFile;
|
||||
|
||||
import net.osmand.aidl.plugins.PluginParams;
|
||||
|
||||
|
||||
|
||||
|
||||
// NOTE: Add new methods at the end of file!!!
|
||||
|
||||
|
@ -161,9 +167,12 @@ interface IOsmAndAidlInterface {
|
|||
boolean showSqliteDbFile(String fileName);
|
||||
boolean hideSqliteDbFile(String fileName);
|
||||
|
||||
boolean setNavDrawerLogoWithParams(in String imageUri, String packageName, String intent);
|
||||
boolean setNavDrawerFooterParams(in String packageName, String intent, String appName);
|
||||
boolean setNavDrawerLogoWithParams(in NavDrawerHeaderParams params);
|
||||
boolean setNavDrawerFooterWithParams(in NavDrawerFooterParams params);
|
||||
|
||||
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.Bundle;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.RemoteException;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
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.mapmarker.AMapMarker;
|
||||
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.tiles.ASqliteDbFile;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
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.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
|
@ -1641,6 +1646,30 @@ public class OsmandAidlApi {
|
|||
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) {
|
||||
if (!TextUtils.isEmpty(appPackage) && items != null) {
|
||||
if (items.isEmpty()) {
|
||||
|
@ -1862,18 +1891,23 @@ public class OsmandAidlApi {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
boolean setNavDrawerFooterParams(@Nullable String packageName, @Nullable String intent, @Nullable String appName) {
|
||||
return app.getAppCustomization().setNavDrawerFooterAction(packageName, intent, appName);
|
||||
boolean setNavDrawerFooterWithParams(@NonNull NavDrawerFooterParams params) {
|
||||
return app.getAppCustomization().setNavDrawerFooterParams(params);
|
||||
}
|
||||
|
||||
boolean restoreOsmand() {
|
||||
return app.getAppCustomization().restoreOsmand();
|
||||
}
|
||||
|
||||
boolean changePluginState(PluginParams params) {
|
||||
return app.getAppCustomization().changePluginStatus(params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) {
|
||||
return new AGpxFileDetails(a.totalDistance, a.totalTracks, a.startTime, a.endTime,
|
||||
|
@ -1945,4 +1979,8 @@ public class OsmandAidlApi {
|
|||
public interface SearchCompleteCallback {
|
||||
void onSearchComplete(List<SearchResult> resultSet);
|
||||
}
|
||||
|
||||
public interface OsmandAppInitCallback {
|
||||
void onAppInitialized();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.os.RemoteException;
|
|||
import android.support.annotation.Nullable;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.aidl.OsmandAidlApi.OsmandAppInitCallback;
|
||||
import net.osmand.aidl.OsmandAidlApi.SearchCompleteCallback;
|
||||
import net.osmand.aidl.calculateroute.CalculateRouteParams;
|
||||
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.RemoveMapWidgetParams;
|
||||
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.navigation.MuteNavigationParams;
|
||||
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.StopRecordingParams;
|
||||
import net.osmand.aidl.note.TakePhotoNoteParams;
|
||||
import net.osmand.aidl.plugins.PluginParams;
|
||||
import net.osmand.aidl.search.SearchParams;
|
||||
import net.osmand.aidl.search.SearchResult;
|
||||
import net.osmand.aidl.tiles.ASqliteDbFile;
|
||||
|
@ -773,15 +777,17 @@ public class OsmandAidlService extends Service {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean setNavDrawerLogoWithParams(String imageUri, String packageName, String intent) throws RemoteException {
|
||||
public boolean setNavDrawerLogoWithParams(NavDrawerHeaderParams params) throws RemoteException {
|
||||
OsmandAidlApi api = getApi("setNavDrawerLogoWithParams");
|
||||
return api != null && api.setNavDrawerLogoWithParams(imageUri, packageName, intent);
|
||||
return api != null && api.setNavDrawerLogoWithParams(
|
||||
params.getImageUri(), params.getPackageName(), params.getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setNavDrawerFooterParams(String packageName, String intent, String appName) throws RemoteException {
|
||||
OsmandAidlApi api = getApi ("setNavDrawerFooterParams");
|
||||
return api != null && api.setNavDrawerFooterParams(packageName, intent, appName);
|
||||
public boolean setNavDrawerFooterWithParams(NavDrawerFooterParams params)
|
||||
throws RemoteException {
|
||||
OsmandAidlApi api = getApi("setNavDrawerFooterParams");
|
||||
return api != null && api.setNavDrawerFooterWithParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -790,5 +796,31 @@ public class OsmandAidlService extends Service {
|
|||
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> 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().
|
||||
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().
|
||||
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();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
applicationMode.defaultSpeed = defSpeed;
|
||||
applicationMode.minDistanceForTurn = distForTurn;
|
||||
|
|
|
@ -14,6 +14,9 @@ import android.text.TextUtils;
|
|||
|
||||
import net.osmand.IProgress;
|
||||
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.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.PluginsActivity;
|
||||
|
@ -45,6 +48,7 @@ public class OsmAndAppCustomization {
|
|||
|
||||
private Bitmap navDrawerLogo;
|
||||
private ArrayList<String> navDrawerParams;
|
||||
private NavDrawerFooterParams navDrawerFooterParams;
|
||||
|
||||
private Set<String> featuresEnabledIds = new HashSet<>();
|
||||
private Set<String> featuresDisabledIds = new HashSet<>();
|
||||
|
@ -207,7 +211,7 @@ public class OsmAndAppCustomization {
|
|||
@Nullable
|
||||
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)) {
|
||||
navDrawerLogo = null;
|
||||
} else {
|
||||
|
@ -223,7 +227,7 @@ public class OsmAndAppCustomization {
|
|||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
if(packageName!=null && intent!=null) {
|
||||
if (packageName != null && intent != null) {
|
||||
navDrawerParams = new ArrayList<>();
|
||||
navDrawerParams.add(packageName);
|
||||
navDrawerParams.add(intent);
|
||||
|
@ -232,7 +236,14 @@ public class OsmAndAppCustomization {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean setNavDrawerFooterParams(NavDrawerFooterParams params) {
|
||||
navDrawerFooterParams = params;
|
||||
return true;
|
||||
}
|
||||
|
||||
public NavDrawerFooterParams getNavFooterParams() {
|
||||
return navDrawerFooterParams;
|
||||
}
|
||||
|
||||
public void setFeaturesEnabledIds(@NonNull Collection<String> ids) {
|
||||
featuresEnabledIds.clear();
|
||||
|
@ -288,16 +299,33 @@ public class OsmAndAppCustomization {
|
|||
return set.contains(appMode);
|
||||
}
|
||||
|
||||
public boolean setNavDrawerLogoWithParams(String uri, @Nullable String packageName, @Nullable String intent) {
|
||||
LOG.info("setNavDrawerLogoWithParams called");
|
||||
return setNavDrawerLogo(uri, packageName, intent);
|
||||
public boolean setNavDrawerLogoWithParams(String imageUri, @Nullable String packageName,
|
||||
@Nullable String intent) {
|
||||
return setNavDrawerLogo(imageUri, packageName, intent);
|
||||
}
|
||||
|
||||
public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) {
|
||||
//todo implement custom action to "Powered by Osmand" action in NavDrawer
|
||||
public boolean changePluginStatus(PluginParams params) {
|
||||
if (params.getNewState() == 0) {
|
||||
for (OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
|
||||
if (plugin.getId().equals(params.getPluginId())) {
|
||||
plugin.setActive(false);
|
||||
}
|
||||
}
|
||||
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
|
||||
private HashSet<ApplicationMode> getAppModesSet(@Nullable List<String> appModeKeys) {
|
||||
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_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out";
|
||||
|
||||
//Point's Context Action Menu:
|
||||
String POINTS_ACTION_MENU = "point.actions.";
|
||||
String POINT_DIRECTIONS_FROM_ID = POINTS_ACTION_MENU + "directions_from";
|
||||
String POINT_SEARCH_NEARBY = POINTS_ACTION_MENU + "search_nearby";
|
||||
String POINT_CHANGE_MARKER_POSITION = POINTS_ACTION_MENU + "change_m_position";
|
||||
String POINT_MARK_AS_PARKING_LOC = POINTS_ACTION_MENU + "mark_as_parking";
|
||||
String POINT_MEASURE_DISTANCE = POINTS_ACTION_MENU + "measure_distance";
|
||||
String POINT_EDIT_GPX_WP = POINTS_ACTION_MENU + "edit_gpx_waypoint";
|
||||
String POINT_ADD_GPX_WAYPOINT = POINTS_ACTION_MENU + "add_gpx_waypoint";
|
||||
String POINT_UPDATE_MAP = POINTS_ACTION_MENU + "update_map";
|
||||
String POINT_DOWNLOAD_MAP = POINTS_ACTION_MENU + "download_map";
|
||||
String POINT_MODIFY_POI = POINTS_ACTION_MENU + "modify_poi";
|
||||
String POINT_MODIFY_OSM_CHANGE = POINTS_ACTION_MENU + "modify_osm_change";
|
||||
String POINT_CREATE_POI = POINTS_ACTION_MENU + "create_poi";
|
||||
String POINT_MODIFY_OSM_NOTE = POINTS_ACTION_MENU + "modify_osm_note";
|
||||
String POINT_OPEN_OSM_NOTE = POINTS_ACTION_MENU + "open_osm_note";
|
||||
//Map Context Menu Actions:
|
||||
String MAP_CONTEXT_MENU_ACTIONS = "point.actions.";
|
||||
String MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID = MAP_CONTEXT_MENU_ACTIONS + "directions_from";
|
||||
String MAP_CONTEXT_MENU_SEARCH_NEARBY = MAP_CONTEXT_MENU_ACTIONS + "search_nearby";
|
||||
String MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION = MAP_CONTEXT_MENU_ACTIONS + "change_m_position";
|
||||
String MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC = MAP_CONTEXT_MENU_ACTIONS + "mark_as_parking";
|
||||
String MAP_CONTEXT_MENU_MEASURE_DISTANCE = MAP_CONTEXT_MENU_ACTIONS + "measure_distance";
|
||||
String MAP_CONTEXT_MENU_EDIT_GPX_WP = MAP_CONTEXT_MENU_ACTIONS + "edit_gpx_waypoint";
|
||||
String MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT = MAP_CONTEXT_MENU_ACTIONS + "add_gpx_waypoint";
|
||||
String MAP_CONTEXT_MENU_UPDATE_MAP = MAP_CONTEXT_MENU_ACTIONS + "update_map";
|
||||
String MAP_CONTEXT_MENU_DOWNLOAD_MAP = MAP_CONTEXT_MENU_ACTIONS + "download_map";
|
||||
String MAP_CONTEXT_MENU_MODIFY_POI = MAP_CONTEXT_MENU_ACTIONS + "modify_poi";
|
||||
String MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE = MAP_CONTEXT_MENU_ACTIONS + "modify_osm_change";
|
||||
String MAP_CONTEXT_MENU_CREATE_POI = MAP_CONTEXT_MENU_ACTIONS + "create_poi";
|
||||
String MAP_CONTEXT_MENU_MODIFY_OSM_NOTE = MAP_CONTEXT_MENU_ACTIONS + "modify_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()) {
|
||||
return;
|
||||
}
|
||||
if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
|
||||
if (drawerLayout.isDrawerOpen(Gravity.START)) {
|
||||
closeDrawer();
|
||||
return;
|
||||
}
|
||||
|
@ -1574,7 +1574,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
public void openDrawer() {
|
||||
mapActions.updateDrawerMenu();
|
||||
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
||||
drawerLayout.openDrawer(Gravity.LEFT, animate);
|
||||
drawerLayout.openDrawer(Gravity.START, animate);
|
||||
}
|
||||
|
||||
public void disableDrawer() {
|
||||
|
@ -1598,7 +1598,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
|
||||
if (drawerLayout.isDrawerOpen(Gravity.START)) {
|
||||
int width = AndroidUtils.dpToPx(this, 280);
|
||||
if (event.getRawX() > width) {
|
||||
closeDrawer();
|
||||
|
@ -1612,11 +1612,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
|
||||
public void closeDrawer() {
|
||||
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
||||
drawerLayout.closeDrawer(Gravity.LEFT, animate);
|
||||
drawerLayout.closeDrawer(Gravity.START, animate);
|
||||
}
|
||||
|
||||
public void toggleDrawer() {
|
||||
if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
|
||||
if (drawerLayout.isDrawerOpen(Gravity.START)) {
|
||||
closeDrawer();
|
||||
} else {
|
||||
openDrawer();
|
||||
|
|
|
@ -51,6 +51,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.Version;
|
||||
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.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
|
@ -79,8 +80,8 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_ADD_GPX_WAYPOINT;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_DIRECTIONS_FROM_ID;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT;
|
||||
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_SCREEN_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_SETTINGS_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.POINT_MEASURE_DISTANCE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_SEARCH_NEARBY;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MEASURE_DISTANCE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_SEARCH_NEARBY;
|
||||
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
||||
|
||||
|
||||
public class MapActivityActions implements DialogProvider {
|
||||
private static final Log LOG = PlatformUtil.getLog(MapActivityActions.class);
|
||||
public static final String KEY_LONGITUDE = "longitude";
|
||||
|
@ -142,7 +144,8 @@ public class MapActivityActions implements DialogProvider {
|
|||
settings = mapActivity.getMyApplication().getSettings();
|
||||
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -324,20 +327,20 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
adapter.addItem(itemBuilder
|
||||
.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)
|
||||
.setOrder(DIRECTIONS_FROM_ITEM_ORDER)
|
||||
.createItem());
|
||||
adapter.addItem(itemBuilder
|
||||
.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)
|
||||
.setOrder(SEARCH_NEAR_ITEM_ORDER)
|
||||
.createItem());
|
||||
|
||||
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||
|
||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
ItemClickListener listener = new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
if (resId == R.string.context_menu_item_add_waypoint) {
|
||||
|
@ -351,17 +354,17 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
if (selectedObj instanceof WptPt
|
||||
&& getMyApplication().getSelectedGpxHelper().getSelectedGPXFile((WptPt) selectedObj) != null) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
adapter.addItem(new ItemBuilder()
|
||||
.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)
|
||||
.setOrder(EDIT_GPX_WAYPOINT_ITEM_ORDER)
|
||||
.setListener(listener).createItem());
|
||||
} else if (!getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles().isEmpty()
|
||||
|| (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
adapter.addItem(new ItemBuilder()
|
||||
.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)
|
||||
.setOrder(ADD_GPX_WAYPOINT_ITEM_ORDER)
|
||||
.setListener(listener).createItem());
|
||||
|
@ -369,7 +372,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
adapter.addItem(itemBuilder
|
||||
.setTitleId(R.string.measurement_tool, mapActivity)
|
||||
.setId(POINT_MEASURE_DISTANCE)
|
||||
.setId(MAP_CONTEXT_MENU_MEASURE_DISTANCE)
|
||||
.setIcon(R.drawable.ic_action_ruler)
|
||||
.setOrder(MEASURE_DISTANCE_ITEM_ORDER)
|
||||
.createItem());
|
||||
|
@ -685,7 +688,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.home, mapActivity)
|
||||
.setId(DRAWER_DASHBOARD_ID)
|
||||
.setIcon(R.drawable.map_dashboard)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
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)
|
||||
.setId(DRAWER_MAP_MARKERS_ID)
|
||||
.setIcon(R.drawable.ic_action_flag_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
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)
|
||||
.setId(DRAWER_MY_PLACES_ID)
|
||||
.setIcon(R.drawable.ic_action_fav_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
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)
|
||||
.setId(DRAWER_SEARCH_ID)
|
||||
.setIcon(R.drawable.ic_action_search_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
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)
|
||||
.setId(DRAWER_DIRECTIONS_ID)
|
||||
.setIcon(R.drawable.ic_action_gdirections_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
app.logEvent(mapActivity, "drawer_directions_open");
|
||||
|
@ -765,10 +768,10 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).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)
|
||||
.setIcon(R.drawable.ic_action_layers_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
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)
|
||||
.setId(DRAWER_DOWNLOAD_MAPS_ID)
|
||||
.setTitle(d).setIcon(R.drawable.ic_type_archive)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
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)
|
||||
.setId(DRAWER_OSMAND_LIVE_ID)
|
||||
.setIcon(R.drawable.ic_action_osm_live)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
app.logEvent(mapActivity, "drawer_osm_live_open");
|
||||
|
@ -836,10 +839,10 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
}).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)
|
||||
.setIcon(R.drawable.ic_action_ruler)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
|
||||
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager());
|
||||
|
@ -852,7 +855,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.layer_map_appearance, mapActivity)
|
||||
.setId(DRAWER_CONFIGURE_SCREEN_ID)
|
||||
.setIcon(R.drawable.ic_configure_screen_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
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)
|
||||
.setId(DRAWER_SETTINGS_ID)
|
||||
.setIcon(R.drawable.ic_action_settings)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
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)
|
||||
.setId(DRAWER_HELP_ID)
|
||||
.setIcon(R.drawable.ic_action_help)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
app.logEvent(mapActivity, "drawer_help_open");
|
||||
|
@ -1057,7 +1060,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
} else {
|
||||
position -= menuItemsListView.getHeaderViewsCount();
|
||||
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
||||
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
|
||||
ItemClickListener click = item.getItemClickListener();
|
||||
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
|
||||
position, false, AndroidUtils.getCenterViewCoordinates(view))) {
|
||||
mapActivity.closeDrawer();
|
||||
|
@ -1089,8 +1092,13 @@ public class MapActivityActions implements DialogProvider {
|
|||
footerLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(navDrawerLogoParams!=null) showReturnConfirmationDialog(navDrawerLogoParams.get(0));
|
||||
else restoreOsmand();
|
||||
if (navDrawerLogoParams != null) {
|
||||
mapActivity.closeDrawer();
|
||||
}
|
||||
new OsmandRestoreOrExitDialog()
|
||||
.show(mapActivity.getSupportFragmentManager(), "dialog");
|
||||
//showReturnConfirmationDialog(navDrawerLogoParams.get(0));
|
||||
|
||||
}
|
||||
});
|
||||
} 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 static net.osmand.plus.OsmAndCustomizationConstants.POINT_CREATE_POI;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_OSM_CHANGE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_OSM_NOTE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_POI;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_OPEN_OSM_NOTE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CREATE_POI;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_OSM_NOTE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_POI;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_OPEN_OSM_NOTE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.OSM_NOTES;
|
||||
|
||||
|
||||
|
@ -235,21 +235,21 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}
|
||||
if (isEditable) {
|
||||
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)
|
||||
.setOrder(MODIFY_POI_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
} 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)
|
||||
.setId(POINT_MODIFY_OSM_CHANGE)
|
||||
.setId(MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE)
|
||||
.setIcon(R.drawable.ic_action_edit_dark)
|
||||
.setOrder(MODIFY_OSM_CHANGE_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
} else {
|
||||
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)
|
||||
.setOrder(CREATE_POI_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
|
@ -257,14 +257,14 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}
|
||||
if (selectedObj instanceof OsmNotesPoint) {
|
||||
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)
|
||||
.setOrder(MODIFY_OSM_NOTE_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
} else {
|
||||
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)
|
||||
.setOrder(OPEN_OSM_NOTE_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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.content.DialogInterface;
|
||||
|
@ -235,7 +235,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
};
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.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)
|
||||
.setOrder(MARK_AS_PARKING_POS_ITEM_ORDER)
|
||||
.setListener(addListener)
|
||||
|
|
|
@ -46,10 +46,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
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.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 static final String ID = "osmand.rastermaps";
|
||||
|
@ -380,13 +380,13 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
|||
};
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.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)
|
||||
.setOrder(UPDATE_MAP_ITEM_ORDER)
|
||||
.setListener(listener).createItem());
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.shared_string_download_map, mapActivity)
|
||||
.setId(POINT_DOWNLOAD_MAP)
|
||||
.setId(MAP_CONTEXT_MENU_DOWNLOAD_MAP)
|
||||
.setIcon(R.drawable.ic_action_import)
|
||||
.setOrder(DOWNLOAD_MAP_ITEM_ORDER)
|
||||
.setListener(listener).createItem());
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
|
@ -68,7 +69,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
@Override
|
||||
public void onCreate(Bundle 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;
|
||||
setStyle(STYLE_NO_FRAME, themeId);
|
||||
}
|
||||
|
@ -135,11 +137,19 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
bottomBar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
if (!editMode) {
|
||||
dismiss();
|
||||
QuickSearchDialogFragment quickSearchDialogFragment = getQuickSearchDialogFragment();
|
||||
if (quickSearchDialogFragment != null) {
|
||||
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) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
String id = null;
|
||||
|
@ -203,6 +222,7 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
private class CategoryListAdapter extends ArrayAdapter<PoiCategory> {
|
||||
|
||||
private OsmandApplication app;
|
||||
|
||||
CategoryListAdapter(OsmandApplication app, List<PoiCategory> items) {
|
||||
|
@ -213,7 +233,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
@NonNull
|
||||
@Override
|
||||
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;
|
||||
if (row == null) {
|
||||
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);
|
||||
if (category != null) {
|
||||
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 descView = (AppCompatTextView) row.findViewById(R.id.description);
|
||||
SwitchCompat check = (SwitchCompat) row.findViewById(R.id.toggle_item);
|
||||
|
@ -239,7 +261,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
iconView.setImageDrawable(null);
|
||||
}
|
||||
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.setChecked(filter.isTypeAccepted(category));
|
||||
String textString = category.getTranslation();
|
||||
|
@ -262,7 +285,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
} else {
|
||||
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);
|
||||
}
|
||||
return (row);
|
||||
|
@ -291,7 +315,18 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
bottomBarShadow.setVisibility(View.GONE);
|
||||
bottomBar.setVisibility(View.GONE);
|
||||
} 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);
|
||||
bottomBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
@ -306,11 +341,11 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
final LinkedHashMap<String, String> subCategories = new LinkedHashMap<String, String>();
|
||||
Set<String> acceptedCategories = filter.getAcceptedSubtypes(poiCategory);
|
||||
if (acceptedCategories != null) {
|
||||
for(String s : acceptedCategories) {
|
||||
for (String s : acceptedCategories) {
|
||||
subCategories.put(s, Algorithms.capitalizeFirstLetterAndLowercase(s));
|
||||
}
|
||||
}
|
||||
for(PoiType pt : poiCategory.getPoiTypes()) {
|
||||
for (PoiType pt : poiCategory.getPoiTypes()) {
|
||||
subCategories.put(pt.getKeyName(), pt.getTranslation());
|
||||
}
|
||||
|
||||
|
@ -351,26 +386,28 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
builder.setCustomTitle(titleView);
|
||||
|
||||
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
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
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
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
LinkedHashSet<String> accepted = new LinkedHashSet<String>();
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
if(selected[i]){
|
||||
if (selected[i]) {
|
||||
accepted.add(array[i]);
|
||||
}
|
||||
}
|
||||
if (subCategories.size() == accepted.size()) {
|
||||
filter.selectSubTypesToAccept(poiCategory, null);
|
||||
} else if(accepted.size() == 0){
|
||||
} else if (accepted.size() == 0) {
|
||||
filter.setTypeToAccept(poiCategory, false);
|
||||
} else {
|
||||
filter.selectSubTypesToAccept(poiCategory, accepted);
|
||||
|
@ -381,7 +418,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
}
|
||||
});
|
||||
|
||||
builder.setMultiChoiceItems(visibleNames, selected, new DialogInterface.OnMultiChoiceClickListener() {
|
||||
builder.setMultiChoiceItems(visibleNames, selected,
|
||||
new DialogInterface.OnMultiChoiceClickListener() {
|
||||
|
||||
@Override
|
||||
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.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -405,6 +406,11 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void refreshList() {
|
||||
initListItems();
|
||||
updateListView();
|
||||
}
|
||||
|
||||
private void updateListView() {
|
||||
adapter.setListItems(getListItems());
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ import java.util.Set;
|
|||
|
||||
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;
|
||||
|
||||
public class ContextMenuLayer extends OsmandMapLayer {
|
||||
|
@ -280,7 +280,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
};
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.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)
|
||||
.setOrder(MapActivityActions.CHANGE_POSITION_ITEM_ORDER)
|
||||
.setClickable(isObjectMoveable(o))
|
||||
|
|
Loading…
Reference in a new issue