你可以检测到向上滑动Android头部通知

问题描述 投票:0回答:1

当用户在抬头通知中向左和向右滑动时,我知道您可以使用setDeleteIntent来捕获此手势并编写自定义意图以进行触发。

但是有可能检测用户何时在抬头通知时刷新,因为此时他们没有解雇它,因此删除Intent永远不会被解雇?

我想知道用户是否向左或向右滑动通知。

java android notifications swipe gesture
1个回答
0
投票

如果你开始检测common gestures,它可以帮你吗?我相信可以遵循相同的通知。

public class MainActivity extends Activity {
@Override
public boolean onTouchEvent(MotionEvent event){

int action = MotionEventCompat.getActionMasked(event);

switch(action) {
    case (MotionEvent.ACTION_DOWN) :
        Log.d(DEBUG_TAG,"Action was DOWN");
        return true;
    case (MotionEvent.ACTION_MOVE) :
        Log.d(DEBUG_TAG,"Action was MOVE");
        return true;
    case (MotionEvent.ACTION_UP) :
        Log.d(DEBUG_TAG,"Action was UP");
        return true;
    case (MotionEvent.ACTION_CANCEL) :
        Log.d(DEBUG_TAG,"Action was CANCEL");
        return true;
    case (MotionEvent.ACTION_OUTSIDE) :
        Log.d(DEBUG_TAG,"Movement occurred outside bounds " +
                "of current screen element");
        return true;
    default :
        return super.onTouchEvent(event);
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.