Commit 2dbbc88f authored by fengruiyu's avatar fengruiyu

搜索页面的item背景和UI优化已完成

parent 3064de6c
...@@ -121,7 +121,6 @@ class HistoryRecordItemVHM(val activity: SearchMapActivity,val viewModel: Search ...@@ -121,7 +121,6 @@ class HistoryRecordItemVHM(val activity: SearchMapActivity,val viewModel: Search
} }
val onClick = BindingCommand<Any>(BindingAction { val onClick = BindingCommand<Any>(BindingAction {
activity.goTOSearch(historyBean.name)
viewModel.searchName.value = HistoryBean(name = historyBean.name, viewModel.searchName.value = HistoryBean(name = historyBean.name,
latitude = historyBean.latitude,longitude = historyBean.longitude) latitude = historyBean.latitude,longitude = historyBean.longitude)
val intent = Intent() val intent = Intent()
......
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
...@@ -37,6 +38,35 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null) ...@@ -37,6 +38,35 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null)
} }
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
...@@ -44,17 +74,20 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null) ...@@ -44,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()
} }
} }
} }
......
...@@ -20,5 +20,7 @@ class ScenicSpotBean( ...@@ -20,5 +20,7 @@ class ScenicSpotBean(
//景区 名称 //景区 名称
var name :String? = null, var name :String? = null,
//景区 图片 //景区 图片
var images : List<String>? = null var images : List<String>? = null,
//景区 星级 默认0-5
var starRating : Int? = null
) )
\ No newline at end of file
...@@ -108,9 +108,7 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -108,9 +108,7 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
} }
fun goTOSearch(text:String?){
binding.et.setSelection(text?.length?:0)
}
private fun update() { private fun update() {
historyRecordAdapter?.apply { historyRecordAdapter?.apply {
......
<?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
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<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/white" android:background="@color/color_FEFFFF"
> >
<View <View
......
<?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"
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<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_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>
......
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