|
18 | 18 |
|
19 | 19 | import android.animation.ObjectAnimator;
|
20 | 20 | import android.app.Activity;
|
21 |
| -import android.app.Dialog; |
22 | 21 | import android.content.DialogInterface;
|
23 | 22 | import android.content.res.Configuration;
|
24 | 23 | import android.content.res.Resources;
|
25 | 24 | import android.graphics.Color;
|
26 | 25 | import android.os.Build;
|
27 | 26 | import android.os.Bundle;
|
28 |
| -import androidx.annotation.ColorInt; |
29 |
| -import androidx.annotation.NonNull; |
30 |
| -import androidx.annotation.StringRes; |
31 |
| -import androidx.appcompat.app.AppCompatDialogFragment; |
32 |
| -import androidx.core.content.ContextCompat; |
33 |
| -import androidx.core.content.res.ResourcesCompat; |
34 | 27 | import android.text.format.DateFormat;
|
35 | 28 | import android.text.format.DateUtils;
|
36 | 29 | import android.view.LayoutInflater;
|
37 | 30 | import android.view.View;
|
38 | 31 | import android.view.View.OnClickListener;
|
39 | 32 | import android.view.ViewGroup;
|
40 |
| -import android.view.Window; |
41 | 33 | import android.view.WindowManager;
|
42 | 34 | import android.view.animation.AlphaAnimation;
|
43 | 35 | import android.view.animation.Animation;
|
44 | 36 | import android.widget.Button;
|
45 | 37 | import android.widget.LinearLayout;
|
46 | 38 | import android.widget.TextView;
|
47 |
| - |
| 39 | +import androidx.annotation.ColorInt; |
| 40 | +import androidx.annotation.NonNull; |
| 41 | +import androidx.annotation.StringRes; |
| 42 | +import androidx.appcompat.app.AppCompatDialogFragment; |
| 43 | +import androidx.core.content.ContextCompat; |
| 44 | +import androidx.core.content.res.ResourcesCompat; |
48 | 45 | import com.wdullaer.materialdatetimepicker.HapticFeedbackController;
|
49 | 46 | import com.wdullaer.materialdatetimepicker.R;
|
50 | 47 | import com.wdullaer.materialdatetimepicker.Utils;
|
@@ -142,10 +139,10 @@ public enum ScrollOrientation {
|
142 | 139 | private int mDefaultView = MONTH_AND_DAY_VIEW;
|
143 | 140 | private int mOkResid = R.string.mdtp_ok;
|
144 | 141 | private String mOkString;
|
145 |
| - private int mOkColor = -1; |
| 142 | + private Integer mOkColor = null; |
146 | 143 | private int mCancelResid = R.string.mdtp_cancel;
|
147 | 144 | private String mCancelString;
|
148 |
| - private int mCancelColor = -1; |
| 145 | + private Integer mCancelColor = null; |
149 | 146 | private Version mVersion;
|
150 | 147 | private ScrollOrientation mScrollOrientation;
|
151 | 148 | private TimeZone mTimezone;
|
@@ -442,10 +439,17 @@ affect the behaviour of the picker (in the unlikely event the user reconfigures
|
442 | 439 | view.findViewById(R.id.mdtp_day_picker_selected_date_layout).setBackgroundColor(mAccentColor);
|
443 | 440 |
|
444 | 441 | // Buttons can have a different color
|
445 |
| - if (mOkColor != -1) okButton.setTextColor(mOkColor); |
446 |
| - else okButton.setTextColor(mAccentColor); |
447 |
| - if (mCancelColor != -1) cancelButton.setTextColor(mCancelColor); |
448 |
| - else cancelButton.setTextColor(mAccentColor); |
| 442 | + if (mOkColor != null) { |
| 443 | + okButton.setTextColor(mOkColor); |
| 444 | + } else { |
| 445 | + okButton.setTextColor(mAccentColor); |
| 446 | + } |
| 447 | + |
| 448 | + if (mCancelColor != null) { |
| 449 | + cancelButton.setTextColor(mCancelColor); |
| 450 | + } else { |
| 451 | + cancelButton.setTextColor(mAccentColor); |
| 452 | + } |
449 | 453 |
|
450 | 454 | if (getDialog() == null) {
|
451 | 455 | view.findViewById(R.id.mdtp_done_background).setVisibility(View.GONE);
|
|
0 commit comments