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

Localize Date Format #501

Merged
merged 2 commits into from
Jul 16, 2020
Merged

Localize Date Format #501

merged 2 commits into from
Jul 16, 2020

Conversation

accandme
Copy link
Contributor

@accandme accandme commented May 11, 2018

Some locales format dates as dd/MM rather than M/dd.

This PR localizes the date format.

@accandme
Copy link
Contributor Author

@alamkanak Small PR to localize the format of the dates in headers. Would be nice to see it merged :-) Cheers!

@AndroidDeveloperLB
Copy link

This is not needed anymore, because I did it and it will use the locale of the device to decide which format is best, including which sign to use (some use "-" instead of "/" for example).
Here:
Quivr#97 (comment)

@accandme
Copy link
Contributor Author

@AndroidDeveloperLB thanks for your comment! How can I make use of the improvements you did? Are they published somewhere? Can I add them in my gradle dependencies?

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented May 14, 2018

@accandme Well, first maybe try out my repository (here).
Note that I've added a bunch of other things:

  • converted all to Kotlin (huge and delicate change)
  • multi-line for the title (actually called the second one a subtitle)
  • a way to put text on the side of the week-days, and I've put a lot of fixes.
  • added handling of time formats like for the dates, because not in all locales you have AM/PM.
  • added ability to scroll whole view (example: week by week)
  • of course, various fixes and minor improvements.

You can read all of the changes I've made over the past weeks. I think it's worth it.

As for using on gradle, not sure. Maybe using Jitpack?
Meaning as such:
https://jitpack.io/#AndroidDeveloperLB/Android-Week-View/develop-SNAPSHOT
?

Not sure...

Currently the issues I've having that I wish others could help me with, are:

I would appreciate it if you could also help with this. I've worked a lot recently to improve and fix this library. It's too complex and much harder to modify than I thought, but it's almost the only library I've found

@AndroidDeveloperLB
Copy link

BTW, here's the relevant code for the formatting (function is "getWeekdayWithNumericDayAndMonthFormat") :
https://github.com/AndroidDeveloperLB/Android-Week-View/blob/develop/library/src/main/java/com/alamkanak/weekview/WeekViewUtil.kt

@accandme
Copy link
Contributor Author

accandme commented May 22, 2018

@AndroidDeveloperLB thanks a lot for your detailed response, and for all the work on this library!

Regarding the horizontal scrolling, I worked around it by using a ViewPager, and creating several copies of WeekView that do not scroll horizontally. The only dirty hack was to synchronize the vertical scroll state across the different instances.

I did not do anything to support RTL for now.

Back to your repo, why don't you publish your work on some repo, so that people can include it in their gradle/maven deps?
EDIT: I just followed your jitpack link.. all good :-)

Thanks again very much!

@AndroidDeveloperLB
Copy link

@accandme The ViewPager has a disadvantage as you wrote, that you need to sync the vertical state .
This means that if you see now hours of 16:00-22:00, for example, and you swipe to the next week, you might get a different time range. It's interesting to know how you did it, and I wonder if it worked well, though.

My repository has a solution instead of a ViewPager, which someone has contributed (not me).
BTW, Google does use a ViewPager in their calendar app, but because they made it out of various views instead of a single one with a canvas, it works fine .

About jitpack, I'm not sure if it works the way I've made it.
Do you have a problem using it? I think it shows the event cells a bit off their correct location in the time lines. I don't know why this occurs, as the sample works fine.

@accandme
Copy link
Contributor Author

@AndroidDeveloperLB thanks for your quick reply!

My dirty hack was to broadcast the current scroll position to the two "instantiated but hidden" views (left and right) at a regular interval. It is not perfect of course, but it works okay.

So far, in my deps, I am still using the original WeekView repo (alamkanak). I'll let you know if I face problems when I migrate to using your modified version.

Cheers, and thanks for the good work!

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented May 23, 2018

@accandme OK thanks.
If you have the time for RTL support (or making it smoother and more efficient), please try...

@alamkanak alamkanak merged commit 2ac4440 into alamkanak:develop Jul 16, 2020
@AndroidDeveloperLB
Copy link

The huge changes I've suggested were approved? Including everything? Kotlin and all?

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.

3 participants