java类android.text.method.TextKeyListener的实例源码

Launcher.java 文件源码 项目:LaunchEnr 阅读 28 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
AllAppsContainerView.java 文件源码 项目:LaunchEnr 阅读 32 收藏 0 点赞 0 评论 0
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
Launcher.java 文件源码 项目:FlickLauncher 阅读 26 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
AllAppsContainerView.java 文件源码 项目:FlickLauncher 阅读 31 收藏 0 点赞 0 评论 0
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
Launcher.java 文件源码 项目:SimpleUILauncher 阅读 23 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
AllAppsContainerView.java 文件源码 项目:SimpleUILauncher 阅读 34 收藏 0 点赞 0 评论 0
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
Launcher.java 文件源码 项目:SimplOS 阅读 27 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
AllAppsContainerView.java 文件源码 项目:SimplOS 阅读 33 收藏 0 点赞 0 评论 0
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
Launcher.java 文件源码 项目:Trebuchet 阅读 25 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
AllAppsContainerView.java 文件源码 项目:Trebuchet 阅读 34 收藏 0 点赞 0 评论 0
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (mSearchBarController != null &&
            !mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
function_settings.java 文件源码 项目:EngineDriver 阅读 16 收藏 0 点赞 0 评论 0
void move_settings_to_view() {
    ViewGroup t = (ViewGroup) findViewById(R.id.label_func_table); //table
    //loop thru input rows, skipping first (headings)
    int ndx = 0;
    for (int i = 1; i < t.getChildCount(); i++) {
        ViewGroup r = (ViewGroup) t.getChildAt(i);
        //move to next non-blank array entry if it exists
        while (ndx < aFnc.size() && aLbl.get(ndx).length() == 0)
            ndx++;
        if (ndx < aFnc.size()) {
            ((EditText) r.getChildAt(0)).setText(aLbl.get(ndx));
            ((EditText) r.getChildAt(1)).setText(aFnc.get(ndx).toString());
            ndx++;
        } else {
            //          
            // work around for known EditText bug - see http://code.google.com/p/android/issues/detail?id=17508
            //          ((EditText)r.getChildAt(0)).setText("");
            //          ((EditText)r.getChildAt(1)).setText("");
            TextKeyListener.clear(((EditText) r.getChildAt(0)).getText());
            TextKeyListener.clear(((EditText) r.getChildAt(1)).getText());
        }
    }
}
Launcher.java 文件源码 项目:TurboLauncher 阅读 26 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0
            && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(
                mWorkspace, mDefaultKeySsb, keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {

            return onSearchRequested();
        }
    }

    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
Launcher.java 文件源码 项目:FLauncher 阅读 29 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
AllAppsContainerView.java 文件源码 项目:FLauncher 阅读 29 收藏 0 点赞 0 评论 0
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
Launcher.java 文件源码 项目:LB-Launcher 阅读 30 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
Launcher.java 文件源码 项目:androidProject 阅读 24 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
Launcher.java 文件源码 项目:open-gel-plus 阅读 28 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
KeyboardKeyListener.java 文件源码 项目:BluetoothHidEmu 阅读 21 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) {
    switch (keyCode) {

    case KeyEvent.KEYCODE_ENTER:
        TextKeyListener.clear(content);
        mHidPayload.assemblePayload(HidKeyPair.ENTER);
        mSocketManager.sendPayload(mHidPayload);
        return true;
    case KeyEvent.KEYCODE_DEL:
        mHidPayload.assemblePayload(HidKeyPair.DEL);
        mSocketManager.sendPayload(mHidPayload);
    case KeyEvent.KEYCODE_VOLUME_UP:
    case KeyEvent.KEYCODE_VOLUME_DOWN:
        mHidPayload.assemblePayload(keyCode);
        mSocketManager.sendPayload(mHidPayload);
    default:
        return mTextKeyListener.onKeyDown(view, content, keyCode, event);
    }
}
Launcher.java 文件源码 项目:LaunchEnr 阅读 59 收藏 0 点赞 0 评论 0
@Override
public void onDestroy() {
    super.onDestroy();

    mWorkspace.removeCallbacks(mBuildLayersRunnable);
    mWorkspace.removeFolderListeners();

    // Stop callbacks from LauncherModel
    // It's possible to receive onDestroy after a new Launcher activity has
    // been created. In this case, don't interfere with the new Launcher.
    if (mModel.isCurrentCallbacks(this)) {
        mModel.stopLoader();
        LauncherAppState.getInstance(this).setLauncher(null);
    }

    if (mRotationPrefChangeHandler != null) {
        mSharedPrefs.unregisterOnSharedPreferenceChangeListener(mRotationPrefChangeHandler);
    }

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        ex.printStackTrace();
    }
    mAppWidgetHost = null;

    TextKeyListener.getInstance().release();

    ((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE))
            .removeAccessibilityStateChangeListener(this);

    LauncherAnimUtils.onDestroyActivity();

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onDestroy();
    }
}
JotaTextKeyListener.java 文件源码 项目:JotaTextEditor 阅读 19 收藏 0 点赞 0 评论 0
public static TextKeyListener getInstance(boolean autotext, Capitalize cap) {
    int off = cap.ordinal() * 2 + (autotext ? 1 : 0);

    if (sInstance[off] == null) {
        sInstance[off] = new JotaTextKeyListener(cap, autotext);
    }

    return sInstance[off];
}
CustomSearchBar.java 文件源码 项目:AbroadEasy 阅读 20 收藏 0 点赞 0 评论 0
public void cancelSearch() {
    hideInputPannel();
    post(new Runnable() {
        @Override
        public void run() {
            if (mListener != null) {
                mListener.cancelSearch();
            }
        }
    });
    TextKeyListener.clear(mSearchEdit.getText());
    mIsSearchMode = false;
}
Launcher.java 文件源码 项目:androidProject 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);

    // Stop callbacks from LauncherModel
    LauncherApplication app = ((LauncherApplication) getApplication());
    mModel.stopLoader();
    app.setLauncher(null);

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();


    unbindWorkspaceAndHotseatItems();

    getContentResolver().unregisterContentObserver(mWidgetObserver);
    unregisterReceiver(mCloseSystemDialogsReceiver);

    ((ViewGroup) mWorkspace.getParent()).removeAllViews();
    mWorkspace.removeAllViews();
    mWorkspace = null;
    mDragController = null;

    ValueAnimator.clearAllAnimations();
}
Launcher.java 文件源码 项目:fruit.launcher 阅读 27 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {             
    if (isWorkspaceLocked())
        return true;

    boolean handled = super.onKeyDown(keyCode, event);
    if (!handled && acceptFilter() && keyCode != KeyEvent.KEYCODE_ENTER) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(
                mWorkspace, mDefaultKeySsb, keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog
            // takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    if (keyCode == KeyEvent.KEYCODE_BACK && mThumbnailWorkspace.isVisible()) {
        int currPageIndex = ((CellLayout) mWorkspace.getChildAt(mWorkspace.getCurrentScreen())).getPageIndex();
           mThumbnailWorkspace.setmCurSelectedScreenIndex(currPageIndex);
        closeThumbnailWorkspace(true);
        return true;
    }
    return handled;
}
Launcher.java 文件源码 项目:fruit.launcher 阅读 34 收藏 0 点赞 0 评论 0
@Override
    public void onDestroy() {
        super.onDestroy();

        Log.d(TAG,"launcherseq,onDestroy");

        try {
            mAppWidgetHost.stopListening();
        } catch (NullPointerException ex) {
            Log.w(TAG,
                    "problem while stopping AppWidgetHost during Launcher destruction",
                    ex);
        }

        TextKeyListener.getInstance().release();

        mThemeMgr.stopListener();
        mModel.stopLoader();

        mPhoneMonitor.removeAllCallback();
        mMssMonitor.removeAllCallback();

        unbindDesktopItems();

        getSharedPreferences(SettingUtils.LAUNCHER_SETTINGS_NAME, 0)
                .unregisterOnSharedPreferenceChangeListener(mSPChangeListener);

        getContentResolver().unregisterContentObserver(mWidgetObserver);

        unregisterReceiver(mCloseSystemDialogsReceiver);
        unregisterReceiver(mScreenConfigReceiver);
//      unregisterReceiver(mSCReceiver);
    }
