Skip to content

Commit

Permalink
header color
Browse files Browse the repository at this point in the history
  • Loading branch information
raul committed Mar 2, 2018
1 parent e2b59a9 commit 7196296
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
Expand Down Expand Up @@ -135,6 +136,7 @@ public enum Version {
private boolean mThemeDarkChanged;
private boolean mVibrate;
private int mAccentColor = -1;
private int mHeaderColor = -1;
private boolean mDismissOnPause;
private Timepoint[] mSelectableTimes;
private Timepoint mMinTime;
Expand Down Expand Up @@ -248,6 +250,10 @@ public void setAccentColor(String color) {
mAccentColor = Color.parseColor(color);
}

public void setHeaderColor(@ColorInt int color) {
mHeaderColor = Color.argb(255, Color.red(color), Color.green(color), Color.blue(color));
}

/**
* Set the accent color of this dialog
* @param color the accent color you want
Expand Down Expand Up @@ -860,7 +866,7 @@ else if (mIs24HourMode && !mEnableSeconds && mEnableMinutes) {
}

// Set the theme at the end so that the initialize()s above don't counteract the theme.
timePickerHeader.setBackgroundColor(Utils.darkenColor(mAccentColor));
timePickerHeader.setBackgroundColor(Utils.darkenColor(mHeaderColor));
view.findViewById(R.id.mdtp_time_display_background).setBackgroundColor(mAccentColor);
view.findViewById(R.id.mdtp_time_display).setBackgroundColor(mAccentColor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void onClick(View v) {
if (limitSelectableTimes.isChecked()) {
tpd.setTimeInterval(3, 5, 10);
}
tpd.setHeaderColor(getResources().getColor(android.R.color.black));
tpd.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
Expand Down

0 comments on commit 7196296

Please sign in to comment.