101Loop / DatePickerTimeline

Android Date Picker Library that provides a calendar as a horizontal timeline
Apache License 2.0
123 stars 37 forks source link

Selected date background color #3

Open magnusfernandes opened 5 years ago

magnusfernandes commented 5 years ago

Ability to change the background color of the selected date.

iamvivekkaushik commented 5 years ago

Will add this in the next version of library.

ziyadrahman commented 5 years ago

how to change the selected background color?

www0488 commented 4 years ago

Any update for this feature? @iamvivekkaushik

akardas16 commented 4 years ago

Actually this is very easy. if you import library as module or copy library java classes, layouts and resource values you will see that if (selectedPosition == position) { rootView.setBackground(timelineView.getResources().getDrawable(R.drawable.background_shape)); selectedView = rootView; } else { rootView.setBackground(null); } in TimelineAdapter.java class. R.drawable.background_shape is your selected background. just change it

akardas16 commented 4 years ago

Also if you want to change week names and month names in your language or other language you can change lists as private static final String[] WEEK_DAYS = DateFormatSymbols.getInstance(new Locale("tr","TR")).getShortWeekdays(); private static final String[] MONTH_NAME = DateFormatSymbols.getInstance(new Locale("tr","TR")).getShortMonths(); in TimelineAdapter. for example above code shows week names and month names in Turkish. if you want you can add your Locale or use default locales

www0488 commented 4 years ago

that's actually a good idea @akardas16 , but when I tried to import the module and I got this issue: A problem occurred configuring project ':datepicker'.

Could not create an instance of type com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3. org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext

Isn't that means I need to downgrade my gradle version? if in that case, I think I will not do that.

akardas16 commented 4 years ago

that's actually a good idea @akardas16 , but when I tried to import the module and I got this issue: A problem occurred configuring project ':datepicker'.

Could not create an instance of type com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3. org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext

Isn't that means I need to downgrade my gradle version? if in that case, I think I will not do that.

I didn't understand error but if you can just copy library class and resource files to your project this is will be more easy

akardas16 commented 4 years ago

that's actually a good idea @akardas16 , but when I tried to import the module and I got this issue: A problem occurred configuring project ':datepicker'.

Could not create an instance of type com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3. org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext

Isn't that means I need to downgrade my gradle version? if in that case, I think I will not do that.

I didn't understand error but if you can just copy library class and resource files to your project this is will be more easy

I don't think it's related to gradle version

www0488 commented 4 years ago

I will give a try, thanks @akardas16.

www0488 commented 4 years ago

By doing some researches and I found this issue. When you update your android studio to 4.0.0, the issue LazyConfigurationUsageContext will show up. This is because the gradle version which is over 6.0.0 does not support that.

The solution is after when you tried to import the module, use finder in path and search for code line: " apply plugin: 'com.novoda.bintray-release' ".

Then these code lines(may be different value, but just remove these lines):

apply plugin: 'com.novoda.bintray-release'

publish { userOrg = 'zhihu' groupId = 'com.zhihu.android' artifactId = 'matisse' publishVersion = '0.5.2-beta4' desc = 'A well-designed local image selector for Android' website = 'https://www.zhihu.com/' }

After that you shall be able to use the latest gradle version and add the module in your project.

Latest stable versions you can use with Android Studio 4.0.1 (July 2020): ndroid Plugin version: 4.0.1 Gradle version: 6.1.1 ref: https://stackoverflow.com/a/35272475/11055217