首页金刚区完善
This commit is contained in:
parent
64d235dfc0
commit
f42435dd60
@ -225,6 +225,12 @@
|
|||||||
android:configChanges="keyboardHidden|orientation|locale"
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.home.activity.BusinessActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.account.authteam.AuthTeamActivity"
|
android:name=".ui.account.authteam.AuthTeamActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|locale"
|
android:configChanges="keyboardHidden|orientation|locale"
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.dahe.gldriver.adapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter4.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||||
|
import com.dahe.gldriver.R
|
||||||
|
import com.dahe.gldriver.bean.CarBean
|
||||||
|
import com.dahe.gldriver.ui.home.activity.BusinessActivity
|
||||||
|
import com.dahe.glex.bean.WayBillBean
|
||||||
|
import com.dahe.mylibrary.utils.ImageLoader
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WaybillAdapter
|
||||||
|
* @Author 用户
|
||||||
|
* @Date 2024/1/23 16:27
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
class BusinessAdapter :
|
||||||
|
BaseQuickAdapter<BusinessActivity.Model, QuickViewHolder>() {
|
||||||
|
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: BusinessActivity.Model?) {
|
||||||
|
holder.run {
|
||||||
|
setText(R.id.type_name, item?.type_name)
|
||||||
|
ImageLoader.getInstance().loadImage(context,item?.type_img,getView(R.id.type_icon))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(
|
||||||
|
context: Context,
|
||||||
|
parent: ViewGroup,
|
||||||
|
viewType: Int
|
||||||
|
): QuickViewHolder {
|
||||||
|
// 返回一个 ViewHolder
|
||||||
|
return QuickViewHolder(R.layout.item_business_type, parent)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.dahe.gldriver.adapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.amap.api.services.core.PoiItem
|
||||||
|
import com.chad.library.adapter4.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||||
|
import com.dahe.gldriver.R
|
||||||
|
import com.dahe.mylibrary.utils.ImageLoader
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WaybillAdapter
|
||||||
|
* @Author 用户
|
||||||
|
* @Date 2024/1/23 16:27
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
class BusinessListAdapter :
|
||||||
|
BaseQuickAdapter<PoiItem, QuickViewHolder>() {
|
||||||
|
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: PoiItem?) {
|
||||||
|
holder.run {
|
||||||
|
setText(R.id.name, item?.title)
|
||||||
|
setText(R.id.address, item?.snippet)
|
||||||
|
setText(R.id.taste, item?.tel)
|
||||||
|
ImageLoader.getInstance()
|
||||||
|
.loadRoundImage(context, item?.photos?.get(0)?.url, 10, getView<ImageView>(R.id.photoUrl))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(
|
||||||
|
context: Context,
|
||||||
|
parent: ViewGroup,
|
||||||
|
viewType: Int
|
||||||
|
): QuickViewHolder {
|
||||||
|
// 返回一个 ViewHolder
|
||||||
|
return QuickViewHolder(R.layout.item_business_list, parent)
|
||||||
|
}
|
||||||
|
}
|
@ -1,24 +1,20 @@
|
|||||||
package com.dahe.gldriver.base
|
package com.dahe.gldriver.base
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.webkit.JavascriptInterface
|
|
||||||
import android.webkit.WebResourceRequest
|
import android.webkit.WebResourceRequest
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.dahe.gldriver.databinding.ActivityWebBinding
|
import com.dahe.gldriver.databinding.ActivityWebBinding
|
||||||
import com.dahe.gldriver.ui.HomeActivity
|
import com.dahe.gldriver.utils.SPUtils
|
||||||
|
import com.dahe.glex.bean.UserBean
|
||||||
import com.dahe.mylibrary.R
|
import com.dahe.mylibrary.R
|
||||||
import com.dahe.mylibrary.base.BaseActivity
|
import com.dahe.mylibrary.base.BaseActivity
|
||||||
import com.just.agentweb.AgentWeb
|
import com.just.agentweb.AgentWeb
|
||||||
import com.just.agentweb.AgentWebUIControllerImplBase
|
import com.just.agentweb.AgentWebUIControllerImplBase
|
||||||
import com.just.agentweb.WebChromeClient
|
import com.just.agentweb.WebChromeClient
|
||||||
import com.just.agentweb.WebViewClient
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName WebActivity
|
* @ClassName WebActivity
|
||||||
@ -51,7 +47,6 @@ class WebActivity : BaseActivity<ActivityWebBinding>() {
|
|||||||
.ready()
|
.ready()
|
||||||
.go(mUrl)
|
.go(mUrl)
|
||||||
|
|
||||||
|
|
||||||
// mAgentWeb?.jsInterfaceHolder?.addJavaObject("phone", AndroidInterfaceWeb())
|
// mAgentWeb?.jsInterfaceHolder?.addJavaObject("phone", AndroidInterfaceWeb())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +54,41 @@ class WebActivity : BaseActivity<ActivityWebBinding>() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun initOpinion() {
|
||||||
|
binding.run {
|
||||||
|
// val ub: UserBean? = SPUtils.instance.getUserInfo(mContext)
|
||||||
|
// wv.getSettings().setJavaScriptEnabled(true)
|
||||||
|
// wv.getSettings().setDomStorageEnabled(true) // 这个要加上
|
||||||
|
// val openid: String = ub.getData().getUname() // 用户的openid
|
||||||
|
// val nickname: String = StringUtil.isNull(ub.getData().getRname(), "游客") // 用户的nickname
|
||||||
|
// val headimgurl: String =
|
||||||
|
// StringUtil.isNull(ub.getData().getHeadportraitUrl(), "") // 用户的头像url
|
||||||
|
//
|
||||||
|
// /* 获得 webview url,请注意url单词是product而不是products,products是旧版本的参数,用错地址将不能成功提交 */
|
||||||
|
// val url = "https://support.qq.com/products/335639" // 把1221数字换成你的产品ID,否则会不成功
|
||||||
|
// /* 准备post参数 */
|
||||||
|
// val postData =
|
||||||
|
// "nickname=$nickname&avatar=$headimgurl&openid=$openid"
|
||||||
|
// wv.postUrl(url, postData.toByteArray())
|
||||||
|
// wv.setWebChromeClient(chromeClient)
|
||||||
|
// wv.setWebViewClient(object : android.webkit.WebViewClient() {
|
||||||
|
// override fun shouldOverrideUrlLoading(
|
||||||
|
// view: WebView,
|
||||||
|
// request: WebResourceRequest
|
||||||
|
// ): Boolean {
|
||||||
|
// return super.shouldOverrideUrlLoading(view, request)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
||||||
|
// //返回值是true的时候控制去WebView打开,为false调用系统浏览器或第三方浏览器
|
||||||
|
// view.loadUrl(url)
|
||||||
|
// return true
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private val mWebChromeClient: WebChromeClient = object : WebChromeClient() {
|
private val mWebChromeClient: WebChromeClient = object : WebChromeClient() {
|
||||||
override fun onProgressChanged(view: WebView, newProgress: Int) {
|
override fun onProgressChanged(view: WebView, newProgress: Int) {
|
||||||
super.onProgressChanged(view, newProgress)
|
super.onProgressChanged(view, newProgress)
|
||||||
|
@ -1,21 +1,24 @@
|
|||||||
package com.dahe.gldriver.ui.home
|
package com.dahe.gldriver.ui.home
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.content.Intent
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.dahe.gldriver.R
|
import com.dahe.gldriver.R
|
||||||
import com.dahe.gldriver.adapter.GridItemAdapter
|
import com.dahe.gldriver.adapter.GridItemAdapter
|
||||||
import com.dahe.gldriver.adapter.WaybillAdapter
|
import com.dahe.gldriver.adapter.WaybillAdapter
|
||||||
import com.dahe.gldriver.adapter.WaybillListAdapter
|
|
||||||
import com.dahe.gldriver.base.AppConfig
|
import com.dahe.gldriver.base.AppConfig
|
||||||
import com.dahe.gldriver.bean.CarBean
|
import com.dahe.gldriver.base.WebActivity
|
||||||
import com.dahe.gldriver.bean.GridBean
|
import com.dahe.gldriver.bean.GridBean
|
||||||
import com.dahe.gldriver.databinding.FragmentHomeBinding
|
import com.dahe.gldriver.databinding.FragmentHomeBinding
|
||||||
import com.dahe.gldriver.net.BaseObserver
|
import com.dahe.gldriver.net.BaseObserver
|
||||||
import com.dahe.gldriver.net.DataManager
|
import com.dahe.gldriver.net.DataManager
|
||||||
import com.dahe.gldriver.net.RxHttpCallBack
|
import com.dahe.gldriver.net.RxHttpCallBack
|
||||||
|
import com.dahe.gldriver.ui.home.activity.BusinessActivity
|
||||||
import com.dahe.gldriver.ui.waybill.activity.WaybillDetailActivity
|
import com.dahe.gldriver.ui.waybill.activity.WaybillDetailActivity
|
||||||
import com.dahe.gldriver.utils.OrderUtils
|
import com.dahe.gldriver.utils.OrderUtils
|
||||||
import com.dahe.glex.bean.OrderBean
|
import com.dahe.glex.bean.OrderBean
|
||||||
@ -25,10 +28,9 @@ import com.dahe.mylibrary.net.CommonResponseBean
|
|||||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||||
import com.dahe.mylibrary.utils.ActivityUtils
|
import com.dahe.mylibrary.utils.ActivityUtils
|
||||||
import com.dahe.mylibrary.utils.ConvertUtils
|
import com.dahe.mylibrary.utils.ConvertUtils
|
||||||
|
import com.permissionx.guolindev.PermissionX
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import org.greenrobot.eventbus.EventBus
|
|
||||||
import org.greenrobot.eventbus.Subscribe
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName HomeFragment
|
* @ClassName HomeFragment
|
||||||
@ -68,6 +70,53 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
|||||||
gridView.run {
|
gridView.run {
|
||||||
adapter = activity?.let { GridItemAdapter(it, gridDatas) }
|
adapter = activity?.let { GridItemAdapter(it, gridDatas) }
|
||||||
setOnItemClickListener { adapterView, view, i, l ->
|
setOnItemClickListener { adapterView, view, i, l ->
|
||||||
|
when (i) {
|
||||||
|
0 -> {
|
||||||
|
//startActivity(new Intent(con, OrderListActivity.class));
|
||||||
|
PermissionX.init(requireActivity())
|
||||||
|
.permissions(Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
|
.request { allGranted: Boolean, grantedList: List<String?>?, deniedList: List<String?>? ->
|
||||||
|
if (allGranted) {
|
||||||
|
ActivityUtils.startActivity(mContext,BusinessActivity::class.java)
|
||||||
|
} else {
|
||||||
|
showToast("请先开启定位权限")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1 -> {
|
||||||
|
ActivityUtils.startActivity(
|
||||||
|
mContext,
|
||||||
|
WebActivity::class.java,
|
||||||
|
Bundle().apply {
|
||||||
|
putString(
|
||||||
|
"url",
|
||||||
|
"https://www.v5kf.com/public/chat/chat?sid=187123&entry=5&ref=link&accountid=2daf303016ed4"
|
||||||
|
)
|
||||||
|
putString("title", gridDatas[i].title)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
2 -> {
|
||||||
|
ActivityUtils.startActivity(
|
||||||
|
mContext,
|
||||||
|
WebActivity::class.java,
|
||||||
|
Bundle().apply {
|
||||||
|
putString("url", "https://www.wjx.cn/vm/mKciqMo.aspx")
|
||||||
|
putString("title", gridDatas[i].title)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
3 -> {
|
||||||
|
ActivityUtils.startActivity(
|
||||||
|
mContext,
|
||||||
|
WebActivity::class.java,
|
||||||
|
Bundle().apply {
|
||||||
|
putString("url", "https://ks.wjx.top/vm/h6Jqu8A.aspx")
|
||||||
|
putString("title", gridDatas[i].title)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tvMar.isSelected = true
|
tvMar.isSelected = true
|
||||||
@ -76,6 +125,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
|||||||
if (this@HomeFragment.mListener != null)
|
if (this@HomeFragment.mListener != null)
|
||||||
this@HomeFragment?.mListener?.invoke(2)
|
this@HomeFragment?.mListener?.invoke(2)
|
||||||
}
|
}
|
||||||
|
ivAllWaybill.setOnClickListener {
|
||||||
|
showToast("敬请期待")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
initData()
|
initData()
|
||||||
}
|
}
|
||||||
@ -132,8 +184,8 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
|||||||
Bundle().apply { putString(AppConfig.ORDER_ID, items[position].orderId) })
|
Bundle().apply { putString(AppConfig.ORDER_ID, items[position].orderId) })
|
||||||
}
|
}
|
||||||
addOnItemChildClickListener(R.id.btnOk) { adapter, view, position ->
|
addOnItemChildClickListener(R.id.btnOk) { adapter, view, position ->
|
||||||
OrderUtils.getInstance().goReceWaybill(mContext, items[position].orderId){
|
OrderUtils.getInstance().goReceWaybill(mContext, items[position].orderId) {
|
||||||
if (it){
|
if (it) {
|
||||||
initData()
|
initData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,154 @@
|
|||||||
|
package com.dahe.gldriver.ui.home.activity
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.amap.api.maps.AMap
|
||||||
|
import com.amap.api.services.core.LatLonPoint
|
||||||
|
import com.amap.api.services.core.PoiItem
|
||||||
|
import com.amap.api.services.poisearch.PoiResult
|
||||||
|
import com.amap.api.services.poisearch.PoiSearch
|
||||||
|
import com.dahe.gldriver.R
|
||||||
|
import com.dahe.gldriver.adapter.BusinessAdapter
|
||||||
|
import com.dahe.gldriver.adapter.BusinessListAdapter
|
||||||
|
import com.dahe.gldriver.databinding.ActivityBusinessBinding
|
||||||
|
import com.dahe.gldriver.utils.GDLocationUtils
|
||||||
|
import com.dahe.mylibrary.base.BaseActivity
|
||||||
|
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||||
|
import com.dahe.mylibrary.utils.ConvertUtils
|
||||||
|
import com.dahe.mylibrary.utils.LoadingUtils
|
||||||
|
import com.dahe.mylibrary.utils.ToastUtils
|
||||||
|
import com.dahe.mylibrary.weight.FullyGridLayoutManager
|
||||||
|
import com.luck.picture.lib.decoration.GridSpacingItemDecoration
|
||||||
|
import com.luck.picture.lib.utils.DensityUtil
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName BusinessActivity
|
||||||
|
* @Author john
|
||||||
|
* @Date 2024/3/25 11:24
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
class BusinessActivity : BaseActivity<ActivityBusinessBinding>(), PoiSearch.OnPoiSearchListener {
|
||||||
|
var listType: List<Model> = arrayListOf(
|
||||||
|
Model("餐饮", R.drawable.icon_canguan),
|
||||||
|
Model("住宿", R.drawable.icon_jiudian),
|
||||||
|
Model("商店", R.drawable.icon_shangdian),
|
||||||
|
Model("加油站", R.drawable.icon_jiayouzhan),
|
||||||
|
Model("汽车维修", R.drawable.icon_xiuche)
|
||||||
|
)
|
||||||
|
|
||||||
|
private val type = listType[0].type_name
|
||||||
|
|
||||||
|
private var mAMap: AMap? = null
|
||||||
|
private var query: PoiSearch.Query? = null
|
||||||
|
private var currLoca: LatLonPoint? = null
|
||||||
|
var adapterList: BusinessListAdapter? = null
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
setStatusBarColor(R.color.white)
|
||||||
|
setTitleBar("司机之家", true)
|
||||||
|
|
||||||
|
binding.run {
|
||||||
|
businessType.run {
|
||||||
|
layoutManager =
|
||||||
|
FullyGridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)
|
||||||
|
addItemDecoration(
|
||||||
|
GridSpacingItemDecoration(
|
||||||
|
4,
|
||||||
|
DensityUtil.dip2px(mContext, 8f), false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
adapter = BusinessAdapter().apply {
|
||||||
|
submitList(listType)
|
||||||
|
setOnItemClickListener { _, _, postion ->
|
||||||
|
changeType(listType[postion].type_name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
adapterList = businessList.run {
|
||||||
|
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||||
|
addItemDecoration(
|
||||||
|
RecycleViewDivider(
|
||||||
|
LinearLayout.VERTICAL,
|
||||||
|
ConvertUtils.dp2px(10.0f),
|
||||||
|
Color.TRANSPARENT
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
adapter = BusinessListAdapter()
|
||||||
|
adapter as BusinessListAdapter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadingUtils.instance.showLoading(this, "定位中...")
|
||||||
|
GDLocationUtils.instance.getLocation(mContext) {
|
||||||
|
runOnUiThread {
|
||||||
|
LoadingUtils.instance.dissLoading()
|
||||||
|
if (it.getErrorCode() == 0) {
|
||||||
|
try {
|
||||||
|
binding.address.text = it.address
|
||||||
|
currLoca = LatLonPoint(it.getLatitude(), it.getLongitude())
|
||||||
|
val poiSearch = PoiSearch(this, query)
|
||||||
|
poiSearch.setOnPoiSearchListener(this)
|
||||||
|
poiSearch.bound = PoiSearch.SearchBound(currLoca, 5000, true) //
|
||||||
|
// 设置搜索区域为以lp点为圆心,其周围5000米范围
|
||||||
|
poiSearch.searchPOIAsyn() // 异步搜索
|
||||||
|
} catch (e: java.lang.Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
showToast("定位失败,请检查定位权限是否开启")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
changeType(type)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initDate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun changeType(type: String) {
|
||||||
|
query = PoiSearch.Query(type, "", "")
|
||||||
|
query?.setExtensions("all")
|
||||||
|
query?.setPageSize(20) // 设置每页最多返回多少条poiitem
|
||||||
|
query?.setPageNum(0) // 设置查第一页
|
||||||
|
if (currLoca != null) {
|
||||||
|
try {
|
||||||
|
val poiSearch = PoiSearch(this, query)
|
||||||
|
poiSearch.setOnPoiSearchListener(this)
|
||||||
|
poiSearch.bound = PoiSearch.SearchBound(currLoca, 5000, true) //
|
||||||
|
// 设置搜索区域为以lp点为圆心,其周围5000米范围
|
||||||
|
poiSearch.searchPOIAsyn() // 异步搜索
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Model(var type_name: String, var type_img: Int)
|
||||||
|
|
||||||
|
override fun onPoiSearched(p0: PoiResult?, p1: Int) {
|
||||||
|
if (p0 != null && p0.getQuery() != null) { // 搜索poi的结果
|
||||||
|
var poiItems = p0.getPois() // 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
|
||||||
|
if (poiItems != null && poiItems.size > 0) {
|
||||||
|
adapterList?.submitList(poiItems)
|
||||||
|
} else {
|
||||||
|
ToastUtils.showToast(mContext, "对不起,没有搜索到相关数据!")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ToastUtils.showToast(mContext, "对不起,没有搜索到相关数据!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPoiItemSearched(p0: PoiItem?, p1: Int) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
BIN
app/src/main/res/drawable-xxhdpi/icon_canguan.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_canguan.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_jiayouzhan.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_jiayouzhan.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_jiudian.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_jiudian.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_shangdian.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_shangdian.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/drawable/icon_xiuche.png
Normal file
BIN
app/src/main/res/drawable/icon_xiuche.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/drawable/img.png
Normal file
BIN
app/src/main/res/drawable/img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.0 KiB |
114
app/src/main/res/layout/activity_business.xml
Normal file
114
app/src/main/res/layout/activity_business.xml
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/activity_business"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include layout="@layout/common_toolbar"></include>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
|
android:layout_marginLeft="@dimen/dp_12"
|
||||||
|
android:layout_marginRight="@dimen/dp_12"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/bg_bai">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginTop="@dimen/dp_8"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/dp_12"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<View
|
||||||
|
android:layout_width="@dimen/dp_3"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:background="@color/theme_color"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_marginLeft="@dimen/dp_7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="当前位置:"
|
||||||
|
android:textSize="@dimen/dp_15"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/address"
|
||||||
|
android:layout_marginRight="@dimen/dp_12"
|
||||||
|
android:layout_marginLeft="@dimen/dp_7"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/dp_15"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
|
android:layout_marginLeft="@dimen/dp_12"
|
||||||
|
android:layout_marginRight="@dimen/dp_12"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/bg_bai">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginTop="@dimen/dp_8"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<View
|
||||||
|
android:layout_width="@dimen/dp_3"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:background="@color/theme_color"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_marginLeft="@dimen/dp_7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="常用服务"
|
||||||
|
android:textSize="@dimen/dp_15"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/businessType"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/dp_10"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
|
android:layout_marginLeft="@dimen/dp_12"
|
||||||
|
android:layout_marginRight="@dimen/dp_12"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/bg_bai">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginTop="@dimen/dp_8"
|
||||||
|
android:layout_marginBottom="@dimen/dp_10"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<View
|
||||||
|
android:layout_width="@dimen/dp_3"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:background="@color/theme_color"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_marginLeft="@dimen/dp_7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="附近好店"
|
||||||
|
android:textSize="@dimen/dp_15"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/businessList"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -105,6 +105,7 @@
|
|||||||
android:paddingRight="@dimen/dp_14">
|
android:paddingRight="@dimen/dp_14">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/ivAllWaybill"
|
||||||
android:layout_width="@dimen/dp_160"
|
android:layout_width="@dimen/dp_160"
|
||||||
android:layout_height="@dimen/dp_96"
|
android:layout_height="@dimen/dp_96"
|
||||||
android:background="@drawable/home_all"></ImageView>
|
android:background="@drawable/home_all"></ImageView>
|
||||||
|
102
app/src/main/res/layout/item_business_list.xml
Normal file
102
app/src/main/res/layout/item_business_list.xml
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/item_business_list"
|
||||||
|
android:padding="@dimen/dp_12"
|
||||||
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
|
android:layout_marginLeft="@dimen/dp_12"
|
||||||
|
android:layout_marginRight="@dimen/dp_12"
|
||||||
|
android:background="@drawable/bg_bai">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/photoUrl"
|
||||||
|
android:layout_width="@dimen/dp_100"
|
||||||
|
android:layout_height="@dimen/dp_100"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginLeft="@dimen/dp_10"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginTop="@dimen/dp_7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13"
|
||||||
|
android:text="店铺名称:"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textSize="@dimen/sp_13" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginTop="@dimen/dp_18"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13"
|
||||||
|
android:text="店铺地址:"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/address"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginTop="@dimen/dp_18"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13"
|
||||||
|
android:text="联系方式:"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/taste"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13" />
|
||||||
|
<TextView
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13"
|
||||||
|
android:text="\t环境:"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/decoration"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13" />
|
||||||
|
<TextView
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13"
|
||||||
|
android:text="\t服务:"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/service"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_13" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
22
app/src/main/res/layout/item_business_type.xml
Normal file
22
app/src/main/res/layout/item_business_type.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/item_business_type">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/type_icon"
|
||||||
|
android:layout_marginTop="@dimen/dp_12"
|
||||||
|
android:layout_width="@dimen/dp_25"
|
||||||
|
android:layout_height="@dimen/dp_25"
|
||||||
|
android:src="@drawable/icon_jiudian"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/type_name"
|
||||||
|
android:layout_marginTop="@dimen/dp_6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="酒店"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user