Android原生模块DeskClock分析1(7)

2018-12-08 18:04

DeskClock分析文档

Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);

//静音模式下闹铃响开启

if (pref.isChecked()) {Log.e(\

ringerModeStreamTypes &= ~ALARM_STREAM_TYPE_BIT; } else {Log.e(\

//静音模式下闹铃响关闭

ringerModeStreamTypes |= ALARM_STREAM_TYPE_BIT; }

Settings.System.putInt(getContentResolver(),

Settings.System.MODE_RINGER_STREAMS_AFFECTED, ringerModeStreamTypes);

return true; }

return super.onPreferenceTreeClick(preferenceScreen, preference); }

public boolean onPreferenceChange(Preference pref, Object newValue) { final ListPreference listPref = (ListPreference) pref; final int idx = listPref.findIndexOfValue((String) newValue); listPref.setSummary(listPref.getEntries()[idx]); return true; }

private void refresh() {Log.e(\ final CheckBoxPreference alarmInSilentModePref =

(CheckBoxPreference) findPreference(KEY_ALARM_IN_SILENT_MODE);

final int silentModeStreams =

Settings.System.getInt(getContentResolver(),

Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); alarmInSilentModePref.setChecked(

(silentModeStreams & ALARM_STREAM_TYPE_BIT) == 0); //再响间隔

final ListPreference snooze =

(ListPreference) findPreference(KEY_ALARM_SNOOZE); snooze.setSummary(snooze.getEntry()); snooze.setOnPreferenceChangeListener(this); } }

31

DeskClock分析文档

五.布局文件

? Include的功能

在一个项目中我们可能会需要用到相同的布局设计,如果都写在一个xml文件中,代码显得很冗余,并且可读性也很差,所以我们可以把相同布局的代码单独写成一个模块,然后用到的时候可 以通过 标签来重用layout代码。

include的功能:可把多个layout.xml布局文件整合到一个布局文件中,便于布局文件的管理,增加了布局文件的可读性和可从用性 desk_clock.xml文件中有这样一段代码:

这里include引入了desk_clock_buttons.xml文件中的布局

style=\

android:layout_height=\ android:layout_width=\ android:layout_weight=\

android:src=\

android:contentDescription=\ />

style=\

android:layout_height=\ android:layout_width=\ android:layout_weight=\

android:src=\

android:contentDescription=\ />

style=\

android:layout_height=\ android:layout_width=\ android:layout_weight=\

32

DeskClock分析文档

android:src=\

android:contentDescription=\ />

style=\

android:layout_height=\ android:layout_width=\ android:layout_weight=\

android:src=\

android:contentDescription=\ />

33

DeskClock分析文档

六.个人总结

通过对第一个模块的研究,除了把之前培训学习的内容全部融入到模块中,还学习了一些新的知识,虽然开始感觉很茫然,无从下手,但通过和团队其他成员的交流,慢慢的找到些

自己的学习方法,相信在以后的工作中,能更好的融入到项目中。

BUG: ?

当时间显示为am/pm模式,小时是两位数时,“午”字会显示出来。 调整布局文件,修改desk_clock.xml参数设置。

? 解决办法:

34

DeskClock分析文档

附件:

类关系图

35


Android原生模块DeskClock分析1(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:行政人事主管试用期工作总结

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: