[fea]
[禁用样式调整]
This commit is contained in:
yangyakun
2024-07-02 19:20:27 +08:00
parent af2db07838
commit 597c57b6cb
2 changed files with 31 additions and 1 deletions

View File

@@ -45,6 +45,8 @@ class SeekBarView : ConstraintLayout, VisualViewModel.IVisualCallback {
private var viewModel: VisualViewModel? = null
var enableCallback:EnableCallback?=null
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
super.onLayout(changed, left, top, right, bottom)
}
@@ -132,6 +134,13 @@ class SeekBarView : ConstraintLayout, VisualViewModel.IVisualCallback {
private var value: VisualViewModel.Visualangle by Delegates.observable(VisualViewModel.Visualangle.None) { _, oldValue, newValue ->
if (oldValue != newValue) {
viewModel?.changeVisualView(newValue)
if(newValue==VisualViewModel.Visualangle.UnChange){
this.enableCallback?.enableChangeListener(false)
}else{
if (oldValue==VisualViewModel.Visualangle.UnChange) {
this.enableCallback?.enableChangeListener(true)
}
}
}
}
@@ -162,7 +171,6 @@ class SeekBarView : ConstraintLayout, VisualViewModel.IVisualCallback {
).apply {
duration = 100
}.start()
alpha = 0.5f
}
}
}
@@ -217,4 +225,8 @@ class SeekBarView : ConstraintLayout, VisualViewModel.IVisualCallback {
translationByValue(VisualViewModel.Visualangle.Middle)
}, UiThreadHandler.MODE.QUEUE)
}
interface EnableCallback{
fun enableChangeListener(enable:Boolean)
}
}

View File

@@ -6,9 +6,12 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.och.common.module.wigets.map.switchvisual.SeekBarView
import com.mogo.och.taxi.passenger.common.R
import kotlinx.android.synthetic.main.taxi_p_leftbar.view.iv_center_location
import kotlinx.android.synthetic.main.taxi_p_leftbar.view.iv_center_location_bg
import kotlinx.android.synthetic.main.taxi_p_leftbar.view.iv_visual_angle_title_bottom
import kotlinx.android.synthetic.main.taxi_p_leftbar.view.iv_visual_angle_title_head
import kotlinx.android.synthetic.main.taxi_p_leftbar.view.iv_visual_angle_title_value_bg
@@ -35,6 +38,21 @@ class LeftBarView : ConstraintLayout {
iv_center_location_bg.onClick {
this.rightBarCallback?.setGo2CenterClick()
}
iv_visual_angle_title_value_bg.enableCallback = object :SeekBarView.EnableCallback{
override fun enableChangeListener(enable: Boolean) {
if (enable){
iv_visual_angle_title_head.alpha = 1f
iv_visual_angle_title_bottom.alpha = 1f
iv_visual_angle_title_value_bg.alpha = 1f
}else{
iv_visual_angle_title_head.alpha = 0.5f
iv_visual_angle_title_bottom.alpha = 0.5f
iv_visual_angle_title_value_bg.alpha = 0.5f
}
}
}
}
override fun onVisibilityAggregated(isVisible: Boolean) {