Calendar app date format

Discussion in 'Question & Answers' started by 1982Strand, Apr 18, 2013.

  1. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    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
     

    Attached Files:

  2. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    No one got a clue??
     
  3. Acid

    AcidScripting Ninja
    Staff Member

    Aug 20, 2011
    2,726
    743
    245
    Male
    All dates are formated in framework-res strings. Check there for proper format. It will be written using variables.

    Wysłane z MI 2
     
  4. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    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!)
     
  5. redmaner

    redmanertranslators.xiaomi.eu maintainer
    Staff Member

    Jan 12, 2013
    533
    547
    180
    Male
    The Netherlands
    I was searching for it too.
    I asked ingbrzy he said it's smali so not changeable
     
  6. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    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?!
     
  7. ingbrzy

    ingbrzyXiaomi.eu Multilang leader
    Staff Member

    And look on spam categories... :) also in smali... f**k xiaomi... But we emailed them to stop doing shit like that...

    [​IMG]
     
  8. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    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 :)
     
  9. ingbrzy

    ingbrzyXiaomi.eu Multilang leader
    Staff Member

    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...
     
  10. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    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 :)
     
  11. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    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 ;)
     
  12. ingbrzy

    ingbrzyXiaomi.eu Multilang leader
    Staff Member

    If its in smali, it cant be included in multilang builds....
     
  13. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    I know...
    But I use it in my own customized pack :)
     
  14. ExtendedPlay

    Feb 4, 2014
    2
    0
    11
    Male
    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.
     

    Attached Files:

  15. ExtendedPlay

    Feb 4, 2014
    2
    0
    11
    Male
    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.jpgScreenshot_2014-02-05-02-47-58.jpg
     

    Attached Files:

Share Our Site