Calendar app date format


Acid

Scripting Ninja
Staff member
Aug 20, 2011
2,726
744
247
#3
All dates are formated in framework-res strings. Check there for proper format. It will be written using variables.

Wysłane z MI 2
 
Apr 2, 2011
204
10
40
#4
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!)
 
Apr 2, 2011
204
10
40
#6
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?!
 

ingbrzy

Xiaomi.eu Multilang leader
Staff member
Feb 11, 2012
8,729
20,146
322
#7
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...

 
Apr 2, 2011
204
10
40
#8
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 :)
 

ingbrzy

Xiaomi.eu Multilang leader
Staff member
Feb 11, 2012
8,729
20,146
322
#9
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...
 
Apr 2, 2011
204
10
40
#11
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 ;)
 

ingbrzy

Xiaomi.eu Multilang leader
Staff member
Feb 11, 2012
8,729
20,146
322
#12
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....
 
Feb 4, 2014
2
0
11
#14
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

Feb 4, 2014
2
0
11
#15
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