标签:android android特效 alarmandmusic 闹钟 alarmservice
闹钟AlarmAndMusic 和支持播放音乐效果的,上下滑动调整时间和页面旋转风车效果,
由于制作的gif有些问题,效果不明显,欢迎下载使用看看真实的效果。
本例子主要由AlertActivity和AlarmService和AlarmAlertWakeLock三个类完成。
AlarmAlertWakeLock主要代码:
public class AlarmAlertWakeLock {
private static PowerManager.WakeLock sCpuWakeLock;
public static void acquireCpuWakeLock(Context context) {
Log.v("Acquiring cpu wake lock");
if (sCpuWakeLock != null) {
return;
}
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
sCpuWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, Log.LOGTAG);
sCpuWakeLock.acquire();
}
public static void releaseCpuLock() {
Log.v("Releasing cpu wake lock");
if (sCpuWakeLock != null) {
sCpuWakeLock.release();
sCpuWakeLock = null;
}
}
}
AlarmService主要用来play()音乐。
闹钟AlarmAndMusic 滑动调整时间和页面旋转风车效果《IT蓝豹》
标签:android android特效 alarmandmusic 闹钟 alarmservice
原文地址:http://10716910.blog.51cto.com/10706910/1702755