Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_street
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_street
Commits
d1e3e3d7
Commit
d1e3e3d7
authored
Jul 29, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交国内外搜索接口
parent
c5f29fca
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
412 additions
and
107 deletions
+412
-107
BaiduApi.kt
app/src/main/java/com/mints/street/api/BaiduApi.kt
+10
-3
BaseArrayResponse.java
...rc/main/java/com/mints/street/bean/BaseArrayResponse.java
+22
-0
BaseResponse.java
app/src/main/java/com/mints/street/bean/BaseResponse.java
+16
-3
PositionBean.kt
app/src/main/java/com/mints/street/bean/PositionBean.kt
+34
-0
LoginActivity.kt
app/src/main/java/com/mints/street/login/LoginActivity.kt
+1
-2
SearchAfterItem.kt
...c/main/java/com/mints/street/main/home/SearchAfterItem.kt
+24
-6
SearchMapActivity.kt
...main/java/com/mints/street/main/home/SearchMapActivity.kt
+68
-30
SearchMapViewModel.kt
...ain/java/com/mints/street/main/home/SearchMapViewModel.kt
+68
-5
onGetSuggestionPositionsLister.kt
.../mints/street/main/home/onGetSuggestionPositionsLister.kt
+8
-0
AboutusActivity.kt
...src/main/java/com/mints/street/main/my/AboutusActivity.kt
+1
-2
MoresettingsActivity.kt
...ain/java/com/mints/street/main/my/MoresettingsActivity.kt
+1
-2
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+58
-1
MyViewModel.kt
app/src/main/java/com/mints/street/main/my/MyViewModel.kt
+1
-24
OpenvipActivity.kt
...src/main/java/com/mints/street/main/my/OpenvipActivity.kt
+1
-2
BaiduModel.kt
app/src/main/java/com/mints/street/model/BaiduModel.kt
+5
-1
DialogUtils.kt
...c/main/java/com/mints/street/widget/dialog/DialogUtils.kt
+10
-0
ShowBenfitDialog.kt
...n/java/com/mints/street/widget/dialog/ShowBenfitDialog.kt
+1
-1
ShowLoginDialog.kt
...in/java/com/mints/street/widget/dialog/ShowLoginDialog.kt
+82
-0
fragment_home.xml
app/src/main/res/layout/fragment_home.xml
+1
-3
BaseArrayResponse.java
...main/java/me/goldze/mvvmhabit/http/BaseArrayResponse.java
+0
-22
No files found.
app/src/main/java/com/mints/street/api/BaiduApi.kt
View file @
d1e3e3d7
package
com.mints.street.api
import
com.google.gson.JsonObject
import
com.mints.street.bean.BaseArrayResponse
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.PositionBean
import
com.mints.street.netwrok.baidu.BaiduHttpManager
import
io.reactivex.Observable
import
retrofit2.Response
...
...
@@ -27,15 +29,20 @@ interface BaiduApi {
/**
* 国外
*
*
* vo["region"] = "全球"
vo["output"] = "json"
vo["ak"] = "tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq"@return
*/
@GET
(
"place_abroad/v1/suggestion"
)
// fun suggestionPlaceAbroad(@Query vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<Any>>>
fun
suggestionPlaceAbroad
(
@Query
(
"query"
)
vo
:
String
,
@Query
(
"region"
)
vo2
:
String
,
@Query
(
"output"
)
vo3
:
String
,
@Query
(
"ak"
)
vo4
:
String
):
Observable
<
Response
<
BaseResponse
<
Any
>>>
@Query
(
"output"
)
vo3
:
String
,
@Query
(
"ak"
)
vo4
:
String
):
Observable
<
Response
<
BaseArrayResponse
<
PositionBean
>>>
@GET
(
"place/v2/suggestion"
)
fun
suggestionPlaceDomestic
(
@Query
(
"query"
)
vo
:
String
,
@Query
(
"region"
)
vo2
:
String
,
@Query
(
"output"
)
vo3
:
String
,
@Query
(
"ak"
)
vo4
:
String
):
Observable
<
Response
<
BaseArrayResponse
<
PositionBean
>>>
}
\ No newline at end of file
app/src/main/java/com/mints/street/bean/BaseArrayResponse.java
0 → 100644
View file @
d1e3e3d7
package
com
.
mints
.
street
.
bean
;
import
java.util.List
;
/**
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
public
class
BaseArrayResponse
<
T
>
extends
BaseResponse
<
List
<
T
>>{
@Override
public
List
<
T
>
getResult
()
{
return
result
;
}
@Override
public
void
setResult
(
List
<
T
>
result
)
{
this
.
result
=
result
;
}
}
app/src/main/java/com/mints/street/bean/BaseResponse.java
View file @
d1e3e3d7
...
...
@@ -16,16 +16,19 @@ public class BaseResponse<T> implements Serializable {
private
String
message
=
""
;
// @JsonAdapter(value = JsonAdapterGsonDeserializer.class)
@SerializedName
(
"data"
)
private
T
data
;
protected
@Nullable
T
result
;
public
BaseResponse
()
{
}
public
BaseResponse
(
int
status
,
String
message
,
T
result
)
{
public
BaseResponse
(
int
status
,
String
message
,
T
result
,
T
data
)
{
this
.
status
=
status
;
this
.
message
=
message
;
this
.
result
=
result
;
this
.
data
=
data
;
}
...
...
@@ -45,12 +48,21 @@ public class BaseResponse<T> implements Serializable {
return
result
;
}
public
void
setData
(
T
data
)
{
this
.
data
=
data
;
}
public
T
getData
()
{
return
data
;
}
public
void
setResult
(
T
result
)
{
this
.
result
=
result
;
}
public
boolean
isOk
()
{
return
status
==
200
&&
status
<
70
0
;
return
status
==
200
||
status
==
0
;
}
public
String
getMessage
()
{
...
...
@@ -67,6 +79,7 @@ public class BaseResponse<T> implements Serializable {
"status="
+
status
+
", message='"
+
message
+
'\''
+
", result="
+
result
+
", data="
+
data
+
'}'
;
}
}
app/src/main/java/com/mints/street/bean/PositionBean.kt
0 → 100644
View file @
d1e3e3d7
package
com.mints.street.bean
import
java.io.Serializable
/**
* Created by 冯瑞雨 on 2021/7/15.
*/
data class
PositionBean
(
val
address
:
String
,
val
business
:
String
,
val
city
:
String
,
val
cityid
:
String
,
val
district
:
String
,
val
location
:
Location
,
val
name
:
String
,
val
tag
:
String
,
val
uid
:
String
/**
* public String key;
public String city;
public String district;
public LatLng pt;
public String uid;
public String tag;
public String address;
*/
)
data class
Location
(
val
lat
:
Double
,
val
lng
:
Double
)
\ No newline at end of file
app/src/main/java/com/mints/street/login/LoginActivity.kt
View file @
d1e3e3d7
...
...
@@ -27,7 +27,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
private
val
userManager
by
lazy
{
UserManager
.
INSTANCE
}
override
fun
getStatusBarHeightView
():
View
?
{
return
null
return
binding
.
tvName
}
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_login
...
...
@@ -35,7 +35,6 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
override
fun
initData
()
{
super
.
initData
()
StatusBarUtil
.
setHeightAndPadding
(
this
,
binding
.
tvName
)
initView
()
initListener
()
}
...
...
app/src/main/java/com/mints/street/main/home/SearchAfterItem.kt
View file @
d1e3e3d7
...
...
@@ -3,6 +3,7 @@ package com.mints.street.main.home
import
android.content.Intent
import
com.baidu.mapapi.model.LatLng
import
com.mints.street.bean.HistoryBean
import
com.mints.street.bean.Location
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.base.ItemViewModel
import
me.goldze.mvvmhabit.binding.command.BindingAction
...
...
@@ -11,19 +12,36 @@ import me.goldze.mvvmhabit.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/15.
*
*/
class
SearchAfterItem
(
viewModel
:
SearchMapViewModel
,
val
name
:
String
?
,
val
address
:
String
?,
val
pt
:
LatLng
?=
null
)
:
ItemViewModel
<
SearchMapViewModel
>(
viewModel
)
{
,
val
address
:
String
?,
val
pt
:
Location
?=
null
)
:
ItemViewModel
<
SearchMapViewModel
>(
viewModel
)
{
/***
* 点击名称回调回调
*/
val
onClick
=
BindingCommand
<
Any
>(
BindingAction
{
viewModel
.
searchName
.
value
=
HistoryBean
(
name
=
this
.
name
,
latitude
=
pt
?.
latitude
,
longitude
=
pt
?.
longitude
)
latitude
=
pt
?.
lat
,
longitude
=
pt
?.
lat
)
val
intent
=
Intent
()
intent
.
putExtra
(
"latitude"
,
pt
?.
lat
itude
)
intent
.
putExtra
(
"longitude"
,
pt
?.
l
ongitude
)
intent
.
putExtra
(
"latitude"
,
pt
?.
lat
)
intent
.
putExtra
(
"longitude"
,
pt
?.
l
at
)
viewModel
.
finishData
(
SearchMapActivity
.
REQUEST_CODE
,
intent
)
})
}
\ No newline at end of file
}
/*class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
, val address:String?,val pt: LatLng?=null) :
ItemViewModel<SearchMapViewModel>(viewModel) {
*//***
* 点击名称回调回调
*//*
val onClick = BindingCommand<Any>(BindingAction {
viewModel.searchName.value = HistoryBean(name = this.name,
latitude = pt?.latitude,longitude = pt?.longitude)
//不带参数、不跳转
// val intent = Intent()
// intent.putExtra("latitude",pt?.latitude)
// intent.putExtra("longitude",pt?.longitude)
// viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent)
})
}*/
\ No newline at end of file
app/src/main/java/com/mints/street/main/home/SearchMapActivity.kt
View file @
d1e3e3d7
...
...
@@ -8,10 +8,6 @@ import android.text.TextWatcher
import
androidx.lifecycle.Observer
import
com.alibaba.android.vlayout.DelegateAdapter
import
com.alibaba.android.vlayout.VirtualLayoutManager
import
com.baidu.mapapi.search.sug.OnGetSuggestionResultListener
import
com.baidu.mapapi.search.sug.SuggestionResult
import
com.baidu.mapapi.search.sug.SuggestionSearch
import
com.baidu.mapapi.search.sug.SuggestionSearchOption
import
com.fry.base.base.BaseActivity
import
com.fry.base.utils.ResourceUtils
import
com.mints.street.BR
...
...
@@ -20,21 +16,21 @@ import com.mints.street.adapter.HistoryRecordAdapter
import
com.mints.street.adapter.PopularSceneAdapter
import
com.mints.street.bean.HistoryBean
import
com.mints.street.bean.MapBean
import
com.mints.street.bean.PositionBean
import
com.mints.street.databinding.ActivitySearchMapBinding
import
me.goldze.mvvmhabit.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/13.
*/
class
SearchMapActivity
:
BaseActivity
<
ActivitySearchMapBinding
,
SearchMapViewModel
>()
,
OnGetSuggestionResultListener
{
class
SearchMapActivity
:
BaseActivity
<
ActivitySearchMapBinding
,
SearchMapViewModel
>()
{
//
OnGetSuggestionResultListener {
companion
object
{
const
val
HISTORY_NAME
=
"history_name"
const
val
REQUEST_CODE
=
201
fun
startSearchMapActivity
(
fragment
:
HomeFragment
)
{
fragment
.
startActivityForResult
(
Intent
(
fragment
.
context
,
SearchMapActivity
::
class
.
java
),
200
Intent
(
fragment
.
context
,
SearchMapActivity
::
class
.
java
),
200
)
}
}
...
...
@@ -44,9 +40,9 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
private
var
historyRecordAdapter
:
HistoryRecordAdapter
?
=
null
private
var
popularSceneAdapter
:
PopularSceneAdapter
?
=
null
//检索模块
private
var
mSuggestionSearch
:
SuggestionSearch
?
=
null
//
//
//检索模块
//
private var mSuggestionSearch: SuggestionSearch? = null
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_search_map
...
...
@@ -62,10 +58,11 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
binding
.
recyList
.
layoutManager
=
vLayout
binding
.
recyList
.
adapter
=
mAdapter
//
// // 初始化建议搜索模块,注册建议搜索事件监听
// mSuggestionSearch = SuggestionSearch.newInstance()
// mSuggestionSearch?.setOnGetSuggestionResultListener(this)
// 初始化建议搜索模块,注册建议搜索事件监听
mSuggestionSearch
=
SuggestionSearch
.
newInstance
()
mSuggestionSearch
?.
setOnGetSuggestionResultListener
(
this
)
binding
.
et
.
addTextChangedListener
(
object
:
TextWatcher
{
override
fun
beforeTextChanged
(
s
:
CharSequence
?,
start
:
Int
,
count
:
Int
,
after
:
Int
)
{
}
...
...
@@ -78,18 +75,32 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
viewModel
.
searchAfterOneItems
.
clear
()
return
}
// 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新
mSuggestionSearch
?.
requestSuggestion
(
SuggestionSearchOption
()
.
keyword
(
s
.
toString
())
// 关键字
.
city
(
viewModel
.
positioningBean
?.
city
?:
"北京"
)
)
if
(
viewModel
.
index
==
0
){
//国外
viewModel
.
searchdomestic
(
s
.
toString
())
}
else
{
//传入参数【这里是可以获取到参数的】【国外】
viewModel
.
searchabroad
(
s
.
toString
())
}
// onGetSuggestionResult(postionConfig)
// // 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新【这里也是百度三方的东西】
// mSuggestionSearch?.requestSuggestion(
// SuggestionSearchOption().keyword(s.toString()) // 关键字
// .city(viewModel.positioningBean?.city ?: "北京")
// )
}
})
historyRecordAdapter
=
HistoryRecordAdapter
(
this
,
viewModel
)
//历史记录
historyRecordAdapter
=
HistoryRecordAdapter
(
this
,
viewModel
)
//热门景点
popularSceneAdapter
=
PopularSceneAdapter
(
this
)
mAdapter
?.
addAdapter
(
historyRecordAdapter
)
...
...
@@ -112,7 +123,7 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
private
fun
update
()
{
historyRecordAdapter
?.
apply
{
this
.
type
=
viewModel
.
index
this
.
type
=
viewModel
.
index
}
popularSceneAdapter
?.
apply
{
if
(
viewModel
.
index
==
0
)
{
...
...
@@ -130,11 +141,18 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
}
})
viewModel
.
searchName
.
observe
(
this
,
Observer
<
HistoryBean
>
{
if
(
TextUtils
.
isEmpty
(
it
.
name
)){
if
(
TextUtils
.
isEmpty
(
it
.
name
))
{
return
@Observer
}
historyRecordAdapter
?.
addHistoryData
(
it
)
})
viewModel
.
positiondata
.
observe
(
this
@SearchMapActivity
,
Observer
{
//srl_my.finishRefresh(true)
it
?.
apply
{
onGetSuggestionResult
(
this
)
}
})
}
private
fun
territory
()
{
...
...
@@ -157,12 +175,32 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
update
()
}
fun
onGetSuggestionResult
(
postionConfig
:
List
<
PositionBean
>?)
{
if
(
postionConfig
==
null
)
{
return
}
viewModel
.
searchAfterOneItems
.
clear
()
if
(
TextUtils
.
isEmpty
(
binding
.
et
.
text
))
{
return
}
for
(
info
in
postionConfig
!!
)
{
viewModel
.
searchAfterOneItems
.
add
(
SearchAfterItem
(
viewModel
,
info
.
name
,
info
.
address
,
info
.
location
)
)
}
}
/**
* 获取在线建议搜索结果,得到requestSuggestion返回的搜索结果
*
*
【这里是第三方百度的东西】
* @param suggestionResult Sug检索结果
*/
override
fun
onGetSuggestionResult
(
suggestionResult
:
SuggestionResult
?)
{
/*
override fun onGetSuggestionResult(suggestionResult: SuggestionResult?) {
if (suggestionResult == null || suggestionResult.allSuggestions == null) {
return
}
...
...
@@ -173,10 +211,10 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
}
for (info in suggestionResult.allSuggestions) {
viewModel.searchAfterOneItems.add(
SearchAfterItem
(
viewModel
,
info
.
key
,
info
.
address
,
info
.
pt
)
SearchAfterItem(
viewModel, info.key, info.address, info.pt
)
)
}
}
}
*/
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/home/SearchMapViewModel.kt
View file @
d1e3e3d7
...
...
@@ -9,10 +9,9 @@ import androidx.lifecycle.MutableLiveData
import
com.google.gson.Gson
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.bean.HistoryBean
import
com.mints.street.bean.MapBean
import
com.mints.street.bean.Places
import
com.mints.street.bean.PositioningBean
import
com.mints.street.bean.*
import
com.mints.street.model.BaiduModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.binding.command.BindingAction
...
...
@@ -28,14 +27,18 @@ import java.io.InputStreamReader
*/
class
SearchMapViewModel
(
application
:
Application
)
:
BaseViewModel
(
application
)
{
var
index
=
0
;
//0=境内 1=境外
val
positiondata
:
MutableLiveData
<
List
<
PositionBean
>>
=
MutableLiveData
()
//这里是走的一个点击回调,能够打开首页进行定位
val
searchAfterItemBinding
=
ItemBinding
.
of
<
SearchAfterItem
>(
BR
.
viewModel
,
R
.
layout
.
item_search_after
)
val
searchAfterOneItems
=
ObservableArrayList
<
SearchAfterItem
>()
//搜索的name
val
searchName
=
MutableLiveData
<
HistoryBean
>()
//定位位置
val
positioningBean
:
PositioningBean
?
=
getpositioningMap
()
private
fun
getpositioningMap
():
PositioningBean
?{
SPUtils
.
getInstance
(
SPUtils
.
POSITIONING_MAP
)
.
decodeString
(
SPUtils
.
POSITIONING_MAP
)
?.
apply
{
...
...
@@ -45,6 +48,8 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application)
}
return
null
}
val
mapBean
=
MutableLiveData
<
MapBean
>()
fun
getMapBean
(){
...
...
@@ -67,6 +72,64 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application)
}
/**
* 获取国外搜索信息【通过搜索内容进行查找】
*/
fun
searchabroad
(
position
:
String
)
{
val
vo
=
hashMapOf
<
String
,
Any
>()
vo
[
"query"
]
=
"澳大利亚 海岸"
vo
[
"region"
]
=
"全球"
vo
[
"output"
]
=
"json"
vo
[
"ak"
]
=
"tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq"
// BaiduModel.suggestionPlaceAbroad(lifecycleProvider,vo).safeSubscribe(
BaiduModel
.
suggestionPlaceAbroad
(
lifecycleProvider
,
position
,
"全球"
,
"json"
,
"tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq"
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseArrayResponse
<
PositionBean
>>(
this
@SearchMapViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseArrayResponse
<
PositionBean
>)
{
positiondata
.
value
=
response
.
result
println
(
"mcg __ "
+
response
.
result
)
}
override
fun
onError
(
e
:
Throwable
)
{
}
}
)
}
/**
* 获取国内搜索信息
*/
fun
searchdomestic
(
position
:
String
)
{
val
vo
=
hashMapOf
<
String
,
Any
>()
vo
[
"query"
]
=
"北京"
vo
[
"region"
]
=
"中国"
vo
[
"output"
]
=
"json"
vo
[
"ak"
]
=
"C56Qdc560TQKtQaavS0NTPUYupsZHspI"
// BaiduModel.suggestionPlaceAbroad(lifecycleProvider,vo).safeSubscribe(
/*
http://api.map.baidu.com/place/v2/suggestion?
query=%E5%8C%97%E4%BA%AC
®ion=%E5%85%A8%E5%9B%BD
&output=json
&page_size=50&
ak=C56Qdc560TQKtQaavS0NTPUYupsZHspI
*/
BaiduModel
.
suggestionPlaceDomestic
(
lifecycleProvider
,
position
,
"中国"
,
"json"
,
"C56Qdc560TQKtQaavS0NTPUYupsZHspI"
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseArrayResponse
<
PositionBean
>>(
this
@SearchMapViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseArrayResponse
<
PositionBean
>)
{
positiondata
.
value
=
response
.
result
println
(
"mcg __ "
+
response
.
result
)
}
override
fun
onError
(
e
:
Throwable
)
{
}
}
)
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/home/onGetSuggestionPositionsLister.kt
0 → 100644
View file @
d1e3e3d7
package
com.mints.street.main.home
import
com.baidu.mapapi.search.sug.SuggestionResult
import
com.mints.street.bean.PositionBean
interface
onGetSuggestionPositionsLister
{
fun
onGetSuggestionResult
(
var1
:
PositionBean
?)
}
app/src/main/java/com/mints/street/main/my/AboutusActivity.kt
View file @
d1e3e3d7
...
...
@@ -21,11 +21,10 @@ class AboutusActivity : BaseActivity<ActivityAboutusBinding, AboutusViewModel>()
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_aboutus
override
fun
getStatusBarHeightView
():
View
?
{
return
null
return
binding
.
tvText
}
override
fun
initData
()
{
super
.
initData
()
StatusBarUtil
.
setHeightAndPadding
(
this
,
binding
.
tvText
)
initView
()
initListener
()
}
...
...
app/src/main/java/com/mints/street/main/my/MoresettingsActivity.kt
View file @
d1e3e3d7
...
...
@@ -27,12 +27,11 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_moresettings
override
fun
getStatusBarHeightView
():
View
?
{
return
null
return
binding
.
elView
}
override
fun
initData
()
{
super
.
initData
()
StatusBarUtil
.
setHeightAndPadding
(
this
,
binding
.
elView
)
initView
()
initListener
()
...
...
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
d1e3e3d7
package
com.mints.street.main.my
import
android.Manifest
import
android.app.Dialog
import
android.content.Context
import
android.graphics.Color
import
android.os.Bundle
...
...
@@ -31,6 +32,8 @@ import com.mints.street.manager.UserManager
import
com.mints.street.manager.oaid.OaidManager
import
com.mints.street.utils.json.JsonUtil
import
com.mints.street.webview.MintsWebViewActivity
import
com.mints.street.widget.dialog.DialogListener
import
com.mints.street.widget.dialog.DialogUtils
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.tbruyelle.rxpermissions2.RxPermissions
...
...
@@ -91,10 +94,10 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
private
fun
initListener
()
{
//设置登录点击事件
RxUtils
.
onMultiClick
(
binding
.
llMyLogin
)
{
// binding.llMyLogin.setOnClickListener {
if
(!
userManager
.
userIsLogin
())
{
//显示登录弹窗
showlogindialog
(
context
)
// backvipDialog()
}
}
//设置立即领取点击事件
...
...
@@ -105,6 +108,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
}
else
{
//打开登录弹框
showlogindialog
(
context
)
// backvipDialog()
}
}
...
...
@@ -149,6 +153,59 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
}
}
/*private fun backvipDialog() {
//显示登录弹窗
DialogUtils.showloginDialog(context!!, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
if (dialog != null && dialog.isShowing) {
dialog.dismiss()
}
//点击事件响应
when (v?.id) {
R.id.iv_weixin -> {
if (cb_checked!!.isChecked) {//判断是否选中条款
val wechat = ShareSDK.getPlatform(Wechat.NAME)
if (!wechat.isClientValid) {//是否安装微信
ToastUtils.showShort("请先安装微信")
return
}
RxPermissions(this@MyFragment)
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
loginApi.setOnLoginListener(this@MyFragment)
loginApi.setPlatform(Wechat.NAME)
loginApi.login(context)
} else {
// showMissingPermissionDialog("设备")
}
}
// dialog?.dismiss()
} else {
ToastUtils.showShort("请先同意用户协议与隐私政策")
}
}
R.id.ly_phone -> {
if (cb_checked!!.isChecked) {
startActivity(LoginActivity::class.java)
// dialog?.dismiss()
} else {
ToastUtils.showShort("请先同意用户协议与隐私政策")
} }
R.id.tv_private -> {//取消
MintsWebViewActivity.startWebView(name = "隐私协议", url = "http://test.mints-id.com/map-api/map/privacy.html")
}
R.id.tv_regist -> {//取消
MintsWebViewActivity.startWebView(name = "用户协议", url = "http://test.mints-id.com/map-api/map/register.html")
}
}
}
})
}*/
private
fun
initView
()
{
aboutus
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"关于我们"
val
userAgree
=
ContextCompat
.
getDrawable
(
context
!!
,
R
.
mipmap
.
iv_about_us
)
...
...
app/src/main/java/com/mints/street/main/my/MyViewModel.kt
View file @
d1e3e3d7
...
...
@@ -3,6 +3,7 @@ package com.mints.street.main.my
import
android.app.Application
import
androidx.lifecycle.MutableLiveData
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.PositionBean
import
com.mints.street.bean.UserBean
import
com.mints.street.common.DeviceInfo
import
com.mints.street.manager.UserManager
...
...
@@ -104,29 +105,5 @@ class MyViewModel(application: Application) : BaseViewModel(application) {
/**
* 获取个人信息
*/
fun
test
()
{
val
vo
=
hashMapOf
<
String
,
Any
>()
vo
[
"query"
]
=
"澳大利亚 海岸"
vo
[
"region"
]
=
"全球"
vo
[
"output"
]
=
"json"
vo
[
"ak"
]
=
"tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq"
// BaiduModel.suggestionPlaceAbroad(lifecycleProvider,vo).safeSubscribe(
BaiduModel
.
suggestionPlaceAbroad
(
lifecycleProvider
,
"澳大利亚 海岸"
,
"全球"
,
"json"
,
"tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq"
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
Any
>>(
this
@MyViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
Any
>)
{
println
(
"mcg __ "
+
response
.
result
)
}
override
fun
onError
(
e
:
Throwable
)
{
}
}
)
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/my/OpenvipActivity.kt
View file @
d1e3e3d7
...
...
@@ -46,7 +46,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_openvip
override
fun
getStatusBarHeightView
():
View
?
{
return
null
return
binding
.
viewBg
}
override
fun
initData
()
{
...
...
@@ -58,7 +58,6 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
viewModel
.
getpaymentwey
(
"android"
)
}
StatusBarUtil
.
setHeightAndPadding
(
this
,
binding
.
viewBg
)
initView
()
initListener
()
}
...
...
app/src/main/java/com/mints/street/model/BaiduModel.kt
View file @
d1e3e3d7
...
...
@@ -20,8 +20,12 @@ object BaiduModel {
// .execute(lifecycleProvider, BaiduApi.newInstance().suggestionPlaceAbroad(map))
// }
fun
suggestionPlaceAbroad
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
String
,
map2
:
String
,
map3
:
String
,
map4
:
String
):
Observable
<
Response
<
Base
Response
<
Any
>>>
{
fun
suggestionPlaceAbroad
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
String
,
map2
:
String
,
map3
:
String
,
map4
:
String
):
Observable
<
Response
<
Base
ArrayResponse
<
PositionBean
>>>
{
return
BaiduHttpManager
.
getInstance
()
.
execute
(
lifecycleProvider
,
BaiduApi
.
newInstance
().
suggestionPlaceAbroad
(
map
,
map2
,
map3
,
map4
))
}
fun
suggestionPlaceDomestic
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
String
,
map2
:
String
,
map3
:
String
,
map4
:
String
):
Observable
<
Response
<
BaseArrayResponse
<
PositionBean
>>>
{
return
BaiduHttpManager
.
getInstance
()
.
execute
(
lifecycleProvider
,
BaiduApi
.
newInstance
().
suggestionPlaceDomestic
(
map
,
map2
,
map3
,
map4
))
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/widget/dialog/DialogUtils.kt
View file @
d1e3e3d7
...
...
@@ -24,4 +24,14 @@ object DialogUtils{
dialogListener
.
setDialog
(
bonusDialog
)
}
/**
* 登录弹窗
*/
fun
showloginDialog
(
ctx
:
Context
,
dialogListener
:
DialogListener
){
val
weakReference
=
WeakReference
<
Context
>(
ctx
)
val
baseDialog
=
ShowLoginDialog
(
weakReference
.
get
()
!!
,
dialogListener
)
baseDialog
.
show
()
dialogListener
.
setDialog
(
baseDialog
)
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/widget/dialog/ShowBenfitDialog.kt
View file @
d1e3e3d7
...
...
@@ -21,7 +21,7 @@ class ShowBenfitDialog(context: Context, private val listener: DialogListener) :
private
var
gridbenfitAdapter
:
GridBenfitAdapter
?
=
null
init
{
setContentView
(
R
.
layout
.
dialog_showbenfit
)
setContentView
(
R
.
layout
.
layout_popupwindow
)
// 设置window属性
lp
=
window
!!
.
attributes
lp
.
gravity
=
Gravity
.
CENTER
...
...
app/src/main/java/com/mints/street/widget/dialog/ShowLoginDialog.kt
0 → 100644
View file @
d1e3e3d7
package
com.mints.street.widget.dialog
import
android.app.Dialog
import
android.content.Context
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.WindowManager
import
android.widget.CheckBox
import
android.widget.ImageView
import
android.widget.TextView
import
androidx.appcompat.widget.LinearLayoutCompat
import
androidx.recyclerview.widget.RecyclerView
import
com.alibaba.android.vlayout.DelegateAdapter
import
com.alibaba.android.vlayout.VirtualLayoutManager
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.mints.street.R
import
com.mints.street.adapter.GridBenfitAdapter
import
com.mints.street.login.LoginActivity
import
me.goldze.mvvmhabit.utils.RxUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
class
ShowLoginDialog
(
context
:
Context
,
private
val
listener
:
DialogListener
)
:
BottomSheetDialog
(
context
,
R
.
style
.
dialog
)
{
private
val
lp
:
WindowManager
.
LayoutParams
//弹窗
private
var
iv_weixin
:
ImageView
?
=
null
private
var
ly_phone
:
LinearLayoutCompat
?
=
null
private
var
cb_checked
:
CheckBox
?
=
null
private
var
tv_regist
:
TextView
?
=
null
private
var
tv_private
:
TextView
?
=
null
init
{
setContentView
(
R
.
layout
.
layout_popupwindow
)
// 设置window属性
lp
=
window
!!
.
attributes
lp
.
gravity
=
Gravity
.
CENTER
lp
.
width
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
lp
.
windowAnimations
=
R
.
style
.
DialogAnimBottom
window
!!
.
attributes
=
lp
// 设置外部不可关闭
setCancelable
(
true
)
setCanceledOnTouchOutside
(
false
)
setOnKeyListener
{
_
,
i
,
_
->
i
==
KeyEvent
.
KEYCODE_BACK
}
initView
();
tv_regist
?.
setOnClickListener
{
listener
.
onClick
(
it
)
}
tv_private
?.
setOnClickListener
{
listener
.
onClick
(
it
)
}
iv_weixin
?.
setOnClickListener
{
listener
.
onClick
(
it
)
}
ly_phone
?.
setOnClickListener
{
listener
.
onClick
(
it
)
}
}
private
fun
initView
()
{
iv_weixin
=
findViewById
(
R
.
id
.
iv_weixin
)
ly_phone
=
findViewById
(
R
.
id
.
ly_phone
)
cb_checked
=
findViewById
(
R
.
id
.
cb_checked
)
tv_private
=
findViewById
(
R
.
id
.
tv_private
)
tv_regist
=
findViewById
(
R
.
id
.
tv_regist
)
// ly_phone?.setOnClickListener(this)
// RxUtils.onMultiClick(ly_phone) {
// if (cb_checked!!.isChecked) {
// startActivity(LoginActivity::class.java)
// mBottomSheetDialog!!.dismiss()
// } else {
// ToastUtils.showShort("请先同意用户协议与隐私政策")
// }
// }
}
}
\ No newline at end of file
app/src/main/res/layout/fragment_home.xml
View file @
d1e3e3d7
...
...
@@ -164,9 +164,7 @@
android:layout_height=
"wrap_content"
android:text=
"搜索境内、境外地址"
android:textColor=
"#A2A4B1"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/BaseArrayResponse.java
deleted
100644 → 0
View file @
c5f29fca
//package me.goldze.mvvmhabit.http;
//
//import java.util.List;
//
///**
// * Created by goldze on 2017/5/10.
// * 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
// */
//public class BaseArrayResponse<T> extends BaseResponse<List<T>>{
//
//
// @Override
// public List<T> getResult() {
// return result;
// }
//
// @Override
// public void setResult(List<T> result) {
// this.result = result;
// }
//
//}
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