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


Java KeyEvent.isCanceled方法代碼示例

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


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

示例1: onKeyPreIme

import android.view.KeyEvent; //導入方法依賴的package包/類
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
    if (keyCode == 4) {
        DispatcherState state;
        if (event.getAction() == 0 && event.getRepeatCount() == 0) {
            state = getKeyDispatcherState();
            if (state == null) {
                return true;
            }
            state.startTracking(event, this);
            return true;
        } else if (event.getAction() == 1) {
            state = getKeyDispatcherState();
            if (state != null) {
                state.handleUpEvent(event);
            }
            if (event.isTracking() && !event.isCanceled()) {
                this.mSearchView.clearFocus();
                this.mSearchView.setImeVisibility(false);
                return true;
            }
        }
    }
    return super.onKeyPreIme(keyCode, event);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:25,代碼來源:SearchView.java

示例2: dispatchKeyEvent

import android.view.KeyEvent; //導入方法依賴的package包/類
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // To intercept hardware key, a view must have focus.
    if (mDelegate == null) return super.dispatchKeyEvent(event);

    if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
        KeyEvent.DispatcherState state = getKeyDispatcherState();
        if (state != null) {
            if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
                state.startTracking(event, this);
                return true;
            } else if (event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()
                    && state.isTracking(event)) {
                onBackPressed();
                return true;
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:22,代碼來源:BookmarkSearchView.java

示例3: onKey

import android.view.KeyEvent; //導入方法依賴的package包/類
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    if (mPopup == null || mPopup.getListView() == null) return false;

    if (event.getKeyCode() == KeyEvent.KEYCODE_MENU) {
        if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
            event.startTracking();
            v.getKeyDispatcherState().startTracking(event, this);
            return true;
        } else if (event.getAction() == KeyEvent.ACTION_UP) {
            v.getKeyDispatcherState().handleUpEvent(event);
            if (event.isTracking() && !event.isCanceled()) {
                dismiss();
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:20,代碼來源:AppMenu.java

示例4: onKey

import android.view.KeyEvent; //導入方法依賴的package包/類
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
            // Tell the framework to start tracking this event.
            getKeyDispatcherState().startTracking(event, this);
            return true;
        } else if (event.getAction() == KeyEvent.ACTION_UP) {
            getKeyDispatcherState().handleUpEvent(event);
            if (event.isTracking() && !event.isCanceled()) {
                mFindToolbar.deactivate();
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:18,代碼來源:FindToolbar.java

示例5: onKeyUp

import android.view.KeyEvent; //導入方法依賴的package包/類
public void onKeyUp(@Nonnull final KeyEvent keyEvent) {
    if (DEBUG) {
        Log.d(TAG, "EmojiHotKeys.onKeyUp() - " + mName + " - considering " + keyEvent);
    }

    final int keyCode = keyEvent.getKeyCode();
    int metaState = keyEvent.getMetaState();
    if (KeyEvent.isModifierKey(keyCode)) {
         // Try restoring meta stat in case the released key was a modifier.
         // I am sure one can come up with scenarios to break this, but it
         // seems to work well in practice.
         metaState |= mMetaState;
    }

    final Pair<Integer, Integer> key = Pair.create(keyCode, metaState);
    if (mKeySet.contains(key)) {
        if (mCanFire) {
            if (!keyEvent.isCanceled()) {
                if (DEBUG) {
                    Log.d(TAG, "EmojiHotKeys.onKeyUp() - " + mName + " - firing action");
                }
                action();
            } else {
                // This key up event was a part of key combinations and
                // should be ignored.
                if (DEBUG) {
                    Log.d(TAG, "EmojiHotKeys.onKeyUp() - " + mName + " - canceled, ignoring action");
                }
            }
            mCanFire = false;
        }
    }

    if (mCanFire) {
        if (DEBUG) {
            Log.d(TAG, "EmojiHotKeys.onKeyUp() - " + mName + " - disabling action");
        }
        mCanFire = false;
    }
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:41,代碼來源:EmojiAltPhysicalKeyDetector.java

示例6: dispatchKeyEvent

import android.view.KeyEvent; //導入方法依賴的package包/類
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_BACK:
                mBackDown = true;
                return true;
            case KeyEvent.KEYCODE_HOME:
                mHomeDown = true;
                return true;
        }
    } else if (event.getAction() == KeyEvent.ACTION_UP) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_BACK:
                if (!event.isCanceled()) {
                    // Do BACK behavior.
                }
                mBackDown = true;
                return true;
            case KeyEvent.KEYCODE_HOME:
                if (!event.isCanceled()) {
                    // Do HOME behavior.
                }
                mHomeDown = true;
                return true;
        }
    }

    return super.dispatchKeyEvent(event);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:31,代碼來源:Home.java

示例7: onKeyUp

import android.view.KeyEvent; //導入方法依賴的package包/類
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() && !event.isCanceled()) {
        if (getScale() > 1.0f) {
            // If we're zoomed in, pressing Back jumps out to show the
            // entire image, otherwise Back returns the user to the gallery
            zoomTo(1.0f);
            return true;
        }
    }
    return super.onKeyUp(keyCode, event);
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:13,代碼來源:ImageViewTouchBase.java

示例8: onKey

import android.view.KeyEvent; //導入方法依賴的package包/類
/**
 * Resets image on {@literal KeyEvent.KEYCODE_BACK} to normal scale if needed, otherwise - hide the viewer.
 */
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK &&
            event.getAction() == KeyEvent.ACTION_UP &&
            !event.isCanceled()) {
        if (viewer.isScaled()) {
            viewer.resetScale();
        } else {
            dialog.cancel();
        }
    }
    return true;
}
 
開發者ID:achenglike,項目名稱:imageviewer,代碼行數:17,代碼來源:ImageViewer.java

示例9: onKeyUp

import android.view.KeyEvent; //導入方法依賴的package包/類
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (mFragmentContext.getApplicationInfo().targetSdkVersion
            >= Build.VERSION_CODES.ECLAIR) {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
                && !event.isCanceled()) {
            mMasterFragment.onBackPressed();
            return true;
        }
    }
    return false;
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:12,代碼來源:MasterFragmentDelegate.java

示例10: onKeyUp

import android.view.KeyEvent; //導入方法依賴的package包/類
/**
 * Called when a key was released and not handled by any of the views
 * inside of the activity. So, for example, key presses while the cursor
 * is inside a TextView will not trigger the event (unless it is a navigation
 * to another object) because TextView handles its own key presses.
 *
 * <p>The default implementation handles KEYCODE_BACK to stop the activity
 * and go back.
 *
 * @return Return <code>true</code> to prevent this event from being propagated
 * further, or <code>false</code> to indicate that you have not handled
 * this event and it should continue to be propagated.
 * @see #onKeyDown
 * @see KeyEvent
 */
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (getApplicationInfo().targetSdkVersion
            >= Build.VERSION_CODES.ECLAIR) {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
                && !event.isCanceled()) {
            onBackPressed();
            return true;
        }
    }
    return false;
}
 
開發者ID:JessYanCoding,項目名稱:ProgressManager,代碼行數:27,代碼來源:a.java


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