當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyEventCompat.hasModifiers方法代碼示例

本文整理匯總了Java中android.support.v4.view.KeyEventCompat.hasModifiers方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyEventCompat.hasModifiers方法的具體用法?Java KeyEventCompat.hasModifiers怎麽用?Java KeyEventCompat.hasModifiers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.view.KeyEventCompat的用法示例。


在下文中一共展示了KeyEventCompat.hasModifiers方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                handled = arrowScroll(FOCUS_LEFT);
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                handled = arrowScroll(FOCUS_RIGHT);
                break;
            case KeyEvent.KEYCODE_TAB:
                if (Build.VERSION.SDK_INT >= 11) {
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
                    if (KeyEventCompat.hasNoModifiers(event)) {
                        handled = arrowScroll(FOCUS_FORWARD);
                    } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
                }
                break;
        }
    }
    return handled;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:34,代碼來源:DirectionalViewpager.java

示例2: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * 執行按鍵響應事件
 */
public boolean executeKeyEvent(KeyEvent event) {
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                handled = arrowScroll(FOCUS_LEFT);
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                handled = arrowScroll(FOCUS_RIGHT);
                break;
            case KeyEvent.KEYCODE_TAB:
                if (Build.VERSION.SDK_INT >= 11) {
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
                    if (KeyEventCompat.hasNoModifiers(event)) {
                        handled = arrowScroll(FOCUS_FORWARD);
                    } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
                }
                break;
        }
    }
    return handled;
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:29,代碼來源:CustomViewAbove.java

示例3: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
	boolean handled = false;
	if (event.getAction() == KeyEvent.ACTION_DOWN) {
		switch (event.getKeyCode()) {
		case KeyEvent.KEYCODE_DPAD_LEFT:
			handled = arrowScroll(FOCUS_LEFT);
			break;
		case KeyEvent.KEYCODE_DPAD_RIGHT:
			handled = arrowScroll(FOCUS_RIGHT);
			break;
		case KeyEvent.KEYCODE_TAB:
			if (Build.VERSION.SDK_INT >= 11) {
				// The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
				// before Android 3.0. Ignore the tab key on those devices.
				if (KeyEventCompat.hasNoModifiers(event)) {
					handled = arrowScroll(FOCUS_FORWARD);
				} else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
					handled = arrowScroll(FOCUS_BACKWARD);
				}
			}
			break;
		}
	}
	return handled;
}
 
開發者ID:6ag,項目名稱:LiuAGeAndroid,代碼行數:34,代碼來源:CustomViewAbove.java

示例4: dispatchKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
public boolean dispatchKeyEvent(KeyEvent event) {
    if (event.getKeyCode() == 19) {
        int action = event.getAction();
        if (action == 0) {
            if (KeyEventCompat.hasModifiers(event, 2)) {
                ActionBar actionBar = getSupportActionBar();
                if (actionBar != null && actionBar.isShowing() && actionBar.requestFocus()) {
                    this.mEatKeyUpEvent = true;
                    return true;
                }
            }
        } else if (action == 1 && this.mEatKeyUpEvent) {
            this.mEatKeyUpEvent = false;
            return true;
        }
    }
    return super.dispatchKeyEvent(event);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:19,代碼來源:AppCompatActivity.java

示例5: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
  boolean handled = false;
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
    switch (event.getKeyCode()) {
      case KeyEvent.KEYCODE_DPAD_LEFT:
        handled = arrowScroll(FOCUS_LEFT);
        break;
      case KeyEvent.KEYCODE_DPAD_RIGHT:
        handled = arrowScroll(FOCUS_RIGHT);
        break;
      case KeyEvent.KEYCODE_TAB:
        if (Build.VERSION.SDK_INT >= 11) {
          // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
          // before Android 3.0. Ignore the tab key on those devices.
          if (KeyEventCompat.hasNoModifiers(event)) {
            handled = arrowScroll(FOCUS_FORWARD);
          } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
            handled = arrowScroll(FOCUS_BACKWARD);
          }
        }
        break;
    }
  }
  return handled;
}
 
開發者ID:smuyyh,項目名稱:SprintNBA,代碼行數:34,代碼來源:VerticalViewPager.java

示例6: handleKeyScroll

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
private boolean handleKeyScroll(KeyEvent event, int count, int direction) {
    boolean handled = false;

    if (KeyEventCompat.hasNoModifiers(event)) {
        handled = resurrectSelectionIfNeeded();
        if (!handled) {
            while (count-- > 0) {
                if (arrowScroll(direction)) {
                    handled = true;
                } else {
                    break;
                }
            }
        }
    } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_ALT_ON)) {
        handled = resurrectSelectionIfNeeded() || fullScroll(direction);
    }

    return handled;
}
 
