Adjust Maps to latest API and fix display issue, add empty Wallet API impl

related to #207, #236
This commit is contained in:
Marvin W 2016-12-02 16:20:25 +01:00
parent 97f4c82172
commit 83725f43cd
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
11 changed files with 175 additions and 26 deletions

2
extern/GmsApi vendored

@ -1 +1 @@
Subproject commit 0b4f43c6a6a091dbdeb0ec544d533373a83ea319 Subproject commit bfae24a17c11d9633fdce4f9b82dff0da4769f8d

View File

@ -527,13 +527,17 @@
<action android:name="com.google.android.gms.safetynet.service.START"/> <action android:name="com.google.android.gms.safetynet.service.START"/>
</intent-filter> </intent-filter>
</service> </service>
<service android:name="org.microg.gms.wallet.PaymentService">
<intent-filter>
<action android:name="com.google.android.gms.wallet.service.BIND"/>
</intent-filter>
</service>
<service android:name="org.microg.gms.DummyService"> <service android:name="org.microg.gms.DummyService">
<intent-filter> <intent-filter>
<action android:name="com.google.android.gms.plus.service.START"/> <action android:name="com.google.android.gms.plus.service.START"/>
<action android:name="com.google.android.gms.plus.service.internal.START"/> <action android:name="com.google.android.gms.plus.service.internal.START"/>
<action android:name="com.google.android.gms.panorama.service.START"/> <action android:name="com.google.android.gms.panorama.service.START"/>
<action android:name="com.google.android.gms.wallet.service.BIND"/>
<action android:name="com.google.android.gms.appstate.service.START"/> <action android:name="com.google.android.gms.appstate.service.START"/>
<action android:name="com.google.android.gms.ads.service.START"/> <action android:name="com.google.android.gms.ads.service.START"/>
<action android:name="com.google.android.gms.accounts.ACCOUNT_SERVICE"/> <action android:name="com.google.android.gms.accounts.ACCOUNT_SERVICE"/>

View File

@ -23,6 +23,7 @@ import android.graphics.Paint;
import android.os.RemoteException; import android.os.RemoteException;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.FrameLayout;
import com.google.android.gms.maps.internal.ISnapshotReadyCallback; import com.google.android.gms.maps.internal.ISnapshotReadyCallback;
import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.CameraPosition;
@ -57,6 +58,7 @@ public class BackendMap implements ItemizedLayer.OnItemGestureListener<MarkerIte
private final Context context; private final Context context;
private final BackendMapView mapView; private final BackendMapView mapView;
private final ContainerLayout container;
private final CameraUpdateListener cameraUpdateListener; private final CameraUpdateListener cameraUpdateListener;
private final Map<String, Markup> markupMap = new HashMap<String, Markup>(); private final Map<String, Markup> markupMap = new HashMap<String, Markup>();
private final List<DrawableMarkup> drawableMarkups = new ArrayList<DrawableMarkup>(); private final List<DrawableMarkup> drawableMarkups = new ArrayList<DrawableMarkup>();
@ -71,6 +73,8 @@ public class BackendMap implements ItemizedLayer.OnItemGestureListener<MarkerIte
mapView.items().setOnItemGestureListener(this); mapView.items().setOnItemGestureListener(this);
mapView.map().input.bind(this); mapView.map().input.bind(this);
mapView.map().events.bind(this); mapView.map().events.bind(this);
container = new ContainerLayout(context);
container.addView(mapView);
} }
public Viewport getViewport() { public Viewport getViewport() {
@ -94,7 +98,7 @@ public class BackendMap implements ItemizedLayer.OnItemGestureListener<MarkerIte
} }
public View getView() { public View getView() {
return mapView; return container;
} }
public boolean hasBuilding() { public boolean hasBuilding() {

View File

@ -152,8 +152,8 @@ public class BackendMapView extends MapView {
tileSource.setCache(cache); tileSource.setCache(cache);
VectorTileLayer baseLayer = map().setBaseMap(tileSource); VectorTileLayer baseLayer = map().setBaseMap(tileSource);
Layers layers = map().layers(); Layers layers = map().layers();
layers.add(labels = new LabelLayer(map(), baseLayer));
layers.add(drawables = new ClearableVectorLayer(map())); layers.add(drawables = new ClearableVectorLayer(map()));
layers.add(labels = new LabelLayer(map(), baseLayer));
layers.add(buildings = new BuildingLayer(map(), baseLayer)); layers.add(buildings = new BuildingLayer(map(), baseLayer));
layers.add(items = new ItemizedLayer<MarkerItem>(map(), new MarkerSymbol( layers.add(items = new ItemizedLayer<MarkerItem>(map(), new MarkerSymbol(
new AndroidBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.nop)), 0.5F, 1))); new AndroidBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.nop)), 0.5F, 1)));

