Java Code Examples for android.widget.TextView#setOnKeyListener()
The following examples show how to use
android.widget.TextView#setOnKeyListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Hotseat.java From Trebuchet with GNU General Public License v3.0 | 5 votes |
void resetLayout() { mContent.removeAllViewsInLayout(); // Add the Apps button Context context = getContext(); LayoutInflater inflater = LayoutInflater.from(context); TextView allAppsButton = (TextView) inflater.inflate(R.layout.all_apps_button, mContent, false); Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon); mLauncher.resizeIconDrawable(d); allAppsButton.setCompoundDrawables(null, d, null, null); allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label)); allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener()); if (mLauncher != null) { mLauncher.setAllAppsButton(allAppsButton); allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener()); allAppsButton.setOnClickListener(mLauncher); allAppsButton.setOnLongClickListener(mLauncher); allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler); } // Note: We do this to ensure that the hotseat is always laid out in the orientation of // the hotseat in order regardless of which orientation they were added int x = getCellXFromOrder(mAllAppsButtonRank); int y = getCellYFromOrder(mAllAppsButtonRank); CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1); lp.canReorder = false; mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true); }
Example 2
Source File: Hotseat.java From LB-Launcher with Apache License 2.0 | 5 votes |
void resetLayout() { mContent.removeAllViewsInLayout(); if (!LauncherAppState.isDisableAllApps()) { // Add the Apps button Context context = getContext(); LayoutInflater inflater = LayoutInflater.from(context); TextView allAppsButton = (TextView) inflater.inflate(R.layout.all_apps_button, mContent, false); Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon); Utilities.resizeIconDrawable(d); allAppsButton.setCompoundDrawables(null, d, null, null); allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label)); allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener()); if (mLauncher != null) { allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener()); mLauncher.setAllAppsButton(allAppsButton); allAppsButton.setOnClickListener(mLauncher); allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler); } // Note: We do this to ensure that the hotseat is always laid out in the orientation of // the hotseat in order regardless of which orientation they were added int x = getCellXFromOrder(mAllAppsButtonRank); int y = getCellYFromOrder(mAllAppsButtonRank); CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1); lp.canReorder = false; mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true); } }
Example 3
Source File: PipService.java From zidoorecorder with Apache License 2.0 | 4 votes |
/** * 初始化控件 */ private void initView() { mVPip = LayoutInflater.from(getApplicationContext()).inflate(R.layout.view_pip, null); View rlPip = (RelativeLayout) mVPip.findViewById(R.id.rl_pip); mFmPip = (FrameLayout) rlPip.findViewById(R.id.fm_pip); mLnFrameBg = (LinearLayout) rlPip.findViewById(R.id.ln_bg); mPgbLoading = (ProgressBar) mFmPip.findViewById(R.id.pgb_loading); mRlFrame = (RelativeLayout) mFmPip.findViewById(R.id.rl_frame); mTvNoSingle = (TextView) mFmPip.findViewById(R.id.tv_no_single); mRlController = (RelativeLayout) mVPip.findViewById(R.id.rl_control); mLnController = (LinearLayout) mRlController.findViewById(R.id.ln_controller); mLnScale = (LinearLayout) mRlController.findViewById(R.id.ln_scale); mLnAudio = (LinearLayout) mRlController.findViewById(R.id.ln_audio); mImgSwitch = (ImageView) mLnAudio.findViewById(R.id.img_switch); mTvReminds = (TextView) mRlController.findViewById(R.id.tv_reminds); mSfPip = (SurfaceView) mFmPip.findViewById(R.id.sf_pip); SurfaceHolder holder = mSfPip.getHolder(); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); holder.addCallback(this); View move = mLnController.findViewById(R.id.tv_move); mTvScale = (TextView) mLnController.findViewById(R.id.tv_scale); mTvAudio = (TextView) mLnController.findViewById(R.id.tv_audio); View exit = mLnController.findViewById(R.id.tv_exit); View audioSwitch = mLnAudio.findViewById(R.id.rl_audio); mScales = new TextView[4]; mScales[0] = mLnScale.findViewById(R.id.tv_scale_0); mScales[1] = mLnScale.findViewById(R.id.tv_scale_1); mScales[2] = mLnScale.findViewById(R.id.tv_scale_2); mScales[3] = mLnScale.findViewById(R.id.tv_scale_3); for (int i = 0; i < mScales.length; i++) { View v = mScales[i]; v.setTag(i); v.setOnClickListener(this); v.setOnKeyListener(this); v.setOnFocusChangeListener(this); } mScales[mScaleMode].setSelected(true); move.setOnClickListener(this); mTvScale.setOnClickListener(this); mTvAudio.setOnClickListener(this); exit.setOnClickListener(this); audioSwitch.setOnClickListener(this); move.setOnFocusChangeListener(this); mTvScale.setOnFocusChangeListener(this); mTvAudio.setOnFocusChangeListener(this); exit.setOnFocusChangeListener(this); audioSwitch.setOnFocusChangeListener(this); move.setOnKeyListener(this); mTvScale.setOnKeyListener(this); mTvAudio.setOnKeyListener(this); exit.setOnKeyListener(this); audioSwitch.setOnKeyListener(this); mFmPip.setOnKeyListener(this); adjustPipFrame(mWindowType.x, mWindowType.y, mWindowType.width, mWindowType.height); WindowManager.LayoutParams params = new WindowManager.LayoutParams(); params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; params.format = PixelFormat.RGBA_8888; // 设置图片格式,效果为背景透明 params.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN; params.width = WindowManager.LayoutParams.MATCH_PARENT; params.height = WindowManager.LayoutParams.MATCH_PARENT; ((WindowManager) getSystemService(WINDOW_SERVICE)).addView(mVPip, params); move.requestFocus(); }