Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_fiveworld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_fiveworld
Commits
6858f40f
Commit
6858f40f
authored
Aug 04, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 首页的推荐的功能
js交互问题
parent
ba364355
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
329 additions
and
372 deletions
+329
-372
gmap.js
app/src/main/assets/web/common/gmap.js
+1
-1
latlng.js
app/src/main/assets/web/common/latlng.js
+19
-1
mr.html
app/src/main/assets/web/mr.html
+1
-1
zsmap.js
app/src/main/assets/web/zsmap.js
+279
-337
HistoryRecordAdapter.kt
...ain/java/com/mints/street/adapter/HistoryRecordAdapter.kt
+1
-0
GPS.java
app/src/main/java/com/mints/street/bean/GPS.java
+8
-1
MutualBean.kt
app/src/main/java/com/mints/street/bean/MutualBean.kt
+1
-2
GoogleMapFragment.kt
...java/com/mints/street/main/googlemap/GoogleMapFragment.kt
+13
-18
HomeViewModel.kt
...src/main/java/com/mints/street/main/home/HomeViewModel.kt
+3
-8
SearchAfterItem.kt
...c/main/java/com/mints/street/main/home/SearchAfterItem.kt
+1
-0
ScrollLayout.java
app/src/main/java/com/mints/street/widget/ScrollLayout.java
+2
-3
icon_me1.webp
app/src/main/res/mipmap-xhdpi/icon_me1.webp
+0
-0
icon_me2.webp
app/src/main/res/mipmap-xhdpi/icon_me2.webp
+0
-0
icon_me3.webp
app/src/main/res/mipmap-xhdpi/icon_me3.webp
+0
-0
icon_me4.webp
app/src/main/res/mipmap-xhdpi/icon_me4.webp
+0
-0
icon_me5.webp
app/src/main/res/mipmap-xhdpi/icon_me5.webp
+0
-0
icon_me6.webp
app/src/main/res/mipmap-xhdpi/icon_me6.webp
+0
-0
icon_me7.webp
app/src/main/res/mipmap-xhdpi/icon_me7.webp
+0
-0
icon_me8.webp
app/src/main/res/mipmap-xhdpi/icon_me8.webp
+0
-0
No files found.
app/src/main/assets/web/common/gmap.js
View file @
6858f40f
...
@@ -94,7 +94,7 @@ function tosh(center) {
...
@@ -94,7 +94,7 @@ function tosh(center) {
],
],
[
[
"zh-CN"
,
"zh-CN"
,
"
CN
"
,
"
US
"
,
null
,
null
,
0
,
0
,
null
,
null
,
...
...
app/src/main/assets/web/common/latlng.js
View file @
6858f40f
...
@@ -95,8 +95,26 @@ var CoordinateUtil = {
...
@@ -95,8 +95,26 @@ var CoordinateUtil = {
return
doubles_wgs84
;
return
doubles_wgs84
;
},
},
wgs84_to_bd
:
function
(
point
){
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
//国测局坐标转bd
var
doubles_bd
=
CoordinateUtil
.
gcj02tobd09
(
doubles_gcj
.
lng
,
doubles_gcj
.
lat
);
var
doubles_bd
=
CoordinateUtil
.
gcj02tobd09
(
doubles_gcj
.
lng
,
doubles_gcj
.
lat
);
//返回 纠偏后 坐标
//返回 纠偏后 坐标
...
...
app/src/main/assets/web/mr.html
View file @
6858f40f
app/src/main/assets/web/zsmap.js
View file @
6858f40f
window
.
google
=
window
.
google
||
{};
//var arr =[120.31, 31.58]
google
.
maps
=
google
.
maps
||
{};
var
B_MAP
;
let
G_MAP
;
//gmap
let
map
;
//fun
var
canclick
=
true
;
var
ZSYDa
;
//gmapinitneed
var
mapInited
=
false
;
//强行阻断地图加载
//获取加载参数
function
loadGoogleMap
(
Yda
)
{
//window.google.maps.Load&&window.google.maps.Load(Yda);
ZSYDa
=
Yda
;
}
(
function
()
{
function
GF_addZoom
()
{
var
zoom
=
G_MAP
.
getZoom
();
var
modules
=
google
.
maps
.
modules
=
{};
if
(
zoom
==
20
)
{
google
.
maps
.
__gjsload__
=
function
(
name
,
text
)
{
tip
(
"已放大至最大级别"
)
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
();
})();
function
al
()
{
if
(
canclick
)
{
canclick
=
false
;
setTimeout
(
function
()
{
canclick
=
true
;
},
1200
);
}
else
{
return
;
return
;
}
}
var
center
=
map
.
getCenter
();
zoom
+=
1
;
console
.
log
(
center
)
G_MAP
.
setZoom
(
zoom
);
}
const
geocoder
=
new
google
.
maps
.
Geocoder
();
const
latlng
=
{
function
GF_reduceZoom
()
{
lat
:
parseFloat
(
center
.
lat
()),
var
zoom
=
G_MAP
.
getZoom
();
lng
:
parseFloat
(
center
.
lng
()),
if
(
zoom
==
0
)
{
};
tip
(
"已缩放至最小级别"
)
toBLatLng
(
latlng
,
function
(
res
)
{
return
;
console
.
log
(
res
)
if
(
res
.
c
)
{
// tips("猜测为国内,准备使用百度")
bvr
(
res
)
}
else
{
// tips("猜测为国外,准备使用谷歌")
tosh
(
center
)
}
}
});
zoom
-=
1
;
G_MAP
.
setZoom
(
zoom
);
}
}
function
tosh
(
center
)
{
function
B_addZoom
()
{
var
zoom
=
B_MAP
.
getZoom
();
if
(
zoom
==
19
)
{
tip
(
"已放大至最大级别"
)
return
;
}
zoom
+=
1
;
B_MAP
.
setZoom
(
zoom
);
}
function
B_reduceZoom
()
{
var
zoom
=
B_MAP
.
getZoom
();
if
(
zoom
==
1
)
{
tip
(
"已缩放至最小级别"
)
return
;
}
zoom
-=
1
;
B_MAP
.
setZoom
(
zoom
);
}
console
.
log
(
"查询国外或中国台湾街景"
)
var
ser
=
new
google
.
maps
.
StreetViewService
();
var
vm
=
new
Vue
({
const
request
=
{
el
:
'#maps'
,
location
:
{
data
:
{
lat
:
center
.
lat
(),
NOWUSEBAIDU
:
true
,
lng
:
center
.
lng
()
G_MAPINITED
:
false
,
//initStatus
B_MAPINITED
:
false
,
//initStatus
canclick
:
true
,
},
created
:
function
()
{
// console.log('llll')
},
},
radius
:
10000
,
methods
:
{
preference
:
'nearest'
,
//google.maps.StreetViewPreference.NEAREST,
};
ser
.
getPanorama
(
request
,
function
(
a
)
{
vrs
:
function
()
{
if
(
a
==
null
||
a
.
location
==
null
)
{
var
th
=
this
;
tips
(
"暂无街景"
)
if
(
th
.
canclick
)
{
th
.
canclick
=
false
;
setTimeout
(
function
()
{
th
.
canclick
=
true
;
},
2000
);
}
else
{
return
;
return
;
}
}
console
.
log
(
a
.
location
.
description
)
console
.
log
(
a
.
location
.
latLng
.
lat
()
+
','
+
a
.
location
.
latLng
.
lng
())
var
point
;
if
(
!
this
.
NOWUSEBAIDU
)
{
gpoint
=
{
lat
:
G_MAP
.
getCenter
().
lat
(),
lng
:
G_MAP
.
getCenter
().
lng
()}
console
.
log
(
gpoint
)
point
=
toBPoint
(
gpoint
)
}
else
{
point
=
B_MAP
.
getCenter
();
}
// console.log("准备模拟app跳转至外国街景:" + a.location.description + "==>./streets.html?a=" + a.location.latLng
console
.
log
(
this
.
NOWUSEBAIDU
,
point
)
// .lat() + "&b=" + a.location.latLng.lng())
var
params
=
{
getLocation
(
point
,
function
(
res
)
{
"lng"
:
a
.
location
.
latLng
.
lng
(),
if
(
res
.
c
)
{
"lat"
:
a
.
location
.
latLng
.
lat
(),
console
.
log
(
"猜测为国内,准备使用百度"
)
"title"
:
a
.
location
.
description
var
center
=
B_MAP
.
getCenter
();
bvr
(
center
)
}
else
{
console
.
log
(
"猜测为国外,准备使用谷歌"
)
var
center
=
G_MAP
.
getCenter
();
tosh
(
center
);
}
}
toVurl
(
'g'
,
params
)
});
})
},
}
//var arr =[120.31, 31.58]
addZoom
:
function
()
{
var
initMap
=
function
()
{
if
(
this
.
NOWUSEBAIDU
)
{
B_addZoom
()
}
else
{
GF_addZoom
();
}
},
reduceZoom
:
function
()
{
if
(
this
.
NOWUSEBAIDU
)
{
B_reduceZoom
()
}
else
{
GF_reduceZoom
();
}
},
initZsMap
:
function
(
pointStr
)
{
console
.
log
(
">>>>>>"
,
pointStr
)
var
th
=
this
;
var
inMsg
=
JSON
.
parse
(
pointStr
)
var
point
=
{
lat
:
parseFloat
(
inMsg
.
lat
),
lng
:
parseFloat
(
inMsg
.
lng
)};
if
(
inMsg
.
inner
==
null
)
{
getLocation
(
point
,
function
(
res
)
{
if
(
res
.
c
)
{
console
.
log
(
"猜测为国内,准备使用百度"
)
th
.
G_initMap
(
point
,
14
);
th
.
B_initmap
(
point
,
14
);
}
else
{
console
.
log
(
"猜测为国外,准备使用谷歌"
)
th
.
B_initmap
(
point
,
14
);
th
.
G_initMap
(
point
,
14
);
}
});
}
else
{
if
(
inMsg
.
inner
==
0
||
inMsg
==
'0'
)
{
console
.
log
(
"确定为国内,准备使用百度"
)
th
.
B_initmap
(
point
,
14
);
}
else
{
console
.
log
(
"确定为国外,准备使用谷歌"
)
th
.
G_initMap
(
point
,
14
);
}
}
console
.
log
(
"initMap>>first"
)
map
=
new
google
.
maps
.
Map
(
document
.
getElementById
(
"map"
),
{
zoom
:
14
,
// RotateControlOptions :RIGHT_CENTER,
center
:
{
lat
:
39.90960456049752
,
lng
:
116.3972282409668
},
},
G_initMap
:
function
(
point
,
zoomLevel
)
{
console
.
log
(
"initG==>"
,
point
,
zoomLevel
)
if
(
zoomLevel
==
undefined
||
zoomLevel
==
null
)
zoomLevel
=
15
;
this
.
NOWUSEBAIDU
=
false
;
var
th
=
this
;
if
(
th
.
G_MAPINITED
==
false
)
{
//第一次初始化
th
.
G_MAPINITED
=
true
;
initMap
=
function
()
{
G_MAP
=
new
google
.
maps
.
Map
(
document
.
getElementById
(
"map"
),
{
zoom
:
zoomLevel
,
// RotateControlOptions :RIGHT_CENTER,
center
:
point
,
mapTypeId
:
"hybrid"
,
mapTypeId
:
"hybrid"
,
zoomControl
:
false
,
zoomControl
:
false
,
mapTypeControl
:
false
,
mapTypeControl
:
false
,
...
@@ -280,92 +167,147 @@ var initMap = function () {
...
@@ -280,92 +167,147 @@ var initMap = function () {
SATELLITE 此地图类型显示卫星图像。
SATELLITE 此地图类型显示卫星图像。
TERRAIN 此地图类型显示具有地形和植被等物理特征的地图。
TERRAIN 此地图类型显示具有地形和植被等物理特征的地图。
*/
*/
}
// G_MAP.addListener("center_changed", () => {
// console.log("center_changed", {lat: G_MAP.getCenter().lat(), lng: G_MAP.getCenter().lng()})
function
addZoom
()
{
// });
var
zoom
=
map
.
getZoom
();
G_MAP
.
addListener
(
'zoom_changed'
,
()
=>
{
if
(
zoom
==
20
){
vm
.
G_TO_B
();
tip
(
"已放大至最大级别"
)
});
G_MAP
.
addListener
(
"dragend"
,
()
=>
{
console
.
log
(
"dragend"
,
{
lat
:
G_MAP
.
getCenter
().
lat
(),
lng
:
G_MAP
.
getCenter
().
lng
()})
// th.G_TO_BMAP();
centerChanged
();
vm
.
G_TO_B
();
});
}
window
.
google
.
maps
.
Load
&&
window
.
google
.
maps
.
Load
(
G_ZSYDA
);
}
else
{
G_MAP
.
panTo
(
point
)
//第二次初始化
G_MAP
.
setZoom
(
zoomLevel
)
}
},
G_TO_B
:
function
()
{
var
th
=
this
;
var
zoom
=
G_MAP
.
getZoom
();
console
.
log
(
"g zoom"
,
zoom
)
if
(
zoom
<
7
)
return
;
return
;
var
gpoint
=
{
lat
:
G_MAP
.
getCenter
().
lat
(),
lng
:
G_MAP
.
getCenter
().
lng
()}
var
bpoint
=
toBPoint
(
gpoint
)
getLocation
(
bpoint
,
function
(
res
)
{
if
(
res
.
c
)
{
var
level
=
G_MAP
.
getZoom
()
+
1
;
if
(
level
<
3
)
level
=
3
;
if
(
level
>
18
)
level
=
18
;
console
.
log
(
"猜测为国内,准备谷歌转百度,bpoint==>goint:level"
,
gpoint
,
bpoint
,
level
)
th
.
B_initmap
(
bpoint
,
level
)
}
}
});
zoom
+=
1
;
},
B_initmap
:
function
(
point
,
zoomLevel
)
{
this
.
NOWUSEBAIDU
=
true
;
console
.
log
(
"initB==>"
,
point
,
zoomLevel
)
// setTimeout(function () {
if
(
zoomLevel
==
undefined
||
zoomLevel
==
null
)
zoomLevel
=
6
;
var
th
=
vm
;
if
(
th
.
B_MAPINITED
==
false
)
{
th
.
B_MAPINITED
=
true
;
// 百度地图API功能
// $("#map").hide();
B_MAP
=
new
BMap
.
Map
(
"bmap"
,
{
mapType
:
BMAP_HYBRID_MAP
,
enableBizAuthLogo
:
false
});
// 创建Map实例
B_MAP
.
centerAndZoom
(
new
BMap
.
Point
(
point
.
lng
,
point
.
lat
),
zoomLevel
);
// 初始化地图,设置中心点坐标和地图级别
// B_MAP.enableScrollWheelZoom();
// B_MAP.addControl(new BMap.NavigationControl());
// B_MAP.addControl(new BMap.ScaleControl());
// B_MAP.addControl(new BMap.OverviewMapControl());
B_MAP
.
enableScrollWheelZoom
(
true
);
//开启鼠标滚轮缩放
B_MAP
.
addEventListener
(
'dragend'
,
function
(
e
)
{
centerChanged
();
vm
.
B_TO_G
();
});
map
.
setZoom
(
zoom
);
B_MAP
.
addEventListener
(
'zoomstart'
,
function
(
type
,
target
)
{
}
// var zoom = B_MAP.getZoom();
// console.log('start zoom=', zoom, ' type=', type, ' ,target=', target);
vm
.
B_TO_G
();
});
}
else
{
B_MAP
.
centerAndZoom
(
new
BMap
.
Point
(
point
.
lng
,
point
.
lat
),
zoomLevel
);
// 初始化地图,设置中心点坐标和地图级别
console
.
log
(
">>>>>>>"
,
point
,
B_MAP
.
getCenter
())
}
// },500)
},
B_TO_G
:
function
()
{
var
th
=
this
;
var
zoom
=
B_MAP
.
getZoom
();
console
.
log
(
' zoom='
,
zoom
);
var
point
=
B_MAP
.
getCenter
();
this
.
initCenter
(
point
)
function
reduceZoom
()
{
var
zoom
=
map
.
getZoom
();
if
(
zoom
<
8
)
//小于9不切换
if
(
zoom
==
0
){
tip
(
"已缩放至最小级别"
)
return
;
return
;
getLocation
(
point
,
function
(
res
)
{
if
(
!
res
.
c
)
{
var
gpoint
=
toGPoint
(
res
)
var
level
=
B_MAP
.
getZoom
()
-
1
;
console
.
log
(
level
)
// if(level<7)
// return;
if
(
level
<
0
)
level
=
0
;
if
(
level
>
20
)
level
=
20
;
console
.
log
(
"猜测为国外,准备百度转谷歌,bpoint==>goint:level"
,
res
,
gpoint
,
level
)
th
.
G_initMap
(
gpoint
,
level
);
}
});
},
initCenter
:
function
(
point
)
{
if
(
this
.
NOWUSEBAIDU
&&
this
.
G_MAPINITED
)
{
var
gpoint
=
toGPoint
(
point
)
console
.
log
(
"同步谷歌中心"
)
G_MAP
.
setCenter
(
point
)
}
}
zoom
-=
1
;
map
.
setZoom
(
zoom
);
if
(
!
this
.
NOWUSEBAIDU
&&
this
.
B_MAPINITED
)
{
}
var
bpoint
=
toBPoint
(
point
)
console
.
log
(
"同步百度中心"
)
B_MAP
.
setCenter
(
bpoint
)
}
}
}
})
window
.
onload
=
function
()
{
window
.
onload
=
function
()
{
console
.
log
(
"window.load_+++++++++++="
)
// console.log("window.load_+++++++++++=")170.89184781519282,-9.108152184807182
allIsOk
();
allIsOk
();
// initZsMap('{"lat":35.69,"lng":139.69
}')
//vm.initZsMap('{"lat": 39.30336768549658, "lng": 350.8918478151928
}')
}
}
function
initZsMap
(
pointStr
)
{
console
.
log
(
">>"
,
pointStr
)
var
point
=
JSON
.
parse
(
pointStr
)
if
(
mapInited
==
false
)
{
//第一次初始化
mapInited
=
true
;
initMap
=
function
()
{
console
.
log
(
"initMap>>second"
)
map
=
new
google
.
maps
.
Map
(
document
.
getElementById
(
"map"
),
{
zoom
:
14
,
// RotateControlOptions :RIGHT_CENTER,
center
:
point
,
mapTypeId
:
"hybrid"
,
zoomControl
:
false
,
mapTypeControl
:
false
,
scaleControl
:
false
,
streetViewControl
:
false
,
rotateControl
:
false
,
fullscreenControl
:
false
,
clickableIcons
:
false
,
zoomControlOptions
:
{
position
:
google
.
maps
.
ControlPosition
.
RIGHT_CENTER
,
},
// scaleControlOptions:true,
});
map
.
addListener
(
"center_changed"
,
()
=>
{
centerChanged
();
});
/**
* HYBRID 此地图类型在卫星图像上显示主要街道的透明图层。
ROADMAP 此地图类型显示普通街道地图。
SATELLITE 此地图类型显示卫星图像。
TERRAIN 此地图类型显示具有地形和植被等物理特征的地图。
*/
}
window
.
google
.
maps
.
Load
&&
window
.
google
.
maps
.
Load
(
ZSYDa
);
}
else
{
map
.
panTo
(
point
)
//第二次初始化
}
}
// window.onload = function() {
// allIsOk();
// }
app/src/main/java/com/mints/street/adapter/HistoryRecordAdapter.kt
View file @
6858f40f
...
@@ -126,6 +126,7 @@ class HistoryRecordItemVHM(val activity: SearchMapActivity,val viewModel: Search
...
@@ -126,6 +126,7 @@ class HistoryRecordItemVHM(val activity: SearchMapActivity,val viewModel: Search
val
intent
=
Intent
()
val
intent
=
Intent
()
intent
.
putExtra
(
"latitude"
,
historyBean
.
latitude
)
intent
.
putExtra
(
"latitude"
,
historyBean
.
latitude
)
intent
.
putExtra
(
"longitude"
,
historyBean
.
longitude
)
intent
.
putExtra
(
"longitude"
,
historyBean
.
longitude
)
intent
.
putExtra
(
"inner"
,
viewModel
.
index
.
value
)
viewModel
.
finishData
(
SearchMapActivity
.
REQUEST_CODE
,
intent
)
viewModel
.
finishData
(
SearchMapActivity
.
REQUEST_CODE
,
intent
)
})
})
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/bean/GPS.java
View file @
6858f40f
...
@@ -16,8 +16,15 @@ public class GPS {
...
@@ -16,8 +16,15 @@ public class GPS {
private
@Nullable
double
lng
;
private
@Nullable
double
lng
;
private
@Nullable
int
inner
=
0
;
public
GPS
()
{
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
)
{
public
GPS
(
double
lat
,
double
lng
)
{
this
.
lat
=
lat
;
this
.
lat
=
lat
;
...
@@ -41,6 +48,6 @@ public class GPS {
...
@@ -41,6 +48,6 @@ public class GPS {
}
}
public
String
toString
()
{
public
String
toString
()
{
return
"lat:"
+
lat
+
","
+
"lng:"
+
lng
;
return
"lat:"
+
lat
+
","
+
"lng:"
+
lng
+
","
+
"inner:"
+
inner
;
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/bean/MutualBean.kt
View file @
6858f40f
...
@@ -8,6 +8,5 @@ class MutualBean {
...
@@ -8,6 +8,5 @@ class MutualBean {
var
d
:
String
?=
null
var
d
:
String
?=
null
var
lat
:
String
?=
null
var
lat
:
String
?=
null
var
lng
:
String
?=
null
var
lng
:
String
?=
null
var
blat
:
String
?=
null
var
inner
:
Int
=
0
var
blng
:
String
?=
null
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/googlemap/GoogleMapFragment.kt
View file @
6858f40f
package
com.mints.street.main.googlemap
package
com.mints.street.main.googlemap
import
android.os.Bundle
import
android.os.Bundle
import
android.os.Handler
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -41,13 +42,14 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
...
@@ -41,13 +42,14 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
var
mLocationClient
:
LocationClient
?
=
null
var
mLocationClient
:
LocationClient
?
=
null
private
val
myListener
:
MyLocationListener
=
MyLocationListener
()
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
{
inner
class
MyLocationListener
:
BDLocationListener
{
override
fun
onReceiveLocation
(
location
:
BDLocation
?)
{
override
fun
onReceiveLocation
(
location
:
BDLocation
?)
{
gps
.
lat
=
location
?.
latitude
?:
0.0
gps
.
lat
=
location
?.
latitude
?:
39.915121
gps
.
lng
=
location
?.
longitude
?:
0.0
gps
.
lng
=
location
?.
longitude
?:
116.403947
}
}
}
}
...
@@ -68,6 +70,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
...
@@ -68,6 +70,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
override
fun
initData
()
{
override
fun
initData
()
{
super
.
initData
()
super
.
initData
()
Handler
().
postDelayed
({
isScrollLayoutClose
=
true
},
2000
)
binding
.
webview
.
setDefaultHandler
(
DefaultHandler
())
binding
.
webview
.
setDefaultHandler
(
DefaultHandler
())
binding
.
webview
.
webChromeClient
=
WebChromeClient
()
binding
.
webview
.
webChromeClient
=
WebChromeClient
()
binding
.
webview
.
setOnLongClickListener
{
true
}
binding
.
webview
.
setOnLongClickListener
{
true
}
...
@@ -125,8 +129,10 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
...
@@ -125,8 +129,10 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
//地图改变时
//地图改变时
binding
.
webview
.
registerHandler
(
"centerChanged"
)
{
data
,
_
->
binding
.
webview
.
registerHandler
(
"centerChanged"
)
{
data
,
_
->
KLog
.
a
(
"js - > android centerChanged"
,
data
)
KLog
.
a
(
"js - > android centerChanged"
,
data
)
if
(!
binding
.
scrollLayout
.
isClose
){
if
(!
binding
.
scrollLayout
.
isClose
&&
isScrollLayoutClose
)
{
binding
.
scrollLayout
.
toggle
(
STATUS_CLOSE
)
binding
.
scrollLayout
.
post
{
binding
.
scrollLayout
.
toggle
(
ScrollLayout
.
STATUS_CLOSE
)
}
}
}
}
}
//加载完成
//加载完成
...
@@ -164,14 +170,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
...
@@ -164,14 +170,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
* 调用JS
* 调用JS
*/
*/
private
fun
initZsMap
()
{
private
fun
initZsMap
()
{
val
bd09ToGcj02
=
GPSConverterUtils
.
bd09_To_Gcj02
(
gps
.
lat
,
gps
.
lat
)
val
mutualBean
=
MutualBean
()
mutualBean
.
lat
=
bd09ToGcj02
.
lat
.
toString
()
mutualBean
.
lng
=
bd09ToGcj02
.
lng
.
toString
()
mutualBean
.
blat
=
gps
.
lat
.
toString
()
mutualBean
.
blng
=
gps
.
lng
.
toString
()
binding
.
webview
.
callHandler
(
"initZsMap"
binding
.
webview
.
callHandler
(
"initZsMap"
,
Gson
().
toJson
(
mutualBean
)
)
{
,
Gson
().
toJson
(
gps
)
)
{
}
}
}
}
...
@@ -232,12 +232,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
...
@@ -232,12 +232,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
}
}
})
})
viewModel
.
pt
.
observe
(
this
,
Observer
{
viewModel
.
pt
.
observe
(
this
,
Observer
{
val
bd09ToGcj02
=
GPSConverterUtils
.
bd09_To_Gcj02
(
it
.
lat
,
it
.
lat
)
KLog
.
a
(
"GPSConverterUtils.bd09_To_Gcj02"
,
Gson
().
toJson
(
it
))
val
mutualBean
=
MutualBean
()
mutualBean
.
lat
=
bd09ToGcj02
.
lat
.
toString
()
mutualBean
.
lng
=
bd09ToGcj02
.
lng
.
toString
()
mutualBean
.
blat
=
it
.
lat
.
toString
()
mutualBean
.
blng
=
it
.
lng
.
toString
()
binding
.
webview
.
callHandler
(
"initZsMap"
binding
.
webview
.
callHandler
(
"initZsMap"
,
Gson
().
toJson
(
it
)
)
{
,
Gson
().
toJson
(
it
)
)
{
}
}
...
...
app/src/main/java/com/mints/street/main/home/HomeViewModel.kt
View file @
6858f40f
...
@@ -61,18 +61,11 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
...
@@ -61,18 +61,11 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
this
@HomeViewModel
,
false
this
@HomeViewModel
,
false
)
{
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
AuthorizedBean
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
AuthorizedBean
>)
{
if
(!
Gson
().
toJson
(
response
.
result
)
.
equals
(
Gson
().
toJson
(
authorizedBean
.
value
))
)
{
authorizedBean
.
value
=
response
.
result
}
MintsWebViewActivity
.
startWebView
(
MintsWebViewActivity
.
startWebView
(
name
,
name
,
MintsWebViewActivity
.
toBaduVR
(
lat
,
lng
,
response
.
result
?.
bk
)
MintsWebViewActivity
.
toBaduVR
(
lat
,
lng
,
response
.
result
?.
bk
)
)
)
}
}
})
})
}
else
{
}
else
{
...
@@ -183,7 +176,9 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
...
@@ -183,7 +176,9 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
if
(
requestCode
==
200
&&
resultCode
==
SearchMapActivity
.
REQUEST_CODE
)
{
if
(
requestCode
==
200
&&
resultCode
==
SearchMapActivity
.
REQUEST_CODE
)
{
data
?.
let
{
data
?.
let
{
pt
.
value
=
GPS
(
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
)
)
)
}
}
}
}
...
...
app/src/main/java/com/mints/street/main/home/SearchAfterItem.kt
View file @
6858f40f
...
@@ -34,6 +34,7 @@ class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
...
@@ -34,6 +34,7 @@ class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
val
intent
=
Intent
()
val
intent
=
Intent
()
intent
.
putExtra
(
"latitude"
,
pt
?.
lat
)
intent
.
putExtra
(
"latitude"
,
pt
?.
lat
)
intent
.
putExtra
(
"longitude"
,
pt
?.
lng
)
intent
.
putExtra
(
"longitude"
,
pt
?.
lng
)
intent
.
putExtra
(
"inner"
,
viewModel
.
index
.
value
)
viewModel
.
finishData
(
SearchMapActivity
.
REQUEST_CODE
,
intent
)
viewModel
.
finishData
(
SearchMapActivity
.
REQUEST_CODE
,
intent
)
})
})
}
}
app/src/main/java/com/mints/street/widget/ScrollLayout.java
View file @
6858f40f
...
@@ -66,7 +66,7 @@ public class ScrollLayout extends ViewGroup {
...
@@ -66,7 +66,7 @@ public class ScrollLayout extends ViewGroup {
private
void
init
(
Context
context
)
{
private
void
init
(
Context
context
)
{
touchSlop
=
ViewConfiguration
.
get
(
context
).
getScaledTouchSlop
();
touchSlop
=
ViewConfiguration
.
get
(
context
).
getScaledTouchSlop
();
slideSlop
=
AppUtils
.
dp2Px
(
context
,
45
);
slideSlop
=
AppUtils
.
dp2Px
(
context
,
45
);
offsetB
=
AppUtils
.
dp2Px
(
context
,
6
0
);
offsetB
=
AppUtils
.
dp2Px
(
context
,
10
0
);
animator
=
ValueAnimator
.
ofFloat
(
0
f
,
1
f
);
animator
=
ValueAnimator
.
ofFloat
(
0
f
,
1
f
);
animator
.
setDuration
(
200
);
animator
.
setDuration
(
200
);
animator
.
setInterpolator
(
new
LinearInterpolator
());
animator
.
setInterpolator
(
new
LinearInterpolator
());
...
@@ -199,8 +199,7 @@ public class ScrollLayout extends ViewGroup {
...
@@ -199,8 +199,7 @@ public class ScrollLayout extends ViewGroup {
//下滑offset就是负数,上滑就是正数
//下滑offset就是负数,上滑就是正数
int
offset
=
(
int
)
(
lastY
-
eY
);
int
offset
=
(
int
)
(
lastY
-
eY
);
lastY
=
eY
;
lastY
=
eY
;
if
((
status
==
STATUS_EXTEND
if
(
status
==
STATUS_EXTEND
||
status
==
STATUS_CLOSE
)
&&
super
.
dispatchTouchEvent
(
ev
))
{
&&
super
.
dispatchTouchEvent
(
ev
))
{
return
true
;
return
true
;
}
}
...
...
app/src/main/res/mipmap-xhdpi/icon_me1.webp
deleted
100644 → 0
View file @
ba364355
File deleted
app/src/main/res/mipmap-xhdpi/icon_me2.webp
deleted
100644 → 0
View file @
ba364355
File deleted
app/src/main/res/mipmap-xhdpi/icon_me3.webp
deleted
100644 → 0
View file @
ba364355
File deleted
app/src/main/res/mipmap-xhdpi/icon_me4.webp
deleted
100644 → 0
View file @
ba364355
File deleted
app/src/main/res/mipmap-xhdpi/icon_me5.webp
deleted
100644 → 0
View file @
ba364355
File deleted
app/src/main/res/mipmap-xhdpi/icon_me6.webp
deleted
100644 → 0
View file @
ba364355
File deleted
app/src/main/res/mipmap-xhdpi/icon_me7.webp
deleted
100644 → 0
View file @
ba364355
File deleted
app/src/main/res/mipmap-xhdpi/icon_me8.webp
deleted
100644 → 0
View file @
ba364355
File deleted
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment