@@ -22,7 +22,6 @@ import com.loper7.date_time_picker.DateTimePicker
2222import com.loper7.date_time_picker.R
2323import com.loper7.date_time_picker.utils.StringUtils
2424import com.loper7.date_time_picker.utils.lunar.Lunar
25- import kotlinx.android.synthetic.main.dt_dialog_time_picker.*
2625import org.jetbrains.annotations.NotNull
2726import java.util.*
2827
@@ -61,6 +60,9 @@ open class CardDatePickerDialog(context: Context) :
6160 private var linear_now: LinearLayout ? = null
6261 private var linear_bg: LinearLayout ? = null
6362 private var mBehavior: BottomSheetBehavior <FrameLayout >? = null
63+ private var divider_top: View ? = null
64+ private var divider_bottom: View ? = null
65+ private var divider_line: View ? = null
6466
6567 private var millisecond: Long = 0
6668
@@ -93,6 +95,9 @@ open class CardDatePickerDialog(context: Context) :
9395 tv_go_back = findViewById(R .id.tv_go_back)
9496 linear_now = findViewById(R .id.linear_now)
9597 linear_bg = findViewById(R .id.linear_bg)
98+ divider_top = findViewById(R .id.divider_top)
99+ divider_bottom = findViewById(R .id.divider_bottom)
100+ divider_line = findViewById(R .id.dialog_select_border)
96101
97102 mBehavior = BottomSheetBehavior .from(bottomSheet)
98103
@@ -232,13 +237,13 @@ open class CardDatePickerDialog(context: Context) :
232237 tv_cancel?.setTextColor(builder!! .assistColor)
233238 datePicker!! .setTextColor(builder!! .assistColor)
234239
235- var dividerColor = Color .parseColor( " #FFFFFF " ) - builder !! .assistColor
236- if (builder !! .assistColor != 0 && dividerColor == 0 )
237- dividerColor = Color .parseColor( " #40000000 " )
238- divider_top?.setBackgroundColor(dividerColor)
239- divider_bottom?.setBackgroundColor(dividerColor)
240- dialog_select_border ?.setBackgroundColor(dividerColor)
241- datePicker!! .setDividerColor(dividerColor)
240+
241+ }
242+ if (builder !! . dividerColor != 0 ) {
243+ divider_top?.setBackgroundColor(builder !! . dividerColor)
244+ divider_bottom?.setBackgroundColor(builder !! . dividerColor)
245+ divider_line ?.setBackgroundColor(builder !! . dividerColor)
246+ datePicker!! .setDividerColor(builder !! . dividerColor)
242247 }
243248
244249 tv_cancel!! .setOnClickListener(this )
@@ -331,6 +336,9 @@ open class CardDatePickerDialog(context: Context) :
331336 @JvmField
332337 var assistColor: Int = 0
333338
339+ @JvmField
340+ var dividerColor: Int = 0
341+
334342 @JvmField
335343 var pickerLayoutResId: Int = 0
336344
@@ -591,6 +599,15 @@ open class CardDatePickerDialog(context: Context) :
591599 return this
592600 }
593601
602+ /* *
603+ * 这只dialog内分割线颜色
604+ * @return Builder
605+ */
606+ fun setDividerColor (@ColorInt value : Int ): Builder {
607+ this .dividerColor = value
608+ return this
609+ }
610+
594611 fun build (): CardDatePickerDialog {
595612 return CardDatePickerDialog (context, this )
596613 }
0 commit comments