View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2013-2016 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.microg.gms.maps;
import android.content.Context;
import android.widget.FrameLayout;
import org.oscim.utils.ThreadUtils;
public class ContainerLayout extends FrameLayout {
public ContainerLayout(Context context) {
super(context);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
ThreadUtils.init();
super.onLayout(changed, left, top, right, bottom);
}
}

View File

@ -41,6 +41,10 @@ import com.google.android.gms.maps.internal.IGoogleMapDelegate;
import com.google.android.gms.maps.internal.IInfoWindowAdapter; import com.google.android.gms.maps.internal.IInfoWindowAdapter;
import com.google.android.gms.maps.internal.ILocationSourceDelegate; import com.google.android.gms.maps.internal.ILocationSourceDelegate;
import com.google.android.gms.maps.internal.IOnCameraChangeListener; import com.google.android.gms.maps.internal.IOnCameraChangeListener;
import com.google.android.gms.maps.internal.IOnCameraIdleListener;
import com.google.android.gms.maps.internal.IOnCameraMoveCanceledListener;
import com.google.android.gms.maps.internal.IOnCameraMoveListener;
import com.google.android.gms.maps.internal.IOnCameraMoveStartedListener;
import com.google.android.gms.maps.internal.IOnInfoWindowClickListener; import com.google.android.gms.maps.internal.IOnInfoWindowClickListener;
import com.google.android.gms.maps.internal.IOnMapClickListener; import com.google.android.gms.maps.internal.IOnMapClickListener;
import com.google.android.gms.maps.internal.IOnMapLoadedCallback; import com.google.android.gms.maps.internal.IOnMapLoadedCallback;
@ -101,10 +105,12 @@ public class GoogleMapImpl extends IGoogleMapDelegate.Stub
private IOnMyLocationChangeListener onMyLocationChangeListener; private IOnMyLocationChangeListener onMyLocationChangeListener;
private Criteria criteria; private Criteria criteria;
private Location myLocation;
private LocationListener listener = new LocationListener() { private LocationListener listener = new LocationListener() {
@Override @Override
public void onLocationChanged(Location location) { public void onLocationChanged(Location location) {
// TODO: Actually do my location overlay // TODO: Actually do my location overlay
myLocation = location;
if (onMyLocationChangeListener != null && location != null) { if (onMyLocationChangeListener != null && location != null) {
try { try {
onMyLocationChangeListener.onMyLocationChanged(ObjectWrapper.wrap(location)); onMyLocationChangeListener.onMyLocationChanged(ObjectWrapper.wrap(location));
@ -464,6 +470,7 @@ public class GoogleMapImpl extends IGoogleMapDelegate.Stub
@Override @Override
public IUiSettingsDelegate getUiSettings() throws RemoteException { public IUiSettingsDelegate getUiSettings() throws RemoteException {
Log.d(TAG, "getUiSettings: "+uiSettings);
return uiSettings; return uiSettings;
} }
@ -551,6 +558,30 @@ public class GoogleMapImpl extends IGoogleMapDelegate.Stub
}, 5000); }, 5000);
} }
@Override
public void setCameraMoveStartedListener(IOnCameraMoveStartedListener listener) throws RemoteException {
Log.d(TAG, "unimplemented Method: setCameraMoveStartedListener");
}
@Override
public void setCameraMoveListener(IOnCameraMoveListener listener) throws RemoteException {
Log.d(TAG, "unimplemented Method: setCameraMoveListener");
}
@Override
public void setCameraMoveCanceledListener(IOnCameraMoveCanceledListener listener) throws RemoteException {
Log.d(TAG, "unimplemented Method: setCameraMoveCanceledListener");
}
@Override
public void setCameraIdleListener(IOnCameraIdleListener listener) throws RemoteException {
Log.d(TAG, "unimplemented Method: setCameraIdleListener");
}
/* /*
Misc Misc
*/ */
@ -575,7 +606,7 @@ public class GoogleMapImpl extends IGoogleMapDelegate.Stub
@Override @Override
public Location getMyLocation() throws RemoteException { public Location getMyLocation() throws RemoteException {
return null; return myLocation;
} }
@Override @Override

View File

@ -20,6 +20,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.os.Parcel; import android.os.Parcel;
import android.os.RemoteException; import android.os.RemoteException;
import android.util.Log; import android.util.Log;
@ -39,16 +40,16 @@ public class MapFragmentImpl extends IMapFragmentDelegate.Stub {
private GoogleMapImpl map; private GoogleMapImpl map;
private GoogleMapOptions options; private GoogleMapOptions options;
private Context context; private Activity activity;
public MapFragmentImpl(Activity activity) { public MapFragmentImpl(Activity activity) {
context = activity; this.activity = activity;
} }
private GoogleMapImpl myMap() { private GoogleMapImpl myMap() {
if (map == null) { if (map == null) {
Log.d(TAG, "GoogleMap instance created"); Log.d(TAG, "GoogleMap instance created");
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
map = GoogleMapImpl.create(inflater.getContext(), options); map = GoogleMapImpl.create(inflater.getContext(), options);
} }
return map; return map;
@ -139,7 +140,7 @@ public class MapFragmentImpl extends IMapFragmentDelegate.Stub {
@Override @Override
public void getMapAsync(final IOnMapReadyCallback callback) throws RemoteException { public void getMapAsync(final IOnMapReadyCallback callback) throws RemoteException {
new Handler(context.getMainLooper()).post(new Runnable() { new Handler(activity.getMainLooper()).post(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {

View File

@ -74,6 +74,7 @@ public class GcmAppFragment extends ResourceSettingsFragment {
}); });
view.setClickable(true); view.setClickable(true);
} catch (Exception e) { } catch (Exception e) {
appName = packageName;
((TextView) activity.findViewById(R.id.app_name)).setText(packageName); ((TextView) activity.findViewById(R.id.app_name)).setText(packageName);
} }
} }

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2013-2016 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.microg.gms.wallet;
import android.content.Context;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.wallet.internal.IOwService;
public class OwServiceImpl extends IOwService.Stub {
private static final String TAG = "GmsWalletOwSvc";
public OwServiceImpl(Context context) {
}
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) return true;
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2013-2016 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.microg.gms.wallet;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.common.internal.GetServiceRequest;
import com.google.android.gms.common.internal.IGmsCallbacks;
import org.microg.gms.BaseService;
import org.microg.gms.common.GmsService;
public class PaymentService extends BaseService {
public PaymentService() {
super("GmsWalletPaySvc", GmsService.WALLET);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
callback.onPostInitComplete(0, new OwServiceImpl(this), null);
}
}

View File

@ -18,13 +18,12 @@
stroke-width="5.0"/> stroke-width="5.0"/>
<style-text style="bold" caption="true" fill="#000000" id="park" k="name" priority="0" <style-text style="bold" caption="true" fill="#000000" id="park" k="name" priority="0"
size="17" stroke="#eeeeee" stroke-width="2.0"/> size="17" stroke="#eeeeee" stroke-width="5.0"/>
<style-text caption="true" dy="-14" fill="#00afff" id="transit" k="name" priority="5" size="16" <style-text caption="true" dy="-14" fill="#00afff" id="transit" k="name" priority="5" size="16"
stroke="#eeeeee" stroke-width="5.0"/> stroke="#eeeeee" stroke-width="5.0"/>
<style-text caption="true" dy="-10" fill="#00afff" id="transit-small" k="name" priority="5" <style-text caption="true" dy="-10" fill="#00afff" id="transit-small" k="name" priority="5"
size="16" size="16" stroke="#eeeeee" stroke-width="5.0"/>
stroke="#eeeeee" stroke-width="5.0"/>
<style-area fill="#33AA0000" id="debug" stroke="#FF0000" stroke-width="1"/> <style-area fill="#33AA0000" id="debug" stroke="#FF0000" stroke-width="1"/>
<style-line id="debug" stroke="#00FF00"/> <style-line id="debug" stroke="#00FF00"/>
@ -481,48 +480,48 @@
<m k="place"> <m k="place">
<m v="suburb" zoom-max="16" zoom-min="9"> <m v="suburb" zoom-max="16" zoom-min="9">
<caption fill="#8B7F5F" k="name" priority="4" size="17" <caption fill="#8B7F5F" k="name" priority="4" size="17"
stroke="#ffffff" stroke-width="2.0"/> stroke="#EAEAEA" stroke-width="5.0"/>
</m> </m>
<m v="village" zoom-max="15" zoom-min="9"> <m v="village" zoom-max="15" zoom-min="9">
<caption fill="#8B7F5F" k="name" priority="3" size="17" stroke="#ffffff" <caption fill="#8B7F5F" k="name" priority="3" size="17" stroke="#EAEAEA"
stroke-width="2.0"/> stroke-width="5.0"/>
</m> </m>
<m v="island" zoom-min="10"> <m v="island" zoom-min="10">
<caption style="bold" fill="#000000" k="name" priority="1" size="20" <caption style="bold" fill="#000000" k="name" priority="1" size="20"
stroke="#ffffff" stroke-width="2.0"/> stroke="#EAEAEA" stroke-width="5.0"/>
</m> </m>
<m v="town"> <m v="town">
<m zoom-max="15" zoom-min="13"> <m zoom-max="15" zoom-min="13">
<caption fill="#8B7F5F" k="name" priority="1" size="23" stroke="#ffffff" <caption fill="#8B7F5F" k="name" priority="1" size="23" stroke="#EAEAEA"
stroke-width="2.0"/> stroke-width="5.0"/>
</m> </m>
<m zoom-max="13" zoom-min="9"> <m zoom-max="13" zoom-min="9">
<caption fill="#615942" k="name" priority="1" size="19" <caption fill="#615942" k="name" priority="1" size="19"
stroke="#ffffff" stroke-width="2.0"/> stroke="#EAEAEA" stroke-width="5.0"/>
</m> </m>
<m zoom-max="9"> <m zoom-max="9">
<caption fill="#000000" k="name" priority="1" size="16" <caption fill="#000000" k="name" priority="1" size="16"
stroke="#ffffff" stroke-width="2.0"/> stroke="#EAEAEA" stroke-width="5.0"/>
</m> </m>
</m> </m>
<m v="city"> <m v="city">
<m zoom-max="15" zoom-min="13"> <m zoom-max="15" zoom-min="13">
<caption fill="#615942" k="name" priority="1" size="24" stroke="#ffffff" <caption fill="#615942" k="name" priority="1" size="24" stroke="#EAEAEA"
stroke-width="2.0"/> stroke-width="5.0"/>
</m> </m>
<m zoom-max="13" zoom-min="9"> <m zoom-max="13" zoom-min="9">
<caption fill="#000000" k="name" priority="1" size="24" <caption fill="#000000" k="name" priority="1" size="24"
stroke="#ffffff" stroke-width="2.0"/> stroke="#EAEAEA" stroke-width="5.0"/>
</m> </m>
<m zoom-max="9"> <m zoom-max="9">
<caption dy="14" fill="#000000" k="name" priority="1" size="19" <caption dy="14" fill="#000000" k="name" priority="1" size="19"
stroke="#ffffff" stroke-width="2.0" stroke="#EAEAEA" stroke-width="5.0"
symbol="assets:symbols/dot_white.svg"/> symbol="assets:symbols/dot_white.svg"/>
</m> </m>
</m> </m>
<m v="country" zoom-max="9"> <m v="country" zoom-max="9">
<caption style="bold" fill="#000000" k="name" priority="0" size="20" <caption style="bold" fill="#000000" k="name" priority="0" size="20"
stroke="#ffffff" stroke-width="2.0"/> stroke="#EAEAEA" stroke-width="5.0"/>
</m> </m>
</m> </m>
<m k="railway"> <m k="railway">
@ -539,7 +538,7 @@
</m> </m>
<m k="addr:housenumber" zoom-min="18"> <m k="addr:housenumber" zoom-min="18">
<caption style="bold" fill="#606060" k="addr:housenumber" size="10" stroke="#ffffff" <caption style="bold" fill="#606060" k="addr:housenumber" size="10" stroke="#EAEAEA"
stroke-width="2.0"/> stroke-width="2.0"/>
</m> </m>
</m> </m>