本文整理匯總了Java中android.view.TouchDelegate.onTouchEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java TouchDelegate.onTouchEvent方法的具體用法?Java TouchDelegate.onTouchEvent怎麽用?Java TouchDelegate.onTouchEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.TouchDelegate
的用法示例。
在下文中一共展示了TouchDelegate.onTouchEvent方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
if (!mEnabled) return false;
TouchDelegate delegate = null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
for (int i = 0; i < mTouchDelegates.size(); i++) {
TouchDelegate touchDelegate = mTouchDelegates.get(i);
if (touchDelegate.onTouchEvent(event)) {
mCurrentTouchDelegate = touchDelegate;
return true;
}
}
break;
case MotionEvent.ACTION_MOVE:
delegate = mCurrentTouchDelegate;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
delegate = mCurrentTouchDelegate;
mCurrentTouchDelegate = null;
break;
default: // Do Nothing
break;
}
return delegate != null && delegate.onTouchEvent(event);
}
示例2: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
if (!mEnabled) return false;
TouchDelegate delegate = null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
for (int i = 0; i < mTouchDelegates.size(); i++) {
TouchDelegate touchDelegate = mTouchDelegates.get(i);
if (touchDelegate.onTouchEvent(event)) {
mCurrentTouchDelegate = touchDelegate;
return true;
}
}
break;
case MotionEvent.ACTION_MOVE:
delegate = mCurrentTouchDelegate;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
delegate = mCurrentTouchDelegate;
mCurrentTouchDelegate = null;
break;
}
return delegate != null && delegate.onTouchEvent(event);
}
示例3: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
if (!mEnabled) return false;
TouchDelegate delegate = null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
for (int i = 0; i < mTouchDelegates.size(); i++) {
TouchDelegate touchDelegate = mTouchDelegates.get(i);
if (touchDelegate.onTouchEvent(event)) {
mCurrentTouchDelegate = touchDelegate;
return true;
}
}
break;
case MotionEvent.ACTION_MOVE:
delegate = mCurrentTouchDelegate;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
delegate = mCurrentTouchDelegate;
mCurrentTouchDelegate = null;
break;
}
return delegate != null && delegate.onTouchEvent(event);
}
示例4: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(MotionEvent event) {
TouchDelegate delegate = null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (mTouchDelegates != null) {
for (TouchDelegate touchDelegate : mTouchDelegates) {
if (touchDelegate != null) {
if (touchDelegate.onTouchEvent(event)) {
mCurrentTouchDelegate = touchDelegate;
return true;
}
}
}
}
break;
case MotionEvent.ACTION_MOVE:
delegate = mCurrentTouchDelegate;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
delegate = mCurrentTouchDelegate;
mCurrentTouchDelegate = null;
break;
default:
break;
}
return delegate == null ? false : delegate.onTouchEvent(event);
}
示例5: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean res = false;
float x = event.getX();
float y = event.getY();
for (TouchDelegate delegate : delegates) {
event.setLocation(x, y);
res = delegate.onTouchEvent(event) || res;
}
return res;
}
示例6: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(MotionEvent event) {
// Go through the list and see if any of the delegates could claim this event.
// Note: Assumes non-overlapping touchDelegates.
boolean result = false;
// Check against all the touchDelegates in the list -- this could be an
// ACTION_MOVE or ACTION_UP that impacts a view that isn't at the (x,y) of an event.
for (TouchDelegate touchDelegate : mDelegateList) {
result = touchDelegate.onTouchEvent(event) || result;
}
return result;
}
示例7: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
if (!mEnabled) {
return false;
}
TouchDelegate delegate = null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
for (int i = 0; i < mTouchDelegates.size(); i++) {
TouchDelegate touchDelegate = mTouchDelegates.get(i);
if (touchDelegate.onTouchEvent(event)) {
mCurrentTouchDelegate = touchDelegate;
return true;
}
}
break;
case MotionEvent.ACTION_MOVE:
delegate = mCurrentTouchDelegate;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
delegate = mCurrentTouchDelegate;
mCurrentTouchDelegate = null;
break;
}
return delegate != null && delegate.onTouchEvent(event);
}
示例8: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
public final boolean onTouchEvent(MotionEvent paramMotionEvent)
{
int i = paramMotionEvent.getActionMasked();
boolean bool1;
if (i == 0) {
if (paramMotionEvent.getPointerCount() > 1) {
bool1 = false;
}
}
for (;;)
{
return bool1;
int j = 0;
int k = this.mTouchDelegates.size();
while (j < k)
{
TouchDelegate localTouchDelegate = (TouchDelegate)this.mTouchDelegates.valueAt(j);
float f1 = paramMotionEvent.getX();
float f2 = paramMotionEvent.getY();
boolean bool2 = localTouchDelegate.onTouchEvent(paramMotionEvent);
paramMotionEvent.setLocation(f1, f2);
if (bool2)
{
this.mCurrentTouchDelegate = localTouchDelegate;
return true;
}
j++;
}
return false;
if ((this.mCurrentTouchDelegate != null) && (this.mCurrentTouchDelegate.onTouchEvent(paramMotionEvent))) {}
for (bool1 = true; (i == 1) || (i == 32); bool1 = false)
{
this.mCurrentTouchDelegate = null;
return bool1;
}
}
}
示例9: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
if (!mEnabled) return false;
TouchDelegate delegate = null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
for (int i = 0; i < mTouchDelegates.size(); i++) {
TouchDelegate touchDelegate = mTouchDelegates.get(i);
if (touchDelegate.onTouchEvent(event)) {
mCurrentTouchDelegate = touchDelegate;
return true;
}
}
break;
case MotionEvent.ACTION_MOVE:
delegate = mCurrentTouchDelegate;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
delegate = mCurrentTouchDelegate;
mCurrentTouchDelegate = null;
break;
}
return delegate != null && delegate.onTouchEvent(event);
}
示例10: onTouchEvent
import android.view.TouchDelegate; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(MotionEvent event) {
TouchDelegate delegate = null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (mTouchDelegates != null) {
for (TouchDelegate touchDelegate : mTouchDelegates) {
if (touchDelegate != null) {
if (touchDelegate.onTouchEvent(event)) {
mCurrentTouchDelegate = touchDelegate;
return true;
}
}
}
}
break;
case MotionEvent.ACTION_MOVE:
delegate = mCurrentTouchDelegate;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
delegate = mCurrentTouchDelegate;
mCurrentTouchDelegate = null;
break;
}
return delegate == null ? false : delegate.onTouchEvent(event);
}