Commit b9135518 authored by shenpc's avatar shenpc

增加音量按键触发

parent 30f3e9c9
......@@ -151,7 +151,8 @@ public final class OutHelp implements KPListener {
private void initReceiver() {
LogUtil.d(TAG + "初始化:initReceiver");
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_SCREEN_ON);
intentfilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
......@@ -469,11 +470,17 @@ public final class OutHelp implements KPListener {
}
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
public void onReceive(Context context, Intent intent) {
if (intent == null) {
return;
}
LogUtil.d(TAG + "外展广播 :" + intent.getAction());
if (!DataManager.get().checkOutOpen(context)) {
LogUtil.d(TAG + "外展未开启,不接收广播");
......@@ -517,6 +524,12 @@ public final class OutHelp implements KPListener {
IcOptManager.getInstance().cycleCheckHideIcon();
break;
}
case TriggerReceiver.ACTION_VOLUME_CHANGED_ACTION: {
LogUtil.d(TAG + "广播===>>> 音量");
OutHelp.get().showOutAd(ActionFrom.ACTION_VOLUME_CHANGED);
break;
}
default: {
LogUtil.d(TAG + "广播===>>> other action="+action);
OutHelp.get().showOutAd(ActionFrom.ACTION_OTHER);
......
......@@ -8,7 +8,9 @@ public enum ActionFrom {
ACTION_TIMER(4),
ACTION_BATTERY_CHANGED(5),
ACTION_PACKAGE_RESTARTED(6),
ACTION_OTHER(5);
ACTION_VOLUME_CHANGED(7),
ACTION_OTHER(8);
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