当前位置: 首页>>代码示例>>Java>>正文


Java TextKeyListener类代码示例

本文整理汇总了Java中android.text.method.TextKeyListener的典型用法代码示例。如果您正苦于以下问题:Java TextKeyListener类的具体用法?Java TextKeyListener怎么用?Java TextKeyListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextKeyListener类属于android.text.method包,在下文中一共展示了TextKeyListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onKeyDown

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:27,代码来源:Launcher.java

示例2: dispatchKeyEvent

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:21,代码来源:AllAppsContainerView.java

示例3: dispatchKeyEvent

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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);
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:22,代码来源:AllAppsContainerView.java

示例4: move_settings_to_view

import android.text.method.TextKeyListener; //导入依赖的package包/类
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());
        }
    }
}
 
开发者ID:JMRI,项目名称:EngineDriver,代码行数:24,代码来源:function_settings.java

示例5: onKeyDown

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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;
}
 
开发者ID:Phonemetra,项目名称:TurboLauncher,代码行数:22,代码来源:Launcher.java

示例6: onKeyDown

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:andraus,项目名称:BluetoothHidEmu,代码行数:21,代码来源:KeyboardKeyListener.java

示例7: onDestroy

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:38,代码来源:Launcher.java

示例8: getInstance

import android.text.method.TextKeyListener; //导入依赖的package包/类
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];
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:10,代码来源:JotaTextKeyListener.java

示例9: cancelSearch

import android.text.method.TextKeyListener; //导入依赖的package包/类
public void cancelSearch() {
    hideInputPannel();
    post(new Runnable() {
        @Override
        public void run() {
            if (mListener != null) {
                mListener.cancelSearch();
            }
        }
    });
    TextKeyListener.clear(mSearchEdit.getText());
    mIsSearchMode = false;
}
 
开发者ID:elffy,项目名称:AbroadEasy,代码行数:14,代码来源:CustomSearchBar.java

示例10: onDestroy

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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();
}
 
开发者ID:pengqinping,项目名称:androidProject,代码行数:39,代码来源:Launcher.java

示例11: onKeyDown

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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;
}
 
开发者ID:yftx,项目名称:fruit.launcher,代码行数:35,代码来源:Launcher.java

示例12: onDestroy

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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);
	}
 
开发者ID:yftx,项目名称:fruit.launcher,代码行数:34,代码来源:Launcher.java

示例13: StringWidget

import android.text.method.TextKeyListener; //导入依赖的package包/类
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);
}
 
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:33,代码来源:StringWidget.java

示例14: onKeyDown

import android.text.method.TextKeyListener; //导入依赖的package包/类
@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;
}
 
开发者ID:Kwamecorp,项目名称:Fairphone,代码行数:29,代码来源:Launcher.java

示例15: setupAutoComplete

import android.text.method.TextKeyListener; //导入依赖的package包/类
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));
}
 
开发者ID:haku,项目名称:Onosendai,代码行数:9,代码来源:PostActivity.java


注:本文中的android.text.method.TextKeyListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。