開發者ID:Garyzx,項目名稱:Android-MuPDF_as,代碼行數:21,代碼來源:TwoWayView.java

示例7: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * ִ�а�����Ӧ�¼�
 */
public boolean executeKeyEvent(KeyEvent event) {
	boolean handled = false;
	if (event.getAction() == KeyEvent.ACTION_DOWN) {
		switch (event.getKeyCode()) {
		case KeyEvent.KEYCODE_DPAD_LEFT:
			handled = arrowScroll(FOCUS_LEFT);
			break;
		case KeyEvent.KEYCODE_DPAD_RIGHT:
			handled = arrowScroll(FOCUS_RIGHT);
			break;
		case KeyEvent.KEYCODE_TAB:
			if (Build.VERSION.SDK_INT >= 11) {
				// The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
				// before Android 3.0. Ignore the tab key on those devices.
				if (KeyEventCompat.hasNoModifiers(event)) {
					handled = arrowScroll(FOCUS_FORWARD);
				} else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
					handled = arrowScroll(FOCUS_BACKWARD);
				}
			}
			break;
		}
	}
	return handled;
}
 
開發者ID:YeXiaoChao,項目名稱:slidingmenu_library,代碼行數:29,代碼來源:CustomViewAbove.java

示例8: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event
 *            The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
	boolean handled = false;
	if (event.getAction() == KeyEvent.ACTION_DOWN) {
		switch (event.getKeyCode()) {
			case KeyEvent.KEYCODE_DPAD_LEFT:
				handled = arrowScroll(FOCUS_LEFT);
				break;
			case KeyEvent.KEYCODE_DPAD_RIGHT:
				handled = arrowScroll(FOCUS_RIGHT);
				break;
			case KeyEvent.KEYCODE_TAB:
				if (Build.VERSION.SDK_INT >= 11) {
					// The focus finder had a bug handling FOCUS_FORWARD and
					// FOCUS_BACKWARD
					// before Android 3.0. Ignore the tab key on those
					// devices.
					if (KeyEventCompat.hasNoModifiers(event)) {
						handled = arrowScroll(FOCUS_FORWARD);
					} else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
						handled = arrowScroll(FOCUS_BACKWARD);
					}
				}
				break;
		}
	}
	return handled;
}
 
開發者ID:fengshihao,項目名稱:WebPager,代碼行數:37,代碼來源:CustomViewPager.java

示例9: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event)
{
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN)
    {
        switch (event.getKeyCode())
        {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                handled = arrowScroll(FOCUS_LEFT);
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                handled = arrowScroll(FOCUS_RIGHT);
                break;
            case KeyEvent.KEYCODE_TAB:
                if (Build.VERSION.SDK_INT >= 11)
                {
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
                    if (KeyEventCompat.hasNoModifiers(event))
                    {
                        handled = arrowScroll(FOCUS_FORWARD);
                    }
                    else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON))
                    {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
                }
                break;
        }
    }
    return handled;
}
 
開發者ID:HueToYou,項目名稱:ChatExchange-old,代碼行數:41,代碼來源:CustomViewAbove.java

示例10: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                if (DEBUG) Log.d(TAG, "======executeKeyEvent is KEYCODE_DPAD_LEFT");
                if (isOrientationHorizontal())
                    handled = arrowScroll(FOCUS_LEFT);
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if (DEBUG) Log.d(TAG, "======executeKeyEvent is KEYCODE_DPAD_RIGHT");
                if (isOrientationHorizontal())
                    handled = arrowScroll(FOCUS_RIGHT);
                break;
            case KeyEvent.KEYCODE_DPAD_UP:
                if (DEBUG) Log.d(TAG, "======executeKeyEvent is KEYCODE_DPAD_UP");
                if (!isOrientationHorizontal())
                    handled = arrowScroll(FOCUS_UP);
                break;
            case KeyEvent.KEYCODE_DPAD_DOWN:
                if (DEBUG) Log.d(TAG, "======executeKeyEvent is KEYCODE_DPAD_DOWN");
                if (!isOrientationHorizontal())
                    handled = arrowScroll(FOCUS_DOWN);
                break;
            case KeyEvent.KEYCODE_TAB:
                if (Build.VERSION.SDK_INT >= 11) {
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
                    if (KeyEventCompat.hasNoModifiers(event)) {
                        handled = arrowScroll(FOCUS_FORWARD);
                    } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
                }
                break;
        }
    }
    return handled;
}
 
