Fix compilation and spaces

This commit is contained in:
Vitaliy 2020-07-20 23:05:28 +03:00
parent 84be1ba7e0
commit 335f085f4b
5 changed files with 60 additions and 58 deletions

View file

@ -95,7 +95,9 @@ import net.osmand.aidlapi.mapmarker.RemoveMapMarkersParams;
import net.osmand.aidlapi.quickaction.QuickActionParams; import net.osmand.aidlapi.quickaction.QuickActionParams;
import net.osmand.aidlapi.quickaction.QuickActionInfoParams; import net.osmand.aidlapi.quickaction.QuickActionInfoParams;
import net.osmand.aidlapi.lock.SetLockStateParams; import net.osmand.aidlapi.lock.SetLockStateParams;
import net.osmand.aidlapi.events.AKeyEventsParams; import net.osmand.aidlapi.events.AKeyEventsParams;
// NOTE: Add new methods at the end of file!!! // NOTE: Add new methods at the end of file!!!
@ -843,11 +845,12 @@ interface IOsmAndAidlInterface {
boolean executeQuickAction(in QuickActionParams params); boolean executeQuickAction(in QuickActionParams params);
boolean getQuickActionsInfo(out List<QuickActionInfoParams> quickActions); boolean getQuickActionsInfo(out List<QuickActionInfoParams> quickActions);
/** /**
* Toggle Lock/Unlock screen. * Toggle Lock/Unlock screen.
*/ */
boolean setLockState(in SetLockStateParams params); boolean setLockState(in SetLockStateParams params);
/** /**
* Method to register for key events. * Method to register for key events.
* *

View file

@ -10,61 +10,64 @@ import java.util.ArrayList;
public class AKeyEventsParams extends AidlParams { public class AKeyEventsParams extends AidlParams {
private long callbackId = -1L; private long callbackId = -1L;
private boolean subscribeToUpdates = true; private boolean subscribeToUpdates = true;
private ArrayList<Integer> keyEventList; private ArrayList<Integer> keyEventList;
public AKeyEventsParams() { } public AKeyEventsParams() {
}
protected AKeyEventsParams(Parcel in) { protected AKeyEventsParams(Parcel in) {
readFromParcel(in); readFromParcel(in);
} }
public static final Parcelable.Creator<AKeyEventsParams> CREATOR = new Parcelable.Creator<AKeyEventsParams>() { public static final Parcelable.Creator<AKeyEventsParams> CREATOR = new Parcelable.Creator<AKeyEventsParams>() {
@Override @Override
public AKeyEventsParams createFromParcel(Parcel in) { public AKeyEventsParams createFromParcel(Parcel in) {
return new AKeyEventsParams(in); return new AKeyEventsParams(in);
} }
@Override @Override
public AKeyEventsParams[] newArray(int size) { public AKeyEventsParams[] newArray(int size) {
return new AKeyEventsParams[size]; return new AKeyEventsParams[size];
} }
}; };
public long getCallbackId() { public long getCallbackId() {
return callbackId; return callbackId;
} }
public void setCallbackId(long callbackId) { public void setCallbackId(long callbackId) {
this.callbackId = callbackId; this.callbackId = callbackId;
} }
public void setSubscribeToUpdates(boolean subscribeToUpdates) { public void setSubscribeToUpdates(boolean subscribeToUpdates) {
this.subscribeToUpdates = subscribeToUpdates; this.subscribeToUpdates = subscribeToUpdates;
} }
public boolean isSubscribeToUpdates() { public boolean isSubscribeToUpdates() {
return subscribeToUpdates; return subscribeToUpdates;
} }
public void setKeyEventList( ArrayList<Integer> keyEventList){
this.keyEventList=keyEventList;
}
public ArrayList<Integer> getKeyEventList() {
return keyEventList;
}
@Override public void setKeyEventList(ArrayList<Integer> keyEventList) {
protected void readFromBundle(Bundle bundle) { this.keyEventList = keyEventList;
callbackId = bundle.getLong("callbackId"); }
subscribeToUpdates = bundle.getBoolean("subscribeToUpdates");
keyEventList = bundle.getIntegerArrayList("keyEventList");
}
@Override public ArrayList<Integer> getKeyEventList() {
public void writeToBundle(Bundle bundle) { return keyEventList;
bundle.putLong("callbackId", callbackId); }
bundle.putBoolean("subscribeToUpdates", subscribeToUpdates);
bundle.putIntegerArrayList("keyEventList", keyEventList); @Override
} protected void readFromBundle(Bundle bundle) {
callbackId = bundle.getLong("callbackId");
subscribeToUpdates = bundle.getBoolean("subscribeToUpdates");
keyEventList = bundle.getIntegerArrayList("keyEventList");
}
@Override
public void writeToBundle(Bundle bundle) {
bundle.putLong("callbackId", callbackId);
bundle.putBoolean("subscribeToUpdates", subscribeToUpdates);
bundle.putIntegerArrayList("keyEventList", keyEventList);
}
} }

View file

@ -2358,7 +2358,6 @@ public class OsmandAidlApi {
a.points, a.wptPoints, a.wptCategoryNames); a.points, a.wptPoints, a.wptCategoryNames);
} }
private Map<Long, Set<Integer>> keyEventCallbacks = new ConcurrentHashMap<>(); private Map<Long, Set<Integer>> keyEventCallbacks = new ConcurrentHashMap<>();
public boolean onKeyEvent(KeyEvent event) { public boolean onKeyEvent(KeyEvent event) {

View file

@ -15,7 +15,6 @@ import net.osmand.PlatformUtil;
import net.osmand.aidl.OsmandAidlApi.GpxBitmapCreatedCallback; import net.osmand.aidl.OsmandAidlApi.GpxBitmapCreatedCallback;
import net.osmand.aidl.OsmandAidlApi.OsmandAppInitCallback; import net.osmand.aidl.OsmandAidlApi.OsmandAppInitCallback;
import net.osmand.aidl.OsmandAidlApi.SearchCompleteCallback; import net.osmand.aidl.OsmandAidlApi.SearchCompleteCallback;
import net.osmand.aidlapi.lock.SetLockStateParams;
import net.osmand.aidlapi.IOsmAndAidlCallback; import net.osmand.aidlapi.IOsmAndAidlCallback;
import net.osmand.aidlapi.IOsmAndAidlInterface; import net.osmand.aidlapi.IOsmAndAidlInterface;
import net.osmand.aidlapi.calculateroute.CalculateRouteParams; import net.osmand.aidlapi.calculateroute.CalculateRouteParams;
@ -28,6 +27,7 @@ import net.osmand.aidlapi.customization.OsmandSettingsInfoParams;
import net.osmand.aidlapi.customization.OsmandSettingsParams; import net.osmand.aidlapi.customization.OsmandSettingsParams;
import net.osmand.aidlapi.customization.ProfileSettingsParams; import net.osmand.aidlapi.customization.ProfileSettingsParams;
import net.osmand.aidlapi.customization.SetWidgetsParams; import net.osmand.aidlapi.customization.SetWidgetsParams;
import net.osmand.aidlapi.events.AKeyEventsParams;
import net.osmand.aidlapi.favorite.AFavorite; import net.osmand.aidlapi.favorite.AFavorite;
import net.osmand.aidlapi.favorite.AddFavoriteParams; import net.osmand.aidlapi.favorite.AddFavoriteParams;
import net.osmand.aidlapi.favorite.RemoveFavoriteParams; import net.osmand.aidlapi.favorite.RemoveFavoriteParams;
@ -46,6 +46,7 @@ import net.osmand.aidlapi.gpx.RemoveGpxParams;
import net.osmand.aidlapi.gpx.ShowGpxParams; import net.osmand.aidlapi.gpx.ShowGpxParams;
import net.osmand.aidlapi.gpx.StartGpxRecordingParams; import net.osmand.aidlapi.gpx.StartGpxRecordingParams;
import net.osmand.aidlapi.gpx.StopGpxRecordingParams; import net.osmand.aidlapi.gpx.StopGpxRecordingParams;
import net.osmand.aidlapi.lock.SetLockStateParams;
import net.osmand.aidlapi.map.ALatLon; import net.osmand.aidlapi.map.ALatLon;
import net.osmand.aidlapi.map.SetMapLocationParams; import net.osmand.aidlapi.map.SetMapLocationParams;
import net.osmand.aidlapi.maplayer.AddMapLayerParams; import net.osmand.aidlapi.maplayer.AddMapLayerParams;
@ -88,8 +89,8 @@ import net.osmand.aidlapi.search.SearchParams;
import net.osmand.aidlapi.search.SearchResult; import net.osmand.aidlapi.search.SearchResult;
import net.osmand.aidlapi.tiles.ASqliteDbFile; import net.osmand.aidlapi.tiles.ASqliteDbFile;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;

View file

@ -62,10 +62,8 @@ public class MapActivityKeyListener implements KeyEvent.Callback {
} }
} else if (mapScrollHelper.isScrollingDirectionKeyCode(keyCode)) { } else if (mapScrollHelper.isScrollingDirectionKeyCode(keyCode)) {
return mapScrollHelper.onKeyDown(keyCode, event); return mapScrollHelper.onKeyDown(keyCode, event);
} else if(app.getAidlApi().onKeyEvent(event)) {
return true;
} }
return false; return app.getAidlApi().onKeyEvent(event);
} }
@Override @Override
@ -125,12 +123,10 @@ public class MapActivityKeyListener implements KeyEvent.Callback {
mapActivity.changeZoom(1); mapActivity.changeZoom(1);
return true; return true;
} }
} else if (app.getAidlApi().onKeyEvent(event)){ } else if (OsmandPlugin.onMapActivityKeyUp(mapActivity, keyCode)) {
return true; return true;
} else{
return OsmandPlugin.onMapActivityKeyUp(mapActivity, keyCode);
} }
return false; return app.getAidlApi().onKeyEvent(event);
} }
@Override @Override