StringWidget.java 文件源码 项目:sagesmobile-mCollect 阅读 28 收藏 0 点赞 0 评论 0
protected StringWidget(Context context, FormEntryPrompt prompt, boolean derived) {
    super(context, prompt);
    mAnswer = new EditText(context);
    mAnswer.setId(QuestionWidget.newUniqueId());
    mReadOnly = prompt.isReadOnly();

    mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize);

    TableLayout.LayoutParams params = new TableLayout.LayoutParams();
    params.setMargins(7, 5, 7, 5);
    mAnswer.setLayoutParams(params);

    // capitalize the first letter of the sentence
    mAnswer.setKeyListener(new TextKeyListener(Capitalize.SENTENCES, false));

    // needed to make long read only text scroll
    mAnswer.setHorizontallyScrolling(false);
    mAnswer.setSingleLine(false);

    String s = prompt.getAnswerText();
    if (s != null) {
        mAnswer.setText(s);
    }

    if (mReadOnly) {
        mAnswer.setBackgroundDrawable(null);
        mAnswer.setFocusable(false);
        mAnswer.setClickable(false);
    }

    addView(mAnswer);
}
Launcher.java 文件源码 项目:Fairphone 阅读 24 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0
            && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(
                mWorkspace, mDefaultKeySsb, keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog
            // takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
Launcher.java 文件源码 项目:Fairphone---DEPRECATED 阅读 23 收藏 0 点赞 0 评论 0
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0
            && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(
                mWorkspace, mDefaultKeySsb, keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog
            // takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
PostActivity.java 文件源码 项目:Onosendai 阅读 32 收藏 0 点赞 0 评论 0
public void setupAutoComplete () {
    if (this.txtBody.getAdapter() != null) return;
    this.txtBody.setThreshold(1);
    this.txtBody.setTokenizer(new UsernameTokenizer());
    this.txtBody.setAdapter(new UsernameSearchAdapter(this));
    this.txtBody.addTextChangedListener(new PopupPositioniner(this.txtBody));
    this.txtBody.setKeyListener(TextKeyListener.getInstance(true, TextKeyListener.Capitalize.SENTENCES));
}
PropertyEdit.java 文件源码 项目:MyFlightbookAndroid 阅读 16 收藏 0 点赞 0 评论 0
private void UpdateForProperty() {
    UpdateLabelTypefaceForProperty();
    CustomPropertyType.CFPPropertyType cptType = m_fp.getType();
    Boolean fIsBasicDecimal = cptType == CustomPropertyType.CFPPropertyType.cfpDecimal && (m_fp.CustomPropertyType().cptFlag & 0x00200000) != 0;

    m_tvLabel.setVisibility(VISIBLE);
    m_txtStringVal.setVisibility(GONE);
    m_txtNumericField.setVisibility(GONE);
    m_ck.setVisibility(GONE);
    m_tvDate.setVisibility(GONE);

    switch (cptType) {
        default:
            break;
        case cfpInteger:
            m_txtNumericField.setVisibility(VISIBLE);
            m_txtNumericField.setMode(DecimalEdit.EditMode.INTEGER);
            m_txtNumericField.setIntValue(m_fp.intValue);
            break;
        case cfpDecimal:
            m_txtNumericField.setVisibility(VISIBLE);
            m_txtNumericField.setMode(DecimalEdit.DefaultHHMM && !fIsBasicDecimal ? DecimalEdit.EditMode.HHMM : DecimalEdit.EditMode.DECIMAL);
            m_txtNumericField.setDoubleValue(m_fp.decValue);
            if (m_cfd != null)
                m_txtNumericField.setDelegate(m_cfd);
            break;
        case cfpCurrency:
            m_txtNumericField.setVisibility(VISIBLE);
            m_txtNumericField.setMode(DecimalEdit.EditMode.DECIMAL);
            m_txtNumericField.setDoubleValue(m_fp.decValue);
            break;
        case cfpString: {
            m_txtStringVal.setVisibility(VISIBLE);
            m_txtStringVal.setHint("");
            m_txtStringVal.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
                    | InputType.TYPE_CLASS_TEXT);
            m_txtStringVal.setKeyListener(TextKeyListener.getInstance());
            m_txtStringVal.setText(m_fp.toString());
            String[] rgPrevVals = m_fp.CustomPropertyType().PreviousValues;
            if (rgPrevVals != null && rgPrevVals.length > 0) {
                ArrayAdapter<String> adapter = new ArrayAdapter<>(
                        this.getContext(), android.R.layout.simple_list_item_1,
                        rgPrevVals);
                m_txtStringVal.setAdapter(adapter);
            }
            m_txtStringVal.setThreshold(1);
        }
            break;
        case cfpBoolean:
            m_ck.setVisibility(VISIBLE);
            m_tvLabel.setVisibility(GONE);
            break;
        case cfpDate:
            m_tvDate.setVisibility(VISIBLE);
            SetPropDate(m_fp.dateValue, false);
            break;
        case cfpDateTime:
            m_tvDate.setVisibility(VISIBLE);
            SetPropDate(m_fp.dateValue, true);
            break;
    }

    findViewById(R.id.imgFavorite).setVisibility(m_fIsPinned ? View.VISIBLE : View.INVISIBLE);
}
Launcher.java 文件源码 项目:FlickLauncher 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);
    mWorkspace.removeFolderListeners();
    if(mHomeWatcher != null) {
        mHomeWatcher.stopWatch();
    }

    // Stop callbacks from LauncherModel
    // It's possible to receive onDestroy after a new Launcher activity has
    // been created. In this case, don't interfere with the new Launcher.
    if (mModel.isCurrentCallbacks(this)) {
        mModel.stopLoader();
        LauncherAppState.getInstance().setLauncher(null);
    }

    if (mRotationPrefChangeHandler != null) {
        mSharedPrefs.unregisterOnSharedPreferenceChangeListener(mRotationPrefChangeHandler);
    }

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();

    ((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE))
            .removeAccessibilityStateChangeListener(this);

    unregisterReceiver(mUiBroadcastReceiver);

    LauncherAnimUtils.onDestroyActivity();

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onDestroy();
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号