[6.7.0]
[fea] [当前行程和待服务页面]
This commit is contained in:
@@ -2,15 +2,19 @@ package com.mogo.och.common.module.wigets.map.orderstatus
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.och.common.module.R
|
||||
import kotlinx.android.synthetic.main.common_order_status_view.view.iv_order_status
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class OrderStatusView : AppCompatImageView, OrderStatusViewModel.IVisualCallback {
|
||||
class OrderStatusView : RelativeLayout, OrderStatusViewModel.IVisualCallback {
|
||||
|
||||
private val TAG = "VisualView"
|
||||
|
||||
@@ -25,7 +29,7 @@ class OrderStatusView : AppCompatImageView, OrderStatusViewModel.IVisualCallback
|
||||
)
|
||||
|
||||
private fun initView() {
|
||||
setImageResource(R.drawable.common_status_unorder)
|
||||
LayoutInflater.from(context).inflate(R.layout.common_order_status_view, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
@@ -48,8 +52,20 @@ class OrderStatusView : AppCompatImageView, OrderStatusViewModel.IVisualCallback
|
||||
}
|
||||
}
|
||||
|
||||
override fun setImageViewResource(name: Int) {
|
||||
setImageResource(name)
|
||||
override fun setImageViewResource(name: Int,ordering:Boolean) {
|
||||
iv_order_status.setImageResource(name)
|
||||
if (iv_order_status.layoutParams is RelativeLayout.LayoutParams) {
|
||||
val temp = iv_order_status.layoutParams as RelativeLayout.LayoutParams
|
||||
temp.removeRule(RelativeLayout.ALIGN_PARENT_START)
|
||||
temp.addRule(ALIGN_PARENT_END)
|
||||
iv_order_status.layoutParams = temp
|
||||
}else{
|
||||
val temp = iv_order_status.layoutParams as RelativeLayout.LayoutParams
|
||||
temp.removeRule(RelativeLayout.ALIGN_PARENT_END)
|
||||
temp.addRule(ALIGN_PARENT_START)
|
||||
iv_order_status.layoutParams = temp
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,16 +32,17 @@ class OrderStatusViewModel : ViewModel(), ILoginCallback {
|
||||
override fun onOpenOrderStatusEnumChange(businessEnum: OpenOrderStatusEnum?) {
|
||||
UiThreadHandler.post({
|
||||
if (LoginStatusManager.isOpenOrderType()) {
|
||||
this.viewCallback?.setImageViewResource(R.drawable.common_status_ordinging)
|
||||
this.viewCallback?.setImageViewResource(R.drawable.common_order_status,true)
|
||||
} else {
|
||||
this.viewCallback?.setImageViewResource(R.drawable.common_status_unorder)
|
||||
this.viewCallback?.setImageViewResource(R.drawable.common_unorder_status,false)
|
||||
}
|
||||
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
|
||||
interface IVisualCallback {
|
||||
fun setImageViewResource(@DrawableRes name: Int)
|
||||
fun setImageViewResource(@DrawableRes name: Int,ordering:Boolean)
|
||||
|
||||
}
|
||||
}
|
||||
BIN
OCH/common/common/src/main/res/drawable-nodpi/common_order_status.png
Executable file
BIN
OCH/common/common/src/main/res/drawable-nodpi/common_order_status.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
BIN
OCH/common/common/src/main/res/drawable-nodpi/common_order_status_bg.png
Executable file
BIN
OCH/common/common/src/main/res/drawable-nodpi/common_order_status_bg.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 394 B |
BIN
OCH/common/common/src/main/res/drawable-nodpi/common_unorder_status.png
Executable file
BIN
OCH/common/common/src/main/res/drawable-nodpi/common_unorder_status.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 925 B |
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@color/acc_default_txt_color"
|
||||
android:layout_width="@dimen/dp_118"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
tools:parentTag="android.widget.RelativeLayout">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_118"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/common_order_status_bg"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_order_status"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_alignParentStart="true"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/common_unorder_status"
|
||||
/>
|
||||
</merge>
|
||||
Reference in New Issue
Block a user