Methods Summary |
---|
private java.lang.String | computeIndication()
if (!TextUtils.isEmpty(mTransientIndication)) {
return mTransientIndication;
}
if (mPowerPluggedIn) {
return computePowerIndication();
}
return mRestingIndication;
|
private java.lang.String | computePowerIndication()
if (mPowerCharged) {
return mContext.getResources().getString(R.string.keyguard_charged);
}
// Try fetching charging time from battery stats.
try {
long chargingTimeRemaining = mBatteryInfo.computeChargeTimeRemaining();
if (chargingTimeRemaining > 0) {
String chargingTimeFormatted = Formatter.formatShortElapsedTimeRoundingUpToMinutes(
mContext, chargingTimeRemaining);
return mContext.getResources().getString(
R.string.keyguard_indication_charging_time, chargingTimeFormatted);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling IBatteryStats: ", e);
}
// Fall back to simple charging label.
return mContext.getResources().getString(R.string.keyguard_plugged_in);
|
public void | hideTransientIndication()Hides transient indication.
if (mTransientIndication != null) {
mTransientIndication = null;
mHandler.removeMessages(MSG_HIDE_TRANSIENT);
updateIndication();
}
|
public void | hideTransientIndicationDelayed(long delayMs)Hides transient indication in {@param delayMs}.
mHandler.sendMessageDelayed(
mHandler.obtainMessage(MSG_HIDE_TRANSIENT), delayMs);
|
public void | setRestingIndication(java.lang.String restingIndication)Sets the indication that is shown if nothing else is showing.
mRestingIndication = restingIndication;
updateIndication();
|
public void | setVisible(boolean visible)
mVisible = visible;
mTextView.setVisibility(visible ? View.VISIBLE : View.GONE);
if (visible) {
hideTransientIndication();
updateIndication();
}
|
public void | showTransientIndication(int transientIndication)Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
showTransientIndication(mContext.getResources().getString(transientIndication));
|
public void | showTransientIndication(java.lang.String transientIndication)Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
mTransientIndication = transientIndication;
mHandler.removeMessages(MSG_HIDE_TRANSIENT);
updateIndication();
|
private void | updateIndication()
if (mVisible) {
mTextView.switchIndication(computeIndication());
}
|