OSDN Git Service

Fix case where the lock screen information won't fit on screen.
authorKarl Rosaen <krosaen@google.com>
Wed, 24 Jun 2009 00:54:58 +0000 (17:54 -0700)
committerKarl Rosaen <krosaen@google.com>
Wed, 24 Jun 2009 01:21:46 +0000 (18:21 -0700)
The case is in landscape, 'next alarm' showing, and the plmn is showing.
In this case, don't show the next alarm.

phone/com/android/internal/policy/impl/LockScreen.java

index 2ec6426..f221688 100644 (file)
@@ -21,6 +21,7 @@ import com.android.internal.widget.LockPatternUtils;
 
 import android.content.Context;
 import android.text.format.DateFormat;
+import android.text.TextUtils;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -236,8 +237,14 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
     }
 
     private void refreshAlarmDisplay() {
-        String nextAlarmText = mLockPatternUtils.getNextAlarm();
-        if (nextAlarmText != null && mSimOk) {
+        final String nextAlarmText = mLockPatternUtils.getNextAlarm();
+
+        // bug 1685880: if we are in landscape and showing plmn, the information can end up not
+        // fitting on screen.  in this case, the alarm will get cut.
+        final CharSequence plmn = mUpdateMonitor.getTelephonyPlmn();
+        final boolean showingPlmn = plmn != null && !TextUtils.isEmpty(plmn);
+        final boolean wontFit = !mUpdateMonitor.isInPortrait() && showingPlmn;
+        if (nextAlarmText != null && mSimOk && !wontFit) {
             setAlarmInfoVisible(true);
             mAlarmText.setText(nextAlarmText);
         } else {
@@ -292,19 +299,20 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
 
     public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
         refreshSimOkHeaders(plmn, spn);
+        refreshAlarmDisplay();  // in case alarm won't fit anymore
     }
 
     private void refreshSimOkHeaders(CharSequence plmn, CharSequence spn) {
         final IccCard.State simState = mUpdateMonitor.getSimState();
         if (simState == IccCard.State.READY) {
-            if (plmn != null) {
+            if (plmn != null && !TextUtils.isEmpty(plmn)) {
                 mHeaderSimOk1.setVisibility(View.VISIBLE);
                 mHeaderSimOk1.setText(plmn);
             } else {
                 mHeaderSimOk1.setVisibility(View.GONE);
             }
 
-            if (spn != null) {
+            if (spn != null && !TextUtils.isEmpty(spn)) {
                 mHeaderSimOk2.setVisibility(View.VISIBLE);
                 mHeaderSimOk2.setText(spn);
             } else {