如何使得锁屏界面显示充电和闹铃信息
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
如何使得锁屏界面显示充电和闹铃信息?
[SOLUTION]
Google default的design 是这个充电信息和闹钟信息是跟SIM卡绑定的,所以在双卡的情况下,需要同时插
入两张SIM卡,才会显示充电信息及闹钟信息的;如需要修改,请参考下面的代码:
在lockscreen.java修改:
private void updateStatusLines() {
/*if (!mStatus.showStatusLines()
|| (mCharging == null && mNextAlARM == null)) {
mStatus1.setVisibility(View.INVISIBLE);
mStatus2.setVisibility(View.INVISIBLE);
// }else if(FeatureOption.mtk_GEMINI_SUPPORT == true &&
!mStatusGemini.showStatusLines()){
else if(FeatureOption.MTK_GEMINI_SUPPORT == true ){
mStatus1.setVisibility(View.INVISIBLE);
mStatus2.setVisibility(View.INVISIBLE);
} else*/
=========================================================
//把上面的代码注释掉。
加上这样的判断:
加上(mCharging == null && mNextAlarm == null)的分支
=====================================================
if (mCharging != null && mNextAlarm == null) {
// charging only
mStatus1.setVisibility(View.VISIBLE);
mStatus2.setVisibility(View.INVISIBLE);
mStatus1.setText(mCharging);
mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon, null,
null, null);
} else if (mNextAlarm != null && mCharging == null) {
// next alarm only
mStatus1.setVisibility(View.VISIBLE);
mStatus2.setVisibility(View.INVISIBLE);
mStatus1.setText(mNextAlarm);
mStatus1.setCompoundDrawablesWithIntrinsicBounds(mAlarMICon, null, null,
null);
} else if (mCharging != null && mNextAlarm != null) {
// both charging and next alarm
mStatus1.setVisibility(View.VISIBLE);
mStatus2.setVisibility(View.VISIBLE);
mStatus1.setText(mCharging);
mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon, null,
null, null);
mStatus2.setText(mNextAlarm);
mStatus2.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon, null, null,
null);
}
}
如何使得锁屏界面显示充电和闹铃信息?
[SOLUTION]
Google default的design 是这个充电信息和闹钟信息是跟SIM卡绑定的,所以在双卡的情况下,需要同时插
入两张SIM卡,才会显示充电信息及闹钟信息的;如需要修改,请参考下面的代码:
在lockscreen.java修改:
private void updateStatusLines() {
/*if (!mStatus.showStatusLines()
|| (mCharging == null && mNextAlARM == null)) {
mStatus1.setVisibility(View.INVISIBLE);
mStatus2.setVisibility(View.INVISIBLE);
// }else if(FeatureOption.mtk_GEMINI_SUPPORT == true &&
!mStatusGemini.showStatusLines()){
else if(FeatureOption.MTK_GEMINI_SUPPORT == true ){
mStatus1.setVisibility(View.INVISIBLE);
mStatus2.setVisibility(View.INVISIBLE);
} else*/
=========================================================
//把上面的代码注释掉。
加上这样的判断:
加上(mCharging == null && mNextAlarm == null)的分支
=====================================================
if (mCharging != null && mNextAlarm == null) {
// charging only
mStatus1.setVisibility(View.VISIBLE);
mStatus2.setVisibility(View.INVISIBLE);
mStatus1.setText(mCharging);
mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon, null,
null, null);
} else if (mNextAlarm != null && mCharging == null) {
// next alarm only
mStatus1.setVisibility(View.VISIBLE);
mStatus2.setVisibility(View.INVISIBLE);
mStatus1.setText(mNextAlarm);
mStatus1.setCompoundDrawablesWithIntrinsicBounds(mAlarMICon, null, null,
null);
} else if (mCharging != null && mNextAlarm != null) {
// both charging and next alarm
mStatus1.setVisibility(View.VISIBLE);
mStatus2.setVisibility(View.VISIBLE);
mStatus1.setText(mCharging);
mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon, null,
null, null);
mStatus2.setText(mNextAlarm);
mStatus2.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon, null, null,
null);
}
}