Commit 20f466f9 authored by 张释方's avatar 张释方

Merge branch 'dev_1.0.0' of http://gitlab.mints-id.com/android/android_street into branche_zsf

parents 6e3e048f e9c9204e
......@@ -24,7 +24,8 @@ android {
//配置so文件
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
//abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
abiFilters "armeabi-v7a", "arm64-v8a"
}
manifestPlaceholders = [CHANNEL_NAME_VALUE: "street",
......
......@@ -2,28 +2,28 @@
// console.log(data)
// }
var isWindowLoad=false;
var BridgeIsLoad=false;
var isWindowLoad = false;//页面加载
var BridgeIsLoad = false;//框架加载
function tryAllIsOk(){
console.log("tryAllIsOk","isWindowLoad",isWindowLoad,"BridgeIsLoad",BridgeIsLoad)
if(isWindowLoad){
function tryAllIsOk() {
//console.log("tryAllIsOk", "isWindowLoad", isWindowLoad, "BridgeIsLoad", BridgeIsLoad)
if (isWindowLoad) {
try {
doAppFun("allIsOk");
} catch (e) {
console.log('allisOk',e)
// console.log('allisOk', e)
// alert("app未接受开始自动跳转" + e)
setTimeout(function(){
setTimeout(function () {
doAppFun("allIsOk");
},1500);
}, 1500);
}
}
}
function toVurl(a, innerData) {
var data=JSON.stringify(innerData);
var data = JSON.stringify(innerData);
if (a == 'b') {
try {
doAppFun("toBVr", data);
......@@ -37,7 +37,7 @@ function toVurl(a, innerData) {
try {
doAppFun("toVr", data);
} catch (e) {
console.log('toVr', data)
// console.log('toVr', data)
//alert("app未接受开始自动跳转" + e)
}
......@@ -46,11 +46,10 @@ function toVurl(a, innerData) {
}
function allIsOk(a, data) {
console.log("innerAllIsOk")
isWindowLoad=true;
tryAllIsOk();
//console.log("innerAllIsOk")
isWindowLoad = true;
tryAllIsOk();
// setTimeout(function(){
//
// },1000);
......@@ -67,15 +66,16 @@ function doAppFun(funstr, params) {
funstr
, params
, function (responseData) {
console.log(responseData)
// console.log(responseData)
}
);
}
function centerChanged() {
try {
doAppFun("centerChanged");
} catch (e) {
console.log("tips",msg)
// console.log("tips", msg)
//alert("app未弹框==>" + msg + e)
}
}
......@@ -84,7 +84,7 @@ function tips(msg) {
try {
doAppFun("tips", msg);
} catch (e) {
console.log("tips",msg)
//console.log("tips", msg)
//alert("app未弹框==>" + msg + e)
}
}
......@@ -98,7 +98,7 @@ function connectWebViewJavascriptBridge(callback) {
'WebViewJavascriptBridgeReady'
, function () {
callback(WebViewJavascriptBridge)
BridgeIsLoad=true;
BridgeIsLoad = true;
tryAllIsOk()
},
false
......@@ -115,24 +115,23 @@ connectWebViewJavascriptBridge(function (bridge) {
'Javascript Responds': 'Wee!'
};
responseCallback(data);
});
//Android调用js方法:functionInJs方法名称需要保持一致 ,并返回给Android通知
bridge.registerHandler("initZsMap", function (data, responseCallback) {
initZsMap(data);
vm.initZsMap(data);
responseCallback("suc:initZsMap");
});
bridge.registerHandler("addZoom", function (data, responseCallback) {
addZoom();
vm.addZoom();
responseCallback("suc:addZoom");
});
bridge.registerHandler("reduceZoom", function (data, responseCallback) {
reduceZoom();
vm.reduceZoom();
responseCallback("suc:reduceZoom");
});
......
......@@ -10,9 +10,9 @@ function CheckChinese(val) {
// function toBLatLng(point, f) {
// // 百度地图API功能
//
// var ggPoint = new BMapGL.Point(point.lng, point.lat);
// var ggPoint = new BMap.Point(point.lng, point.lat);
//
// var convertor = new BMapGL.Convertor();
// var convertor = new BMap.Convertor();
// var pointArr = [];
// pointArr.push(ggPoint);
//
......@@ -20,7 +20,7 @@ function CheckChinese(val) {
//
// console.log("转换后百度ip", );
// console.log(data.points[0])
// var geoc = new BMapGL.Geocoder();
// var geoc = new BMap.Geocoder();
//
// geoc.getLocation(data.points[0], function (rs) {
// //console.log(rs)
......@@ -50,31 +50,33 @@ function CheckChinese(val) {
//
// }
//var rpoint = CoordinateUtil.wgs84_to_bd(point)
function toBLatLng(point, f) {
function toGPoint(point) {
return CoordinateUtil.getWgs84xy(point);
}
var rpoint = CoordinateUtil.wgs84_to_bd(point)
function toBPoint(point) {
return CoordinateUtil.wgs84_to_bd(point);
}
console.log("工具类转换后", rpoint);
var geoc = new BMapGL.Geocoder();
var data = new BMapGL.Point(rpoint.lng,rpoint.lat);
function getLocation(rpoint, f) {
// console.log("工具类转换后", rpoint);
var geoc = new BMap.Geocoder();
var data = new BMap.Point(rpoint.lng, rpoint.lat);
geoc.getLocation(data, function (rs) {
console.log(rs)
var addComp = rs.addressComponents;
console.log(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " +
addComp.street + ", " + addComp.streetNumber);
console.log(addComp.province);
//+ ", " + addComp.city + ", " + addComp.district + ", " addComp.street + ", " + addComp.streetNumber);
// console.log( CheckChinese(addComp.province),typeof(addComp.province),addComp.province.indexOf("台湾")!=-1,CheckChinese(addComp.province)&&addComp.province!="台湾省")
var res = data;
res.c = CheckChinese(addComp.province)&&addComp.province!="台湾省";
res.c = CheckChinese(addComp.province) && addComp.province != "台湾省";
f && f(res)
})
}
// getBAr(data.points[0])
// function getBAr(point){
function bvr(point) {
var panoramaService = new BMap.PanoramaService();
panoramaService.getPanoramaByLocation(new BMap.Point(point.lng, point.lat), 10000, function (data) {
......@@ -84,9 +86,9 @@ function bvr(point) {
tips("暂无街景")
return;
}
panoramaInfo += '全景id为:' + data.id + '\n';
panoramaInfo += '<br/>全景路段名为:' + data.description + '\n';
panoramaInfo += '<br/>坐标为:' + data.position.lng + ':' + data.position.lat + '\n';
// panoramaInfo += '全景id为:' + data.id + '\n';
panoramaInfo = '全景路段名为:' + data.description;
// panoramaInfo += '<br/>坐标为:' + data.position.lng + ':' + data.position.lat + '\n';
console.log(panoramaInfo);
// tips("准备跳转国内" + data.description)
......@@ -95,22 +97,11 @@ function bvr(point) {
"d": data.id,
"title": data.description
}
toVurl('b',params)
toVurl('b', params)
});
}
// function getblc(f) {
//
// var geolocation = new BMap.Geolocation();
// geolocation.getCurrentPosition(function (r) {
// if (this.getStatus() == BMAP_STATUS_SUCCESS) {
// f&&f(r.point)
// //alert('您的位置:' + r.point.lng + ',' + r.point.lat);
// } else {
// // alert('failed' + this.getStatus());
// }
// });
// }
window.google = window.google || {};
google.maps = google.maps || {};
//强行阻断地图加载
//获取加载参数
var G_ZSYDA;//gmapinitneed
function loadGoogleMap(Yda) {
//window.google.maps.Load&&window.google.maps.Load(Yda);
G_ZSYDA = Yda;
}
var initMap;//gneedfun
function tosh(center) {
console.log("查询国外或中国台湾街景")
var ser = new google.maps.StreetViewService();
const request = {
location: {
lat: center.lat(),
lng: center.lng()
},
radius: 10000,
preference: 'nearest', //google.maps.StreetViewPreference.NEAREST,
};
ser.getPanorama(request, function (a) {
if (a == null || a.location == null) {
tips("暂无街景")
return;
}
console.log(a.location.description)
//console.log(a.location.latLng.lat() + ',' + a.location.latLng.lng())
// console.log("准备模拟app跳转至外国街景:" + a.location.description + "==>./streets.html?a=" + a.location.latLng
// .lat() + "&b=" + a.location.latLng.lng())
var params = {
"lng": a.location.latLng.lng(),
"lat": a.location.latLng.lat(),
"title": a.location.description
}
toVurl('g', params)
})
}
(function () {
var modules = google.maps.modules = {};
google.maps.__gjsload__ = function (name, text) {
modules[name] = text;
};
google.maps.Load = function (apiLoad) {
delete google.maps.Load;
apiLoad([
0.009999999776482582,
[
null,
[
getMb1U(),
null,
null,
null,
1,
"904",
[
"http://khms0.google.com/kh?v=904\u0026hl=zh-CN\u0026",
"http://khms1.google.com/kh?v=904\u0026hl=zh-CN\u0026"
]
],
null,
null,
null,
null,
[
[
"http://cbks0.googleapis.com/cbk?",
"http://cbks1.googleapis.com/cbk?"
]
],
[
getMb2U(),
null,
null,
null,
null,
"130",
[
"http://khms0.google.com/kh?v=130\u0026hl=zh-CN\u0026",
"http://khms1.google.com/kh?v=130\u0026hl=zh-CN\u0026"
]
]
],
[
"zh-CN",
"US",
null,
0,
null,
null,
"http://maps.gstatic.com/mapfiles/",
null,
getRequestUrl(),
getRequestUrl(''),
null,
"http://maps.google.com",
null,
"http://maps.gstatic.com/maps-api-v3/api/images/",
"http://www.google.com/maps",
null,
"http://www.google.com",
1,
"http://maps.googleapis.com/maps_api_js_slo/log?hasfast=true"
],
[
getRequestUrl() + "/maps-api-v3/api/js/45/7/intl/zh_cn",
"3.45.7"
],
[
3420973460
],
null,
null,
null,
null,
null,
null,
"initMap",
null,
null,
1,
"http://khms.googleapis.com/mz?v=904\u0026",
getZsKey(),
"http://earthbuilder.googleapis.com",
"http://earthbuilder.googleapis.com",
null,
"http://mts.googleapis.com/maps/vt/icon",
[
[
getRequestUrl() + "/maps/vt"
],
[
getRequestUrl() + "/maps/vt"
],
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
[
"http://www.google.com/maps/vt"
],
"/maps/vt",
565000000,
565,
565290767
],
2,
500,
[
null,
null,
null,
null,
"http://www.google.com/maps/preview/log204",
"",
"http://static.panoramio.com.storage.googleapis.com/photos/",
[
"http://geo0.ggpht.com/cbk",
"http://geo1.ggpht.com/cbk",
"http://geo2.ggpht.com/cbk",
"http://geo3.ggpht.com/cbk"
],
getRequestUrl() + "/maps/api/js/GeoPhotoService.GetMetadata",
getRequestUrl() + "/maps/api/js/GeoPhotoService.SingleImageSearch",
getVrUrls(),
],
null,
null,
null,
null,
"/maps/api/js/ApplicationService.GetEntityDetails",
0,
null,
null,
null,
null,
[],
[
"45.7"
],
1,
0,
[
1
],
null,
null,
null,
0.009999999776482582
], loadScriptTime);
};
var loadScriptTime = (new Date).getTime();
})();
......@@ -86,18 +86,35 @@ var CoordinateUtil = {
ret += (150.0 * Math.sin(lng / 12.0 * CoordinateUtil.pi) + 300.0 * Math.sin(lng / 30.0 * CoordinateUtil.pi)) * 2.0 / 3.0;
return ret;
},
getWgs84xy:function(x,y){
getWgs84xy:function(point){
//先转 国测局坐标
var doubles_gcj = CoordinateUtil.bd09togcj02(x, y); //(x 117. y 36. )
var doubles_gcj = CoordinateUtil.bd09togcj02(point.lng, point.lat); //(x 117. y 36. )
//国测局坐标转wgs84
var doubles_wgs84 = CoordinateUtil.gcj02towgs84(doubles_gcj.lng, doubles_gcj.lat);
//返回 纠偏后 坐标
return doubles_wgs84;
},
wgs84_to_bd:function(point){
var lng=point.lng;
if(lng>180){
console.log("lng>>",lng)
lng=lng%360;
if(lng>180){
lng=lng-360;
}
console.log("lng>>>>",lng)
}
if(lng<-180){
console.log("lng>>",lng)
lng=lng%360;
if(lng<-180){
lng=lng+360;
}
console.log("lng>>>>",lng)
}
//先转 国测局坐标
var doubles_gcj = CoordinateUtil.wgs84togcj02(point.lng, point.lat); //(x 117. y 36. )
var doubles_gcj = CoordinateUtil.wgs84togcj02(lng, point.lat); //(x 117. y 36. )
//国测局坐标转bd
var doubles_bd = CoordinateUtil.gcj02tobd09(doubles_gcj.lng, doubles_gcj.lat);
//返回 纠偏后 坐标
......
This diff is collapsed.
......@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="./common/url.js"></script>
<script>
document.write('<script type="text/javascript"' +
' src="https://api.map.baidu.com/api?v=3.0&ak=' + getParam("bk") + '"><\/script>')
......@@ -48,8 +49,6 @@
//全景图展示
var panorama = new BMap.Panorama('panorama');
// panorama.setPosition(new BMap.Point(120.320032, 31.589666)); //根据经纬度坐标展示全景图
......@@ -86,7 +85,7 @@
}
var map = new BMap.Map("normal_map", mapOption);
var testpoint = new BMap.Point(120.320032, 31.589666);
map.centerAndZoom(testpoint, 18);
map.centerAndZoom(testpoint, 15);
// 创建小车图标
var myIcon = new BMap.Icon("./common/bm.jpg", new BMap.Size(40, 63),{
// anchor: new BMap.Size(0, 0)
......
......@@ -21,9 +21,12 @@
}
#map {
width: 100%;
height: 100%;
position: relative;
}
.d1 {
width: 70px;
height: 90px;
......@@ -34,41 +37,54 @@
left: 50%;
margin-left: -35px;
}
/*.gmnoprint{*/
/* display: none !important;*/
/*}*/
</style>
<script type="text/javascript" charset="UTF-8" src="./common/latlng.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/url.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/zsc.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap.js"></script>
<script>
document.write('<script type="text/javascript"' +
' src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak='+getParam("bk")+'"><\/script>'
+'<script type="text/javascript"' +
' src="https://api.map.baidu.com/api?v=3.0&ak='+getParam("bk")+'"><\/script>');
</script>
#bmap {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
position:absolute;
font-family: "微软雅黑";
}
<script src="https://code.bdstatic.com/npm/jquery@1.12.4/dist/jquery.min.js"></script>
.anchorBL,a{
display: none !important;
}
#map .gmnoprint{
display: none !important;
}
<script src="./common/baidu.js" async=""></script>
</style>
<script type="text/javascript" charset="UTF-8" src="./common/ap.js" async=""></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/common.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/util.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/map.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/onion.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/controls.js"></script>
</head>
<body>
<div id="map" style="position: relative; overflow: hidden;">
<div id="maps" style="height: 100%;width: 100%;padding: 0;margin:0;">
<div id="map" v-show="!NOWUSEBAIDU"></div>
<div id="bmap" v-show="true||NOWUSEBAIDU"></div>
<img src="./common/icon.jpg" @click="vrs()" class="d1" id="im">
</div>
<img src="./common/icon.jpg" onclick="al()" class="d1" id="im">
</img>
<script src="./zsmap_files/js" async=""></script>
</body>
<script type="text/javascript" charset="UTF-8" src="./common/vue.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/latlng.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/url.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/zsc.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/gmap.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/bmap.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap.js"></script>
<script>
document.write('<script type="text/javascript"' +
' src="https://api.map.baidu.com/api?v=3.0&ak=' + getParam("bk") + '"><\/script>');
</script>
<script src="./common/jquery.min.js"></script>
<script src="./common/baidu.js" async=""></script>
<script type="text/javascript" charset="UTF-8" src="./common/ap.js" async=""></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/common.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/util.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/map.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/onion.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/controls.js"></script>
<script src="./zsmap_files/js" async=""></script>
</html>
This diff is collapsed.
This diff is collapsed.
......@@ -126,6 +126,7 @@ class HistoryRecordItemVHM(val activity: SearchMapActivity,val viewModel: Search
val intent = Intent()
intent.putExtra("latitude",historyBean.latitude)
intent.putExtra("longitude",historyBean.longitude)
intent.putExtra("inner",viewModel.index.value)
viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent)
})
}
\ No newline at end of file
......@@ -16,8 +16,15 @@ public class GPS {
private @Nullable double lng;
private @Nullable int inner=0;
public GPS() {
}
public GPS(double lat, double lng,int inner) {
this.lat = lat;
this.lng = lng;
this.inner = inner;
}
public GPS(double lat, double lng) {
this.lat = lat;
......@@ -41,6 +48,6 @@ public class GPS {
}
public String toString() {
return "lat:" + lat + "," + "lng:" + lng;
return "lat:" + lat + "," + "lng:" + lng+"," + "inner:" + inner;
}
}
\ No newline at end of file
......@@ -8,4 +8,5 @@ class MutualBean {
var d:String?=null
var lat:String?=null
var lng:String?=null
var inner:Int=0
}
\ No newline at end of file
......@@ -54,7 +54,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
ApiModel.checkUpgrade(lifecycleProvider, vo)
.safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<Version>>(
this@MainViewModel, false
null, false
) {
override fun onBusinessSuccess(response: BaseResponse<Version>) {
response.result?.apply {
......
package com.mints.street.main.googlemap
import android.os.Bundle
import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -41,13 +42,18 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
var mLocationClient: LocationClient? = null
private val myListener: MyLocationListener = MyLocationListener()
private var isScrollLayoutClose: Boolean = false
private var gps = GPS()
private var gps = GPS(39.915121, 116.403947,0)
inner class MyLocationListener : BDLocationListener {
override fun onReceiveLocation(location: BDLocation?) {
gps.lat = location?.latitude?:0.0
gps.lng = location?.longitude?:0.0
override fun onReceiveLocation(location: BDLocation?) {//4.9E-324 4.9E-324
if( location?.latitude == 4.9E-324 ||location?.longitude == 4.9E-324){
return
}
gps.lat = location?.latitude?:39.915121
gps.lng = location?.longitude?:116.403947
KLog.e("onReceiveLocation","${location?.latitude} --- ${location?.longitude}")
}
}
......@@ -68,6 +74,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
override fun initData() {
super.initData()
Handler().postDelayed({ isScrollLayoutClose = true }, 2000)
binding.webview.setDefaultHandler(DefaultHandler())
binding.webview.webChromeClient = WebChromeClient()
binding.webview.setOnLongClickListener { true }
......@@ -125,13 +133,14 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
//地图改变时
binding.webview.registerHandler("centerChanged") { data, _ ->
KLog.a("js - > android centerChanged", data)
if (!binding.scrollLayout.isClose){
binding.scrollLayout.toggle(STATUS_CLOSE)
if (!binding.scrollLayout.isClose && isScrollLayoutClose) {
binding.scrollLayout.post {
binding.scrollLayout.toggle(ScrollLayout.STATUS_CLOSE)
}
}
}
//加载完成
binding.webview.registerHandler("allIsOk") { _, _ ->
KLog.e("Sfsadfa","allIsOk")
initZsMap()
}
......@@ -166,7 +175,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
*/
private fun initZsMap() {
binding.webview.callHandler("initZsMap"
,Gson().toJson(GPSConverterUtils.bd09_To_Gcj02(gps.lat,gps.lng)) ) {
,Gson().toJson(gps) ) {
}
}
......@@ -227,6 +236,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
}
})
viewModel.pt.observe(this, Observer {
KLog.a("GPSConverterUtils.bd09_To_Gcj02", Gson().toJson(it))
binding.webview.callHandler("initZsMap"
,Gson().toJson(it) ) {
}
......
......@@ -116,8 +116,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
viewModel.pt.observe(this, Observer {
if (it == null) return@Observer
// 默认 天安门
val gps = GPSConverterUtils.gcj02_To_Bd09(it.lat, it.lng)
val center = LatLng(gps.lat, gps.lng)
val center = LatLng(it.lat, it.lng)
setNewMapStatus(center)
binding.scrollLayout.toggle(ScrollLayout.STATUS_CLOSE)
})
......@@ -262,40 +261,43 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
var positioningBean: PositioningBean? = null
inner class MyLocationListener : BDLocationListener {
override fun onReceiveLocation(location: BDLocation) {
override fun onReceiveLocation(location: BDLocation?) {
if( location?.latitude == 4.9E-324 ||location?.longitude == 4.9E-324){
return
}
if (sp == null) {
sp = SPUtils.getInstance(SPUtils.POSITIONING_MAP)
}
if (positioningBean == null) {
positioningBean = PositioningBean()
}
positioningBean?.latitude = location.latitude
positioningBean?.longitude = location.longitude
positioningBean?.countryCode = location.countryCode
positioningBean?.country = location.country
positioningBean?.province = location.province
positioningBean?.city = location.city
positioningBean?.district = location.district
positioningBean?.town = location.town
positioningBean?.street = location.street
positioningBean?.addrStr = location.addrStr
positioningBean?.latitude = location?.latitude
positioningBean?.longitude = location?.longitude
positioningBean?.countryCode = location?.countryCode
positioningBean?.country = location?.country
positioningBean?.province = location?.province
positioningBean?.city = location?.city
positioningBean?.district = location?.district
positioningBean?.town = location?.town
positioningBean?.street = location?.street
positioningBean?.addrStr = location?.addrStr
sp?.encode(SPUtils.POSITIONING_MAP, Gson().toJson(positioningBean).toString())
// MapView 销毁后不在处理新接收的位置
mBaiduMap?.apply {
mCurrentLat = location.latitude
mCurrentLon = location.longitude
mCurrentAccracy = location.radius
mCurrentLat = location?.latitude?:0.0
mCurrentLon = location?.longitude?:0.0
mCurrentAccracy = location?.radius?:0f
myLocationData = MyLocationData.Builder()
.accuracy(location.radius) // 设置定位数据的精度信息,单位:米
.accuracy(location?.radius?:0f) // 设置定位数据的精度信息,单位:米
.direction(mCurrentDirection.toFloat()) // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(location.latitude)
.longitude(location.longitude)
.latitude(location?.latitude?:0.0)
.longitude(location?.longitude?:0.0)
.build()
this.setMyLocationData(myLocationData)
if (isFirstLoc) {
isFirstLoc = false
val ll = LatLng(location.latitude, location.longitude)
val ll = LatLng(location?.latitude?:0.0, location?.longitude?:0.0)
val builder = MapStatus.Builder()
builder.target(ll).zoom(18.0f)
this.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()))
......
......@@ -34,6 +34,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
var addressItemBinding =
ItemBinding.of<HomeButtonItemVM>(BR.viewModel, R.layout.item_home_button)
//搜索页面回调 谷歌GPS
var pt = MutableLiveData<GPS>()
val authorizedBean = MutableLiveData<AuthorizedBean>()
......@@ -60,18 +61,11 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
this@HomeViewModel, false
) {
override fun onBusinessSuccess(response: BaseResponse<AuthorizedBean>) {
if (!Gson().toJson(response.result)
.equals(Gson().toJson(authorizedBean.value))
) {
authorizedBean.value = response.result
}
MintsWebViewActivity.startWebView(
name,
MintsWebViewActivity.toBaduVR(lat, lng, response.result?.bk)
)
}
})
} else {
......@@ -182,7 +176,9 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
if (requestCode == 200 && resultCode == SearchMapActivity.REQUEST_CODE) {
data?.let {
pt.value = GPS(
it.getDoubleExtra("latitude", 0.0), it.getDoubleExtra("longitude", 0.0)
it.getDoubleExtra("latitude", 0.0),
it.getDoubleExtra("longitude", 0.0),
it.getIntExtra("inner", 0)
)
}
}
......
......@@ -34,6 +34,7 @@ class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
val intent = Intent()
intent.putExtra("latitude",pt?.lat)
intent.putExtra("longitude",pt?.lng)
intent.putExtra("inner",viewModel.index.value)
viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent)
})
}
......@@ -100,8 +100,22 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
if (userManager.userIsLogin()) {
btn_switch.visibility = View.VISIBLE
item_invitedCode.visibility = View.VISIBLE
item_invitedCode_line.visibility = View.VISIBLE
item_invitedCode.findViewById<TextView>(R.id.tv_title).text = "用户ID"
val invitedCode = resources.getDrawable(R.mipmap.icon_settings_invite)
invitedCode.setBounds(0, 0, 56, 56)
item_invitedCode.findViewById<TextView>(R.id.tv_title)
.setCompoundDrawables(invitedCode, null, null, null)
item_invitedCode.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
item_invitedCode.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
item_invitedCode.findViewById<TextView>(R.id.tv_right).text =
"街景-${UserManager.INSTANCE.getCodeID()}"
} else {
btn_switch.visibility = View.GONE
item_invitedCode.visibility = View.GONE
item_invitedCode_line.visibility = View.GONE
}
}
......
......@@ -51,6 +51,7 @@ public class GPSConverterUtils {
}
/**
* 谷歌转百度
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
*
* @param gg_lat
......@@ -66,6 +67,7 @@ public class GPSConverterUtils {
}
/**
* 百度转谷歌
* * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 * * 将 BD-09 坐标转换成GCJ-02 坐标 * * @param
* bd_lat * @param bd_lon * @return
*/
......
......@@ -39,7 +39,7 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
}
fun toBaduVR(d:String?,bk:String?):String{
KLog.i("MintsWebViewActivity","file:///android_asset/web/mr.html?d=${d}&bk=${bk}")
return "file:///android_asset/web/m.html?d=${d}&bk=${bk}"
return "file:///android_asset/web/mr.html?d=${d}&bk=${bk}"
}
fun toBaduVR(lat:String?,lng:String?,bk:String?):String{
......
......@@ -66,7 +66,7 @@ public class ScrollLayout extends ViewGroup {
private void init(Context context) {
touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
slideSlop = AppUtils.dp2Px(context, 45);
offsetB = AppUtils.dp2Px(context, 60);
offsetB = AppUtils.dp2Px(context, 100);
animator = ValueAnimator.ofFloat(0f, 1f);
animator.setDuration(200);
animator.setInterpolator(new LinearInterpolator());
......@@ -199,8 +199,7 @@ public class ScrollLayout extends ViewGroup {
//下滑offset就是负数,上滑就是正数
int offset = (int) (lastY - eY);
lastY = eY;
if ((status == STATUS_EXTEND
|| status == STATUS_CLOSE)
if (status == STATUS_EXTEND
&& super.dispatchTouchEvent(ev)) {
return true;
}
......
......@@ -23,20 +23,19 @@
<ImageView
android:visibility="gone"
android:id="@+id/image_map_history"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:src="@mipmap/map_history_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change" />
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/image_location_icon"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginBottom="120dp"
android:layout_marginBottom="220dp"
android:layout_marginTop="15dp"
android:src="@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -23,7 +23,17 @@
style="@style/view_line_E6E6E6"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp" />
<include
android:id="@+id/item_invitedCode"
layout="@layout/item_settings" />
<View
android:id="@+id/item_invitedCode_line"
style="@style/view_line_E6E6E6"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp" />
<include
......
......@@ -53,7 +53,7 @@
android:id="@+id/image_location_icon"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginBottom="120dp"
android:layout_marginBottom="220dp"
android:layout_marginTop="15dp"
android:src="@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -28,6 +28,7 @@
android:id="@+id/tv_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:visibility="gone" />
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment