[charter]
[3.2.0]
This commit is contained in:
@@ -20,6 +20,7 @@ import com.mogo.och.bus.passenger.ui.dialogfragment.fragment.M1SoftFragment
|
||||
import com.mogo.och.bus.passenger.ui.dialogfragment.fragment.M1VideoFragment
|
||||
import com.mogo.och.bus.passenger.ui.dialogfragment.fragment.OrderInfoFragment
|
||||
import com.mogo.och.bus.passenger.ui.view.bottom.BottomBar
|
||||
import com.mogo.och.bus.passenger.ui.view.bottom.BottomClickView
|
||||
import kotlinx.android.synthetic.main.m1_contain_fragment.*
|
||||
|
||||
/**
|
||||
@@ -52,26 +53,40 @@ class M1ContainFragment :
|
||||
fragment = childFragmentManager.findFragmentByTag(M1VideoFragment.TAG)
|
||||
?: M1VideoFragment.newInstance()
|
||||
bb_bottom_bar.setCheckIndex(BottomBar.SelectView.VIDEO)
|
||||
cl_container.setBackgroundResource(R.drawable.m1_function_bg)
|
||||
fragmentTag = M1VideoFragment.TAG
|
||||
}
|
||||
SETTINGSOFTTAB -> {
|
||||
fragment = childFragmentManager.findFragmentByTag(M1SoftFragment.TAG)
|
||||
?: M1SoftFragment.newInstance()
|
||||
bb_bottom_bar.setCheckIndex(BottomBar.SelectView.SETTING)
|
||||
cl_container.setBackgroundResource(R.drawable.m1_function_bg)
|
||||
fragmentTag = M1SoftFragment.TAG
|
||||
}
|
||||
ORDERINFO -> {
|
||||
fragment = childFragmentManager.findFragmentByTag(OrderInfoFragment.TAG)
|
||||
?: OrderInfoFragment.newInstance()
|
||||
bb_bottom_bar.setCheckIndex(BottomBar.SelectView.ORDERINFO)
|
||||
cl_container.background = null
|
||||
fragmentTag = OrderInfoFragment.TAG
|
||||
}
|
||||
SELECTLINE ->{
|
||||
fragment = childFragmentManager.findFragmentByTag(M1OrderLineFragment.TAG)
|
||||
?: M1OrderLineFragment.newInstance()
|
||||
bb_bottom_bar.setCheckIndex(BottomBar.SelectView.LINE)
|
||||
cl_container.background = null
|
||||
fragmentTag = M1OrderLineFragment.TAG
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
CallerLogger.d(M_BUS_P+ TAG, "fragment:$fragment")
|
||||
|
||||
fragment?.let {
|
||||
childFragmentManager.beginTransaction()
|
||||
val beginTransaction = childFragmentManager.beginTransaction()
|
||||
if(!it.isAdded){
|
||||
beginTransaction.add(it,fragmentTag)
|
||||
}
|
||||
beginTransaction
|
||||
.replace(R.id.fl_function_group, it, fragmentTag)
|
||||
.commitNow()
|
||||
}
|
||||
@@ -117,6 +132,11 @@ class M1ContainFragment :
|
||||
setCheckView()
|
||||
}
|
||||
}
|
||||
bb_bottom_bar.setApplyClickListener(object : BottomClickView.ApplyClickLintener{
|
||||
override fun onApplyClick() {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ class M1OrderLineFragment :
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "BusPassengerFunctionOrderFragment"
|
||||
const val TAG = "M1OrderLineFragment"
|
||||
|
||||
@JvmStatic
|
||||
fun newInstance(): M1OrderLineFragment {
|
||||
|
||||
@@ -711,7 +711,7 @@ class M1SoftFragment :
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "BusPassengerFunctionSoftFragment"
|
||||
const val TAG = "M1SoftFragment"
|
||||
const val touchTagKey = 2
|
||||
const val touchTag = 2
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ class M1VideoFragment :
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "BusPassengerFunctionVideoFragment"
|
||||
const val TAG = "M1VideoFragment"
|
||||
@JvmStatic
|
||||
fun newInstance(): M1VideoFragment {
|
||||
val args = Bundle()
|
||||
|
||||
@@ -33,6 +33,13 @@ class BottomBar @JvmOverloads constructor(
|
||||
actv_line.setOnClickListener(click)
|
||||
}
|
||||
|
||||
fun setApplyClickListener(click:BottomClickView.ApplyClickLintener){
|
||||
aciv_center_image.applyClickListener=click
|
||||
actv_stop_site.applyClickListener=click
|
||||
actv_close_door.applyClickListener=click
|
||||
actv_open_door.applyClickListener=click
|
||||
}
|
||||
|
||||
fun setCheckIndex(index:SelectView){
|
||||
if(checkIndex==index){
|
||||
return
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.mogo.och.bus.passenger.ui.view.bottom
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.main.m1_bottom_stop_site.view.*
|
||||
|
||||
open class BottomCheckView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "StopSiteView"
|
||||
}
|
||||
|
||||
private var backageViewId: Int = -1
|
||||
private var bottomTitle: String = ""
|
||||
private var selectedDrawable: Int = -1
|
||||
private var normalDrawable: Int = -1
|
||||
private var backageView: View? = null
|
||||
|
||||
private var isCheck = false
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.m1_bottom_stop_site, this, true)
|
||||
try {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.BottomSelectView)
|
||||
backageViewId = typedArray.getResourceId(R.styleable.BottomSelectView_backageViewId, -1)
|
||||
bottomTitle = typedArray.getString(R.styleable.BottomSelectView_bottomTitle) ?: ""
|
||||
selectedDrawable = typedArray.getResourceId(R.styleable.BottomSelectView_selectedDrawable, -1)
|
||||
normalDrawable = typedArray.getResourceId(R.styleable.BottomSelectView_normalDrawable, -1)
|
||||
typedArray.recycle()
|
||||
initView(context)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
if (selectedDrawable > 0) {
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
}
|
||||
actv_title.text = bottomTitle
|
||||
}
|
||||
|
||||
fun setCheckItem(isCheck: Boolean) {
|
||||
if (isCheck != this.isCheck) {
|
||||
this.isCheck = isCheck
|
||||
notifiBackageView()
|
||||
}
|
||||
}
|
||||
|
||||
private fun notifiBackageView() {
|
||||
if (isCheck) {
|
||||
backageView?.visibility = View.VISIBLE
|
||||
aciv_center_image.setImageResource(selectedDrawable)
|
||||
actv_title.setTextColor(context.getColor(android.R.color.white))
|
||||
} else {
|
||||
backageView?.visibility = View.GONE
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
actv_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
parent?.let {
|
||||
if (parent is ConstraintLayout) {
|
||||
if (backageViewId > 0) {
|
||||
backageView = (parent as ConstraintLayout).findViewById(backageViewId)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isCheck) {
|
||||
backageView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,7 @@ open class BottomClickView @JvmOverloads constructor(
|
||||
private var normalDrawable: Int = -1
|
||||
private var backageView: View? = null
|
||||
|
||||
private var showBackageView = true
|
||||
private var isCheck = false
|
||||
var applyClickListener:ApplyClickLintener?=null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.m1_bottom_stop_site, this, true)
|
||||
@@ -43,11 +42,8 @@ open class BottomClickView @JvmOverloads constructor(
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.BottomSelectView)
|
||||
backageViewId = typedArray.getResourceId(R.styleable.BottomSelectView_backageViewId, -1)
|
||||
bottomTitle = typedArray.getString(R.styleable.BottomSelectView_bottomTitle) ?: ""
|
||||
showBackageView = typedArray.getBoolean(R.styleable.BottomSelectView_bottomClick, true)
|
||||
selectedDrawable =
|
||||
typedArray.getResourceId(R.styleable.BottomSelectView_selectedDrawable, -1)
|
||||
normalDrawable =
|
||||
typedArray.getResourceId(R.styleable.BottomSelectView_normalDrawable, -1)
|
||||
selectedDrawable = typedArray.getResourceId(R.styleable.BottomSelectView_selectedDrawable, -1)
|
||||
normalDrawable = typedArray.getResourceId(R.styleable.BottomSelectView_normalDrawable, -1)
|
||||
typedArray.recycle()
|
||||
initView(context)
|
||||
} catch (e: Exception) {
|
||||
@@ -61,61 +57,39 @@ open class BottomClickView @JvmOverloads constructor(
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
}
|
||||
actv_title.text = bottomTitle
|
||||
if (showBackageView) {
|
||||
setOnTouchListener(object : OnTouchListener {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "ACTION_DOWN")
|
||||
if (selectedDrawable > 0) {
|
||||
aciv_center_image.setImageResource(selectedDrawable)
|
||||
actv_title.setTextColor(context.getColor(android.R.color.white))
|
||||
backageView?.visibility = View.VISIBLE
|
||||
}
|
||||
setOnTouchListener(object : OnTouchListener {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "ACTION_DOWN")
|
||||
if (selectedDrawable > 0) {
|
||||
aciv_center_image.setImageResource(selectedDrawable)
|
||||
actv_title.setTextColor(context.getColor(android.R.color.white))
|
||||
backageView?.visibility = View.VISIBLE
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "ACTION_UP")
|
||||
if (selectedDrawable > 0) {
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
actv_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
|
||||
backageView?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "ACTION_CANCEL")
|
||||
if (selectedDrawable > 0) {
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
actv_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
|
||||
backageView?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
return false
|
||||
MotionEvent.ACTION_UP -> {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "ACTION_UP")
|
||||
if (selectedDrawable > 0) {
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
actv_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
|
||||
backageView?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "ACTION_CANCEL")
|
||||
if (selectedDrawable > 0) {
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
actv_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
|
||||
backageView?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun setCheckItem(isCheck: Boolean) {
|
||||
showBackageView = false
|
||||
if (isCheck != this.isCheck) {
|
||||
this.isCheck = isCheck
|
||||
notifiBackageView()
|
||||
}
|
||||
}
|
||||
|
||||
private fun notifiBackageView() {
|
||||
if (isCheck) {
|
||||
backageView?.visibility = View.VISIBLE
|
||||
aciv_center_image.setImageResource(selectedDrawable)
|
||||
actv_title.setTextColor(context.getColor(android.R.color.white))
|
||||
} else {
|
||||
backageView?.visibility = View.GONE
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
actv_title.setTextColor(context.getColor(R.color.bus_p_m1_090f28))
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
@@ -127,8 +101,9 @@ open class BottomClickView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isCheck) {
|
||||
backageView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
interface ApplyClickLintener{
|
||||
fun onApplyClick()
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ class CloseDoorView @JvmOverloads constructor(
|
||||
init {
|
||||
setOnClickListener {
|
||||
go2OpenDoor()
|
||||
applyClickListener?.onApplyClick()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.bus.passenger.ui.view.bottom.BottomClickView
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper
|
||||
import kotlinx.android.synthetic.main.m1_bottom_bar.view.*
|
||||
|
||||
@@ -24,6 +25,8 @@ class GoView @JvmOverloads constructor(
|
||||
defStyleAttr: Int = 0
|
||||
) : AppCompatTextView(context, attrs, defStyleAttr) {
|
||||
|
||||
var applyClickListener: BottomClickView.ApplyClickLintener?=null
|
||||
|
||||
companion object{
|
||||
private const val TAG = "GoView"
|
||||
}
|
||||
@@ -51,7 +54,10 @@ class GoView @JvmOverloads constructor(
|
||||
return false
|
||||
}
|
||||
})
|
||||
setOnClickListener { startGo() }
|
||||
setOnClickListener {
|
||||
startGo()
|
||||
applyClickListener?.onApplyClick()
|
||||
}
|
||||
}
|
||||
|
||||
private fun startGo(){
|
||||
|
||||
@@ -18,6 +18,7 @@ class OpenDoorView @JvmOverloads constructor(
|
||||
init {
|
||||
setOnClickListener {
|
||||
go2OpenDoor()
|
||||
applyClickListener?.onApplyClick()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ class StopSiteView @JvmOverloads constructor(
|
||||
init {
|
||||
setOnClickListener {
|
||||
stopSite()
|
||||
applyClickListener?.onApplyClick()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.view.bottom.BottomClickView
|
||||
<com.mogo.och.bus.passenger.ui.view.bottom.BottomCheckView
|
||||
android:id="@+id/actv_setting"
|
||||
app:backageViewId="@+id/actv_setting_press"
|
||||
app:selectedDrawable="@drawable/charter_p_bottom_softsettiing_press"
|
||||
@@ -183,7 +183,7 @@
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.view.bottom.BottomClickView
|
||||
<com.mogo.och.bus.passenger.ui.view.bottom.BottomCheckView
|
||||
android:id="@+id/actv_line"
|
||||
app:backageViewId="@+id/actv_line_press"
|
||||
app:selectedDrawable="@drawable/charter_p_bottom_line_press"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/cl_container"
|
||||
android:background="@drawable/m1_function_bg"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<FrameLayout
|
||||
@@ -11,6 +10,7 @@
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_bottom_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_34_5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:clickable="true"
|
||||
android:layout_marginBottom="@dimen/dp_140"
|
||||
android:layout_marginStart="@dimen/dp_26"
|
||||
android:layout_width="@dimen/dp_327"
|
||||
android:layout_height="@dimen/dp_270">
|
||||
@@ -79,7 +78,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:clickable="true"
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="@dimen/dp_140"
|
||||
android:layout_marginStart="@dimen/dp_26"
|
||||
android:layout_width="@dimen/dp_400"
|
||||
android:layout_height="@dimen/dp_270">
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1031:500"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_179"
|
||||
android:layout_marginBottom="@dimen/dp_181"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintWidth_percent="0.53698">
|
||||
<!-- 结束包车 后展示的界面 根据车辆状态来显示 -->
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<dimen name="dp_18">18dp</dimen>
|
||||
<dimen name="dp_30">30dp</dimen>
|
||||
<dimen name="dp_34">34dp</dimen>
|
||||
<dimen name="dp_34_5">34.5dp</dimen>
|
||||
<dimen name="dp_36">36dp</dimen>
|
||||
<dimen name="dp_38">38dp</dimen>
|
||||
<dimen name="dp_42">42dp</dimen>
|
||||
|
||||
Reference in New Issue
Block a user