Merge "Remove charging text and carrier label on bouncer." into lmp-preview-dev

This commit is contained in:
Jorim Jaggi
2014-05-27 20:30:26 +00:00
committed by Android (Google) Code Review
5 changed files with 14 additions and 48 deletions

View File

@@ -37,6 +37,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="@dimen/kg_status_line_font_size"
android:textColor="?android:attr/textColorSecondary"
android:visibility="gone"
androidprv:allCaps="@bool/kg_use_all_caps" />
<LinearLayout

View File

@@ -17,13 +17,12 @@
package com.android.keyguard;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import com.android.keyguard.R;
public class EmergencyCarrierArea extends LinearLayout {
private CarrierText mCarrierText;
@@ -48,6 +47,7 @@ public class EmergencyCarrierArea extends LinearLayout {
mEmergencyButton.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mCarrierText.getVisibility() != View.VISIBLE) return false;
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
mCarrierText.animate().alpha(0);
@@ -59,4 +59,8 @@ public class EmergencyCarrierArea extends LinearLayout {
return false;
}});
}
public void setCarrierTextVisible(boolean visible) {
mCarrierText.setVisibility(visible ? View.VISIBLE : View.GONE);
}
}

View File

@@ -48,35 +48,19 @@ class KeyguardMessageArea extends TextView {
*/
private static final long ANNOUNCEMENT_DELAY = 250;
static final int CHARGING_ICON = 0; //R.drawable.ic_lock_idle_charging;
static final int BATTERY_LOW_ICON = 0; //R.drawable.ic_lock_idle_low_battery;
static final int SECURITY_MESSAGE_DURATION = 5000;
protected static final int FADE_DURATION = 750;
private static final String TAG = "KeyguardMessageArea";
// are we showing battery information?
boolean mShowingBatteryInfo = false;
// is the bouncer up?
boolean mShowingBouncer = false;
// last known plugged in state
boolean mCharging = false;
// last known battery level
int mBatteryLevel = 100;
KeyguardUpdateMonitor mUpdateMonitor;
// Timeout before we reset the message to show charging/owner info
long mTimeout = SECURITY_MESSAGE_DURATION;
// Shadowed text values
protected boolean mBatteryCharged;
protected boolean mBatteryIsLow;
private Handler mHandler;
CharSequence mMessage;
@@ -146,16 +130,6 @@ class KeyguardMessageArea extends TextView {
}
private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
@Override
public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
mShowingBatteryInfo = status.isPluggedIn() || status.isBatteryLow();
mCharging = status.status == BatteryManager.BATTERY_STATUS_CHARGING
|| status.status == BatteryManager.BATTERY_STATUS_FULL;
mBatteryLevel = status.level;
mBatteryCharged = status.isCharged();
mBatteryIsLow = status.isBatteryLow();
update();
}
public void onScreenTurnedOff(int why) {
setSelected(false);
};
@@ -212,7 +186,7 @@ class KeyguardMessageArea extends TextView {
*/
void update() {
MutableInt icon = new MutableInt(0);
CharSequence status = concat(getChargeInfo(icon), getOwnerInfo(), getCurrentMessage());
CharSequence status = concat(getOwnerInfo(), getCurrentMessage());
setCompoundDrawablesWithIntrinsicBounds(icon.value, 0, 0, 0);
setText(status);
}
@@ -248,25 +222,6 @@ class KeyguardMessageArea extends TextView {
return info;
}
private CharSequence getChargeInfo(MutableInt icon) {
CharSequence string = null;
if (mShowingBatteryInfo && !mShowingMessage) {
// Battery status
if (mCharging) {
// Charging, charged or waiting to charge.
string = getContext().getString(mBatteryCharged
? R.string.keyguard_charged
: R.string.keyguard_plugged_in, mBatteryLevel);
icon.value = CHARGING_ICON;
} else if (mBatteryIsLow) {
// Battery is low
string = getContext().getString(R.string.keyguard_low_battery);
icon.value = BATTERY_LOW_ICON;
}
}
return string;
}
private void hideMessage(int duration, boolean thenUpdate) {
if (duration > 0) {
Animator anim = ObjectAnimator.ofFloat(this, "alpha", 0f);

View File

@@ -135,6 +135,9 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
mPasswordEntry.requestFocus();
mSecurityMessageDisplay.setTimeout(0); // don't show ownerinfo/charging status by default
if (mEcaView instanceof EmergencyCarrierArea) {
((EmergencyCarrierArea) mEcaView).setCarrierTextVisible(true);
}
}
@Override

View File

@@ -186,6 +186,9 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
mPasswordEntry.requestFocus();
mSecurityMessageDisplay.setTimeout(0); // don't show ownerinfo/charging status by default
if (mEcaView instanceof EmergencyCarrierArea) {
((EmergencyCarrierArea) mEcaView).setCarrierTextVisible(true);
}
}
@Override