code-troopers / android-betterpickers

[NO LONGER MAINTAINED] Android library for better Picker DialogFragments
2.67k stars 563 forks source link

Separately color header, body and footer in RadialTimePicker #291

Closed bridgeri127 closed 8 years ago

bridgeri127 commented 8 years ago

I wand to use the library for a radial time picker, but I'm getting blocked by trying to color separate elements of the dialog differently. I am aiming for this:

screen shot 2016-05-24 at 15 50 49

but the closest I can get is:

screen shot 2016-05-24 at 15 51 24

I see that the following lines of code are responsible for setting the background color and define each of them as having the same color. Is it possible to over ride this and color them independently?

// Prepare some colors to use.
        int mainColor1 = themeColors.getColor(R.styleable.BetterPickersDialog_bpMainColor1, R.color.bpWhite);
        int mainColor2 = themeColors.getColor(R.styleable.BetterPickersDialog_bpMainColor2, R.color.circle_background);
        int lineColor = themeColors.getColor(R.styleable.BetterPickersDialog_bpLineColor, R.color.bpLine_background);
        int mainTextColor = themeColors.getColor(R.styleable.BetterPickersDialog_bpMainTextColor, R.color.numbers_text_color);

        // Set the colors for each view based on the theme.
        view.findViewById(R.id.time_display_background).setBackgroundColor(mainColor1);
        view.findViewById(R.id.ok_cancel_buttons_layout).setBackgroundColor(mainColor1);
        view.findViewById(R.id.time_display).setBackgroundColor(mainColor1);
        ((TextView) view.findViewById(R.id.separator)).setTextColor(mainTextColor);
        ((TextView) view.findViewById(R.id.ampm_label)).setTextColor(mainTextColor);
bridgeri127 commented 8 years ago

I was able to work this out eventually, by extending the class and addressing those views directly myself. However, this would have been made much easier if the fields of the class were protected instead of private, do you think changing the access modifiers is something that could happen in a future release? It would make customising and adapting the library so much easier.

fchauveau commented 8 years ago

Yes we can change visibility of fields. But we certainly must change display of radial to make customization easier

fchauveau commented 8 years ago

@bridgeri127 white part of header is fixed in release 2.5.6

fchauveau commented 8 years ago

Please see v3.0.0 release that offer new styling features