@Override public boolean onTouch(View v, MotionEvent event) { if (v.equals(win_control)) if (isView) { if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { // 来电事件 if (sp.getString("end" + C.EVENT_CALL, "") .equals(PropertiesUtils.GetEventInfo(C.EVENT_CALL, MSSService.this)[1])) { stopAnimation(); } // 锁屏事件 if (sp.getString("end" + C.EVENT_LOCKSCREEN, "") .equals(PropertiesUtils.GetEventInfo(C.EVENT_LOCKSCREEN, MSSService.this)[1])) { stopAnimation(); } // 信息事件 if (sp.getString("end" + C.EVENT_SMS, "") .equals(PropertiesUtils.GetEventInfo(C.EVENT_SMS, MSSService.this)[1])) { stopAnimation(); } // 充电事件 if (sp.getString("end" + C.EVENT_CHARGING, "") .equals(PropertiesUtils.GetEventInfo(C.EVENT_CHARGING, MSSService.this)[1])) { stopAnimation(); } } } return true; }
/** 加载事件信息,包括(是否有此事件,以及该事件的动画) */ public void loadEvent() { // 清理SparseArray sa_IsEvent.clear(); sa_Animation.clear(); if (sp_userinfo.getString("UserVersionInfo", "").equals("OfficialVersion") || sp_userinfo.getString("UserVersionInfo", "").equals("TrialVersion") || sp_userinfo.getString("UserVersionInfo", "").equals(C.VERSION_FREE)) { // 来电事件 MSSValue.EVENT_CALL if (sp.getString("start" + C.EVENT_CALL, "") .equals(PropertiesUtils.GetEventInfo(C.EVENT_CALL, MSSService.this)[0]) && sp.getString("state" + C.EVENT_CALL, "").equals(getString(R.string.action_started))) { sa_IsEvent.put(C.EVENT_CALL, true); sa_Animation.put( C.EVENT_CALL, AnimationConvert.convertAnimation( sp.getString("animation" + C.EVENT_CALL, ""), getApplicationContext())); } else { sa_IsEvent.put(C.EVENT_CALL, false); sa_Animation.put(C.EVENT_CALL, C.ANIMATION_BUBBLE); } // 锁屏事件 MSSValue.EVENT_LOCKSCREEN if (sp.getString("start" + C.EVENT_LOCKSCREEN, "") .equals(PropertiesUtils.GetEventInfo(C.EVENT_LOCKSCREEN, MSSService.this)[0]) && sp.getString("state" + C.EVENT_LOCKSCREEN, "") .equals(getString(R.string.action_started))) { sa_IsEvent.put(C.EVENT_LOCKSCREEN, true); sa_Animation.put( C.EVENT_LOCKSCREEN, AnimationConvert.convertAnimation( sp.getString("animation" + C.EVENT_LOCKSCREEN, ""), getApplicationContext())); } else { sa_IsEvent.put(C.EVENT_LOCKSCREEN, false); sa_Animation.put(C.EVENT_LOCKSCREEN, C.ANIMATION_BUBBLE); } // 信息事件 MSSValue.EVENT_SMS if (sp.getString("start" + C.EVENT_SMS, "") .equals(PropertiesUtils.GetEventInfo(C.EVENT_SMS, MSSService.this)[0]) && sp.getString("state" + C.EVENT_SMS, "").equals(getString(R.string.action_started))) { sa_IsEvent.put(C.EVENT_SMS, true); sa_Animation.put( C.EVENT_SMS, AnimationConvert.convertAnimation( sp.getString("animation" + C.EVENT_SMS, ""), getApplicationContext())); } else { sa_IsEvent.put(C.EVENT_SMS, false); sa_Animation.put(C.EVENT_SMS, C.ANIMATION_BUBBLE); } // 充电事件 MSSValue.EVENT_CHARING if (sp.getString("start" + C.EVENT_CHARGING, "") .equals(PropertiesUtils.GetEventInfo(C.EVENT_CHARGING, MSSService.this)[0]) && sp.getString("state" + C.EVENT_CHARGING, "") .equals(getString(R.string.action_started))) { sa_IsEvent.put(C.EVENT_CHARGING, true); sa_Animation.put( C.EVENT_CHARGING, AnimationConvert.convertAnimation( sp.getString("animation" + C.EVENT_CHARGING, ""), getApplicationContext())); } else { sa_IsEvent.put(C.EVENT_CHARGING, false); sa_Animation.put(C.EVENT_CHARGING, C.ANIMATION_BUBBLE); } MyLog.i( TAG, "EVENT_CALL " + sa_IsEvent.get(C.EVENT_CALL) + " " + sa_Animation.get(C.EVENT_CALL)); MyLog.i( TAG, "EVENT_LOCKSCREEN " + sa_IsEvent.get(C.EVENT_LOCKSCREEN) + " " + sa_Animation.get(C.EVENT_LOCKSCREEN)); MyLog.i( TAG, "EVENT_SMS " + sa_IsEvent.get(C.EVENT_SMS) + " " + sa_Animation.get(C.EVENT_SMS)); MyLog.i( TAG, "EVENT_CHARING " + sa_IsEvent.get(C.EVENT_CHARGING) + " " + sa_Animation.get(C.EVENT_CHARGING)); } }