Add restoreOsmand to AIDL &&& Call restoreOsmand on strikelines-app pause if Navigate wasn't pressed

This commit is contained in:
madwasp79 2019-01-08 16:50:30 +02:00
parent 900e07dc12
commit 7c8c02704c
5 changed files with 18 additions and 6 deletions

View file

@ -164,5 +164,6 @@ interface IOsmAndAidlInterface {
boolean setNavDrawerLogoWithParams(in String imageUri, String packageName, String intent); boolean setNavDrawerLogoWithParams(in String imageUri, String packageName, String intent);
boolean setNavDrawerFooterParams(in String packageName, String intent, String appName); boolean setNavDrawerFooterParams(in String packageName, String intent, String appName);
boolean restoreOsmand();
} }

View file

@ -151,6 +151,7 @@ public class OsmandAidlApi {
private static final String AIDL_HIDE_SQLITEDB_FILE = "aidl_hide_sqlitedb_file"; private static final String AIDL_HIDE_SQLITEDB_FILE = "aidl_hide_sqlitedb_file";
private static final String AIDL_FILE_NAME = "aidl_file_name"; private static final String AIDL_FILE_NAME = "aidl_file_name";
private static final ApplicationMode DEFAULT_PROFILE = ApplicationMode.CAR; private static final ApplicationMode DEFAULT_PROFILE = ApplicationMode.CAR;
private static final ApplicationMode[] VALID_PROFILES = new ApplicationMode[]{ private static final ApplicationMode[] VALID_PROFILES = new ApplicationMode[]{
@ -1869,6 +1870,9 @@ public class OsmandAidlApi {
return app.getAppCustomization().setNavDrawerFooterAction(packageName, intent, appName); return app.getAppCustomization().setNavDrawerFooterAction(packageName, intent, appName);
} }
boolean restoreOsmand() {
return app.getAppCustomization().restoreOsmand();
}
private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) { private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) {

View file

@ -784,5 +784,11 @@ public class OsmandAidlService extends Service {
return api != null && api.setNavDrawerFooterParams(packageName, intent, appName); return api != null && api.setNavDrawerFooterParams(packageName, intent, appName);
} }
@Override
public boolean restoreOsmand() {
OsmandAidlApi api = getApi("restoreOsmand");
return api != null && api.restoreOsmand();
}
}; };
} }

View file

@ -11,7 +11,6 @@ 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;
@ -112,17 +111,17 @@ public class OsmAndAppCustomization {
notifySettingsCustomized(); notifySettingsCustomized();
} }
private void restoreOsmandSetting() { public void restoreOsmandSettings() {
app.setOsmandSettings(osmandSettings); app.setOsmandSettings(osmandSettings);
notifySettingsCustomized(); notifySettingsCustomized();
} }
public void restoreOsmand() { public boolean restoreOsmand() {
navDrawerLogo = null; navDrawerLogo = null;
featuresCustomized = false; featuresCustomized = false;
widgetsCustomized = false; widgetsCustomized = false;
customOsmandSettings = null; customOsmandSettings = null;
restoreOsmandSetting(); restoreOsmandSettings();
featuresEnabledIds.clear(); featuresEnabledIds.clear();
featuresDisabledIds.clear(); featuresDisabledIds.clear();
@ -130,6 +129,8 @@ public class OsmAndAppCustomization {
featuresDisabledPatterns.clear(); featuresDisabledPatterns.clear();
widgetsVisibilityMap.clear(); widgetsVisibilityMap.clear();
widgetsAvailabilityMap.clear(); widgetsAvailabilityMap.clear();
return true;
} }
// Activities // Activities

View file

@ -1089,8 +1089,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) {
if(navDrawerLogoParams!=null) showReturnConfirmationDialog(navDrawerLogoParams.get(0)); if(navDrawerLogoParams!=null) showReturnConfirmationDialog(navDrawerLogoParams.get(0));
else restoreOsmand(); else restoreOsmand();
} }
}); });
} else { } else {