savvisingh / DateRangePicker

Date Range Picker is a Calendar Picker View to show a Customized Date Range Picker with improved UI and functionality to add subtitles to the dates
Apache License 2.0
784 stars 160 forks source link

Cleanup + Easy color changing #48

Closed alashow closed 5 years ago

alashow commented 5 years ago
alashow commented 5 years ago

You can try it before this gets merged:

Change the dependency:

https://jitpack.io/#alashow/DateRangePicker/1.3.1:

dependencies {
    implementation 'com.github.alashow:DateRangePicker:1.3.1'
}

Override the colors

    <color name="calendar_selected_day_bg">@color/primary</color>
    <color name="calendar_selected_range_bg">@color/primary</color>
    <color name="dateTimeRangePickerStateToday">@color/primary</color>
alashow commented 5 years ago

Resolves: #47, #39, #35, #15

CoolMind commented 5 years ago

@alashow In https://github.com/alashow/DateRangePicker you write that we can import your fork library with:

dependencies {
    compile 'com.savvi.datepicker:rangepicker:1.2.0'
}

But that is a path to the original library.


After adding maven { url 'https://jitpack.io' } and implementation 'com.github.alashow:DateRangePicker:1.3.1' I got several errors during build. As I understood, this library raised minSdk to 15, also uses AndroidX.

After removing an imported library rangedatepicker as a module, removing from build.gradle, changing AndroidManifest:

<uses-sdk tools:overrideLibrary="com.savvi.rangedatepicker" />

<application
    ...
    tools:replace="android:appComponentFactory" android:appComponentFactory="androidx">

I got many errors in build window:

LoginFragment.kt: (120, 17): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:

So I have to reference all views from XML in Kotlin with view?.control?.....

alashow commented 5 years ago

But that is a path to the original library.

Yes, I didn't update readme files in this fork.

this library raised minSdk to 15

I didn't change minSdk. It was 15 and it's still 15 in my fork.

also uses AndroidX. I got many errors in build window:

Yes, as I upgraded to latest support libs. Did you upgrade your project to AndroidX? As far as I know, you can't use a library with AndroidX if you aren't using AndroidX (Jetifier only works the other way).

CoolMind commented 5 years ago

Sorry, you are right, you didn't change to 15. When I imported DateRangePicker last year, I manually changed to 14.

Currently I don't know whether I should upgrade the project to AndroidX. It works without it.

alashow commented 5 years ago

Well, you will have to upgrade in the near future as most libraries started upgrading to it. Besides, it's not a hard process.

CoolMind commented 5 years ago

I read that 28.0.0 would be the last version of support-libraries, so, you are right, I have to upgrade to AndroidX. Probably it will waste several hours for me. Not only migration, but also testing.

savvisingh commented 5 years ago

Thanks will review the code this coming weekend

alashow commented 5 years ago

@savvisingh this can be improved though: overriding colors via attributes per view and not globally via resources.

savvisingh commented 5 years ago

Yeah that is the ideal approach but for now, I have published the new version with overriding the color values from resource file

ShaistaQureshi commented 3 years ago

how to change the text of date selected? when a date is clicked, its background color changes to yellow and its text color changes to white.... I don't want to change the text color, it should remain black (as it was earlier) please help as so as possible.