Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9821e15a authored by Sven Dawitz's avatar Sven Dawitz
Browse files

Mod: Lockscreen lense style obeys time format

as requested here: http://code.google.com/p/cyanogenmod/issues/detail?id=2824

using localized am/pm sting like in any other clocks - can look funny
on languages not using am/pm - but thats intended by the localization

Change-Id: I4622e95be78856735de40e8961d855c665a3e687
parent 73816051
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@ public class RotarySelector extends View {
    private boolean mLenseMode=false;
    // are we in rotary revamped mode?
    private boolean mRevampedMode=false;
    // time format from system settings - contains 12 or 24
    private int mTime12_24 = 12;


    // state of the animation used to bring the handle back to its start position when
    // the user lets go before triggering an action
@@ -442,7 +445,11 @@ public class RotarySelector extends View {
                Time mTime = new Time();
                mTime.setToNow();

                String mTimeString=mTime.format("%R");
                String mTimeString;
                if(mTime12_24==24)
                    mTimeString=mTime.format("%R");
                else
                    mTimeString=mTime.format("%l:%M %P");
                String mDate=(String) DateFormat.format(mDateFormatString, new Date());

                canvas.translate(0, 0);
@@ -1060,6 +1067,13 @@ public class RotarySelector extends View {
        }
    }

    /**
     *  Sets the time format for propper display in lense style - called from LockScreen.java
     */
    public void setTimeFormat(int time12_24){
        mTime12_24=time12_24;
    }

    // Debugging / testing code

    private void log(String msg) {
+1 −0
Original line number Diff line number Diff line
@@ -424,6 +424,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
        mRotarySelector.setLenseSquare(mUseRotaryRevLockscreen);
        if(mRotaryHideArrows)
            mRotarySelector.hideArrows(true);
        mRotarySelector.setTimeFormat(mTime12_24);

        //hide most items when we are in potrait lense mode
        mLensePortrait=(mUseLenseSquareLockscreen && mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE);