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
eea467fc
Commit
eea467fc
authored
Jul 29, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.搜索页面的境内境外切换
2.bean的list修改
parent
858398fe
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
101 additions
and
107 deletions
+101
-107
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
BaiduApi.kt
app/src/main/java/com/mints/street/api/BaiduApi.kt
+2
-2
BaseArrayResponse.java
...rc/main/java/com/mints/street/bean/BaseArrayResponse.java
+1
-9
BaseResponse.java
app/src/main/java/com/mints/street/bean/BaseResponse.java
+15
-2
SearchMapActivity.kt
...main/java/com/mints/street/main/home/SearchMapActivity.kt
+55
-47
SearchMapViewModel.kt
...ain/java/com/mints/street/main/home/SearchMapViewModel.kt
+19
-38
BaiduModel.kt
app/src/main/java/com/mints/street/model/BaiduModel.kt
+2
-2
activity_aboutus.xml
app/src/main/res/layout/activity_aboutus.xml
+1
-1
activity_bindmobile.xml
app/src/main/res/layout/activity_bindmobile.xml
+1
-1
NotificationUtils.java
...e/src/main/java/com/fry/base/utils/NotificationUtils.java
+3
-3
common_setting_item.xml
library_base/src/main/res/layout/common_setting_item.xml
+1
-1
ic_launcher_main.png
library_base/src/main/res/mipmap-xhdpi/ic_launcher_main.png
+0
-0
ic_launcher_main.png
library_base/src/main/res/mipmap-xxhdpi/ic_launcher_main.png
+0
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
eea467fc
...
...
@@ -18,7 +18,7 @@
<application
android:name=
".AppApplication"
android:allowBackup=
"true"
android:icon=
"@mipmap/
logo
"
android:icon=
"@mipmap/
ic_launcher_main
"
android:label=
"@string/app_name"
android:largeHeap=
"true"
android:networkSecurityConfig=
"@xml/network_security_config"
...
...
app/src/main/java/com/mints/street/api/BaiduApi.kt
View file @
eea467fc
...
...
@@ -38,11 +38,11 @@ interface BaiduApi {
// 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
<
Base
Array
Response
<
PositionBean
>>>
Observable
<
Response
<
BaseResponse
<
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
<
Base
Array
Response
<
PositionBean
>>>
Observable
<
Response
<
BaseResponse
<
PositionBean
>>>
}
\ No newline at end of file
app/src/main/java/com/mints/street/bean/BaseArrayResponse.java
View file @
eea467fc
...
...
@@ -6,17 +6,9 @@ import java.util.List;
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
public
class
BaseArrayResponse
<
T
>
extends
BaseResponse
<
List
<
T
>>
{
public
class
BaseArrayResponse
<
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 @
eea467fc
...
...
@@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
import
com.google.gson.annotations.SerializedName
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* Created by goldze on 2017/5/10.
...
...
@@ -17,7 +18,10 @@ public class BaseResponse<T> implements Serializable {
// @JsonAdapter(value = JsonAdapterGsonDeserializer.class)
@SerializedName
(
"data"
)
protected
@Nullable
T
result
;
private
@Nullable
T
result
;
@SerializedName
(
"result"
)
private
@Nullable
List
<
T
>
resultList
;
public
BaseResponse
()
{
}
...
...
@@ -50,7 +54,7 @@ public class BaseResponse<T> implements Serializable {
}
public
boolean
isOk
()
{
return
status
==
200
&&
status
<
70
0
;
return
status
==
200
||
status
==
0
;
}
public
String
getMessage
()
{
...
...
@@ -61,6 +65,15 @@ public class BaseResponse<T> implements Serializable {
this
.
message
=
message
;
}
public
void
setResultList
(
@Nullable
List
<
T
>
resultList
)
{
this
.
resultList
=
resultList
;
}
@Nullable
public
List
<
T
>
getResultList
()
{
return
resultList
;
}
@Override
public
String
toString
()
{
return
"BaseResponse{"
+
...
...
app/src/main/java/com/mints/street/main/home/SearchMapActivity.kt
View file @
eea467fc
...
...
@@ -22,8 +22,8 @@ import com.mints.street.databinding.ActivitySearchMapBinding
/**
* 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
...
...
@@ -75,16 +75,15 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
viewModel
.
searchAfterOneItems
.
clear
()
return
}
if
(
viewModel
.
index
==
0
)
{
if
(
viewModel
.
index
.
value
==
0
)
{
//国外
viewModel
.
searchdomestic
(
s
.
toString
())
}
else
{
}
else
{
//传入参数【这里是可以获取到参数的】【国外】
viewModel
.
searchabroad
(
s
.
toString
())
}
// onGetSuggestionResult(postionConfig)
// // 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新【这里也是百度三方的东西】
// mSuggestionSearch?.requestSuggestion(
...
...
@@ -120,13 +119,12 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
}
private
fun
update
()
{
historyRecordAdapter
?.
apply
{
this
.
type
=
viewModel
.
index
this
.
type
=
viewModel
.
index
.
value
?:
0
}
popularSceneAdapter
?.
apply
{
if
(
viewModel
.
index
==
0
)
{
if
(
viewModel
.
index
.
value
?:
0
==
0
)
{
this
.
data
=
viewModel
.
mapBean
.
value
?.
innerPlaces
?.
places
}
else
{
this
.
data
=
viewModel
.
mapBean
.
value
?.
outerPlaces
?.
places
...
...
@@ -151,13 +149,24 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
it
?.
apply
{
onGetSuggestionResult
(
this
)
}
})
viewModel
.
index
.
observe
(
this
,
Observer
{
if
(
TextUtils
.
isEmpty
(
binding
.
et
.
text
)){
return
@Observer
}
if
(
it
==
0
)
{
//国外
viewModel
.
searchdomestic
(
binding
.
et
.
text
.
toString
())
}
else
{
//传入参数【这里是可以获取到参数的】【国外】
viewModel
.
searchabroad
(
binding
.
et
.
text
.
toString
())
}
})
}
private
fun
territory
()
{
if
(
viewModel
.
index
==
0
)
return
viewModel
.
index
=
0
if
(
viewModel
.
index
.
value
?:
0
==
0
)
return
viewModel
.
index
.
value
=
0
binding
.
territory
.
setTextColor
(
ResourceUtils
.
getColor
(
R
.
color
.
color_668BFF
))
binding
.
abroad
.
setTextColor
(
ResourceUtils
.
getColor
(
R
.
color
.
white
))
binding
.
territory
.
solid
=
ResourceUtils
.
getColor
(
R
.
color
.
white
)
...
...
@@ -166,8 +175,8 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
}
private
fun
abroad
()
{
if
(
viewModel
.
index
==
1
)
return
viewModel
.
index
=
1
if
(
viewModel
.
index
.
value
?:
0
==
1
)
return
viewModel
.
index
.
value
=
1
binding
.
territory
.
setTextColor
(
ResourceUtils
.
getColor
(
R
.
color
.
white
))
binding
.
abroad
.
setTextColor
(
ResourceUtils
.
getColor
(
R
.
color
.
color_668BFF
))
binding
.
territory
.
solid
=
ResourceUtils
.
getColor
(
R
.
color
.
color_668BFF
)
...
...
@@ -194,7 +203,6 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
}
/**
* 获取在线建议搜索结果,得到requestSuggestion返回的搜索结果
* 【这里是第三方百度的东西】
...
...
app/src/main/java/com/mints/street/main/home/SearchMapViewModel.kt
View file @
eea467fc
...
...
@@ -26,7 +26,8 @@ import java.io.InputStreamReader
* Created by 冯瑞雨 on 2021/7/13.
*/
class
SearchMapViewModel
(
application
:
Application
)
:
BaseViewModel
(
application
)
{
var
index
=
0
;
//0=境内 1=境外
//0=境内 1=境外
val
index
=
MutableLiveData
(
0
)
val
positiondata
:
MutableLiveData
<
List
<
PositionBean
>>
=
MutableLiveData
()
//这里是走的一个点击回调,能够打开首页进行定位
val
searchAfterItemBinding
=
ItemBinding
.
of
<
SearchAfterItem
>(
BR
.
viewModel
,
R
.
layout
.
item_search_after
)
...
...
@@ -76,58 +77,38 @@ 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
>>(
BaiduModel
.
suggestionPlaceAbroad
(
lifecycleProvider
,
position
,
"全球"
,
"json"
,
"tnFhCM9cTeTDZqNjRPVHbfzOz6AUPoEq"
)
.
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
PositionBean
>>(
this
@SearchMapViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseArrayResponse
<
PositionBean
>)
{
positiondata
.
value
=
response
.
result
println
(
"mcg __ "
+
response
.
result
)
}
override
fun
onError
(
e
:
Throwable
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
PositionBean
>)
{
positiondata
.
value
=
response
.
resultList
println
(
"mcg __ "
+
response
.
resultList
)
}
}
)
}
/**
* 获取国内搜索信息
* "query"" = "北京"
* "region"" = "中国"
* "output"" = "json"
* "ak"" = "C56Qdc560TQKtQaavS0NTPUYupsZHspI"
*/
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
>>(
BaiduModel
.
suggestionPlaceDomestic
(
lifecycleProvider
,
position
,
"中国"
,
"json"
,
"C56Qdc560TQKtQaavS0NTPUYupsZHspI"
)
.
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
PositionBean
>>(
this
@SearchMapViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
Base
Array
Response
<
PositionBean
>)
{
positiondata
.
value
=
response
.
result
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
PositionBean
>)
{
positiondata
.
value
=
response
.
result
List
println
(
"mcg __ "
+
response
.
result
)
}
override
fun
onError
(
e
:
Throwable
)
{
}
}
)
}
...
...
app/src/main/java/com/mints/street/model/BaiduModel.kt
View file @
eea467fc
...
...
@@ -20,11 +20,11 @@ object BaiduModel {
// .execute(lifecycleProvider, BaiduApi.newInstance().suggestionPlaceAbroad(map))
// }
fun
suggestionPlaceAbroad
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
String
,
map2
:
String
,
map3
:
String
,
map4
:
String
):
Observable
<
Response
<
Base
Array
Response
<
PositionBean
>>>
{
fun
suggestionPlaceAbroad
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
String
,
map2
:
String
,
map3
:
String
,
map4
:
String
):
Observable
<
Response
<
BaseResponse
<
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
<
Base
Array
Response
<
PositionBean
>>>
{
fun
suggestionPlaceDomestic
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
String
,
map2
:
String
,
map3
:
String
,
map4
:
String
):
Observable
<
Response
<
BaseResponse
<
PositionBean
>>>
{
return
BaiduHttpManager
.
getInstance
()
.
execute
(
lifecycleProvider
,
BaiduApi
.
newInstance
().
suggestionPlaceDomestic
(
map
,
map2
,
map3
,
map4
))
}
...
...
app/src/main/res/layout/activity_aboutus.xml
View file @
eea467fc
...
...
@@ -31,7 +31,7 @@
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:layout_marginBottom=
"65dp"
android:src=
"@mipmap/
logo
"
/>
android:src=
"@mipmap/
ic_launcher_main
"
/>
<LinearLayout
android:layout_centerHorizontal=
"true"
android:id=
"@+id/ly_text"
...
...
app/src/main/res/layout/activity_bindmobile.xml
View file @
eea467fc
...
...
@@ -34,7 +34,7 @@
android:layout_height=
"70dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"50dp"
android:src=
"@mipmap/
logo
"
/>
android:src=
"@mipmap/
ic_launcher_main
"
/>
<LinearLayout
...
...
library_base/src/main/java/com/fry/base/utils/NotificationUtils.java
View file @
eea467fc
...
...
@@ -114,7 +114,7 @@ public class NotificationUtils extends ContextWrapper {
//文本内容
builder
.
setContentText
(
content
);
//小图标
builder
.
setSmallIcon
(
R
.
mipmap
.
logo
);
builder
.
setSmallIcon
(
R
.
mipmap
.
ic_launcher_main
);
//设置点击信息后自动清除通知
builder
.
setAutoCancel
(
true
);
return
builder
;
...
...
@@ -157,10 +157,10 @@ public class NotificationUtils extends ContextWrapper {
//文本内容
builder
.
setContentText
(
content
);
//小图标
builder
.
setSmallIcon
(
R
.
mipmap
.
logo
);
builder
.
setSmallIcon
(
R
.
mipmap
.
ic_launcher_main
);
//设置大图标,未设置时使用小图标代替,拉下通知栏显示的那个图标
//设置大图片 BitmpFactory.decodeResource(Resource res,int id) 根据给定的资源Id解析成位图
builder
.
setLargeIcon
(
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
mipmap
.
logo
));
builder
.
setLargeIcon
(
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
mipmap
.
ic_launcher_main
));
if
(
progress
<
100
)
{
//一种是有进度刻度的(false),一种是循环流动的(true)
//设置为false,表示刻度,设置为true,表示流动
...
...
library_base/src/main/res/layout/common_setting_item.xml
View file @
eea467fc
...
...
@@ -70,7 +70,7 @@
android:id=
"@+id/iv_image"
android:layout_width=
"28dp"
android:layout_height=
"28dp"
android:src=
"@mipmap/
logo
"
android:src=
"@mipmap/
ic_launcher_main
"
android:layout_marginEnd=
"10dp"
android:visibility=
"gone"
/>
...
...
library_base/src/main/res/mipmap-xhdpi/
logo
.png
→
library_base/src/main/res/mipmap-xhdpi/
ic_launcher_main
.png
View file @
eea467fc
File moved
library_base/src/main/res/mipmap-xxhdpi/
logo
.png
→
library_base/src/main/res/mipmap-xxhdpi/
ic_launcher_main
.png
View file @
eea467fc
File moved
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