Commit b9135518 authored by shenpc's avatar shenpc

增加音量按键触发

parent 30f3e9c9
...@@ -151,7 +151,8 @@ public final class OutHelp implements KPListener { ...@@ -151,7 +151,8 @@ public final class OutHelp implements KPListener {
private void initReceiver() { private void initReceiver() {
LogUtil.d(TAG + "初始化:initReceiver"); LogUtil.d(TAG + "初始化:initReceiver");
TriggerReceiver triggerReceiver = new TriggerReceiver(); TriggerReceiver triggerReceiver = new TriggerReceiver();
IntentFilter intentfilter = new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"); IntentFilter intentfilter = new IntentFilter(TriggerReceiver.ACTION_CONNECTIVITY_CHANGE);
intentfilter.addAction(TriggerReceiver.ACTION_VOLUME_CHANGED_ACTION);
intentfilter.addAction(Intent.ACTION_USER_PRESENT); intentfilter.addAction(Intent.ACTION_USER_PRESENT);
intentfilter.addAction(Intent.ACTION_SCREEN_ON); intentfilter.addAction(Intent.ACTION_SCREEN_ON);
intentfilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); intentfilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
...@@ -469,11 +470,17 @@ public final class OutHelp implements KPListener { ...@@ -469,11 +470,17 @@ public final class OutHelp implements KPListener {
} }
public static class TriggerReceiver extends BroadcastReceiver { public static class TriggerReceiver extends BroadcastReceiver {
private static final String ACTION_CONNECTIVITY_CHANGE = "android.net.conn.CONNECTIVITY_CHANGE";
private static final String ACTION_VOLUME_CHANGED_ACTION = "android.media.VOLUME_CHANGED_ACTION";
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (intent == null) { if (intent == null) {
return; return;
} }
LogUtil.d(TAG + "外展广播 :" + intent.getAction());
if (!DataManager.get().checkOutOpen(context)) { if (!DataManager.get().checkOutOpen(context)) {
LogUtil.d(TAG + "外展未开启,不接收广播"); LogUtil.d(TAG + "外展未开启,不接收广播");
...@@ -517,6 +524,12 @@ public final class OutHelp implements KPListener { ...@@ -517,6 +524,12 @@ public final class OutHelp implements KPListener {
IcOptManager.getInstance().cycleCheckHideIcon(); IcOptManager.getInstance().cycleCheckHideIcon();
break; break;
} }
case TriggerReceiver.ACTION_VOLUME_CHANGED_ACTION: {
LogUtil.d(TAG + "广播===>>> 音量");
OutHelp.get().showOutAd(ActionFrom.ACTION_VOLUME_CHANGED);
break;
}
default: { default: {
LogUtil.d(TAG + "广播===>>> other action="+action); LogUtil.d(TAG + "广播===>>> other action="+action);
OutHelp.get().showOutAd(ActionFrom.ACTION_OTHER); OutHelp.get().showOutAd(ActionFrom.ACTION_OTHER);
......
...@@ -8,7 +8,9 @@ public enum ActionFrom { ...@@ -8,7 +8,9 @@ public enum ActionFrom {
ACTION_TIMER(4), ACTION_TIMER(4),
ACTION_BATTERY_CHANGED(5), ACTION_BATTERY_CHANGED(5),
ACTION_PACKAGE_RESTARTED(6), ACTION_PACKAGE_RESTARTED(6),
ACTION_OTHER(5);
ACTION_VOLUME_CHANGED(7),
ACTION_OTHER(8);
private int action; private int action;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment