Commit b061a29c authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parents a28731b7 76d889c6
...@@ -188,5 +188,15 @@ dependencies { ...@@ -188,5 +188,15 @@ dependencies {
implementation(name: 'BaiduLBS_AndroidSDK_Lib', ext: 'aar') implementation(name: 'BaiduLBS_AndroidSDK_Lib', ext: 'aar')
//room数据库
def room_version = "2.3.0"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version" // use kapt for Kotlin
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:$room_version"
// Test helpers
testImplementation "androidx.room:room-testing:$room_version"
} }
\ No newline at end of file
package com.mints.street.adapter package com.mints.street.adapter
import android.content.Context import android.content.Context
import com.alibaba.android.vlayout.LayoutHelper
import com.alibaba.android.vlayout.layout.GridLayoutHelper import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.fry.base.adapter.AbstractVLayoutBaseAdapter import com.fry.base.adapter.AbstractVLayoutBaseAdapter
...@@ -59,7 +60,12 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?) ...@@ -59,7 +60,12 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
override fun getItemCount() = list!!.size override fun getItemCount() = list!!.size
override fun onCreateLayoutHelper() = GridLayoutHelper(2) override fun onCreateLayoutHelper(): LayoutHelper {
val hp : GridLayoutHelper= GridLayoutHelper(2)
hp.setAutoExpand(false)
return hp
}
override fun getLayoutId(viewType: Int) = R.layout.item_grid_map_adapter override fun getLayoutId(viewType: Int) = R.layout.item_grid_map_adapter
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.mints.street.adapter ...@@ -3,6 +3,7 @@ package com.mints.street.adapter
import android.content.Context import android.content.Context
import android.graphics.Paint import android.graphics.Paint
import android.view.View import android.view.View
import com.alibaba.android.vlayout.LayoutHelper
import com.alibaba.android.vlayout.layout.GridLayoutHelper import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.alibaba.android.vlayout.layout.LinearLayoutHelper import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter import com.fry.base.adapter.AbstractVLayoutBaseAdapter
...@@ -67,11 +68,15 @@ class GridPaymentAdapter(val context: Context, val list: List<VipBean.ListBean>) ...@@ -67,11 +68,15 @@ class GridPaymentAdapter(val context: Context, val list: List<VipBean.ListBean>)
} }
} }
override fun onCreateLayoutHelper() = GridLayoutHelper(3)
override fun getLayoutId(viewType: Int) = R.layout.item_grid_payment_adpater override fun getLayoutId(viewType: Int) = R.layout.item_grid_payment_adpater
fun getPosition() = mposition fun getPosition() = mposition
override fun onCreateLayoutHelper(): LayoutHelper {
val hp : GridLayoutHelper= GridLayoutHelper(3)
hp.setAutoExpand(false)
return hp
}
} }
package com.mints.street.adapter package com.mints.street.adapter
import android.content.Context import android.content.Intent
import android.text.TextUtils import android.text.TextUtils
import android.view.View
import androidx.databinding.ViewDataBinding import androidx.databinding.ViewDataBinding
import com.alibaba.android.vlayout.layout.LinearLayoutHelper import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter import com.fry.base.adapter.AbstractVLayoutBaseAdapter
...@@ -9,55 +10,95 @@ import com.fry.base.adapter.BindingViewHolder ...@@ -9,55 +10,95 @@ import com.fry.base.adapter.BindingViewHolder
import com.fry.base.recycler_view.VHMAdapter import com.fry.base.recycler_view.VHMAdapter
import com.fry.base.recycler_view.VHModel import com.fry.base.recycler_view.VHModel
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.HistoryBean
import com.mints.street.databinding.ItemHistoryRecordAdapterBinding import com.mints.street.databinding.ItemHistoryRecordAdapterBinding
import com.mints.street.main.home.SearchMapActivity import com.mints.street.main.home.SearchMapActivity
import com.mints.street.main.home.SearchMapViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction
import me.goldze.mvvmhabit.binding.command.BindingCommand
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.SPUtils import me.goldze.mvvmhabit.utils.SPUtils
import java.lang.reflect.Type
/** /**
* Created by 冯瑞雨 on 2021/7/14. * Created by 冯瑞雨 on 2021/7/14.
* 历史记录的adapter * 历史记录的adapter
*/ */
class HistoryRecordAdapter(val context: Context, var name: String? = null) : class HistoryRecordAdapter(val activity: SearchMapActivity,val viewModel: SearchMapViewModel
AbstractVLayoutBaseAdapter<ItemHistoryRecordAdapterBinding, String>(context, name, 1) { , var type: Int=0,var name: String? = null) :
AbstractVLayoutBaseAdapter<ItemHistoryRecordAdapterBinding, String>(activity, name, 1) {
var listName: List<String>? = getHistoryData() var listName: MutableList<HistoryBean>?=null
var binding:ItemHistoryRecordAdapterBinding?= null
override fun onBindViewHolder( override fun onBindViewHolder(
holder: BindingViewHolder<ItemHistoryRecordAdapterBinding>, holder: BindingViewHolder<ItemHistoryRecordAdapterBinding>,
position: Int position: Int
) { ) {
binding = holder.binding
listName = getHistoryData()
if (listName!=null && listName!!.size>0){
binding?.historyBg?.visibility = View.VISIBLE
}else{
binding?.historyBg?.visibility = View.GONE
}
val adapter = VHMAdapter<HistoryRecordItemVHM>() val adapter = VHMAdapter<HistoryRecordItemVHM>()
listName?.apply { listName?.let {
for (items in this) { for (index in it.size - 1 downTo 0) {
adapter.add(HistoryRecordItemVHM(items)) adapter.add(HistoryRecordItemVHM(activity,viewModel,it[index]))
} }
} }
holder.binding.listView.adapter = adapter holder.binding.listView.adapter = adapter
//清空
RxUtils.onMultiClick(binding?.tvClear){
listName?.clear()
SPUtils.getInstance(SearchMapActivity.HISTORY_NAME)
.removeKey(if (type==0){"Territory"}else{"Abroad"})
binding?.historyBg?.visibility = View.GONE
notifyDataSetChanged()
}
} }
private fun getHistoryData(): List<String>? { private fun getHistoryData(): MutableList<HistoryBean>? {
val instance = SPUtils.getInstance(SearchMapActivity.HISTORY_NAME) val instance = SPUtils.getInstance(SearchMapActivity.HISTORY_NAME)
val string = instance.decodeString("name") val string = instance.decodeString(if (type==0){"Territory"}else{"Abroad"})
if (TextUtils.isEmpty(string)){ if (TextUtils.isEmpty(string)) {
return null return null
} }
return Gson().fromJson<List<String>>(string, List::class.java) return try {
val listType: Type = object : TypeToken<List<HistoryBean?>?>() {}.type
Gson().fromJson(string, listType)
}catch (e:Exception){
null
} }
fun addHistoryData(addName:String) {
val instance = SPUtils.getInstance(SearchMapActivity.HISTORY_NAME)
if (listName ==null ){
listName = ArrayList<String>()
} }
for (index in listName!!.indices){
if (listName!![index] == addName || addName == listName!![index]){
fun addHistoryData(addName: HistoryBean) {
if (listName == null) {
listName = ArrayList<HistoryBean>()
} }
if (listName?.size ?: 0 >= 15) {
val size = listName!!.size - 15
for (index in 0..size) {
listName?.removeAt(index)
} }
}
instance?.encode("name", Gson().toJson(listName).toString()) for (index in listName!!.indices) {
if (listName!![index].name == addName.name) {
listName?.removeAt(index)
break
}
}
if (listName!=null && listName!!.size>0 && binding?.historyBg?.visibility == View.GONE){
binding?.historyBg?.visibility = View.VISIBLE
}
listName?.add(addName)
val instance = SPUtils.getInstance(SearchMapActivity.HISTORY_NAME)
instance?.encode(if (type==0){"Territory"}else{"Abroad"}, Gson().toJson(listName).toString())
} }
override fun getItemCount() = 1 override fun getItemCount() = 1
...@@ -68,8 +109,8 @@ class HistoryRecordAdapter(val context: Context, var name: String? = null) : ...@@ -68,8 +109,8 @@ class HistoryRecordAdapter(val context: Context, var name: String? = null) :
} }
class HistoryRecordItemVHM( class HistoryRecordItemVHM(val activity: SearchMapActivity,val viewModel: SearchMapViewModel,
var name: String var historyBean: HistoryBean
) : VHModel() { ) : VHModel() {
override fun getLayoutId() = R.layout.item_history_record_name override fun getLayoutId() = R.layout.item_history_record_name
...@@ -79,4 +120,12 @@ class HistoryRecordItemVHM( ...@@ -79,4 +120,12 @@ class HistoryRecordItemVHM(
super.onBind(binding) super.onBind(binding)
} }
val onClick = BindingCommand<Any>(BindingAction {
viewModel.searchName.value = HistoryBean(name = historyBean.name,
latitude = historyBean.latitude,longitude = historyBean.longitude)
val intent = Intent()
intent.putExtra("latitude",historyBean.latitude)
intent.putExtra("longitude",historyBean.longitude)
viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent)
})
} }
\ No newline at end of file
package com.mints.street.adapter package com.mints.street.adapter
import android.content.Context import android.content.Context
import android.view.View
import com.alibaba.android.vlayout.layout.LinearLayoutHelper import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.bumptech.glide.GlideBuilder import com.bumptech.glide.GlideBuilder
import com.fry.base.adapter.AbstractVLayoutBaseAdapter import com.fry.base.adapter.AbstractVLayoutBaseAdapter
...@@ -21,6 +22,11 @@ import me.goldze.mvvmhabit.utils.RxUtils ...@@ -21,6 +22,11 @@ import me.goldze.mvvmhabit.utils.RxUtils
class PopularSceneAdapter(val context: Context, var list: List<Places>? = null) : class PopularSceneAdapter(val context: Context, var list: List<Places>? = null) :
AbstractVLayoutBaseAdapter<ItemPopularSceneAdapterBinding, List<Places>>(context, list, 2) { AbstractVLayoutBaseAdapter<ItemPopularSceneAdapterBinding, List<Places>>(context, list, 2) {
fun setData(list: List<Places>?){
this.list = list
notifyDataSetChanged()
}
override fun onBindViewHolder( override fun onBindViewHolder(
holder: BindingViewHolder<ItemPopularSceneAdapterBinding>, holder: BindingViewHolder<ItemPopularSceneAdapterBinding>,
position: Int position: Int
...@@ -31,6 +37,36 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null) ...@@ -31,6 +37,36 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null)
,longitude = list?.get(position)?.longitude.toString()) ,longitude = list?.get(position)?.longitude.toString())
} }
holder.binding.tvName.text = list?.get(position)?.name holder.binding.tvName.text = list?.get(position)?.name
when(position){
0->{
holder.binding.sortIm.visibility = View.VISIBLE
holder.binding.sortTvName.text = ""
ImageLoader.ImageBuilder.with(context)
.setTargetView(holder.binding.sortIm)
.setDrawable(R.mipmap.sort_icon_1).start()
}
1->{
holder.binding.sortIm.visibility = View.VISIBLE
holder.binding.sortTvName.text = ""
ImageLoader.ImageBuilder.with(context)
.setTargetView(holder.binding.sortIm)
.setDrawable(R.mipmap.sort_icon_2).start()
}
2->{
holder.binding.sortIm.visibility = View.VISIBLE
holder.binding.sortTvName.text = ""
ImageLoader.ImageBuilder.with(context)
.setTargetView(holder.binding.sortIm)
.setDrawable(R.mipmap.sort_icon_3).start()
}
else->{
holder.binding.sortIm.visibility = View.GONE
holder.binding.sortTvName.text = "No.${position+1}"
}
}
if(list?.get(position)?.images!=null){ if(list?.get(position)?.images!=null){
for ( index in list?.get(position)?.images!!.indices){ for ( index in list?.get(position)?.images!!.indices){
if (list?.get(position)?.images?.get(index)==null)return if (list?.get(position)?.images?.get(index)==null)return
...@@ -38,17 +74,20 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null) ...@@ -38,17 +74,20 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null)
0 -> { 0 -> {
ImageLoader.ImageBuilder.with(context) ImageLoader.ImageBuilder.with(context)
.setUrl(list?.get(position)?.images?.get(index)) .setUrl(list?.get(position)?.images?.get(index))
.setTargetView(holder.binding.image1).start() .setTargetView(holder.binding.image1)
.setCornerDp(4).start()
} }
1 -> { 1 -> {
ImageLoader.ImageBuilder.with(context) ImageLoader.ImageBuilder.with(context)
.setUrl(list?.get(position)?.images?.get(index)) .setUrl(list?.get(position)?.images?.get(index))
.setTargetView(holder.binding.image2).start() .setTargetView(holder.binding.image2)
.setCornerDp(4).start()
} }
else -> { else -> {
ImageLoader.ImageBuilder.with(context) ImageLoader.ImageBuilder.with(context)
.setUrl(list?.get(position)?.images?.get(index)) .setUrl(list?.get(position)?.images?.get(index))
.setTargetView(holder.binding.image3).start() .setTargetView(holder.binding.image3)
.setCornerDp(4).start()
} }
} }
} }
......
package com.mints.street.bean
/**
* Created by 冯瑞雨 on 2021/7/21.
*/
class HistoryBean (
var name:String?=null,
var latitude:Double?=null,
var longitude:Double?=null
)
\ No newline at end of file
package com.mints.street.db
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import me.goldze.mvvmhabit.utils.Utils
/**
* Created by 冯瑞雨 on 2021/7/20.
*/
@Database(entities = [ScenicSpotBean::class], version = 1)
abstract class AppDatabase : RoomDatabase() {
abstract fun userDao(): ScenicSpotDao
companion object {
private var _instance: AppDatabase? = null
@JvmStatic
fun instance(): AppDatabase {
if (_instance == null) {
synchronized(AppDatabase::class.java) {
if (_instance == null) {
_instance = Room.databaseBuilder(
Utils.getContext()
, AppDatabase::class.java
, "mints_room.com.mints.street.db")
.allowMainThreadQueries()//设置是否允许在主线程做查询操作
//.fallbackToDestructiveMigration()//设置迁移数据库如果发生错误,将会重新创建数据库,而不是发生崩溃
.build()
}
}
}
return _instance!!
}
}
}
\ No newline at end of file
package com.mints.street.db
import androidx.room.Dao
import androidx.room.Query
/**
* Created by 冯瑞雨 on 2021/7/20.
*/
@Dao
interface ScenicSpotDao {
@Query("SELECT * FROM scenic_spot")
fun getAll(): List<ScenicSpotBean>
}
\ No newline at end of file
package com.mints.street.db
import androidx.room.Entity
import androidx.room.PrimaryKey
/**
* Created by 冯瑞雨 on 2021/7/20.
* 景区表
*/
@Entity(tableName = "scenic_spot")
class ScenicSpotBean(
//主键 自增
@PrimaryKey(autoGenerate = true) var id: Int = 0,
//景区 类型 1=境内热门景区 2=境内免费专区 3=首页的景区
var type :Int = 0,
//景区 经度
var longitude :Double?=null,
//景区 纬度
var latitude :Double?=null,
//景区 名称
var name :String? = null,
//景区 图片
var images : List<String>? = null,
//景区 星级 默认0-5
var starRating : Int? = null
)
\ No newline at end of file
...@@ -18,6 +18,7 @@ import kotlinx.android.synthetic.main.activity_login.* ...@@ -18,6 +18,7 @@ import kotlinx.android.synthetic.main.activity_login.*
import kotlinx.android.synthetic.main.include_header.* import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.AppUtils import me.goldze.mvvmhabit.utils.AppUtils
import me.goldze.mvvmhabit.utils.ToastUtils import me.goldze.mvvmhabit.utils.ToastUtils
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
/** /**
* Created by 冯瑞雨 on 2021/7/2. * Created by 冯瑞雨 on 2021/7/2.
...@@ -25,12 +26,16 @@ import me.goldze.mvvmhabit.utils.ToastUtils ...@@ -25,12 +26,16 @@ import me.goldze.mvvmhabit.utils.ToastUtils
class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View.OnClickListener { class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View.OnClickListener {
private val userManager by lazy { UserManager.INSTANCE } private val userManager by lazy { UserManager.INSTANCE }
override fun getStatusBarHeightView(): View? {
return null
}
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_login override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_login
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun initData() { override fun initData() {
super.initData() super.initData()
StatusBarUtil.setHeightAndPadding(this, binding.tvName)
initView() initView()
initListener() initListener()
} }
......
...@@ -115,7 +115,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE ...@@ -115,7 +115,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
if (it==null)return@Observer if (it==null)return@Observer
// 默认 天安门 // 默认 天安门
val center = LatLng(it["latitude"] ?:39.915071, it["longitude"] ?:116.403907) val center = LatLng(it["latitude"] ?:39.915071, it["longitude"] ?:116.403907)
setNewMapStatus(center)
}) })
} }
...@@ -123,7 +123,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE ...@@ -123,7 +123,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
mBaiduMap = binding.bmapView.map mBaiduMap = binding.bmapView.map
mBaiduMap?.mapType = BaiduMap.MAP_TYPE_SATELLITE mBaiduMap?.mapType = BaiduMap.MAP_TYPE_SATELLITE
//设置是否显示缩放控件 //设置是否显示缩放控件
binding.bmapView.showZoomControls(false) binding.bmapView.showZoomControls(false)
// 构建地图状态 // 构建地图状态
...@@ -361,4 +360,17 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE ...@@ -361,4 +360,17 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) { override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {
} }
/**
* 设置地图新状态
*
* @param v
*/
private fun setNewMapStatus(latLng :LatLng) {
val builder = MapStatus.Builder()
builder.target(latLng).zoom(18.5f).overlook(-21f).rotate(0f)
// 更新地图状态
mBaiduMap!!.setMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()))
//mMarker.setPosition(latLng)
}
} }
\ No newline at end of file
...@@ -98,6 +98,7 @@ class HomeViewModel(application: Application):BaseViewModel(application) { ...@@ -98,6 +98,7 @@ class HomeViewModel(application: Application):BaseViewModel(application) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == 200 && resultCode == SearchMapActivity.REQUEST_CODE){ if (requestCode == 200 && resultCode == SearchMapActivity.REQUEST_CODE){
KLog.a("homeFragment onActivityResult")
data?.let { data?.let {
val map = HashMap<String,Double>(2) val map = HashMap<String,Double>(2)
map["latitude"] = it.getDoubleExtra("latitude",0.0) map["latitude"] = it.getDoubleExtra("latitude",0.0)
......
...@@ -2,6 +2,7 @@ package com.mints.street.main.home ...@@ -2,6 +2,7 @@ package com.mints.street.main.home
import android.content.Intent import android.content.Intent
import com.baidu.mapapi.model.LatLng import com.baidu.mapapi.model.LatLng
import com.mints.street.bean.HistoryBean
import me.goldze.mvvmhabit.base.AppManager import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.base.ItemViewModel import me.goldze.mvvmhabit.base.ItemViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction import me.goldze.mvvmhabit.binding.command.BindingAction
...@@ -18,12 +19,11 @@ class SearchAfterItem(viewModel: SearchMapViewModel,val name:String? ...@@ -18,12 +19,11 @@ class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
* 点击名称回调回调 * 点击名称回调回调
*/ */
val onClick = BindingCommand<Any>(BindingAction { val onClick = BindingCommand<Any>(BindingAction {
viewModel.searchName.value = HistoryBean(name = this.name,
latitude = pt?.latitude,longitude = pt?.longitude)
val intent = Intent() val intent = Intent()
intent.putExtra("latitude",pt?.latitude) intent.putExtra("latitude",pt?.latitude)
intent.putExtra("longitude",pt?.longitude) intent.putExtra("longitude",pt?.longitude)
viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent) viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent)
// KLog.e("SearchAfterItem","key : $name")
// KLog.e("SearchAfterItem","latitude : ${pt?.latitude}")
// KLog.e("SearchAfterItem","longitude : ${pt?.longitude}")
}) })
} }
\ No newline at end of file
...@@ -18,9 +18,9 @@ import com.mints.street.BR ...@@ -18,9 +18,9 @@ import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.adapter.HistoryRecordAdapter import com.mints.street.adapter.HistoryRecordAdapter
import com.mints.street.adapter.PopularSceneAdapter import com.mints.street.adapter.PopularSceneAdapter
import com.mints.street.bean.HistoryBean
import com.mints.street.bean.MapBean import com.mints.street.bean.MapBean
import com.mints.street.databinding.ActivitySearchMapBinding import com.mints.street.databinding.ActivitySearchMapBinding
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.KLog import me.goldze.mvvmhabit.utils.KLog
/** /**
...@@ -32,7 +32,10 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -32,7 +32,10 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
const val HISTORY_NAME = "history_name" const val HISTORY_NAME = "history_name"
const val REQUEST_CODE = 201 const val REQUEST_CODE = 201
fun startSearchMapActivity(fragment: HomeFragment) { fun startSearchMapActivity(fragment: HomeFragment) {
fragment.startActivityForResult(Intent(fragment.context, SearchMapActivity::class.java),REQUEST_CODE) fragment.startActivityForResult(
Intent(fragment.context, SearchMapActivity::class.java),
200
)
} }
} }
...@@ -75,19 +78,17 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -75,19 +78,17 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
viewModel.searchAfterOneItems.clear() viewModel.searchAfterOneItems.clear()
return return
} }
// 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新 // 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新
mSuggestionSearch?.requestSuggestion( mSuggestionSearch?.requestSuggestion(
SuggestionSearchOption() SuggestionSearchOption()
.keyword(s.toString()) // 关键字 .keyword(s.toString()) // 关键字
.city(viewModel.positioningBean?.city ?: "北京") .city(viewModel.positioningBean?.city ?: "北京")
) // 城市 )
} }
}) })
historyRecordAdapter = HistoryRecordAdapter(this) historyRecordAdapter = HistoryRecordAdapter(this,viewModel)
popularSceneAdapter = PopularSceneAdapter(this) popularSceneAdapter = PopularSceneAdapter(this)
...@@ -107,24 +108,19 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -107,24 +108,19 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
} }
private fun update() { private fun update() {
mAdapter?.clear()
if (viewModel.index == 0) {
historyRecordAdapter?.apply { historyRecordAdapter?.apply {
mAdapter?.addAdapter(historyRecordAdapter) this.type = viewModel.index
}
} else {
mAdapter?.removeAdapter(historyRecordAdapter)
} }
popularSceneAdapter?.apply { popularSceneAdapter?.apply {
if (viewModel.index==0){ if (viewModel.index == 0) {
this.list = viewModel.mapBean.value?.innerPlaces?.places this.data = viewModel.mapBean.value?.innerPlaces?.places
}else{ } else {
this.list = viewModel.mapBean.value?.outerPlaces?.places this.data = viewModel.mapBean.value?.outerPlaces?.places
} }
mAdapter?.addAdapter(popularSceneAdapter)
} }
mAdapter?.notifyDataSetChanged()
} }
override fun initViewObservable() { override fun initViewObservable() {
...@@ -133,6 +129,12 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -133,6 +129,12 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
update() update()
} }
}) })
viewModel.searchName.observe(this, Observer<HistoryBean> {
if (TextUtils.isEmpty(it.name)){
return@Observer
}
historyRecordAdapter?.addHistoryData(it)
})
} }
private fun territory() { private fun territory() {
...@@ -166,12 +168,15 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -166,12 +168,15 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
} }
viewModel.searchAfterOneItems.clear() viewModel.searchAfterOneItems.clear()
if(TextUtils.isEmpty(binding.et.text)){ if (TextUtils.isEmpty(binding.et.text)) {
return return
} }
for (info in suggestionResult.allSuggestions) { for (info in suggestionResult.allSuggestions) {
viewModel.searchAfterOneItems.add(SearchAfterItem(viewModel viewModel.searchAfterOneItems.add(
,info.key,info.address,info.pt)) SearchAfterItem(
viewModel, info.key, info.address, info.pt
)
)
} }
} }
} }
\ No newline at end of file
package com.mints.street.main.home package com.mints.street.main.home
import android.app.Application import android.app.Application
import android.content.Intent
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
import androidx.databinding.ObservableArrayList import androidx.databinding.ObservableArrayList
...@@ -8,11 +9,13 @@ import androidx.lifecycle.MutableLiveData ...@@ -8,11 +9,13 @@ import androidx.lifecycle.MutableLiveData
import com.google.gson.Gson import com.google.gson.Gson
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.HistoryBean
import com.mints.street.bean.MapBean import com.mints.street.bean.MapBean
import com.mints.street.bean.Places import com.mints.street.bean.Places
import com.mints.street.bean.PositioningBean import com.mints.street.bean.PositioningBean
import me.goldze.mvvmhabit.base.AppManager import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.base.BaseViewModel import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction
import me.goldze.mvvmhabit.binding.command.BindingCommand import me.goldze.mvvmhabit.binding.command.BindingCommand
import me.goldze.mvvmhabit.utils.KLog import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.SPUtils import me.goldze.mvvmhabit.utils.SPUtils
...@@ -28,6 +31,8 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application) ...@@ -28,6 +31,8 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application)
val searchAfterItemBinding = ItemBinding.of<SearchAfterItem>(BR.viewModel, R.layout.item_search_after) val searchAfterItemBinding = ItemBinding.of<SearchAfterItem>(BR.viewModel, R.layout.item_search_after)
val searchAfterOneItems = ObservableArrayList<SearchAfterItem>() val searchAfterOneItems = ObservableArrayList<SearchAfterItem>()
//搜索的name
val searchName = MutableLiveData<HistoryBean>()
//定位位置 //定位位置
val positioningBean: PositioningBean? =getpositioningMap() val positioningBean: PositioningBean? =getpositioningMap()
......
...@@ -11,21 +11,26 @@ import com.mints.street.R ...@@ -11,21 +11,26 @@ import com.mints.street.R
import com.mints.street.bean.UserBean import com.mints.street.bean.UserBean
import com.mints.street.databinding.ActivityBindmobileBinding import com.mints.street.databinding.ActivityBindmobileBinding
import com.mints.street.main.MainActivity import com.mints.street.main.MainActivity
import com.mints.street.manager.UserManager
import com.mints.street.utils.BackInputUtil import com.mints.street.utils.BackInputUtil
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import kotlinx.android.synthetic.main.activity_bindmobile.* import kotlinx.android.synthetic.main.activity_bindmobile.*
import kotlinx.android.synthetic.main.include_header.* import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.ToastUtils import me.goldze.mvvmhabit.utils.ToastUtils
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileViewModel>(), View.OnClickListener { class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileViewModel>(), View.OnClickListener {
private var mobile: String? = null private var mobile: String? = null
override fun getStatusBarHeightView(): View? {
return null
}
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_bindmobile override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_bindmobile
override fun initData() { override fun initData() {
super.initData() super.initData()
StatusBarUtil.setHeightAndPadding(this, binding.ivApplogo)
initView() initView()
initListener() initListener()
} }
...@@ -50,7 +55,7 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie ...@@ -50,7 +55,7 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie
} }
override fun onClick(v: View?) { override fun onClick(v: View?) {
when(v?.id){ when (v?.id) {
R.id.iv_left_icon -> { R.id.iv_left_icon -> {
finish() finish()
} }
...@@ -84,7 +89,7 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie ...@@ -84,7 +89,7 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie
.subscribe { granted: Boolean -> .subscribe { granted: Boolean ->
if (granted) { if (granted) {
mobile = mobile.replace(" ".toRegex(), "") mobile = mobile.replace(" ".toRegex(), "")
viewModel.bindingMobile(mobile,code) viewModel.bindingMobile(mobile, code)
} else { } else {
// showMissingPermissionDialog("设备") // showMissingPermissionDialog("设备")
} }
......
...@@ -31,9 +31,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti ...@@ -31,9 +31,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
override fun getStatusBarHeightView(): View? { override fun getStatusBarHeightView(): View? {
return null return null
} }
override fun initData() { override fun initData() {
super.initData() super.initData()
StatusBarUtil.setHeightAndPadding(this, binding.lyLinear) StatusBarUtil.setHeightAndPadding(this, binding.btnSwitch)
initView() initView()
initListener() initListener()
...@@ -60,7 +61,7 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti ...@@ -60,7 +61,7 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
item_phone.findViewById<TextView>(R.id.tv_right).setTextColor(Color.BLACK) item_phone.findViewById<TextView>(R.id.tv_right).setTextColor(Color.BLACK)
item_phone.findViewById<TextView>(R.id.tv_right).text = "去绑定" item_phone.findViewById<TextView>(R.id.tv_right).text = "去绑定"
item_phone.setOnClickListener(this) item_phone.setOnClickListener(this)
RxUtils.onMultiClick(item_phone){ RxUtils.onMultiClick(item_phone) {
if (userManager.userIsLogin()) { if (userManager.userIsLogin()) {
startActivity(BindMobileActivity::class.java) startActivity(BindMobileActivity::class.java)
return@onMultiClick return@onMultiClick
...@@ -70,6 +71,7 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti ...@@ -70,6 +71,7 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
} }
} }
} }
private fun initView() { private fun initView() {
tv_title.text = "更多设置" tv_title.text = "更多设置"
...@@ -126,10 +128,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti ...@@ -126,10 +128,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
KLog.e("setOnClick", "btn_switch has been clicked.") KLog.e("setOnClick", "btn_switch has been clicked.")
} }
R.id.item_userAgree -> {//用户协议 R.id.item_userAgree -> {//用户协议
MintsWebViewActivity.startWebView(name = "用户协议",url = "http://test.mints-id.com/map-api/map/register.html") MintsWebViewActivity.startWebView(name = "用户协议", url = "http://test.mints-id.com/map-api/map/register.html")
} }
R.id.item_privacyAgree -> {//隐私协议 R.id.item_privacyAgree -> {//隐私协议
MintsWebViewActivity.startWebView(name = "隐私协议",url = "http://test.mints-id.com/map-api/map/privacy.html") MintsWebViewActivity.startWebView(name = "隐私协议", url = "http://test.mints-id.com/map-api/map/privacy.html")
} }
} }
......
...@@ -156,6 +156,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList ...@@ -156,6 +156,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
moresettings.findViewById<TextView>(R.id.tv_right).visibility = View.GONE moresettings.findViewById<TextView>(R.id.tv_right).visibility = View.GONE
moresettings.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE moresettings.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE
ic_theme.findViewById<TextView>(R.id.tv_theme_name).text="享8大特权" ic_theme.findViewById<TextView>(R.id.tv_theme_name).text="享8大特权"
ic_theme.findViewById<TextView>(R.id.tv_me1).text = "无线缩放" ic_theme.findViewById<TextView>(R.id.tv_me1).text = "无线缩放"
ic_theme.findViewById<TextView>(R.id.tv_me2).text = "国内外街景" ic_theme.findViewById<TextView>(R.id.tv_me2).text = "国内外街景"
......
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
<!-- 边框的颜色和粗细 --> <!-- 边框的颜色和粗细 -->
<solid android:color="#ffffffff" /> <solid android:color="#ffffffff" />
<corners android:radius="81dp" /> <corners android:radius="81dp" />
<stroke android:width="0.5dp" android:color="#D1D1D1"/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="#0DCCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="#10CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="#15CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="#20CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="#25CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="#FFFFFF" />
<corners android:radius="8dp" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"> <layout
xmlns:android="http://schemas.android.com/apk/res/android">
<data> <data>
...@@ -14,7 +15,8 @@ ...@@ -14,7 +15,8 @@
android:background="@color/white" android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/include_header" /> <include
layout="@layout/include_header" />
<com.mints.street.widget.ElasticScrollView <com.mints.street.widget.ElasticScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -27,6 +29,7 @@ ...@@ -27,6 +29,7 @@
<ImageView <ImageView
android:id="@+id/iv_applogo"
android:layout_width="70dp" android:layout_width="70dp"
android:layout_height="70dp" android:layout_height="70dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
layout="@layout/include_header"/> layout="@layout/include_header"/>
<TextView <TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
......
...@@ -12,15 +12,16 @@ ...@@ -12,15 +12,16 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/include_header" /> <include layout="@layout/include_header" />
<com.mints.street.widget.ElasticScrollView <com.mints.street.widget.ElasticScrollView
android:id="@+id/ly_linear"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:overScrollMode="never"> android:overScrollMode="never">
<LinearLayout <LinearLayout
android:id="@+id/ly_linear"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:elevation="5dp" android:elevation="5dp"
...@@ -32,9 +33,10 @@ ...@@ -32,9 +33,10 @@
<View <View
style="@style/view_line_E6E6E6" style="@style/view_line_E6E6E6"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_alignParentBottom="true" /> android:layout_marginEnd="20dp" />
<include <include
android:id="@+id/item_userAgree" android:id="@+id/item_userAgree"
...@@ -42,9 +44,9 @@ ...@@ -42,9 +44,9 @@
<View <View
style="@style/view_line_E6E6E6" style="@style/view_line_E6E6E6"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp" />
android:layout_alignParentBottom="true" />
<include <include
android:id="@+id/item_privacyAgree" android:id="@+id/item_privacyAgree"
......
...@@ -3,27 +3,35 @@ ...@@ -3,27 +3,35 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="@color/color_FEFFFF"
>
<View <View
android:id="@+id/view_bg" android:id="@+id/view_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="150dp" android:layout_height="120dp"
android:background="#668BFF" android:background="#668BFF"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<com.fry.base.ui.widget.CommonTitleBar
android:id="@+id/ctb_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ctb_theme="dark"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout <LinearLayout
android:layout_marginBottom="10dp"
android:id="@+id/ll_title_bg" android:id="@+id/ll_title_bg"
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="30dp" android:layout_height="30dp"
android:gravity="center" android:gravity="center"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/ctb_title" app:layout_constraintBottom_toBottomOf="@id/ctb_title"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/ctb_title"> >
<com.coorchice.library.SuperTextView <com.coorchice.library.SuperTextView
android:id="@+id/territory" android:id="@+id/territory"
...@@ -79,10 +87,12 @@ ...@@ -79,10 +87,12 @@
android:hint="请输入地址" android:hint="请输入地址"
android:paddingStart="45dp" android:paddingStart="45dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:textColor="@color/color_8F6D21" android:textColor="@color/color_555"
android:textColorHint="#E1E1E1" android:textColorHint="#E1E1E1"
android:textCursorDrawable="@drawable/cursor_color" android:textCursorDrawable="@drawable/cursor_color"
android:textSize="14sp" android:textSize="14sp"
android:singleLine="true"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="@id/view_bg" app:layout_constraintBottom_toBottomOf="@id/view_bg"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -98,12 +108,7 @@ ...@@ -98,12 +108,7 @@
app:layout_constraintStart_toStartOf="@id/et" app:layout_constraintStart_toStartOf="@id/et"
app:layout_constraintTop_toTopOf="@id/et" /> app:layout_constraintTop_toTopOf="@id/et" />
<com.fry.base.ui.widget.CommonTitleBar
android:id="@+id/ctb_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ctb_theme="dark"
app:layout_constraintTop_toTopOf="parent" />
<com.fry.base.ui.widget.CustomRecycleView <com.fry.base.ui.widget.CustomRecycleView
android:id="@+id/recy_after_search" android:id="@+id/recy_after_search"
......
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
</data> </data>
<LinearLayout <LinearLayout
android:layout_margin="15dp"
android:id="@+id/bg" android:id="@+id/bg"
android:layout_width="100dp" android:layout_width="wrap_content"
android:layout_height="230dp" android:layout_height="230dp"
android:background="@drawable/shape_bg_vrdata" android:background="@drawable/shape_bg_vrdata"
android:elevation="5dp" android:elevation="5dp"
...@@ -21,11 +22,7 @@ ...@@ -21,11 +22,7 @@
<com.mints.street.widget.XCRoundRectImageView <com.mints.street.widget.XCRoundRectImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="160dp" android:layout_height="160dp" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/avatars" />
<TextView <TextView
android:id="@+id/tv_name" android:id="@+id/tv_name"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"> <layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data> <data>
<variable <variable
name="adpter" name="adpter"
...@@ -9,8 +10,10 @@ ...@@ -9,8 +10,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:id="@+id/bg"
> >
<LinearLayout <LinearLayout
android:id="@+id/history_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
...@@ -33,8 +36,9 @@ ...@@ -33,8 +36,9 @@
android:textSize="14sp" android:textSize="14sp"
/> />
<TextView <TextView
android:id="@+id/tv_clear"
android:padding="10dp" android:padding="10dp"
android:drawableStart="@mipmap/icon_search_history" android:drawableStart="@mipmap/trash_can_icon"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -52,5 +56,18 @@ ...@@ -52,5 +56,18 @@
app:useDivider="true" app:useDivider="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<TextView
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="热门景区"
android:textSize="15sp"
android:textColor="@color/color_323334"
android:textStyle="bold"
android:drawableStart="@mipmap/popular_scenic_spots_icon"
android:paddingStart="10dp"
android:drawablePadding="5dp"
/>
</LinearLayout> </LinearLayout>
</layout> </layout>
\ No newline at end of file
...@@ -9,14 +9,15 @@ ...@@ -9,14 +9,15 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="20dp" android:layout_height="20dp"
android:textSize="14sp" android:textSize="12sp"
android:gravity="center" android:gravity="center"
android:text="@{vhm.name}" android:text="@{vhm.historyBean.name}"
android:textColor="@color/color_555" android:textColor="@color/color_555"
app:stv_stroke_color="@color/color_555" app:stv_stroke_color="@color/color_555"
app:stv_stroke_width="1dp" app:stv_stroke_width="0.5dp"
app:stv_corner="10dp" app:stv_corner="10dp"
android:paddingStart="5dp" android:paddingStart="10dp"
android:paddingEnd="5dp" android:paddingEnd="10dp"
app:onClickCommand="@{vhm.onClick}"
/> />
</layout> </layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"> <layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bg" android:id="@+id/bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="138dp" android:layout_height="158dp"
android:background="@mipmap/vip_google_bg" android:background="@drawable/search_item_bg"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:padding="10dp" android:paddingBottom="10dp"
android:paddingEnd="10dp"
android:layout_marginTop="5dp"
> >
<ImageView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/sort_im"
android:layout_width="50dp"
android:layout_height="24dp"
/>
<TextView <TextView
android:id="@+id/tv_name"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:id="@+id/sort_tv_name"
android:layout_width="50dp"
android:layout_height="24dp"
tool:text="NO.4"
android:textColor="#F78515"
android:textSize="16sp"
android:gravity="center"
/>
<TextView
android:layout_marginStart="10dp"
android:id="@+id/tv_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sort_tv_name"
app:layout_constraintBottom_toTopOf="@id/image1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="测试" android:text="测试"
...@@ -22,6 +45,8 @@ ...@@ -22,6 +45,8 @@
android:textStyle="bold" android:textStyle="bold"
/> />
<ImageView <ImageView
android:layout_marginStart="10dp"
android:id="@+id/image1" android:id="@+id/image1"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="80dp" android:layout_height="80dp"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"> <layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -10,14 +11,17 @@ ...@@ -10,14 +11,17 @@
<ImageView <ImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="wrap_content" android:layout_marginStart="10dp"
android:layout_height="50dp" android:layout_width="20dp"
android:src="@mipmap/map_history_icon" android:layout_height="20dp"
android:src="@mipmap/positioning_small_icon"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:layout_marginStart="10dp"
android:id="@+id/tv_name" android:id="@+id/tv_name"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -32,20 +36,23 @@ ...@@ -32,20 +36,23 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:layout_marginStart="10dp"
android:id="@+id/tv_address" android:id="@+id/tv_address"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:text="@{viewModel.address}" android:text="@{viewModel.address}"
android:textColor="@color/color_555" android:textColor="@color/color_333"
android:textSize="10sp" android:textSize="10sp"
tools:text="dsfdsfds"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/image" app:layout_constraintStart_toEndOf="@id/image"
app:layout_constraintTop_toBottomOf="@id/tv_name" /> app:layout_constraintTop_toBottomOf="@id/tv_name" />
<View <View
android:layout_marginStart="10dp"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0.5dp" android:layout_height="0.5dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
<color name="color_668BFF">#668BFF</color> <color name="color_668BFF">#668BFF</color>
<color name="color_7EE2FF">#7EE2FF</color> <color name="color_7EE2FF">#7EE2FF</color>
<color name="color_A7BCFE">#A7BCFE</color> <color name="color_A7BCFE">#A7BCFE</color>
<color name="color_FEFFFF">#FEFFFF</color>
<color name="color_323334">#323334</color>
<color name="color_333">#333333</color> <color name="color_333">#333333</color>
<color name="color_172B54">#172B54</color> <color name="color_172B54">#172B54</color>
<color name="color_121B32">#121B32</color> <color name="color_121B32">#121B32</color>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment