Fix support for old aidl api
This commit is contained in:
parent
440ad5828b
commit
b5c6593743
6 changed files with 71 additions and 18 deletions
|
@ -6,7 +6,9 @@ import android.os.Parcel;
|
||||||
import net.osmand.aidlapi.AidlParams;
|
import net.osmand.aidlapi.AidlParams;
|
||||||
|
|
||||||
public class SetLockStateParams extends AidlParams {
|
public class SetLockStateParams extends AidlParams {
|
||||||
|
|
||||||
private boolean lock;
|
private boolean lock;
|
||||||
|
|
||||||
public SetLockStateParams(boolean lock) {
|
public SetLockStateParams(boolean lock) {
|
||||||
this.lock = lock;
|
this.lock = lock;
|
||||||
}
|
}
|
||||||
|
@ -26,9 +28,11 @@ public class SetLockStateParams extends AidlParams {
|
||||||
return new SetLockStateParams[size];
|
return new SetLockStateParams[size];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public boolean getLockState() {
|
public boolean getLockState() {
|
||||||
return lock;
|
return lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToBundle(Bundle bundle) {
|
public void writeToBundle(Bundle bundle) {
|
||||||
bundle.putBoolean("lock", this.lock);
|
bundle.putBoolean("lock", this.lock);
|
||||||
|
|
|
@ -96,7 +96,7 @@ import net.osmand.aidl.mapmarker.RemoveMapMarkersParams;
|
||||||
|
|
||||||
import net.osmand.aidl.quickaction.QuickActionParams;
|
import net.osmand.aidl.quickaction.QuickActionParams;
|
||||||
import net.osmand.aidl.quickaction.QuickActionInfoParams;
|
import net.osmand.aidl.quickaction.QuickActionInfoParams;
|
||||||
import net.osmand.aidlapi.lock.SetLockStateParams;
|
import net.osmand.aidl.lock.SetLockStateParams;
|
||||||
|
|
||||||
// NOTE: Add new methods at the end of file!!!
|
// NOTE: Add new methods at the end of file!!!
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,6 @@ import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.AppInitializer;
|
import net.osmand.plus.AppInitializer;
|
||||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
import net.osmand.plus.AppInitializer.InitEvents;
|
import net.osmand.plus.AppInitializer.InitEvents;
|
||||||
import net.osmand.plus.dialogs.GpxAppearanceAdapter;
|
|
||||||
import net.osmand.plus.helpers.LockHelper;
|
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuItem;
|
import net.osmand.plus.ContextMenuItem;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
|
@ -54,16 +51,15 @@ import net.osmand.plus.GpxSelectionHelper;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.MapMarkersHelper;
|
import net.osmand.plus.MapMarkersHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
import net.osmand.plus.settings.backend.SettingsHelper;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||||
|
import net.osmand.plus.dialogs.GpxAppearanceAdapter;
|
||||||
import net.osmand.plus.helpers.ColorDialogs;
|
import net.osmand.plus.helpers.ColorDialogs;
|
||||||
import net.osmand.plus.helpers.ExternalApiHelper;
|
import net.osmand.plus.helpers.ExternalApiHelper;
|
||||||
|
import net.osmand.plus.helpers.LockHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.IContextMenuButtonListener;
|
import net.osmand.plus.mapcontextmenu.other.IContextMenuButtonListener;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
|
@ -75,6 +71,10 @@ import net.osmand.plus.routing.IRoutingDataUpdateListener;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
|
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.routing.VoiceRouter;
|
import net.osmand.plus.routing.VoiceRouter;
|
||||||
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
|
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
import net.osmand.plus.settings.backend.SettingsHelper;
|
||||||
import net.osmand.plus.views.AidlMapLayer;
|
import net.osmand.plus.views.AidlMapLayer;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
@ -861,13 +861,12 @@ public class OsmandAidlApi {
|
||||||
BroadcastReceiver lockStateReceiver = new BroadcastReceiver() {
|
BroadcastReceiver lockStateReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
LockHelper lockHelper = app.getLockHelper();
|
||||||
boolean lock = intent.getBooleanExtra(AIDL_LOCK_STATE, false);
|
boolean lock = intent.getBooleanExtra(AIDL_LOCK_STATE, false);
|
||||||
LockHelper lh = app.getLockHelper();
|
|
||||||
if (lock) {
|
if (lock) {
|
||||||
lh.lock();
|
lockHelper.lock();
|
||||||
}
|
} else {
|
||||||
else{
|
lockHelper.unlock();
|
||||||
lh.unlock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1711,6 +1710,7 @@ public class OsmandAidlApi {
|
||||||
app.sendBroadcast(intent);
|
app.sendBroadcast(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean setLockState(boolean lock) {
|
boolean setLockState(boolean lock) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(AIDL_LOCK_STATE);
|
intent.setAction(AIDL_LOCK_STATE);
|
||||||
|
@ -1718,6 +1718,7 @@ public class OsmandAidlApi {
|
||||||
app.sendBroadcast(intent);
|
app.sendBroadcast(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean search(final String searchQuery, final int searchType, final double latitude, final double longitude,
|
boolean search(final String searchQuery, final int searchType, final double latitude, final double longitude,
|
||||||
final int radiusLevel, final int totalLimit, final SearchCompleteCallback callback) {
|
final int radiusLevel, final int totalLimit, final SearchCompleteCallback callback) {
|
||||||
if (Algorithms.isEmpty(searchQuery) || latitude == 0 || longitude == 0 || callback == null) {
|
if (Algorithms.isEmpty(searchQuery) || latitude == 0 || longitude == 0 || callback == null) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ import net.osmand.aidl.quickaction.QuickActionParams;
|
||||||
import net.osmand.aidl.search.SearchParams;
|
import net.osmand.aidl.search.SearchParams;
|
||||||
import net.osmand.aidl.search.SearchResult;
|
import net.osmand.aidl.search.SearchResult;
|
||||||
import net.osmand.aidl.tiles.ASqliteDbFile;
|
import net.osmand.aidl.tiles.ASqliteDbFile;
|
||||||
import net.osmand.aidlapi.lock.SetLockStateParams;
|
import net.osmand.aidl.lock.SetLockStateParams;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
|
3
OsmAnd/src/net/osmand/aidl/lock/SetLockStateParams.aidl
Normal file
3
OsmAnd/src/net/osmand/aidl/lock/SetLockStateParams.aidl
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
package net.osmand.aidl.lock;
|
||||||
|
|
||||||
|
parcelable SetLockStateParams;
|
45
OsmAnd/src/net/osmand/aidl/lock/SetLockStateParams.java
Normal file
45
OsmAnd/src/net/osmand/aidl/lock/SetLockStateParams.java
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package net.osmand.aidl.lock;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
public class SetLockStateParams implements Parcelable {
|
||||||
|
|
||||||
|
private boolean lock;
|
||||||
|
|
||||||
|
public SetLockStateParams(boolean lock) {
|
||||||
|
this.lock = lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SetLockStateParams(Parcel in) {
|
||||||
|
readFromParcel(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<SetLockStateParams> CREATOR = new Creator<SetLockStateParams>() {
|
||||||
|
@Override
|
||||||
|
public SetLockStateParams createFromParcel(Parcel in) {
|
||||||
|
return new SetLockStateParams(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SetLockStateParams[] newArray(int size) {
|
||||||
|
return new SetLockStateParams[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public boolean getLockState() {
|
||||||
|
return lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
|
out.writeByte((byte) (lock ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readFromParcel(Parcel in) {
|
||||||
|
lock = in.readByte() == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue