From 38235d45ba60658622959bbf147dc071c17c2677 Mon Sep 17 00:00:00 2001 From: woshiqujun <463655834@qq.com> Date: Fri, 18 Jan 2019 15:22:44 +0800 Subject: [PATCH] Update --- .../java/com/qj/picker/MDCalendarDialog.java | 23 ++++++++++++++++++- .../main/res/layout/custom_datetime_view.xml | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/qj/picker/MDCalendarDialog.java b/app/src/main/java/com/qj/picker/MDCalendarDialog.java index 9dcd5fe..136a317 100644 --- a/app/src/main/java/com/qj/picker/MDCalendarDialog.java +++ b/app/src/main/java/com/qj/picker/MDCalendarDialog.java @@ -2,11 +2,14 @@ import android.app.AlertDialog; import android.content.Context; +import android.graphics.Color; +import android.support.annotation.ColorInt; +import android.support.annotation.DrawableRes; +import android.support.annotation.StringRes; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.TextView; - import com.qj.picker.calendarview.CalendarDay; import com.qj.picker.calendarview.MaterialCalendarView; import com.qj.picker.tool.DateUtil; @@ -59,6 +62,9 @@ public void show() { } mcv.setSelectedDate(mBuilder.currentDate); mcv.setCurrentDate(mBuilder.currentDate); + mcv.setSelectionColor(mBuilder.selectionColor); + + btnSure.setBackgroundResource(mBuilder.sureBackGroundColor); btnSure.setOnClickListener(new View.OnClickListener() { @Override @@ -88,6 +94,11 @@ public static class Builder { private Context mContext = null; + private @ColorInt + int selectionColor = Color.parseColor("#03a9f4"); + + private @DrawableRes int sureBackGroundColor = R.drawable.login_btn_bg; + private OnDetermineSelectorListener onDetermineSelectorListener = null; public Builder(Context context) { @@ -109,6 +120,16 @@ public Builder setCurrentDate(Date date) { return this; } + public Builder setSelectionColor(@StringRes int color) { + selectionColor = color; + return this; + } + + public Builder setSureBackGroudColor(@StringRes int color) { + sureBackGroundColor = color; + return this; + } + public Builder onDetermineSeleterListener(OnDetermineSelectorListener onDetermineSelectorListener) { this.onDetermineSelectorListener = onDetermineSelectorListener; return this; diff --git a/app/src/main/res/layout/custom_datetime_view.xml b/app/src/main/res/layout/custom_datetime_view.xml index 87e12e1..95e8c8a 100644 --- a/app/src/main/res/layout/custom_datetime_view.xml +++ b/app/src/main/res/layout/custom_datetime_view.xml @@ -11,6 +11,7 @@