Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup + Easy color changing #48

Merged
merged 4 commits into from
Mar 31, 2019
Merged

Conversation

alashow
Copy link
Contributor

@alashow alashow commented Mar 2, 2019

  • Added .gitignore and untracked/removed ignorable files
  • Upgraded to AndroidX and changed to the latest targetAPI
  • Refactored drawable resources for easy color changing
    • Overriding colors defined in libraries colors.xml will work.
    • Used android:tint in vector resources for color overriding.

@alashow
Copy link
Contributor Author

alashow commented Mar 2, 2019

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
Copy link
Contributor Author

alashow commented Mar 2, 2019

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

This was referenced Mar 2, 2019
@CoolMind
Copy link

CoolMind commented Mar 13, 2019

@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
Copy link
Contributor Author

alashow commented Mar 13, 2019

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
Copy link

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
Copy link
Contributor Author

alashow commented Mar 14, 2019

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
Copy link

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
Copy link
Owner

Thanks will review the code this coming weekend

@alashow
Copy link
Contributor Author

alashow commented Mar 18, 2019

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

@savvisingh savvisingh merged commit ff2bf8d into savvisingh:master Mar 31, 2019
@savvisingh
Copy link
Owner

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

@ShaistaQureshi
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants