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
5e806fc8
Commit
5e806fc8
authored
Jul 13, 2021
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
8d8b7ed2
e937e0fc
Changes
41
Show whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
772 additions
and
443 deletions
+772
-443
build.gradle
app/build.gradle
+4
-4
umeng-apm-armeabi-v1.2.0.aar
app/libs/umeng-apm-armeabi-v1.2.0.aar
+0
-0
umeng-asms-armeabi-v1.2.2.aar
app/libs/umeng-asms-armeabi-v1.2.2.aar
+0
-0
umeng-common-9.3.8.jar
app/libs/umeng-common-9.3.8.jar
+0
-0
proguard-rules.pro
app/proguard-rules.pro
+29
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+13
-6
AppApplication.kt
app/src/main/java/com/mints/street/AppApplication.kt
+27
-8
GridMapAdapter.kt
app/src/main/java/com/mints/street/adapter/GridMapAdapter.kt
+8
-1
MainApi.kt
app/src/main/java/com/mints/street/api/MainApi.kt
+1
-1
LoginViewModel.kt
app/src/main/java/com/mints/street/login/LoginViewModel.kt
+3
-1
MainActivity.kt
app/src/main/java/com/mints/street/main/MainActivity.kt
+15
-1
HistoricalimageActivity.kt
...ava/com/mints/street/main/home/HistoricalimageActivity.kt
+33
-0
HistoricalimageModel.kt
...n/java/com/mints/street/main/home/HistoricalimageModel.kt
+7
-0
HomeFragment.kt
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
+181
-45
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+3
-1
PanoramicActivity.kt
...c/main/java/com/mints/street/main/vr/PanoramicActivity.kt
+225
-0
PanoramicViewModel.kt
.../main/java/com/mints/street/main/vr/PanoramicViewModel.kt
+10
-0
ApiModel.kt
app/src/main/java/com/mints/street/model/ApiModel.kt
+1
-1
HttpConfiguation.java
.../java/com/mints/street/netwrok/base/HttpConfiguation.java
+1
-1
HttpSubscribeImpl.kt
...n/java/com/mints/street/netwrok/base/HttpSubscribeImpl.kt
+1
-1
IHttpResponseListener.java
.../com/mints/street/netwrok/base/IHttpResponseListener.java
+1
-1
IHttpSubscribe.kt
...main/java/com/mints/street/netwrok/base/IHttpSubscribe.kt
+1
-1
RetrofitClient.java
...in/java/com/mints/street/netwrok/base/RetrofitClient.java
+2
-4
GsonConverterFactory.java
...com/mints/street/netwrok/common/GsonConverterFactory.java
+138
-0
HttpErrorProcess.java
...ava/com/mints/street/netwrok/common/HttpErrorProcess.java
+1
-1
HttpManager.java
...ain/java/com/mints/street/netwrok/common/HttpManager.java
+4
-5
OkHttpInterceptor.kt
...java/com/mints/street/netwrok/common/OkHttpInterceptor.kt
+5
-1
SplashActivity.kt
app/src/main/java/com/mints/street/splash/SplashActivity.kt
+8
-7
libCtaApiLib.so
app/src/main/jniLibs/arm64-v8a/libCtaApiLib.so
+0
-0
libCtaApiLib.so
app/src/main/jniLibs/armeabi-v7a/libCtaApiLib.so
+0
-0
libCtaApiLib.so
app/src/main/jniLibs/armeabi/libCtaApiLib.so
+0
-0
activity_historical_image.xml
app/src/main/res/layout/activity_historical_image.xml
+17
-0
activity_panoramic.xml
app/src/main/res/layout/activity_panoramic.xml
+27
-0
ic_launcher.xml
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+0
-5
ic_launcher_round.xml
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+0
-5
ic_launcher.png
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
+0
-0
ic_launcher_round.png
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
+0
-0
build.gradle
build.gradle
+6
-0
HttpResponseListenerImpl.java
...va/com/fry/base/basenetwork/HttpResponseListenerImpl.java
+0
-95
HttpsUtil.java
...ase/src/main/java/com/fry/base/basenetwork/HttpsUtil.java
+0
-60
SslHttpsUtils.java
...src/main/java/com/fry/base/basenetwork/SslHttpsUtils.java
+0
-187
No files found.
app/build.gradle
View file @
5e806fc8
...
...
@@ -134,7 +134,7 @@ android {
}
dependencies
{
implementation
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
implementation
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
testImplementation
rootProject
.
ext
.
support
[
"junit"
]
//下拉刷新
...
...
@@ -162,8 +162,9 @@ dependencies {
// 应用管理中心分包
implementation
(
name:
'humesdk-1.0.0'
,
ext:
'aar'
)
// umeng
implementation
(
name:
'umeng-asms-armeabi-v1.2.2'
,
ext:
'aar'
)
implementation
(
name:
'umeng-apm-armeabi-v1.2.0'
,
ext:
'aar'
)
implementation
'com.umeng.umsdk:common:9.4.0'
// 必选
implementation
'com.umeng.umsdk:asms:1.2.3'
// 必选
implementation
'com.umeng.umsdk:apm:1.4.0'
// 穿山甲 GroMore
// mediation_ad_sdk
implementation
(
name:
'mediation_ad_sdk_2.8.1.0'
,
ext:
'aar'
)
...
...
@@ -178,7 +179,6 @@ dependencies {
//RxPay
implementation
'com.cuieney:rxpay-api:2.2.3'
kapt
'com.cuieney:rxpay-compiler:2.1.1'
implementation
'com.romandanylyk:pageindicatorview:1.0.3'
implementation
(
name:
'BaiduLBS_AndroidSDK_Lib'
,
ext:
'aar'
)
...
...
app/libs/umeng-apm-armeabi-v1.2.0.aar
deleted
100644 → 0
View file @
8d8b7ed2
File deleted
app/libs/umeng-asms-armeabi-v1.2.2.aar
deleted
100644 → 0
View file @
8d8b7ed2
File deleted
app/libs/umeng-common-9.3.8.jar
deleted
100644 → 0
View file @
8d8b7ed2
File deleted
app/proguard-rules.pro
View file @
5e806fc8
...
...
@@ -410,6 +410,35 @@
# ======================= 穿山甲 GroMore END ================
# ===================== RxPay START ================
-keep class com.alipay.android.app.IAlixPay{*;}
-keep class com.alipay.android.app.IAlixPay$Stub{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
-keep class com.alipay.sdk.app.PayTask{ public *;}
-keep class com.alipay.sdk.app.AuthTask{ public *;}
-keep class com.alipay.sdk.app.H5PayCallback {
<fields>;
<methods>;
}
-keep class com.alipay.android.phone.mrpc.core.
*
* { *; }
-keep class com.alipay.apmobilesecuritysdk.
*
* { *; }
-keep class com.alipay.mobile.framework.service.annotation.
*
* { *; }
-keep class com.alipay.mobilesecuritysdk.face.
*
* { *; }
-keep class com.alipay.tscenter.biz.rpc.
*
* { *; }
-keep class org.json.alipay.
*
* { *; }
-keep class com.alipay.tscenter.
*
* { *; }
-keep class com.ta.utdid2.
*
* { *;}
-keep class com.ut.device.
*
* { *;}
-dontwarn com.alipay.
*
*
# ======================= RxPay END ================
# ===================== 百度地图 START ================
-keep class com.baidu.
*
* {*;}
-keep class vi.com.
*
* {*;}
...
...
app/src/main/AndroidManifest.xml
View file @
5e806fc8
...
...
@@ -22,15 +22,14 @@
<!-- 获取手机状态信息 -->
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<application
android:name=
"com.mints.street.AppApplication"
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:icon=
"@mipmap/ic_launcher
_main
"
android:label=
"@string/app_name"
android:largeHeap=
"true"
android:networkSecurityConfig=
"@xml/network_security_config"
android:requestLegacyExternalStorage=
"true"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
android:usesCleartextTraffic=
"true"
>
...
...
@@ -69,20 +68,25 @@
android:process=
":remote"
/>
<activity
android:name=
"com.mints.street.splash.SplashActivity"
android:excludeFromRecents=
"true"
android:theme=
"@style/NormalSplash"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<data
android:scheme=
"um.60e80209a6f90557b7b19aa7"
/>
</intent-filter>
</activity>
<activity
android:name=
"com.mints.street.login.LoginActivity"
>
</activity>
<activity
android:name=
"com.mints.street.main.MainActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:excludeFromRecents=
"true"
android:launchMode=
"singleTask"
android:theme=
"@style/AppTheme.NoneTranslucent"
>
...
...
@@ -91,6 +95,8 @@
<activity
android:name=
".main.my.AboutusActivity"
/>
<activity
android:name=
".main.my.PermissionsActivity"
/>
<activity
android:name=
".main.my.OpenvipActivity"
/>
<activity
android:name=
".main.home.HistoricalimageActivity"
/>
<!-- ShareSDK start -->
<activity
android:name=
"com.mob.tools.MobUIShell"
...
...
@@ -174,6 +180,7 @@
android:exported=
"false"
android:screenOrientation=
"behind"
android:windowSoftInputMode=
"adjustResize|stateHidden"
/>
<activity
android:name=
".main.vr.PanoramicActivity"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/mints/street/AppApplication.kt
View file @
5e806fc8
package
com.mints.street
import
android.content.Context
import
android.os.StrictMode
import
android.os.StrictMode.VmPolicy
import
android.util.Log
import
android.widget.Toast
import
com.baidu.lbsapi.BMapManager
import
com.baidu.mapapi.CoordType
import
com.baidu.mapapi.SDKInitializer
import
com.cuieney.rxpay_annotation.WX
import
com.fry.base.base.BaseApp
import
com.mints.street.main.vr.PanoramicActivity
import
com.mints.street.manager.CsjGroMoreManager
import
com.mints.street.manager.UmengManager
import
me.goldze.mvvmhabit.utils.KLog
import
java.util.concurrent.TimeoutException
/**
...
...
@@ -28,14 +33,14 @@ class AppApplication : BaseApp() {
builder
.
detectFileUriExposure
()
// 解决java.util.concurrent.TimeoutException https://www.jianshu.com/p/844ef9c84f15
val
defaultUncaughtExceptionHandler
=
Thread
.
getDefaultUncaughtExceptionHandler
()
Thread
.
setDefaultUncaughtExceptionHandler
{
t
,
e
->
if
(
t
.
name
==
"FinalizerWatchdogDaemon"
&&
e
is
TimeoutException
)
{
Log
.
e
(
"ignore"
,
"ignore"
)
}
else
{
defaultUncaughtExceptionHandler
?.
uncaughtException
(
t
,
e
)
}
}
//
val defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler()
//
Thread.setDefaultUncaughtExceptionHandler { t, e ->
//
if (t.name == "FinalizerWatchdogDaemon" && e is TimeoutException) {
//
Log.e("ignore", "ignore")
//
} else {
//
defaultUncaughtExceptionHandler?.uncaughtException(t, e)
//
}
//
}
}
/*
...
...
@@ -54,10 +59,24 @@ class AppApplication : BaseApp() {
//自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型.
//包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。
SDKInitializer
.
setCoordType
(
CoordType
.
BD09LL
)
//百度全景
initEngineManager
(
this
)
}
/**
* 初始化百度全景
*/
private
fun
initEngineManager
(
context
:
Context
)
{
if
(
mBMapManager
==
null
)
{
mBMapManager
=
BMapManager
(
context
)
}
if
(
mBMapManager
?.
init
(
PanoramicActivity
.
MyGeneralListener
())==
false
)
{
KLog
.
e
(
"BMapManager"
,
"BMapManager 初始化错误!"
)
}
}
companion
object
{
var
mContext
:
AppApplication
?
=
null
var
mBMapManager
:
BMapManager
?
=
null
fun
getContext
():
AppApplication
?
{
return
mContext
...
...
app/src/main/java/com/mints/street/adapter/GridMapAdapter.kt
View file @
5e806fc8
...
...
@@ -8,7 +8,9 @@ import com.fry.base.adapter.BindingViewHolder
import
com.fry.base.binding.setMargin
import
com.mints.street.R
import
com.mints.street.databinding.ItemGridMapAdapterBinding
import
com.mints.street.main.vr.PanoramicActivity
import
me.goldze.mvvmhabit.utils.AppUtils
import
me.goldze.mvvmhabit.utils.RxUtils
/**
* Created by 冯瑞雨 on 2021/7/9.
...
...
@@ -24,6 +26,11 @@ class GridMapAdapter(val context: Context,val list :List<String>):AbstractVLayo
}
else
{
holder
.
binding
.
bg
.
setMargin
(
0
,
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
null
,
null
,
null
)
}
RxUtils
.
onMultiClick
(
holder
.
binding
.
bg
){
PanoramicActivity
.
starPanoramicActivity
(
context
,
""
,
PanoramicActivity
.
WGS84
,
lat
=
39.906283536127169
,
lon
=
116.39129554889048
)
}
}
override
fun
getItemCount
()
=
list
.
size
...
...
app/src/main/java/com/mints/street/api/MainApi.kt
View file @
5e806fc8
...
...
@@ -2,7 +2,7 @@ package com.mints.street.api
import
com.mints.street.bean.AwardBean
import
com.mints.street.bean.UserBean
import
com.mints.street.netwrok.HttpManager
import
com.mints.street.netwrok.
common.
HttpManager
import
io.reactivex.Observable
import
me.goldze.mvvmhabit.http.BaseResponse
import
retrofit2.Response
...
...
app/src/main/java/com/mints/street/login/LoginViewModel.kt
View file @
5e806fc8
package
com.mints.street.login
import
android.app.Application
import
com.fry.base.basenetwork.HttpSubscribeImpl
import
com.mints.street.bean.AwardBean
import
com.mints.street.model.ApiModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.http.BaseResponse
import
me.goldze.mvvmhabit.utils.KLog
...
...
@@ -26,7 +26,9 @@ class LoginViewModel(application:Application):BaseViewModel(application) {
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
AwardBean
>)
{
KLog
.
e
(
"sfdsdf"
,
response
.
result
.
toString
())
}
override
fun
onBusinessFail
(
response
:
BaseResponse
<
AwardBean
>?)
{
}
})
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/MainActivity.kt
View file @
5e806fc8
...
...
@@ -20,7 +20,7 @@ import com.mints.street.main.my.MyFragment
import
com.mints.street.main.vr.VRFragment
import
com.mints.street.manager.UmengManager
import
com.tbruyelle.rxpermissions2.RxPermissions
import
kotlinx.android.synthetic.main.layout_popupwindow.*
import
com.umeng.analytics.MobclickAgent
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.ToastUtils
...
...
@@ -70,6 +70,20 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
}
override
fun
onResume
()
{
super
.
onResume
()
// 友盟
MobclickAgent
.
onResume
(
this
)
}
override
fun
onPause
()
{
super
.
onPause
()
// 友盟
MobclickAgent
.
onPause
(
this
)
}
var
oldTime
:
Long
=
0
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
):
Boolean
{
when
(
keyCode
)
{
...
...
app/src/main/java/com/mints/street/main/home/HistoricalimageActivity.kt
0 → 100644
View file @
5e806fc8
package
com.mints.street.main.home
import
android.os.Bundle
import
android.view.View
import
com.coorchice.library.utils.LogUtils
import
com.fry.base.base.BaseActivity
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.ActivityHistoricalImageBinding
import
kotlinx.android.synthetic.main.activity_historical_image.*
import
me.goldze.mvvmhabit.utils.ToastUtils
/**
* 描述:历史影像
* 作者:孟崔广
* 时间:2021/7/12 17:51
*/
class
HistoricalimageActivity
:
BaseActivity
<
ActivityHistoricalImageBinding
,
HistoricalimageModel
>(),
View
.
OnClickListener
{
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)=
R
.
layout
.
activity_historical_image
override
fun
initData
()
{
super
.
initData
()
initView
()
}
private
fun
initView
()
{
}
override
fun
onClick
(
v
:
View
?)
{
}
}
app/src/main/java/com/mints/street/main/home/HistoricalimageModel.kt
0 → 100644
View file @
5e806fc8
package
com.mints.street.main.home
import
android.app.Application
import
me.goldze.mvvmhabit.base.BaseViewModel
class
HistoricalimageModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
View file @
5e806fc8
package
com.mints.street.main.home
import
android.content.Context.SENSOR_SERVICE
import
android.graphics.Color
import
android.hardware.Sensor
import
android.hardware.SensorEvent
import
android.hardware.SensorEventListener
import
android.hardware.SensorManager
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
com.baidu.location.BDLocation
import
com.baidu.location.BDLocationListener
import
com.baidu.location.LocationClient
import
com.baidu.location.LocationClientOption
import
com.baidu.mapapi.map.*
import
com.baidu.mapapi.model.LatLng
import
com.baidu.mapapi.search.core.RecommendStopInfo
import
com.baidu.mapapi.search.recommendstop.OnGetRecommendStopResultListener
import
com.baidu.mapapi.search.recommendstop.RecommendStopResult
import
com.baidu.mapapi.search.recommendstop.RecommendStopSearch
import
com.baidu.mapapi.search.recommendstop.RecommendStopSearchOption
import
com.fry.base.base.BaseFragment
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.FragmentHomeBinding
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.RxUtils
...
...
@@ -24,7 +31,7 @@ import me.goldze.mvvmhabit.utils.RxUtils
* Created by 冯瑞雨 on 2021/7/2.
* 首页页面
*/
class
HomeFragment
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>()
{
class
HomeFragment
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>(),
SensorEventListener
{
private
var
mBaiduMap
:
BaiduMap
?
=
null
...
...
@@ -32,28 +39,54 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
private
var
mRecommendStopSearch
:
RecommendStopSearch
?
=
null
// 定位相关
private
var
mLocClient
:
LocationClient
?
=
null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
// 定位图层显示方式
private
var
mCurrentMode
:
MyLocationConfiguration
.
LocationMode
?
=
null
private
var
mSensorManager
:
SensorManager
?
=
null
private
var
lastX
=
0.0
//// 此处设置开发者获取到的方向信息,顺时针0-360
private
var
mCurrentDirection
=
0
//纬度
private
var
mCurrentLat
=
0.0
//经度
private
var
mCurrentLon
=
0.00
//设置定位数据的精度信息,单位:米
private
var
mCurrentAccracy
=
0f
// 是否首次定位
private
var
isFirstLoc
=
true
private
var
myLocationData
:
MyLocationData
?
=
null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)=
R
.
layout
.
fragment_home
savedInstanceState
:
Bundle
?
)
=
R
.
layout
.
fragment_home
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initData
(
)
{
super
.
initData
(
)
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?
)
{
super
.
onActivityCreated
(
savedInstanceState
)
initMap
()
}
override
fun
initData
()
{
super
.
initData
()
viewModel
.
add
()
}
private
fun
initMap
(){
private
fun
initMap
()
{
mBaiduMap
=
binding
.
bmapView
.
map
mBaiduMap
?.
mapType
=
BaiduMap
.
MAP_TYPE_SATELLITE
binding
.
bmapView
.
showZoomControls
(
false
)
//设置是否显示缩放控件
//设置是否显示缩放控件
binding
.
bmapView
.
showZoomControls
(
false
)
// 构建地图状态
val
builder
=
MapStatus
.
Builder
()
// 默认 天安门
...
...
@@ -62,27 +95,31 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
val
zoom
=
11.0f
builder
.
target
(
center
).
zoom
(
zoom
)
val
mapStatusUpdate
=
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
())
// 设置地图状态
mBaiduMap
?.
setMapStatus
(
mapStatusUpdate
)
mBaiduMap
?.
setOnMapStatusChangeListener
(
object
:
BaiduMap
.
OnMapStatusChangeListener
{
mBaiduMap
?.
setOnMapStatusChangeListener
(
object
:
BaiduMap
.
OnMapStatusChangeListener
{
override
fun
onMapStatusChangeStart
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动开始"
)
KLog
.
a
(
"百度map"
,
"移动开始"
)
}
override
fun
onMapStatusChangeStart
(
status
:
MapStatus
?,
reason
:
Int
)
{
KLog
.
a
(
"百度map"
,
"移动开始,两个参数"
)
KLog
.
a
(
"百度map"
,
"移动开始,两个参数"
)
}
override
fun
onMapStatusChange
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动改变"
)
KLog
.
a
(
"百度map"
,
"移动改变"
)
}
override
fun
onMapStatusChangeFinish
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动结束"
)
val
center
=
status
?.
target
mRecommendStopSearch
?.
requestRecommendStop
(
RecommendStopSearchOption
().
location
(
center
))
KLog
.
a
(
"百度map"
,
"移动结束"
)
mRecommendStopSearch
?.
requestRecommendStop
(
RecommendStopSearchOption
().
location
(
center
)
)
}
})
...
...
@@ -98,13 +135,55 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
mBaiduMap
?.
setMapStatus
(
MapStatusUpdateFactory
.
zoomOut
())
}
mRecommendStopSearch
=
RecommendStopSearch
.
newInstance
()
mRecommendStopSearch
?.
setOnGetRecommendStopResultListener
(
object
:
OnGetRecommendStopResultListener
{
override
fun
onGetRecommendStopResult
(
result
:
RecommendStopResult
?)
{
mRecommendStopSearch
?.
setOnGetRecommendStopResultListener
{
result
->
if
(
result
!=
null
)
{
addMarkerToMap
(
result
.
recommendStopInfoList
)
}
}
})
//重新回到定位点
RxUtils
.
onMultiClick
(
binding
.
imageLocationIcon
){
// 默认 天安门
val
center
=
LatLng
(
mCurrentLat
,
mCurrentLon
)
// 默认 11级
val
zoom
=
17.0f
builder
.
target
(
center
).
zoom
(
zoom
)
val
mapStatusUpdate
=
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
())
// 设置地图状态
mBaiduMap
?.
setMapStatus
(
mapStatusUpdate
)
}
//定位初始化
initLocation
()
}
/**
* 定位初始化
*/
private
fun
initLocation
()
{
// 获取传感器管理服务
mSensorManager
=
AppManager
.
getAppManager
().
currentActivity
.
getSystemService
(
SENSOR_SERVICE
)
as
SensorManager
mCurrentMode
=
MyLocationConfiguration
.
LocationMode
.
NORMAL
// 为系统的方向传感器注册监听器
mSensorManager
?.
registerListener
(
this
,
mSensorManager
?.
getDefaultSensor
(
Sensor
.
TYPE_ORIENTATION
),
SensorManager
.
SENSOR_DELAY_UI
)
// 开启定位图层
mBaiduMap
?.
isMyLocationEnabled
=
true
// 定位初始化
mLocClient
=
LocationClient
(
context
)
mLocClient
?.
registerLocationListener
(
MyLocationListener
())
val
option
=
LocationClientOption
()
// 打开gps
option
.
isOpenGps
=
true
// 设置坐标类型
option
.
setCoorType
(
"bd09ll"
)
option
.
setScanSpan
(
1000
)
mLocClient
?.
locOption
=
option
mLocClient
?.
start
()
}
...
...
@@ -120,9 +199,17 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
override
fun
onDestroy
()
{
super
.
onDestroy
()
// 取消注册传感器监听
mSensorManager
?.
unregisterListener
(
this
)
// 退出时销毁定位
mLocClient
?.
stop
()
// 关闭定位图层
mBaiduMap
?.
isMyLocationEnabled
=
false
mRecommendStopSearch
?.
destroy
()
binding
.
bmapView
.
onDestroy
()
}
/**
* 推荐上车点添加到地图上
* @param stops 推荐上车点列表
...
...
@@ -140,13 +227,62 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
stop
.
location
,
-
47
)
val
markerOptions
=
MarkerOptions
()
markerOptions
.
icon
(
mBitmapDescriptor
).
position
(
stop
.
location
).
scaleX
(
0.5f
).
scaleY
(
0.5f
)
markerOptions
.
icon
(
mBitmapDescriptor
).
position
(
stop
.
location
).
scaleX
(
0.5f
)
.
scaleY
(
0.5f
)
.
infoWindow
(
infoWindow
)
mBaiduMap
!!
.
addOverlay
(
markerOptions
)
}
}
}
}
/**
* 定位SDK监听函数
*/
inner
class
MyLocationListener
:
BDLocationListener
{
override
fun
onReceiveLocation
(
location
:
BDLocation
)
{
// MapView 销毁后不在处理新接收的位置
mBaiduMap
?.
apply
{
mCurrentLat
=
location
.
latitude
mCurrentLon
=
location
.
longitude
mCurrentAccracy
=
location
.
radius
myLocationData
=
MyLocationData
.
Builder
()
.
accuracy
(
location
.
radius
)
// 设置定位数据的精度信息,单位:米
.
direction
(
mCurrentDirection
.
toFloat
())
// 此处设置开发者获取到的方向信息,顺时针0-360
.
latitude
(
location
.
latitude
)
.
longitude
(
location
.
longitude
)
.
build
()
this
.
setMyLocationData
(
myLocationData
)
if
(
isFirstLoc
)
{
isFirstLoc
=
false
val
ll
=
LatLng
(
location
.
latitude
,
location
.
longitude
)
val
builder
=
MapStatus
.
Builder
()
builder
.
target
(
ll
).
zoom
(
18.0f
)
this
.
animateMapStatus
(
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
()))
}
}
}
}
override
fun
onSensorChanged
(
sensorEvent
:
SensorEvent
?)
{
val
x
:
Double
=
sensorEvent
?.
values
?.
get
(
SensorManager
.
DATA_X
)
?.
toDouble
()
?:
0.0
if
(
kotlin
.
math
.
abs
(
x
-
lastX
)
>
1.0
)
{
mCurrentDirection
=
x
.
toInt
()
myLocationData
=
MyLocationData
.
Builder
()
.
accuracy
(
mCurrentAccracy
)
// 设置定位数据的精度信息,单位:米
.
direction
(
mCurrentDirection
.
toFloat
())
// 此处设置开发者获取到的方向信息,顺时针0-360
.
latitude
(
mCurrentLat
)
.
longitude
(
mCurrentLon
)
.
build
()
mBaiduMap
?.
setMyLocationData
(
myLocationData
)
}
lastX
=
x
}
override
fun
onAccuracyChanged
(
sensor
:
Sensor
?,
accuracy
:
Int
)
{
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
5e806fc8
...
...
@@ -16,6 +16,7 @@ import com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.FragmentMyBinding
import
com.mints.street.login.LoginActivity
import
com.mints.street.main.home.HistoricalimageActivity
import
kotlinx.android.synthetic.main.fragment_my.*
...
...
@@ -71,7 +72,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickL
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
R
.
id
.
ly_aboutus
->
{
startActivity
(
AboutusActivity
::
class
.
java
)
// startActivity(AboutusActivity::class.java)
startActivity
(
HistoricalimageActivity
::
class
.
java
)
}
R
.
id
.
ly_moresettings
->
{
startActivity
(
MoresettingsActivity
::
class
.
java
)
...
...
app/src/main/java/com/mints/street/main/vr/PanoramicActivity.kt
0 → 100644
View file @
5e806fc8
package
com.mints.street.main.vr
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.view.Window
import
com.baidu.lbsapi.BMapManager
import
com.baidu.lbsapi.MKGeneralListener
import
com.baidu.lbsapi.panoramaview.PanoramaView
import
com.baidu.lbsapi.panoramaview.PanoramaViewListener
import
com.fry.base.base.BaseActivity
import
com.mints.street.AppApplication
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.ActivityPanoramicBinding
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/12.
* 全景页面
*/
class
PanoramicActivity
:
BaseActivity
<
ActivityPanoramicBinding
,
PanoramicViewModel
>()
{
companion
object
{
const
val
PID
=
0
// PID方式
const
val
GEO
=
1
// 经纬度方式
const
val
MERCATOR
=
2
// 墨卡托方式
const
val
UID_STREET
=
3
// UID方式展示外景
const
val
UID_INTERIOR
=
4
// UID方式展示内景
const
val
UID_STREET_CUSTOMALBUM
=
5
// UID方式展示外景(使用自定义相册)
const
val
MARKER
=
6
// 标注
const
val
OTHER
=
7
// 其他测试
const
val
COORDINATE_CONVERTER
=
8
// 坐标转换测试
const
val
WGS84
=
9
// 大地坐标系方式
const
val
GCJ02
=
10
// 国测局加密方式
fun
starPanoramicActivity
(
context
:
Context
,
name
:
String
,
type
:
Int
,
pid
:
String
?
=
null
,
lon
:
Double
?
=
null
,
lat
:
Double
?
=
null
)
{
val
intent
=
Intent
(
context
,
PanoramicActivity
::
class
.
java
)
intent
.
putExtra
(
"name"
,
name
)
intent
.
putExtra
(
"type"
,
type
)
intent
.
putExtra
(
"pid"
,
pid
)
intent
.
putExtra
(
"lon"
,
lon
)
intent
.
putExtra
(
"lat"
,
lat
)
context
.
startActivity
(
intent
)
}
}
internal
class
MyGeneralListener
:
MKGeneralListener
{
override
fun
onGetPermissionState
(
iError
:
Int
)
{
// 非零值表示key验证未通过
if
(
iError
!=
0
)
{
// 授权Key错误:
KLog
.
e
(
"BMapManager"
,
"请在AndoridManifest.xml中输入正确的授权Key,并检查您的网络连接是否正常!error: $iError"
)
}
else
{
KLog
.
a
(
"BMapManager"
,
"key认证成功"
)
}
}
}
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_panoramic
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
//requestWindowFeature(Window.FEATURE_NO_TITLE)
initBMapManager
()
}
override
fun
initData
()
{
super
.
initData
()
val
intent
=
intent
if
(
intent
!=
null
)
{
testPanoByType
(
name
=
intent
.
getStringExtra
(
"name"
)
?:
"全景"
,
type
=
intent
.
getIntExtra
(
"type"
,
-
1
),
pid
=
intent
.
getStringExtra
(
"pid"
),
lon
=
intent
.
getDoubleExtra
(
"lon"
,
0.0
),
lat
=
intent
.
getDoubleExtra
(
"lat"
,
0.0
)
)
}
}
private
fun
initBMapManager
()
{
if
(
AppApplication
.
mBMapManager
==
null
)
{
AppApplication
.
mBMapManager
=
BMapManager
(
AppApplication
.
mContext
)
AppApplication
.
mBMapManager
?.
init
(
MyGeneralListener
())
}
}
/**
* 加载全景
* @param name 标题名称 必填
* @param type type类型 必选
* @param pid 百度pid 非必填
* @param lon 纬度 非必填
* @param lat 经度 非必填
*/
private
fun
testPanoByType
(
name
:
String
,
type
:
Int
,
pid
:
String
?
=
null
,
lon
:
Double
?
=
null
,
lat
:
Double
?
=
null
)
{
KLog
.
e
(
"PanoramicActivity"
,
"测试--------------- $name $type $pid $lon $lat"
)
if
(
type
==
-
1
)
{
KLog
.
e
(
"PanoramicActivity"
,
"错误类型"
)
return
}
binding
.
panorama
.
setShowTopoLink
(
true
)
// 测试回调函数,需要注意的是回调函数要在setPanorama()之前调用,否则回调函数可能执行异常
binding
.
panorama
.
setPanoramaViewListener
(
object
:
PanoramaViewListener
{
override
fun
onDescriptionLoadEnd
(
p0
:
String
?)
{
KLog
.
i
(
"PanoramicActivity"
,
"onLoadPanoramaStart..."
)
}
override
fun
onLoadPanoramaBegin
()
{
KLog
.
i
(
"PanoramicActivity"
,
"onLoadPanoramaBegin..."
)
}
override
fun
onLoadPanoramaEnd
(
p0
:
String
?)
{
KLog
.
i
(
"PanoramicActivity"
,
"onLoadPanoramaEnd..."
)
}
override
fun
onLoadPanoramaError
(
p0
:
String
?)
{
}
override
fun
onMessage
(
p0
:
String
?,
p1
:
Int
)
{
}
override
fun
onCustomMarkerClick
(
p0
:
String
?)
{
}
override
fun
onMoveStart
()
{
}
override
fun
onMoveEnd
()
{
}
})
binding
.
ctbTitle
.
setTitle
(
name
)
when
(
type
)
{
//通过百度全景ID(PID)获取全景
PID
->
{
if
(
pid
==
null
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionHigh
)
binding
.
panorama
.
setPanorama
(
pid
)
}
//通过大地坐标系(WGS84)获取全景
WGS84
->
{
if
(
lon
==
null
||
lat
==
null
||
lon
<=
0
||
lat
<=
0
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionMiddle
)
binding
.
panorama
.
setPanorama
(
lon
,
lat
,
PanoramaView
.
COORDTYPE_WGS84
)
}
//通过国测局加密坐标(GCJ02)获取全景
GCJ02
->
{
if
(
lon
==
null
||
lat
==
null
||
lon
<=
0
||
lat
<=
0
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionMiddle
)
binding
.
panorama
.
setPanorama
(
lon
,
lat
,
PanoramaView
.
COORDTYPE_GCJ02
)
}
//通过百度经纬度坐标(BD09LL)获取全景
GEO
->
{
if
(
lon
==
null
||
lat
==
null
||
lon
<=
0
||
lat
<=
0
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionMiddle
)
binding
.
panorama
.
setPanorama
(
lon
,
lat
,
PanoramaView
.
COORDTYPE_BD09LL
)
}
//通过百度墨卡托坐标(BD09MC)获取全景
MERCATOR
->
{
if
(
lon
==
null
||
lat
==
null
||
lon
<=
0
||
lat
<=
0
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionMiddle
)
binding
.
panorama
.
setPanorama
(
lon
,
lat
,
PanoramaView
.
COORDTYPE_BD09MC
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/PanoramicViewModel.kt
0 → 100644
View file @
5e806fc8
package
com.mints.street.main.vr
import
android.app.Application
import
me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/12.
*/
class
PanoramicViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
}
\ No newline at end of file
app/src/main/java/com/mints/street/model/ApiModel.kt
View file @
5e806fc8
...
...
@@ -3,7 +3,7 @@ package com.mints.street.model
import
com.mints.street.api.MainApi
import
com.mints.street.bean.AwardBean
import
com.mints.street.bean.UserBean
import
com.mints.street.netwrok.HttpManager
import
com.mints.street.netwrok.
common.
HttpManager
import
com.trello.rxlifecycle2.LifecycleProvider
import
io.reactivex.Observable
import
me.goldze.mvvmhabit.http.BaseResponse
...
...
library_base/src/main/java/com/fry/base/basenetwork
/HttpConfiguation.java
→
app/src/main/java/com/mints/street/netwrok/base
/HttpConfiguation.java
View file @
5e806fc8
package
com
.
fry
.
base
.
basenetwork
;
package
com
.
mints
.
street
.
netwrok
.
base
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
library_base/src/main/java/com/fry/base/basenetwork
/HttpSubscribeImpl.kt
→
app/src/main/java/com/mints/street/netwrok/base
/HttpSubscribeImpl.kt
View file @
5e806fc8
package
com.
fry.base.basenetwork
package
com.
mints.street.netwrok.base
import
me.goldze.mvvmhabit._enum.ViewStatus
import
me.goldze.mvvmhabit.base.BaseViewModel
...
...
library_base/src/main/java/com/fry/base/basenetwork
/IHttpResponseListener.java
→
app/src/main/java/com/mints/street/netwrok/base
/IHttpResponseListener.java
View file @
5e806fc8
package
com
.
fry
.
base
.
basenetwork
;
package
com
.
mints
.
street
.
netwrok
.
base
;
import
io.reactivex.disposables.Disposable
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
...
...
library_base/src/main/java/com/fry/base/basenetwork
/IHttpSubscribe.kt
→
app/src/main/java/com/mints/street/netwrok/base
/IHttpSubscribe.kt
View file @
5e806fc8
package
com.
fry.base.basenetwork
package
com.
mints.street.netwrok.base
import
io.reactivex.Observer
import
io.reactivex.disposables.Disposable
...
...
library_base/src/main/java/com/fry/base/basenetwork
/RetrofitClient.java
→
app/src/main/java/com/mints/street/netwrok/base
/RetrofitClient.java
View file @
5e806fc8
package
com
.
fry
.
base
.
basenetwork
;
package
com
.
mints
.
street
.
netwrok
.
base
;
import
android.content.Context
;
import
android.text.TextUtils
;
...
...
@@ -6,6 +6,7 @@ import android.text.TextUtils;
import
androidx.annotation.NonNull
;
import
com.fry.base.BuildConfig
;
import
com.mints.street.netwrok.common.GsonConverterFactory
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -15,7 +16,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import
io.reactivex.schedulers.Schedulers
;
import
me.goldze.mvvmhabit.http.cookie.CookieJarImpl
;
import
me.goldze.mvvmhabit.http.cookie.store.PersistentCookieStore
;
import
me.goldze.mvvmhabit.http.interceptor.BaseInterceptor
;
import
me.goldze.mvvmhabit.http.interceptor.logging.Level
;
import
me.goldze.mvvmhabit.http.interceptor.logging.LoggingInterceptor
;
import
me.goldze.mvvmhabit.utils.Utils
;
...
...
@@ -25,7 +25,6 @@ import okhttp3.OkHttpClient;
import
okhttp3.internal.platform.Platform
;
import
retrofit2.Retrofit
;
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
;
import
retrofit2.converter.gson.GsonConverterFactory
;
/**
* Created by jeme on 2019/1/31
...
...
@@ -45,7 +44,6 @@ public class RetrofitClient {
throw
new
RuntimeException
(
"baseUrl 不能为空"
);
}
SslHttpsUtils
.
SSLParams
sslParams
=
SslHttpsUtils
.
getSslSocketFactory
();
OkHttpClient
.
Builder
clientBuilder
=
new
OkHttpClient
.
Builder
()
.
cookieJar
(
new
CookieJarImpl
(
new
PersistentCookieStore
(
mContext
)))
// .cache(cache)
...
...
app/src/main/java/com/mints/street/netwrok/common/GsonConverterFactory.java
0 → 100644
View file @
5e806fc8
package
com
.
mints
.
street
.
netwrok
.
common
;
import
com.google.gson.Gson
;
import
com.mints.street.manager.UserManager
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.io.Reader
;
import
java.io.Writer
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Type
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
import
okhttp3.ResponseBody
;
import
okio.Buffer
;
import
retrofit2.Converter
;
import
retrofit2.Retrofit
;
/**
* Description:gson全局解析
*/
public
class
GsonConverterFactory
extends
Converter
.
Factory
{
private
final
Gson
gson
;
public
static
GsonConverterFactory
create
()
{
return
create
(
new
Gson
());
}
public
static
GsonConverterFactory
create
(
Gson
gson
)
{
return
new
GsonConverterFactory
(
gson
);
}
private
GsonConverterFactory
(
Gson
gson
)
{
if
(
gson
==
null
)
throw
new
NullPointerException
(
"gson == null"
);
this
.
gson
=
gson
;
}
@Override
public
Converter
<
ResponseBody
,
?>
responseBodyConverter
(
Type
type
,
Annotation
[]
annotations
,
Retrofit
retrofit
)
{
return
new
GsonResponseBodyConverter
<>(
gson
,
type
);
}
@Override
public
Converter
<?,
RequestBody
>
requestBodyConverter
(
Type
type
,
Annotation
[]
parameterAnnotations
,
Annotation
[]
methodAnnotations
,
Retrofit
retrofit
)
{
return
new
GsonRequestBodyConverter
<>(
gson
,
type
);
}
// 这里创建从ResponseBody其它类型的Converter
// 主要用于对响应体的处理
final
class
GsonResponseBodyConverter
<
T
>
implements
Converter
<
ResponseBody
,
T
>
{
private
final
Gson
gson
;
private
final
Type
type
;
GsonResponseBodyConverter
(
Gson
gson
,
Type
type
)
{
this
.
gson
=
gson
;
this
.
type
=
type
;
}
@Override
public
T
convert
(
ResponseBody
value
)
throws
IOException
{
Reader
reader
=
value
.
charStream
();
try
{
T
t
=
gson
.
fromJson
(
reader
,
type
);
loginInvalid
(
t
);
return
t
;
}
finally
{
try
{
if
(
reader
!=
null
)
reader
.
close
();
}
catch
(
IOException
ignored
)
{
ignored
.
printStackTrace
();
}
}
}
/**
* 用户登陆失效
*
* @param t
*/
private
void
loginInvalid
(
T
t
)
{
if
(
t
instanceof
BaseResponse
)
{
BaseResponse
br
=
(
BaseResponse
)
t
;
int
code
=
br
.
getstatus
();
if
(
code
==
401
)
{
try
{
UserManager
.
Companion
.
getINSTANCE
().
userLogout
();
// Activity forwardActivity = ForegroundOrBackground.getApp_activity();
// if (forwardActivity != null) {
// if (!forwardActivity.isFinishing()) {
// forwardActivity.startActivity(new Intent(forwardActivity, WxLoginActivity.class));
// }
// }
}
catch
(
Exception
e
)
{
}
}
}
}
}
// 在这里创建 从自定类型到ResponseBody 的Converter
// 主要用于对Part、PartMap、Body注解的处理
final
class
GsonRequestBodyConverter
<
T
>
implements
Converter
<
T
,
RequestBody
>
{
private
final
MediaType
MEDIA_TYPE
=
MediaType
.
parse
(
"application/json; charset=UTF-8"
);
private
final
Charset
UTF_8
=
StandardCharsets
.
UTF_8
;
private
final
Gson
gson
;
private
final
Type
type
;
GsonRequestBodyConverter
(
Gson
gson
,
Type
type
)
{
this
.
gson
=
gson
;
this
.
type
=
type
;
}
@Override
public
RequestBody
convert
(
T
value
)
throws
IOException
{
Buffer
buffer
=
new
Buffer
();
Writer
writer
=
new
OutputStreamWriter
(
buffer
.
outputStream
(),
UTF_8
);
gson
.
toJson
(
value
,
type
,
writer
);
writer
.
flush
();
return
RequestBody
.
create
(
MEDIA_TYPE
,
buffer
.
readByteString
());
}
}
}
app/src/main/java/com/mints/street/netwrok/HttpErrorProcess.java
→
app/src/main/java/com/mints/street/netwrok/
common/
HttpErrorProcess.java
View file @
5e806fc8
package
com
.
mints
.
street
.
netwrok
;
package
com
.
mints
.
street
.
netwrok
.
common
;
import
io.reactivex.Observable
;
...
...
app/src/main/java/com/mints/street/netwrok/HttpManager.java
→
app/src/main/java/com/mints/street/netwrok/
common/
HttpManager.java
View file @
5e806fc8
package
com
.
mints
.
street
.
netwrok
;
package
com
.
mints
.
street
.
netwrok
.
common
;
import
android.annotation.SuppressLint
;
import
com.fry.base.basenetwork.HttpConfiguation
;
import
com.fry.base.basenetwork.IHttpResponseListener
;
import
com.fry.base.basenetwork.RetrofitClient
;
import
com.fry.base.global.Constants
;
import
com.fry.base.netwrok.OkHttpInterceptor
;
import
com.mints.street.netwrok.base.HttpConfiguation
;
import
com.mints.street.netwrok.base.IHttpResponseListener
;
import
com.mints.street.netwrok.base.RetrofitClient
;
import
com.mints.street.utils.encry.AESUtils
;
import
com.trello.rxlifecycle2.LifecycleProvider
;
...
...
app/src/main/java/com/mints/street/netwrok/OkHttpInterceptor.kt
→
app/src/main/java/com/mints/street/netwrok/
common/
OkHttpInterceptor.kt
100755 → 100644
View file @
5e806fc8
package
com.
fry.base.netwrok
package
com.
mints.street.netwrok.common
import
android.text.TextUtils
import
android.util.Log
...
...
@@ -165,6 +165,10 @@ class OkHttpInterceptor(aesKey: String) : Interceptor {
// 解密
try
{
val
json
=
JSONObject
(
rspString
)
// if(!json.isNull("status")&& TextUtils.equals(json["status"].toString(),"401")){
// return
// }
if
(!
json
.
isNull
(
"data"
))
{
val
data
=
json
[
"data"
]
rspString
=
AESUtils
.
detrypt
(
data
.
toString
(),
aesKey
)
...
...
app/src/main/java/com/mints/street/splash/SplashActivity.kt
View file @
5e806fc8
...
...
@@ -89,15 +89,16 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
if
(!
deviceInfo
.
signInfo
)
{
finish
()
}
else
{
try
{
mSplashContainer
=
findViewById
(
R
.
id
.
splash_container
)
//加载开屏广告
loadSplashAd
()
}
catch
(
e
:
Exception
)
{
// try {
// mSplashContainer = findViewById(R.id.splash_container)
// //加载开屏广告
// loadSplashAd()
// } catch (e: Exception) {
// goToMainActivity()
// }
goToMainActivity
()
}
}
}
/**
* 加载开屏广告
...
...
app/src/main/jniLibs/arm64-v8a/libCtaApiLib.so
0 → 100644
View file @
5e806fc8
File added
app/src/main/jniLibs/armeabi-v7a/libCtaApiLib.so
0 → 100644
View file @
5e806fc8
File added
app/src/main/jniLibs/armeabi/libCtaApiLib.so
0 → 100644
View file @
5e806fc8
File added
app/src/main/res/layout/activity_historical_image.xml
0 → 100644
View file @
5e806fc8
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"ViewModel"
type=
"com.mints.street.main.home.HistoricalimageModel"
/>
</data>
<LinearLayout
android:layout_width=
"match_parent"
android:orientation=
"vertical"
android:layout_height=
"match_parent"
>
</LinearLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/activity_panoramic.xml
0 → 100644
View file @
5e806fc8
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.main.vr.PanoramicViewModel"
/>
</data>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<com.fry.base.ui.widget.CommonTitleBar
android:id=
"@+id/ctb_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
app:ctb_theme=
"dark"
app:ctb_title=
"全景"
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.baidu.lbsapi.panoramaview.PanoramaView
android:id=
"@+id/panorama"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:clickable=
"true"
/>
</LinearLayout>
</layout>
\ No newline at end of file
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted
100644 → 0
View file @
8d8b7ed2
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<background
android:drawable=
"@drawable/ic_launcher_background"
/>
<foreground
android:drawable=
"@drawable/ic_launcher_foreground"
/>
</adaptive-icon>
\ No newline at end of file
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted
100644 → 0
View file @
8d8b7ed2
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<background
android:drawable=
"@drawable/ic_launcher_background"
/>
<foreground
android:drawable=
"@drawable/ic_launcher_foreground"
/>
</adaptive-icon>
\ No newline at end of file
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted
100644 → 0
View file @
8d8b7ed2
7.72 KB
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
deleted
100644 → 0
View file @
8d8b7ed2
11.6 KB
build.gradle
View file @
5e806fc8
...
...
@@ -8,6 +8,9 @@ buildscript {
maven
{
url
"https://jitpack.io"
}
google
()
jcenter
()
// umeng
maven
{
url
'https://repo1.maven.org/maven2/'
}
}
dependencies
{
classpath
'com.android.tools.build:gradle:4.1.1'
...
...
@@ -27,6 +30,9 @@ allprojects {
google
()
jcenter
()
// umeng
maven
{
url
'https://repo1.maven.org/maven2/'
}
}
}
...
...
library_base/src/main/java/com/fry/base/basenetwork/HttpResponseListenerImpl.java
deleted
100644 → 0
View file @
8d8b7ed2
package
com
.
fry
.
base
.
basenetwork
;
import
java.lang.ref.WeakReference
;
import
io.reactivex.disposables.Disposable
;
import
me.goldze.mvvmhabit._enum.ViewStatus
;
import
me.goldze.mvvmhabit.base.BaseViewModel
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
import
me.goldze.mvvmhabit.http.ExceptionHandle
;
import
me.goldze.mvvmhabit.http.ResponseThrowable
;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
import
retrofit2.Response
;
/**
* Created by jeme on 2019/1/31
*/
public
abstract
class
HttpResponseListenerImpl
<
T
extends
BaseResponse
>
implements
IHttpResponseListener
<
T
>{
private
WeakReference
<
BaseViewModel
>
viewModel
;
private
boolean
needToast
=
true
;
protected
boolean
isLoading
=
false
;
public
HttpResponseListenerImpl
(
BaseViewModel
viewModel
)
{
this
.
viewModel
=
new
WeakReference
<>(
viewModel
);
}
public
HttpResponseListenerImpl
(
BaseViewModel
viewModel
,
boolean
needToast
)
{
this
.
viewModel
=
new
WeakReference
<>(
viewModel
);
this
.
needToast
=
needToast
;
}
public
HttpResponseListenerImpl
()
{
}
@Override
public
void
onStart
(
Disposable
disposable
)
{
if
(!
isLoading
){
if
(
viewModel
!=
null
&&
viewModel
.
get
()
!=
null
){
viewModel
.
get
().
showDialog
();
}
isLoading
=
true
;
}
else
{
disposable
.
dispose
();
}
}
@Override
public
boolean
onParseResponse
(
Response
<
T
>
response
)
{
return
false
;
}
public
boolean
isEmpty
(
T
response
){
return
false
;
}
@Override
public
void
onBusinessFail
(
T
response
)
{
/* if(isEmpty(response)){
viewModel.get().viewSwitch(ViewStatus.NODATA);
}*/
if
(
response
==
null
){
viewModel
.
get
().
viewSwitch
(
ViewStatus
.
NODATA
);
return
;
}
if
(
needToast
)
{
ToastUtils
.
showShort
(
response
.
getMessage
());
}
}
@Override
public
void
onFailed
(
ResponseThrowable
throwable
)
{
isLoading
=
false
;
if
(
throwable
==
null
){
return
;
}
if
(
needToast
)
{
ToastUtils
.
showShort
(
throwable
.
message
);
}
if
(
throwable
.
code
==
ExceptionHandle
.
ERROR
.
HTTP_ERROR
||
throwable
.
code
==
ExceptionHandle
.
ERROR
.
NETWORD_ERROR
||
throwable
.
code
==
ExceptionHandle
.
ERROR
.
TIMEOUT_ERROR
){
if
(
viewModel
!=
null
&&
viewModel
.
get
()
!=
null
){
viewModel
.
get
().
viewSwitch
(
ViewStatus
.
NONETWORK
);
}
}
}
@Override
public
void
onCompleted
()
{
isLoading
=
false
;
if
(
viewModel
!=
null
&&
viewModel
.
get
()
!=
null
){
viewModel
.
get
().
dismissDialog
();
}
}
}
library_base/src/main/java/com/fry/base/basenetwork/HttpsUtil.java
deleted
100644 → 0
View file @
8d8b7ed2
package
com
.
fry
.
base
.
basenetwork
;
import
java.security.SecureRandom
;
import
java.security.cert.X509Certificate
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLSession
;
import
javax.net.ssl.SSLSocketFactory
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.X509TrustManager
;
/**
* Created by ωǒ、〃尐川.η on 2018/8/20.
*/
public
class
HttpsUtil
{
//获取这个SSLSocketFactory
public
static
SSLSocketFactory
getSSLSocketFactory
()
{
try
{
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"SSL"
);
sslContext
.
init
(
null
,
getTrustManager
(),
new
SecureRandom
());
return
sslContext
.
getSocketFactory
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
//获取TrustManager
private
static
TrustManager
[]
getTrustManager
()
{
TrustManager
[]
trustAllCerts
=
new
TrustManager
[]{
new
X509TrustManager
()
{
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
{
}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
{
}
@Override
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
new
X509Certificate
[]{};
}
}
};
return
trustAllCerts
;
}
//获取HostnameVerifier
public
static
HostnameVerifier
getHostnameVerifier
()
{
HostnameVerifier
hostnameVerifier
=
new
HostnameVerifier
()
{
@Override
public
boolean
verify
(
String
s
,
SSLSession
sslSession
)
{
return
true
;
}
};
return
hostnameVerifier
;
}
}
library_base/src/main/java/com/fry/base/basenetwork/SslHttpsUtils.java
deleted
100644 → 0
View file @
8d8b7ed2
package
com
.
fry
.
base
.
basenetwork
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.security.KeyManagementException
;
import
java.security.KeyStore
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.cert.Certificate
;
import
java.security.cert.CertificateException
;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.X509Certificate
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.KeyManager
;
import
javax.net.ssl.KeyManagerFactory
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLSession
;
import
javax.net.ssl.SSLSocketFactory
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.TrustManagerFactory
;
import
javax.net.ssl.X509TrustManager
;
/**
* Created by jeme on 2019/1/31
*/
public
class
SslHttpsUtils
{
public
static
class
SSLParams
{
public
SSLSocketFactory
sSLSocketFactory
;
public
X509TrustManager
trustManager
;
}
public
static
SSLParams
getSslSocketFactory
()
{
return
getSslSocketFactoryBase
(
null
,
null
,
null
);
}
/**
* https单向认证
* 可以额外配置信任服务端的证书策略,否则默认是按CA证书去验证的,若不是CA可信任的证书,则无法通过验证
*/
public
static
SSLParams
getSslSocketFactory
(
X509TrustManager
trustManager
)
{
return
getSslSocketFactoryBase
(
trustManager
,
null
,
null
);
}
/**
* https单向认证
* 用含有服务端公钥的证书校验服务端证书
*/
public
static
SSLParams
getSslSocketFactory
(
InputStream
...
certificates
)
{
return
getSslSocketFactoryBase
(
null
,
null
,
null
,
certificates
);
}
/**
* https双向认证
* bksFile 和 password -> 客户端使用bks证书校验服务端证书
* certificates -> 用含有服务端公钥的证书校验服务端证书
*/
public
static
SSLParams
getSslSocketFactory
(
InputStream
bksFile
,
String
password
,
InputStream
...
certificates
)
{
return
getSslSocketFactoryBase
(
null
,
bksFile
,
password
,
certificates
);
}
/**
* https双向认证
* bksFile 和 password -> 客户端使用bks证书校验服务端证书
* X509TrustManager -> 如果需要自己校验,那么可以自己实现相关校验,如果不需要自己校验,那么传null即可
*/
public
static
SSLParams
getSslSocketFactory
(
InputStream
bksFile
,
String
password
,
X509TrustManager
trustManager
)
{
return
getSslSocketFactoryBase
(
trustManager
,
bksFile
,
password
);
}
private
static
SSLParams
getSslSocketFactoryBase
(
X509TrustManager
trustManager
,
InputStream
bksFile
,
String
password
,
InputStream
...
certificates
)
{
SSLParams
sslParams
=
new
SSLParams
();
try
{
KeyManager
[]
keyManagers
=
prepareKeyManager
(
bksFile
,
password
);
TrustManager
[]
trustManagers
=
prepareTrustManager
(
certificates
);
X509TrustManager
manager
;
if
(
trustManager
!=
null
)
{
//优先使用用户自定义的TrustManager
manager
=
trustManager
;
}
else
if
(
trustManagers
!=
null
)
{
//然后使用默认的TrustManager
manager
=
chooseTrustManager
(
trustManagers
);
}
else
{
//否则使用不安全的TrustManager
manager
=
UnSafeTrustManager
;
}
// 创建TLS类型的SSLContext对象, that uses our TrustManager
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLS"
);
// 用上面得到的trustManagers初始化SSLContext,这样sslContext就会信任keyStore中的证书
// 第一个参数是授权的密钥管理器,用来授权验证,比如授权自签名的证书验证。第二个是被授权的证书管理器,用来验证服务器端的证书
sslContext
.
init
(
keyManagers
,
new
TrustManager
[]{
manager
},
null
);
// 通过sslContext获取SSLSocketFactory对象
sslParams
.
sSLSocketFactory
=
sslContext
.
getSocketFactory
();
sslParams
.
trustManager
=
manager
;
return
sslParams
;
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
AssertionError
(
e
);
}
catch
(
KeyManagementException
e
)
{
throw
new
AssertionError
(
e
);
}
}
private
static
KeyManager
[]
prepareKeyManager
(
InputStream
bksFile
,
String
password
)
{
try
{
if
(
bksFile
==
null
||
password
==
null
)
return
null
;
KeyStore
clientKeyStore
=
KeyStore
.
getInstance
(
"BKS"
);
clientKeyStore
.
load
(
bksFile
,
password
.
toCharArray
());
KeyManagerFactory
kmf
=
KeyManagerFactory
.
getInstance
(
KeyManagerFactory
.
getDefaultAlgorithm
());
kmf
.
init
(
clientKeyStore
,
password
.
toCharArray
());
return
kmf
.
getKeyManagers
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
private
static
TrustManager
[]
prepareTrustManager
(
InputStream
...
certificates
)
{
if
(
certificates
==
null
||
certificates
.
length
<=
0
)
return
null
;
try
{
CertificateFactory
certificateFactory
=
CertificateFactory
.
getInstance
(
"X.509"
);
// 创建一个默认类型的KeyStore,存储我们信任的证书
KeyStore
keyStore
=
KeyStore
.
getInstance
(
KeyStore
.
getDefaultType
());
keyStore
.
load
(
null
);
int
index
=
0
;
for
(
InputStream
certStream
:
certificates
)
{
String
certificateAlias
=
Integer
.
toString
(
index
++);
// 证书工厂根据证书文件的流生成证书 cert
Certificate
cert
=
certificateFactory
.
generateCertificate
(
certStream
);
// 将 cert 作为可信证书放入到keyStore中
keyStore
.
setCertificateEntry
(
certificateAlias
,
cert
);
try
{
if
(
certStream
!=
null
)
certStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
//我们创建一个默认类型的TrustManagerFactory
TrustManagerFactory
tmf
=
TrustManagerFactory
.
getInstance
(
TrustManagerFactory
.
getDefaultAlgorithm
());
//用我们之前的keyStore实例初始化TrustManagerFactory,这样tmf就会信任keyStore中的证书
tmf
.
init
(
keyStore
);
//通过tmf获取TrustManager数组,TrustManager也会信任keyStore中的证书
return
tmf
.
getTrustManagers
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
private
static
X509TrustManager
chooseTrustManager
(
TrustManager
[]
trustManagers
)
{
for
(
TrustManager
trustManager
:
trustManagers
)
{
if
(
trustManager
instanceof
X509TrustManager
)
{
return
(
X509TrustManager
)
trustManager
;
}
}
return
null
;
}
/**
* 为了解决客户端不信任服务器数字证书的问题,网络上大部分的解决方案都是让客户端不对证书做任何检查,
* 这是一种有很大安全漏洞的办法
*/
public
static
X509TrustManager
UnSafeTrustManager
=
new
X509TrustManager
()
{
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
@Override
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
new
X509Certificate
[]{};
}
};
/**
* 此类是用于主机名验证的基接口。 在握手期间,如果 URL 的主机名和服务器的标识主机名不匹配,
* 则验证机制可以回调此接口的实现程序来确定是否应该允许此连接。策略可以是基于证书的或依赖于其他验证方案。
* 当验证 URL 主机名使用的默认规则失败时使用这些回调。如果主机名是可接受的,则返回 true
*/
public
static
HostnameVerifier
UnSafeHostnameVerifier
=
new
HostnameVerifier
()
{
@Override
public
boolean
verify
(
String
hostname
,
SSLSession
session
)
{
return
true
;
}
};
}
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