有没有办法了解用户是在主屏幕上单击应用程序的图标还是只是单击桌面?
在开发动态壁纸期间,我重写了该onTouchEvent
功能
@Override
public void onTouchEvent(MotionEvent event) {
int action = event.getAction();
float currentXPosition = event.getX();
float currentYPosition = event.getY();
Log.d(Constants.TAG_DISPLAY, "Action = " + action);
Log.d(Constants.TAG_DISPLAY, "X = " + currentXPosition + "Y = " + currentYPosition);
if (action == MotionEvent.ACTION_UP) {
Log.d(Constants.TAG_DISPLAY, "FIRE Action, drawframe");
pos[0] = Math.round(currentXPosition) + 150;
pos[1] = Math.round(currentYPosition) - 50;
drawFrame(true, true);
}
super.onTouchEvent(event);
}
为了刷新壁纸。但是如果用户正在打开应用程序,我不想刷新它。从事件或超级动作,可以确定用户动作吗?