[fea]
[UI修改]
This commit is contained in:
yangyakun
2024-07-16 20:31:10 +08:00
parent b08b2b0e2e
commit be5cbfbbe9
5 changed files with 26 additions and 51 deletions

View File

@@ -166,9 +166,9 @@
android:layout_marginTop="@dimen/dp_24"
android:layout_marginEnd="@dimen/dp_24"
android:src="@drawable/baseline_link_off_24"
android:padding="@dimen/dp_23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:padding="@dimen/dp_20"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,6 +1,7 @@
package com.mogo.och.offline.ui.adapter
import android.content.Context
import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -24,8 +25,7 @@ class SwitchLineAdapter(
}
// RecyclerView设置点击事件
private var mItemClickListener: LineItemClickListener? = null
var checkLineId:Int = -1
var checkTaskId:Int = -1
private var checkInfo:BindLineListResponse.Result? = null
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
@@ -39,15 +39,24 @@ class SwitchLineAdapter(
override fun onBindViewHolder(holder: SwitchLineViewHolder, position: Int) {
val currentPosition = holder.bindingAdapterPosition
val lineInfo = mData[currentPosition]
if (lineInfo==checkInfo) {
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal)
} else {
holder.itemView.setBackgroundColor(Color.parseColor("#162761"))
}
lineInfo.line?.let {line->
line.lineName?.let {
if(it.length>10){
line.lineName = it.substring(0,10)+""
holder.linelineName.text = it.substring(0,10)+""
}else{
holder.linelineName.text = lineInfo.line?.lineName
}
}
}
holder.linelineName.text = lineInfo.line?.lineName
lineInfo.siteList?.let {
val last = it.last()
last.name?.let {siteName->
@@ -66,6 +75,10 @@ class SwitchLineAdapter(
//设置item点击事件
holder.itemView.setOnClickListener {
val oldPosition = mData.indexOf(checkInfo)
checkInfo = lineInfo
notifyItemChanged(oldPosition)
notifyItemChanged(currentPosition)
mItemClickListener?.onItemClick(lineInfo)
}
}
@@ -79,18 +92,12 @@ class SwitchLineAdapter(
}
class SwitchLineViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val selectIv: ImageView
val linelineName: AppCompatTextView//线路名称
val lineEndlineName: AppCompatTextView //终点
val actvShowMore: AppCompatTextView //选择时间
val vLineTask: View// 白色分割线
init {
selectIv = itemView.findViewById(R.id.switch_line_item_select_iv)
linelineName = itemView.findViewById(R.id.switch_line_name)
lineEndlineName = itemView.findViewById(R.id.switch_line_end_station)
vLineTask = itemView.findViewById(R.id.v_line_task)
actvShowMore = itemView.findViewById(R.id.actv_show_more)
}
}

View File

@@ -2,6 +2,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#660043FF"
android:endColor="#CC0043FF"
android:startColor="#0028345E" />
</shape>

View File

@@ -4,30 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bus_shape_select_line_item_bg_normal">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_show_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_13"
android:text="选择时间"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_40"
app:layout_constraintTop_toTopOf="@+id/switch_line_item_select_iv"
app:layout_constraintBottom_toBottomOf="@+id/switch_line_item_select_iv"
app:layout_constraintEnd_toStartOf="@+id/switch_line_item_select_iv" />
<ImageView
android:id="@+id/switch_line_item_select_iv"
android:layout_width="@dimen/dp_19"
android:layout_height="@dimen/dp_34"
android:layout_marginEnd="@dimen/dp_80"
android:background="@drawable/bus_line_task_arrow"
app:layout_constraintBottom_toTopOf="@+id/v_line_task"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:background="@color/offline_color_162761">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/switch_line_name"
@@ -52,22 +29,12 @@
android:singleLine="true"
android:textColor="@color/bus_color_ccb9c3e9"
android:textSize="@dimen/dp_36"
app:layout_constraintBottom_toTopOf="@+id/v_line_task"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/switch_line_name"
app:layout_constraintTop_toBottomOf="@+id/switch_line_name"
app:layout_constraintEnd_toStartOf="@+id/actv_show_more"
app:layout_constraintEnd_toEndOf="parent"
tools:text="@string/bus_switch_line_end" />
<View
android:id="@+id/v_line_task"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="@dimen/dp_80"
android:layout_marginEnd="@dimen/dp_80"
android:background="#63ffffff"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/switch_line_end_station" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -29,6 +29,7 @@
<color name="v2x_FFF_333">#FFFFFF</color>
<color name="arc_speeding">#DB3137</color>
<color name="offline_color_162761">#162761</color>
<color name="arc_speed">#3E77F6</color>
<color name="bus_switch_map_bg_c">#323C6F</color>