diff options
author | Danesh Mondegarian <daneshm90@gmail.com> | 2011-08-31 14:52:21 -0400 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2011-09-24 12:50:41 -0700 |
commit | 755df7c2f0009cfba85093a201fa9d9a7a224718 (patch) | |
tree | 4639dac1b5077080413e94b4763ed7979de448b0 | |
parent | a7cd15aa37cb1ff788c89bc1e3f59c72d03ece42 (diff) | |
download | frameworks_base-755df7c2f0009cfba85093a201fa9d9a7a224718.zip frameworks_base-755df7c2f0009cfba85093a201fa9d9a7a224718.tar.gz frameworks_base-755df7c2f0009cfba85093a201fa9d9a7a224718.tar.bz2 |
Lockscreen Widget Layout (1/2)
Control widget layout :
time,carrier,date,msg
Options : Default,Hidden,Centered
Part 2 : http://review.cyanogenmod.com/#change,7726
Change-Id: Ib254c29af03bbdacb64259dfc8d908aa756a355f
-rw-r--r-- | core/java/android/provider/Settings.java | 6 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/LockScreen.java | 31 |
2 files changed, 35 insertions, 2 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index f656eda..323f4f6 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2506,6 +2506,12 @@ public final class Settings { public static final String LOCKSCREEN_CUSTOM_ICON_STYLE = "lockscreen_custom_icon_style"; /** + * Modify lockscreen widgets layout (time,date,carrier,msg,status) + * @hide + */ + public static final String LOCKSCREEN_WIDGETS_LAYOUT = "lockscreen_widgets_layout"; + + /** * When enabled, rotary lockscreen switches app starter and unlock, so you can drag down to unlock * @hide */ diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java index 6ab7164..9f2bfae 100644 --- a/policy/src/com/android/internal/policy/impl/LockScreen.java +++ b/policy/src/com/android/internal/policy/impl/LockScreen.java @@ -34,6 +34,7 @@ import android.content.res.Resources; import android.content.res.ColorStateList; import android.net.Uri; import android.text.format.DateFormat; +import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -192,6 +193,9 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM private int mCustomIconStyle = Settings.System.getInt(mContext.getContentResolver(), Settings.System.LOCKSCREEN_CUSTOM_ICON_STYLE, 1); + private int mWidgetLayout = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.LOCKSCREEN_WIDGETS_LAYOUT, 0); + private boolean mRotaryUnlockDown = (Settings.System.getInt(mContext.getContentResolver(), Settings.System.LOCKSCREEN_ROTARY_UNLOCK_DOWN, 0) == 1); @@ -487,7 +491,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM //hide most items when we are in potrait lense mode mLensePortrait=(mUseLenseSquareLockscreen && mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE); - if (mLensePortrait) + if (mLensePortrait || mWidgetLayout == 1 ) setLenseWidgetsVisibility(View.INVISIBLE); mTabSelector.setLeftTabResources( @@ -583,6 +587,29 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM } resetStatusInfo(updateMonitor); + centerWidgets(); + } + + private void centerWidgets() { + if (mWidgetLayout == 2) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) + mCarrier.getLayoutParams(); + layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; + mCarrier.setLayoutParams(layoutParams); + mCarrier.setGravity(Gravity.CENTER_HORIZONTAL); + layoutParams = (RelativeLayout.LayoutParams)mDate.getLayoutParams(); + layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); + mDate.setLayoutParams(layoutParams); + layoutParams = (RelativeLayout.LayoutParams)mStatus1.getLayoutParams(); + layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); + mStatus1.setLayoutParams(layoutParams); + layoutParams = (RelativeLayout.LayoutParams)mStatus2.getLayoutParams(); + layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); + mStatus2.setLayoutParams(layoutParams); + layoutParams = (RelativeLayout.LayoutParams)mClock.getLayoutParams(); + layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); + mClock.setLayoutParams(layoutParams); + } } static void setBackground(Context bcontext, ViewGroup layout){ @@ -919,7 +946,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM private void updateStatusLines() { if (!mStatus.showStatusLines() - || (mCharging == null && mNextAlarm == null) || mLensePortrait) { + || (mCharging == null && mNextAlarm == null) || mLensePortrait || mWidgetLayout == 1) { mStatus1.setVisibility(View.INVISIBLE); mStatus2.setVisibility(View.INVISIBLE); } else if (mCharging != null && mNextAlarm == null) { |