Methods Summary |
---|
public static java.lang.String | formatNextAlarm(android.content.Context context, AlarmManager.AlarmClockInfo info)
if (info == null) {
return "";
}
String skeleton = DateFormat.is24HourFormat(context, ActivityManager.getCurrentUser())
? "EHm"
: "Ehma";
String pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), skeleton);
return DateFormat.format(pattern, info.getTriggerTime()).toString();
|
public int | getAppWidgetId()
return LockPatternUtils.ID_DEFAULT_STATUS_WIDGET;
|
private java.lang.String | getOwnerInfo()
ContentResolver res = getContext().getContentResolver();
String info = null;
final boolean ownerInfoEnabled = mLockPatternUtils.isOwnerInfoEnabled();
if (ownerInfoEnabled) {
info = mLockPatternUtils.getOwnerInfo(mLockPatternUtils.getCurrentUser());
}
return info;
|
public boolean | hasOverlappingRendering()
return false;
|
protected void | onAttachedToWindow()
super.onAttachedToWindow();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mInfoCallback);
|
protected void | onConfigurationChanged(android.content.res.Configuration newConfig)
super.onConfigurationChanged(newConfig);
mClockView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimensionPixelSize(R.dimen.widget_big_font_size));
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimensionPixelSize(R.dimen.widget_label_font_size));
mOwnerInfo.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimensionPixelSize(R.dimen.widget_label_font_size));
|
protected void | onDetachedFromWindow()
super.onDetachedFromWindow();
KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mInfoCallback);
|
protected void | onFinishInflate()
super.onFinishInflate();
mAlarmStatusView = (TextView) findViewById(R.id.alarm_status);
mDateView = (TextClock) findViewById(R.id.date_view);
mClockView = (TextClock) findViewById(R.id.clock_view);
mDateView.setShowCurrentUserTime(true);
mClockView.setShowCurrentUserTime(true);
mOwnerInfo = (TextView) findViewById(R.id.owner_info);
mLockPatternUtils = new LockPatternUtils(getContext());
final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
setEnableMarquee(screenOn);
refresh();
updateOwnerInfo();
// Disable elegant text height because our fancy colon makes the ymin value huge for no
// reason.
mClockView.setElegantTextHeight(false);
|
private void | refresh()
AlarmManager.AlarmClockInfo nextAlarm = mLockPatternUtils.getNextAlarm();
Patterns.update(mContext, nextAlarm != null);
refreshTime();
refreshAlarmStatus(nextAlarm);
|
void | refreshAlarmStatus(AlarmManager.AlarmClockInfo nextAlarm)
if (nextAlarm != null) {
String alarm = formatNextAlarm(mContext, nextAlarm);
mAlarmStatusView.setText(alarm);
mAlarmStatusView.setContentDescription(
getResources().getString(R.string.keyguard_accessibility_next_alarm, alarm));
mAlarmStatusView.setVisibility(View.VISIBLE);
} else {
mAlarmStatusView.setVisibility(View.GONE);
}
|
public void | refreshTime()
mDateView.setFormat24Hour(Patterns.dateView);
mDateView.setFormat12Hour(Patterns.dateView);
mClockView.setFormat12Hour(Patterns.clockView12);
mClockView.setFormat24Hour(Patterns.clockView24);
|
private void | setEnableMarquee(boolean enabled)
if (DEBUG) Log.v(TAG, (enabled ? "Enable" : "Disable") + " transport text marquee");
if (mAlarmStatusView != null) mAlarmStatusView.setSelected(enabled);
if (mOwnerInfo != null) mOwnerInfo.setSelected(enabled);
|
private void | updateOwnerInfo()
if (mOwnerInfo == null) return;
String ownerInfo = getOwnerInfo();
if (!TextUtils.isEmpty(ownerInfo)) {
mOwnerInfo.setVisibility(View.VISIBLE);
mOwnerInfo.setText(ownerInfo);
} else {
mOwnerInfo.setVisibility(View.GONE);
}
|