-
Notifications
You must be signed in to change notification settings - Fork 407
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
SublimeDatePicker displays wrong week name in Chinese in API 19 #15
Comments
In datePicker/SimpleMonthView.java, the SimpleDateFormat used to format day of week label was built with pattern "EEEEE". Then in drawWeekDayLabels(Canvas), you used following code to draw them:
And dayLabel.substring(0, 1) is the root reason. |
And I recommend you to use dayLabel.substring(0, 3) for English instead... |
Thank you opening this issue and following up with the research. I really appreciate this. I chose One way forward would be to define the Keeping in mind the 'overlap' issue, can you propose a different solution? |
@vikramkakkar well, for consistent UI, you're on the right way. However, please tell me with which screen size it will overlap using My solution to solve first issue is to judge locale in java code and use different final String dayLabel = mDayFormatter.format(mDayLabelCalendar.getTime());
final int x = (2 * i + 1) * dayWidthHalf + mPadding;
String finalDayLabel = dayLabel;
int length = dayLabel.length();
if (length > 1) {
String language = getContext().getResources().getConfiguration().locale.getLanguage();
if (language.equals(Locale.SIMPLIFIED_CHINESE.getLanguage())
|| language.equals(Locale.TRADITIONAL_CHINESE.getLanguage())) {
finalDayLabel = dayLabel.substring(length - 1, length);
} else if (language.equals(Locale.ENGLISH.getLanguage())) {
finalDayLabel = dayLabel.substring(0, 3);
} else {
finalDayLabel = dayLabel.substring(0, 1);
}
}
canvas.drawText(finalDayLabel, x, y, mMonthDayLabelPaint); Anyway, I do it in that way. And it's enough for me at least now because I don't know if |
same problem。 |
This issue has been addressed in v2.0.0 which was released today. |
In China we call Monday "星期一". The first two characters means "week" and the last character determines which day in a week. When I use SublimeDatePicker, it only displays "星" for all days of a week:
This only occurs in API 19(I didn't test Android 4.2 but I did test on 4.3 and above, at those versions it displays correctly). Maybe we should change DateFormat pattern or sth.
The text was updated successfully, but these errors were encountered: