diff options
Diffstat (limited to 'policy')
-rw-r--r-- | policy/com/android/internal/policy/impl/LockScreen.java | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/policy/com/android/internal/policy/impl/LockScreen.java b/policy/com/android/internal/policy/impl/LockScreen.java index 381b913..baed9eb 100644 --- a/policy/com/android/internal/policy/impl/LockScreen.java +++ b/policy/com/android/internal/policy/impl/LockScreen.java @@ -66,7 +66,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM private TextView mStatus1; private TextView mStatus2; private TextView mScreenLocked; - private TextView mEmergencyCallText; + private Button mEmergencyCallButton; // current configuration state of keyboard and display private int mKeyboardHidden; @@ -203,12 +203,18 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM mStatus1 = (TextView) findViewById(R.id.status1); mStatus2 = (TextView) findViewById(R.id.status2); + mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton); + mEmergencyCallButton.setText(R.string.lockscreen_emergency_call); + mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton); mScreenLocked = (TextView) findViewById(R.id.screenLocked); mSelector = (SlidingTab) findViewById(R.id.tab_selector); mSelector.setHoldAfterTrigger(true, false); mSelector.setLeftHintText(R.string.lockscreen_unlock_label); - - mEmergencyCallText = (TextView) findViewById(R.id.emergencyCallText); + mEmergencyCallButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + mCallback.takeEmergencyCallAction(); + } + }); setFocusable(true); setFocusableInTouchMode(true); @@ -263,6 +269,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM refreshBatteryStringAndIcon(); refreshAlarmDisplay(); + mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton); mTimeFormat = DateFormat.getTimeFormat(getContext()); mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year); @@ -333,6 +340,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM * @param iconResourceId The left hand icon. */ private void toastMessage(final TextView textView, final String text, final int color, final int iconResourceId) { + if (DBG) android.util.Log.d("LockScreen", "toastMessage(text=" + text +", color=" + color + ")"); + if (mPendingR1 != null) { textView.removeCallbacks(mPendingR1); mPendingR1 = null; @@ -490,8 +499,9 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM * Update the layout to match the current status. */ private void updateLayout(Status status) { - // The emergency call button no longer appears on this screen. - if (DBG) Log.d(TAG, "updateLayout: status=" + status); + // The emergency call button appears where the carrier would + // ordinarily be shown, so if one is VISIBLE the other must be + // INVISIBLE. switch (status) { case Normal: // text @@ -499,13 +509,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM getCarrierString( mUpdateMonitor.getTelephonyPlmn(), mUpdateMonitor.getTelephonySpn())); - // unnecessary clutter - //mScreenLocked.setText(R.string.lockscreen_screen_locked); +// mScreenLocked.setText(R.string.lockscreen_screen_locked); // layout - mScreenLocked.setVisibility(View.INVISIBLE); + mScreenLocked.setVisibility(View.VISIBLE); mSelector.setVisibility(View.VISIBLE); - mEmergencyCallText.setVisibility(View.GONE); + mEmergencyCallButton.setVisibility(View.GONE); break; case NetworkLocked: // The carrier string shows both sim card status (i.e. No Sim Card) and @@ -519,30 +528,35 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM // layout mScreenLocked.setVisibility(View.VISIBLE); mSelector.setVisibility(View.VISIBLE); - mEmergencyCallText.setVisibility(View.GONE); + mEmergencyCallButton.setVisibility(View.GONE); break; case SimMissing: // text - mCarrier.setText(R.string.lockscreen_missing_sim_message_short); - mScreenLocked.setText(R.string.lockscreen_missing_sim_instructions); + mCarrier.setText(""); + mScreenLocked.setText( + getCarrierString( + mUpdateMonitor.getTelephonyPlmn(), + getContext().getText(R.string.lockscreen_missing_sim_message_short))); + // previously shown here: lockscreen_instructions_when_pattern_disabled // layout mScreenLocked.setVisibility(View.VISIBLE); mSelector.setVisibility(View.VISIBLE); - mEmergencyCallText.setVisibility(View.VISIBLE); + mEmergencyCallButton.setVisibility(View.VISIBLE); break; case SimMissingLocked: // text - mCarrier.setText( + mCarrier.setText(""); + mScreenLocked.setText( getCarrierString( mUpdateMonitor.getTelephonyPlmn(), getContext().getText(R.string.lockscreen_missing_sim_message_short))); - mScreenLocked.setText(R.string.lockscreen_missing_sim_instructions); + // previously shown here: lockscreen_missing_sim_instructions // layout mScreenLocked.setVisibility(View.VISIBLE); mSelector.setVisibility(View.GONE); - mEmergencyCallText.setVisibility(View.VISIBLE); + mEmergencyCallButton.setVisibility(View.VISIBLE); break; case SimLocked: // text @@ -554,20 +568,21 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM // layout mScreenLocked.setVisibility(View.INVISIBLE); mSelector.setVisibility(View.VISIBLE); - mEmergencyCallText.setVisibility(View.GONE); + mEmergencyCallButton.setVisibility(View.GONE); break; case SimPukLocked: // text - mCarrier.setText( + mCarrier.setText(""); + mScreenLocked.setText( getCarrierString( mUpdateMonitor.getTelephonyPlmn(), getContext().getText(R.string.lockscreen_sim_puk_locked_message))); - mScreenLocked.setText(R.string.lockscreen_sim_puk_locked_instructions); + // previously shown here: lockscreen_sim_puk_locked_instructions); // layout mScreenLocked.setVisibility(View.VISIBLE); mSelector.setVisibility(View.GONE); - mEmergencyCallText.setVisibility(View.VISIBLE); + mEmergencyCallButton.setVisibility(View.VISIBLE); break; } } @@ -640,6 +655,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM /** {@inheritDoc} */ public void onResume() { resetStatusInfo(mUpdateMonitor); + mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton); } /** {@inheritDoc} */ @@ -657,5 +673,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM } public void onPhoneStateChanged(String newState) { + mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton); } } |