onClick "Powered by Osmand" now asks if user wants to restore osmand or get back to client app.
This commit is contained in:
parent
37b283ebc9
commit
49d7529f9c
8 changed files with 309 additions and 45 deletions
|
@ -119,34 +119,166 @@
|
||||||
|
|
||||||
<!-- android matches non-greedy : http://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i-->
|
<!-- android matches non-greedy : http://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i-->
|
||||||
<!-- mimeType&host are both needed or you will either have unwanted matching or no match when needed -->
|
<!-- mimeType&host are both needed or you will either have unwanted matching or no match when needed -->
|
||||||
<intent-filter>
|
<!-- Capture file open requests (pathPattern is honoured) where no MIME type is provided in the Intent. An Intent with a null
|
||||||
|
MIME type will never be matched by a filter with a set MIME type, so we need a second intent-filter if we wish to also
|
||||||
|
match files with this extension and a non-null MIME type (even if it is non-null but zero length).
|
||||||
|
https://stackoverflow.com/a/31028507/4654078 -->
|
||||||
|
|
||||||
|
<intent-filter
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:priority="50">
|
||||||
<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" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\.gpx" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\.gpx" />
|
<data android:scheme="file"/>
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\.gpx" />
|
<data android:scheme="content"/>
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\.gpx" />
|
<data android:host="*"/>
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\..*\\.gpx" />
|
<data android:pathPattern=".*\\.gpx" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\.kml" />
|
<data android:pathPattern=".*\\..*\\.gpx" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\.kml" />
|
<data android:pathPattern=".*\\..*\\..*\\.gpx" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\.kml" />
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.gpx" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\.kml" />
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.gpx" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\..*\\.kml" />
|
</intent-filter>
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\.kmz" />
|
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\.kmz" />
|
<intent-filter
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\.kmz" />
|
android:label="@string/app_name"
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\.kmz" />
|
android:priority="50">
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\..*\\.kmz" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\.obf" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\.obf" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\.obf" />
|
<data android:scheme="file"/>
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\.obf" />
|
<data android:scheme="content"/>
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\..*\\.obf" />
|
<data android:host="*"/>
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\.sqlitedb" />
|
<data android:mimeType="*/*"/>
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\.sqlitedb" />
|
<data android:pathPattern=".*\\.gpx" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\.sqlitedb" />
|
<data android:pathPattern=".*\\..*\\.gpx" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\.sqlitedb" />
|
<data android:pathPattern=".*\\..*\\..*\\.gpx" />
|
||||||
<data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\..*\\..*\\..*\\..*\\.sqlitedb" />
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.gpx" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.gpx" />
|
||||||
|
</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: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:mimeType="*/*"/>
|
||||||
|
<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:pathPattern=".*\\.kmz" />
|
||||||
|
<data android:pathPattern=".*\\..*\\.kmz" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\.kmz" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.kmz" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.kmz" />
|
||||||
|
</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:mimeType="*/*"/>
|
||||||
|
<data android:pathPattern=".*\\.kmz" />
|
||||||
|
<data android:pathPattern=".*\\..*\\.kmz" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\.kmz" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.kmz" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.kmz" />
|
||||||
|
</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:pathPattern=".*\\.obf" />
|
||||||
|
<data android:pathPattern=".*\\..*\\.obf" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\.obf" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.obf" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.obf" />
|
||||||
|
</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:mimeType="*/*"/>
|
||||||
|
<data android:pathPattern=".*\\.obf" />
|
||||||
|
<data android:pathPattern=".*\\..*\\.obf" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\.obf" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.obf" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.obf" />
|
||||||
|
</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:pathPattern=".*\\.sqlitedb" />
|
||||||
|
<data android:pathPattern=".*\\..*\\.sqlitedb" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\.sqlitedb" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.sqlitedb" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.sqlitedb" />
|
||||||
|
</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:mimeType="*/*"/>
|
||||||
|
<data android:pathPattern=".*\\.sqlitedb" />
|
||||||
|
<data android:pathPattern=".*\\..*\\.sqlitedb" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\.sqlitedb" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\.sqlitedb" />
|
||||||
|
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.sqlitedb" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<!--trying to handle emails-->
|
<!--trying to handle emails-->
|
||||||
|
|
|
@ -160,4 +160,12 @@ interface IOsmAndAidlInterface {
|
||||||
boolean getActiveSqliteDbFiles(out List<ASqliteDbFile> files);
|
boolean getActiveSqliteDbFiles(out List<ASqliteDbFile> files);
|
||||||
boolean showSqliteDbFile(String fileName);
|
boolean showSqliteDbFile(String fileName);
|
||||||
boolean hideSqliteDbFile(String fileName);
|
boolean hideSqliteDbFile(String fileName);
|
||||||
|
|
||||||
|
|
||||||
|
boolean setNavDrawerLogoWithIntent(in String imageUri, String packageName, String intent);
|
||||||
|
boolean setNavDrawerFooterAction(in String packageName, String intent, String appName);
|
||||||
|
boolean setPointMenuEnabledIds(in List<String> ids);
|
||||||
|
boolean setPointMenuDisabledIds(in List<String> ids);
|
||||||
|
boolean setPointMenuEnabledPatterns(in List<String> patterns);
|
||||||
|
boolean setPointMenuDisabledPatterns(in List<String> patterns);
|
||||||
}
|
}
|
|
@ -1822,7 +1822,7 @@ public class OsmandAidlApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean setNavDrawerLogo(@Nullable String uri) {
|
boolean setNavDrawerLogo(@Nullable String uri) {
|
||||||
return app.getAppCustomization().setNavDrawerLogo(uri);
|
return app.getAppCustomization().setNavDrawerLogo(uri,null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean setEnabledIds(Collection<String> ids) {
|
boolean setEnabledIds(Collection<String> ids) {
|
||||||
|
@ -1860,6 +1860,34 @@ public class OsmandAidlApi {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean setNavDrawerLogoWithIntent(
|
||||||
|
@Nullable String uri, @Nullable String packageName, @Nullable String intent) {
|
||||||
|
|
||||||
|
return app.getAppCustomization().setNavDrawerLogoWithIntent(uri, packageName, intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean setNavDrawerFooterAction(@Nullable String packageName, @Nullable String intent, @Nullable String appName) {
|
||||||
|
|
||||||
|
return app.getAppCustomization().setNavDrawerFooterAction(packageName, intent, appName);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean setPointMenuEnabledIds(List<String> ids){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean setPointMenuDisabledIds(List<String> ids){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean setPointMenuEnabledPatterns(List<String> patterns){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean setPointMenuDisabledPatterns(List<String> patterns){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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,
|
||||||
a.timeSpan, a.timeMoving, a.totalDistanceMoving, a.diffElevationUp, a.diffElevationDown,
|
a.timeSpan, a.timeMoving, a.totalDistanceMoving, a.diffElevationUp, a.diffElevationDown,
|
||||||
|
|
|
@ -771,5 +771,37 @@ public class OsmandAidlService extends Service {
|
||||||
OsmandAidlApi api = getApi("hideSqliteDbFile");
|
OsmandAidlApi api = getApi("hideSqliteDbFile");
|
||||||
return api != null && api.hideSqliteDbFile(fileName);
|
return api != null && api.hideSqliteDbFile(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setNavDrawerLogoWithIntent(String imageUri, String packageName, String intent) throws RemoteException {
|
||||||
|
OsmandAidlApi api = getApi("setNavDrawerLogoWithIntent");
|
||||||
|
return api != null && api.setNavDrawerLogoWithIntent(imageUri, packageName, intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) throws RemoteException {
|
||||||
|
OsmandAidlApi api = getApi ("setNavDrawerFooterAction");
|
||||||
|
return api != null && api.setNavDrawerFooterAction(packageName, intent, appName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setPointMenuEnabledIds(List<String> ids) throws RemoteException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setPointMenuDisabledIds(List<String> ids) throws RemoteException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setPointMenuEnabledPatterns(List<String> patterns) throws RemoteException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setPointMenuDisabledPatterns(List<String> patterns) throws RemoteException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
|
@ -42,6 +43,7 @@ public class OsmAndAppCustomization {
|
||||||
protected OsmandSettings osmandSettings;
|
protected OsmandSettings osmandSettings;
|
||||||
|
|
||||||
private Bitmap navDrawerLogo;
|
private Bitmap navDrawerLogo;
|
||||||
|
private ArrayList<String> navDrawerParams;
|
||||||
|
|
||||||
private Set<String> featuresEnabledIds = new HashSet<>();
|
private Set<String> featuresEnabledIds = new HashSet<>();
|
||||||
private Set<String> featuresDisabledIds = new HashSet<>();
|
private Set<String> featuresDisabledIds = new HashSet<>();
|
||||||
|
@ -199,7 +201,10 @@ public class OsmAndAppCustomization {
|
||||||
return navDrawerLogo;
|
return navDrawerLogo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setNavDrawerLogo(@Nullable String uri) {
|
@Nullable
|
||||||
|
public ArrayList<String> getNavDrawerLogoParams() {return navDrawerParams; }
|
||||||
|
|
||||||
|
public boolean setNavDrawerLogo(@Nullable String uri, @Nullable String packageName, @Nullable String intent) {
|
||||||
if (TextUtils.isEmpty(uri)) {
|
if (TextUtils.isEmpty(uri)) {
|
||||||
navDrawerLogo = null;
|
navDrawerLogo = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,16 +213,25 @@ public class OsmAndAppCustomization {
|
||||||
if (is != null) {
|
if (is != null) {
|
||||||
navDrawerLogo = BitmapFactory.decodeStream(is);
|
navDrawerLogo = BitmapFactory.decodeStream(is);
|
||||||
is.close();
|
is.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
return false;
|
return false;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
if(packageName!=null && intent!=null) {
|
||||||
|
Log.d("setNavDrawerLogo", packageName + ", " + intent);
|
||||||
|
navDrawerParams = new ArrayList<>();
|
||||||
|
navDrawerParams.add(packageName);
|
||||||
|
navDrawerParams.add(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setFeaturesEnabledIds(@NonNull Collection<String> ids) {
|
public void setFeaturesEnabledIds(@NonNull Collection<String> ids) {
|
||||||
featuresEnabledIds.clear();
|
featuresEnabledIds.clear();
|
||||||
featuresEnabledIds.addAll(ids);
|
featuresEnabledIds.addAll(ids);
|
||||||
|
@ -272,6 +286,15 @@ public class OsmAndAppCustomization {
|
||||||
return set.contains(appMode);
|
return set.contains(appMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean setNavDrawerLogoWithIntent(String uri, @Nullable String packageName, @Nullable String intent) {
|
||||||
|
return setNavDrawerLogo(uri, packageName, intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) {
|
||||||
|
//todo implement custom action to "Powered by Osmand" action in NavDrawer
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@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<>();
|
||||||
|
|
|
@ -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.audionotes.SortByMenuBottomSheetDialogFragment;
|
||||||
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;
|
||||||
|
@ -990,6 +991,26 @@ public class MapActivityActions implements DialogProvider {
|
||||||
menu.show();
|
menu.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void restoreOrReturnDialog(final String packageName) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
||||||
|
builder.setTitle("Restore OsmAnd");
|
||||||
|
builder.setMessage("Do you want to Restore OsmAnd or get back to the Client App?");
|
||||||
|
builder.setPositiveButton("Restore", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
restoreOsmand();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNeutralButton("Return", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
executeHeadersIntent(packageName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton("Cancel", null);
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
|
||||||
protected void updateDrawerMenu() {
|
protected void updateDrawerMenu() {
|
||||||
boolean nightMode = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
boolean nightMode = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
final ListView menuItemsListView = (ListView) mapActivity.findViewById(R.id.menuItems);
|
final ListView menuItemsListView = (ListView) mapActivity.findViewById(R.id.menuItems);
|
||||||
|
@ -1001,6 +1022,8 @@ public class MapActivityActions implements DialogProvider {
|
||||||
menuItemsListView.removeHeaderView(drawerLogoHeader);
|
menuItemsListView.removeHeaderView(drawerLogoHeader);
|
||||||
menuItemsListView.removeFooterView(drawerOsmAndFooter);
|
menuItemsListView.removeFooterView(drawerOsmAndFooter);
|
||||||
Bitmap navDrawerLogo = getMyApplication().getAppCustomization().getNavDrawerLogo();
|
Bitmap navDrawerLogo = getMyApplication().getAppCustomization().getNavDrawerLogo();
|
||||||
|
final ArrayList<String> navDrawerLogoParams = getMyApplication().getAppCustomization().getNavDrawerLogoParams();
|
||||||
|
|
||||||
boolean customHeader = false;
|
boolean customHeader = false;
|
||||||
if (navDrawerLogo != null) {
|
if (navDrawerLogo != null) {
|
||||||
customHeader = true;
|
customHeader = true;
|
||||||
|
@ -1019,9 +1042,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
mapActivity.dismissCardDialog();
|
mapActivity.dismissCardDialog();
|
||||||
boolean hasHeader = menuItemsListView.getHeaderViewsCount() > 0;
|
boolean hasHeader = menuItemsListView.getHeaderViewsCount() > 0;
|
||||||
boolean hasFooter = menuItemsListView.getFooterViewsCount() > 0;
|
boolean hasFooter = menuItemsListView.getFooterViewsCount() > 0;
|
||||||
if ((hasHeader && position == 0) || (hasFooter && position == menuItemsListView.getCount() - 1)) {
|
if (hasHeader && position ==0 || (hasFooter && position== menuItemsListView.getCount() - 1)) {
|
||||||
getMyApplication().getAppCustomization().restoreOsmand();
|
if(navDrawerLogoParams!=null) executeHeadersIntent(navDrawerLogoParams.get(0));
|
||||||
mapActivity.closeDrawer();
|
else restoreOsmand();
|
||||||
} else {
|
} else {
|
||||||
position -= menuItemsListView.getHeaderViewsCount();
|
position -= menuItemsListView.getHeaderViewsCount();
|
||||||
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
||||||
|
@ -1032,6 +1055,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
if (customHeader) {
|
if (customHeader) {
|
||||||
menuItemsListView.post(new Runnable() {
|
menuItemsListView.post(new Runnable() {
|
||||||
|
@ -1056,9 +1080,8 @@ 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) {
|
||||||
getMyApplication().getAppCustomization().restoreOsmand();
|
if(navDrawerLogoParams!=null) showReturnConfirmationDialog(navDrawerLogoParams.get(0));
|
||||||
mapActivity.closeDrawer();
|
else restoreOsmand();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -1069,6 +1092,23 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void executeHeadersIntent(String packageName) {
|
||||||
|
Intent launchIntent = mapActivity.getPackageManager().getLaunchIntentForPackage(packageName);
|
||||||
|
if(launchIntent!=null) mapActivity.startActivity(launchIntent);
|
||||||
|
mapActivity.closeDrawer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showReturnConfirmationDialog(String packageName) {
|
||||||
|
restoreOrReturnDialog(packageName);
|
||||||
|
mapActivity.closeDrawer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restoreOsmand(){
|
||||||
|
getMyApplication().getAppCustomization().restoreOsmand();
|
||||||
|
mapActivity.closeDrawer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setFirstMapMarkerAsTarget() {
|
public void setFirstMapMarkerAsTarget() {
|
||||||
if (getMyApplication().getMapMarkersHelper().getMapMarkers().size() > 0) {
|
if (getMyApplication().getMapMarkersHelper().getMapMarkers().size() > 0) {
|
||||||
MapMarkersHelper.MapMarker marker = getMyApplication().getMapMarkersHelper().getMapMarkers().get(0);
|
MapMarkersHelper.MapMarker marker = getMyApplication().getMapMarkersHelper().getMapMarkers().get(0);
|
||||||
|
|
|
@ -237,6 +237,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
.setOrder(MARK_AS_PARKING_POS_ITEM_ORDER)
|
.setOrder(MARK_AS_PARKING_POS_ITEM_ORDER)
|
||||||
.setListener(addListener)
|
.setListener(addListener)
|
||||||
.createItem());
|
.createItem());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
#
|
#
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
#
|
#
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
|
Loading…
Reference in a new issue