Calendar app date format


1982Strand

Members
Apr 2, 2011
204
40
I'm looking for the string to change the date format in the calendar app. It's in the top left corner of the monthly calendar view (see image where it says 2013.04)

Any help is appreciated :) Thanks


Sendt fra min GT-I9300 med Tapatalk2
 

Attachments

  • uploadfromtaptalk1366304854000.jpg
    uploadfromtaptalk1366304854000.jpg
    37.3 KB · Views: 295
All dates are formated in framework-res strings. Check there for proper format. It will be written using variables.

Wysłane z MI 2
 
Hmm, weird. Everywhere else in the system, the date is right, except the calendar app.. Don't know exactly what i'm looking for in framework-res, i found lots of date format strings, can't determine if the formatting is correct or not, they seem fine though...

Btw, i use the old sort script, which has the bug that it puts "formatted false" in front of the string, like:
Code:
<string formatted="false" name="abbrev_month_day_year">%-e. %b %Y</string>

Maybe that is what mess things up?
(Could really use that new one you guys made.. :) Hint, hint!)
 
I was searching for it too.
I asked ingbrzy he said it's smali so not changeable
 
Oh damn...
I'll try to look for it, but smali is pure evil.. Seems pretty dumb they made it that way, why not just make it use the system settings?!
 
Oh damn...
I'll try to look for it, but smali is pure evil.. Seems pretty dumb they made it that way, why not just make it use the system settings?!
And look on spam categories... :) also in smali... f**k xiaomi... But we emailed them to stop doing s**t like that...

ujapevep.jpg
 
I actually found the date formats in Calendar app!!
It's in the CalendarViewAdapter.smali

I changed these lines (in red) - just switched places, so that year comes last and day comes before month :

Code:
    .line 367
    sget-object v1, Ljava/util/Locale;->US:Ljava/util/Locale;
 
    const-string v2, "%d.%02d.%02d"
 
    const/4 v3, 0x3
 
    new-array v3, v3, [Ljava/lang/Object;
 
    const/4 v4, 0x0
 
    iget v5, v0, Landroid/text/format/Time;->[COLOR=#ff0000]monthDay[/COLOR]:I
 
    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
 
    move-result-object v5
 
    aput-object v5, v3, v4
 
    const/4 v4, 0x1
 
    iget v5, v0, Landroid/text/format/Time;->[COLOR=#ff0000]month[/COLOR]:I
 
    add-int/lit8 v5, v5, 0x1
 
    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
 
    move-result-object v5
 
    aput-object v5, v3, v4
 
    const/4 v4, 0x2
 
    iget v5, v0, Landroid/text/format/Time;->[COLOR=#ff0000]year[/COLOR]:I
 
    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

And this:

Code:
    .line 373
    sget-object v1, Ljava/util/Locale;->US:Ljava/util/Locale;
 
    const-string v2, "%d.%02d"
 
    const/4 v3, 0x2
 
    new-array v3, v3, [Ljava/lang/Object;
 
    const/4 v4, 0x0
 
    iget v5, v0, Landroid/text/format/Time;->[COLOR=#ff0000]month[/COLOR]:I
 
    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
 
    move-result-object v5
 
    aput-object v5, v3, v4
 
    const/4 v4, 0x1
 
    iget v5, v0, Landroid/text/format/Time;->[COLOR=#ff0000]year[/COLOR]:I
 
    add-int/lit8 v5, v5, 0x1

But it's incomplete. First of all, somehow, the date in monthview is screwed up. For example, it needs to show "4.2013", but it shows "3.2014" and when i click the button for today, it goes to the 20th - it is actually correct, but just the date in the top shows wrong...

Every other view is correct too, except in agenda view, the top date is right, showing for instance "21.04.2013" - for tomorrows events and so forth, but the date on the left side is showing month BEFORE date, which i'd like to switch..

Gotta look more into this, but was hoping for some help :)

Uhm, don't know about the spam categories, havn't had a look yet, but i'll get to it!

EDIT: Err.. Well, the code blocks don't show red text, but you get the idea, it's the parts surrounded by the [COLOR] - tags :)
 
Dont waste your time... We will not play with smali code... It can cause more issues than pros...

For spam caregories we hope, next release will use xml...
 
Yeah, tell me about it! Well, maybe you could email Xiaomi to make those date formats as strings too? To make them more international compatible :)
 
Just an update here. I finally figured it out and fixed the date formatting in the calendar app... And seems it's bugfree, but i still need to test it more to be completely sure ;)
 
Just an update here. I finally figured it out and fixed the date formatting in the calendar app... And seems it's bugfree, but i still need to test it more to be completely sure ;)
If its in smali, it cant be included in multilang builds....
 
I actually found the date formats in Calendar app!!
It's in the CalendarViewAdapter.smali
I changed these lines (in red)
1982Strand, you was on the right way. CalendarViewAdapter.smali - is exacly what you need.
But you should switch places not only monthDay/year. You should edit a little bit more code.

I attached the modified file.
Explore the difference and try to use it on your phone. Just rename it to *.smali.
 

Attachments

  • CalendarViewAdapter.txt
    48.7 KB · Views: 265
By the way, I've made some additional changes in the Calendar application.

1. In the both day and agenda view the date strings looks like dd.MM.yyyy.
2. In the month view the date contains a full name of current month.
3. In the agenda view the date appears as dd.MM.

Look at attached files to understand what I am talking about.
Also I've attached modified *.smali files and builded *.apk.

It was interesting :) See ya.

Screenshot_2014-02-05-02-47-38.jpg Screenshot_2014-02-05-02-47-58.jpg
 

Attachments

  • Calendar-apk.zip
    1.7 MB · Views: 247
  • smalis.zip
    125.2 KB · Views: 171