開發者ID:m4coding,項目名稱:Orientation-ViewPager,代碼行數:48,代碼來源:OrientationViewPager.java

示例11: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                handled = arrowScroll(FOCUS_LEFT);
                break;
            case KeyEvent.KEYCODE_DPAD_UP:
                handled = arrowScroll(FOCUS_UP);
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                handled = arrowScroll(FOCUS_RIGHT);
                break;
            case KeyEvent.KEYCODE_DPAD_DOWN:
                handled = arrowScroll(FOCUS_DOWN);
                break;
            case KeyEvent.KEYCODE_TAB:
                if (Build.VERSION.SDK_INT >= 11) {
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
                    if (KeyEventCompat.hasNoModifiers(event)) {
                        handled = arrowScroll(FOCUS_FORWARD);
                    } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
                }
                break;
        }
    }
    return handled;
}
 
開發者ID:miku-nyan,項目名稱:Overchan-Android,代碼行數:40,代碼來源:VerticalViewPager.java

示例12: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 * 
 * @param event
 *            The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
	boolean handled = false;
	if (event.getAction() == KeyEvent.ACTION_DOWN) {
		switch (event.getKeyCode()) {
		case KeyEvent.KEYCODE_DPAD_LEFT:
			handled = arrowScroll(FOCUS_LEFT);
			break;
		case KeyEvent.KEYCODE_DPAD_RIGHT:
			handled = arrowScroll(FOCUS_RIGHT);
			break;
		case KeyEvent.KEYCODE_TAB:
			if (Build.VERSION.SDK_INT >= 11) {
				// The focus finder had a bug handling FOCUS_FORWARD and
				// FOCUS_BACKWARD
				// before Android 3.0. Ignore the tab key on those devices.
				if (KeyEventCompat.hasNoModifiers(event)) {
					handled = arrowScroll(FOCUS_FORWARD);
				} else if (KeyEventCompat.hasModifiers(event,
						KeyEvent.META_SHIFT_ON)) {
					handled = arrowScroll(FOCUS_BACKWARD);
				}
			}
			break;
		}
	}
	return handled;
}
 
開發者ID:Mr-wangyong,項目名稱:slidingMenu,代碼行數:37,代碼來源:CustomViewAbove.java

示例13: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                if (isOrientationHorizontal())
                    handled = arrowScroll(FOCUS_LEFT);
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if (isOrientationHorizontal())
                    handled = arrowScroll(FOCUS_RIGHT);
                break;
            case KeyEvent.KEYCODE_DPAD_UP:
                if (!isOrientationHorizontal())
                    handled = arrowScroll(FOCUS_UP);
                break;
            case KeyEvent.KEYCODE_DPAD_DOWN:
                if (!isOrientationHorizontal())
                    handled = arrowScroll(FOCUS_DOWN);
                break;
            case KeyEvent.KEYCODE_TAB:
                if (Build.VERSION.SDK_INT >= 11) {
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
                    if (KeyEventCompat.hasNoModifiers(event)) {
                        handled = arrowScroll(FOCUS_FORWARD);
                    } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
                }
                break;
        }
    }
    return handled;
}
 
開發者ID:FolioReader,項目名稱:FolioReader-Android,代碼行數:44,代碼來源:ViewPager.java

示例14: executeKeyEvent

import android.support.v4.view.KeyEventCompat; //導入方法依賴的package包/類
/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 * 
 * @param event
 *            The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
	boolean handled = false;
	if (event.getAction() == KeyEvent.ACTION_DOWN) {
		switch (event.getKeyCode()) {
		case KeyEvent.KEYCODE_DPAD_LEFT:
			handled = arrowScroll(FOCUS_LEFT);
			break;
		case KeyEvent.KEYCODE_DPAD_RIGHT:
			handled = arrowScroll(FOCUS_RIGHT);
			break;
		case KeyEvent.KEYCODE_TAB:
			if (Build.VERSION.SDK_INT >= 11) {
				// The focus finder had a bug handling FOCUS_FORWARD and
				// FOCUS_BACKWARD
				// before Android 3.0. Ignore the tab key on those
				// devices.
				if (KeyEventCompat.hasNoModifiers(event)) {
					handled = arrowScroll(FOCUS_FORWARD);
				} else if (KeyEventCompat.hasModifiers(event,
						KeyEvent.META_SHIFT_ON)) {
					handled = arrowScroll(FOCUS_BACKWARD);
				}
			}
			break;
		}
	}
	return handled;
}
 
開發者ID:lnfscj,項目名稱:webbroserBaiDu,代碼行數:38,代碼來源:SlidingCard.java


注:本文中的android.support.v4.view.KeyEventCompat.hasModifiers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。