List of usage examples for android.widget TextView setFocusableInTouchMode
public void setFocusableInTouchMode(boolean focusableInTouchMode)
From source file:net.lp.actionbarpoirot.helpers.ActivityHelperHoneycomb.java
/** {@inheritDoc} */ @Override/*from w w w . j a v a 2 s .c om*/ public void enableActionBarTitleMarquee() { // Make title scrolling, a bit of a hack final TextView titleView = (TextView) mActivity.findViewById(actionBarTitleResId); if (titleView != null) { titleView.setEllipsize(TextUtils.TruncateAt.MARQUEE); titleView.setMarqueeRepeatLimit(-1); titleView.setFocusable(true); titleView.setFocusableInTouchMode(true); titleView.requestFocus();// TODO: action bar title doesn't keep // scrolling after you've touched // something else. Should fix that. } // Also focus LeftNavBar, a bit of a hack too final View view = (mActivity.findViewById(leftNavActionBarResId)); if (view != null) { view.setFocusable(true); view.setFocusableInTouchMode(true); view.requestFocus(); } }
From source file:com.kaszubski.kamil.emmhelper.MainActivity.java
private void longTextTitleMode(boolean enabled) { try {/* w ww . ja v a2 s. c om*/ Field titleField = Toolbar.class.getDeclaredField("mTitleTextView"); titleField.setAccessible(enabled); TextView barTitleView = (TextView) titleField.get(toolbar); barTitleView.setEllipsize(enabled ? TextUtils.TruncateAt.START : TextUtils.TruncateAt.START); barTitleView.setFocusable(enabled); barTitleView.setFocusableInTouchMode(enabled); barTitleView.requestFocus(); barTitleView.setSingleLine(enabled); barTitleView.setSelected(enabled); } catch (NoSuchFieldException e) { Log.e(TAG, "" + e); } catch (IllegalAccessException e) { Log.e(TAG, " " + e); } }
From source file:jahirfiquitiva.iconshowcase.adapters.ChangelogAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(context); convertView = inflater.inflate(R.layout.changelog_content, parent, false); convertView.setClickable(false); convertView.setLongClickable(false); convertView.setFocusable(false); convertView.setFocusableInTouchMode(false); convertView.setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent)); }/*from w ww . j a v a 2s . c om*/ TextView title = (TextView) convertView.findViewById(R.id.changelog_title); TextView content = (TextView) convertView.findViewById(R.id.changelog_content); String nameStr = mChangelog[position][0]; String contentStr = ""; for (int i = 1; i < mChangelog[position].length; i++) { if (i > 1) { // No need for new line on the first item contentStr += "\n"; } contentStr += "\u2022 "; contentStr += mChangelog[position][i]; } title.setText(nameStr); title.setClickable(false); title.setLongClickable(false); title.setFocusable(false); title.setFocusableInTouchMode(false); title.setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent)); content.setText(contentStr); content.setClickable(false); content.setLongClickable(false); content.setFocusable(false); content.setFocusableInTouchMode(false); content.setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent)); return convertView; }
From source file:com.github.irshulx.Components.InputExtensions.java
private void addEditableStyling(TextView editText) { editText.setTypeface(getTypeface(CONTENT, Typeface.NORMAL)); editText.setFocusableInTouchMode(true); editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, NORMALTEXTSIZE); editText.setTextColor(Color.parseColor(this.DEFAULT_TEXT_COLOR)); editText.setPadding(0, 30, 0, 30);// ww w .j a v a 2 s . c om }
From source file:org.anhonesteffort.flock.EditAutoRenewActivity.java
private void handleEnableForm() { Log.d(TAG, "handleEnableForm()"); EditText cardExpirationView = (EditText) findViewById(R.id.card_expiration); EditText cardNumberView = (EditText) findViewById(R.id.card_number); TextView cardCVCView = (TextView) findViewById(R.id.card_cvc); cardNumberView.setFocusable(true);//ww w. ja v a 2 s .c om cardNumberView.setFocusableInTouchMode(true); cardExpirationView.setFocusable(true); cardExpirationView.setFocusableInTouchMode(true); cardCVCView.setFocusable(true); cardCVCView.setFocusableInTouchMode(true); cardNumberView.setOnTouchListener(null); cardExpirationView.setOnTouchListener(null); cardCVCView.setOnTouchListener(null); }
From source file:org.anhonesteffort.flock.EditAutoRenewActivity.java
private void handleDisableForm() { Log.d(TAG, "handleDisableForm()"); Button verifyAndSaveButton = (Button) findViewById(R.id.button_verify_and_save); EditText cardExpirationView = (EditText) findViewById(R.id.card_expiration); EditText cardNumberView = (EditText) findViewById(R.id.card_number); TextView cardCVCView = (TextView) findViewById(R.id.card_cvc); cardNumberView.setFocusable(false);/*from w w w .j a va2 s. c o m*/ cardNumberView.setFocusableInTouchMode(false); cardExpirationView.setFocusable(false); cardExpirationView.setFocusableInTouchMode(false); cardCVCView.setFocusable(false); cardCVCView.setFocusableInTouchMode(false); cardNumberView.setText(""); cardExpirationView.setText(""); cardCVCView.setText(""); cardNumberView.setOnTouchListener(null); cardExpirationView.setOnTouchListener(null); cardCVCView.setOnTouchListener(null); verifyAndSaveButton.setText(R.string.button_save); verifyAndSaveButton.setOnClickListener(null); }
From source file:org.anhonesteffort.flock.EditAutoRenewActivity.java
private void handleInitFormAsAutoRenewDisabled() { Log.d(TAG, "handleInitFormFormAsAutoRenewDisabled()"); Button verifyAndSaveButton = (Button) findViewById(R.id.button_verify_and_save); EditText cardExpirationView = (EditText) findViewById(R.id.card_expiration); EditText cardNumberView = (EditText) findViewById(R.id.card_number); TextView cardCVCView = (TextView) findViewById(R.id.card_cvc); cardNumberView.setFocusable(false);/*from www . ja va 2s . c o m*/ cardNumberView.setFocusableInTouchMode(false); cardExpirationView.setFocusable(false); cardExpirationView.setFocusableInTouchMode(false); cardCVCView.setFocusable(false); cardCVCView.setFocusableInTouchMode(false); cardNumberView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) ((CheckBox) findViewById(R.id.checkbox_enable_auto_renew)).setChecked(true); return false; } }); cardExpirationView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) ((CheckBox) findViewById(R.id.checkbox_enable_auto_renew)).setChecked(true); return false; } }); cardCVCView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) ((CheckBox) findViewById(R.id.checkbox_enable_auto_renew)).setChecked(true); return false; } }); cardNumberView.setText(""); cardExpirationView.setText(""); cardCVCView.setText(""); verifyAndSaveButton.setText(R.string.button_save); verifyAndSaveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { handleSaveAutoRenewAndFinish(false); } }); }
From source file:com.audiokernel.euphonyrmt.MainMenuActivity.java
private TextView initializeTextView() { final LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final TextView textView = (TextView) inflater.inflate(R.layout.actionbar_title, null); textView.setFocusable(true);/* w w w . j a va 2 s . com*/ textView.setFocusableInTouchMode(true); textView.setSelected(true); textView.requestFocus(); return textView; }
From source file:com.google.android.apps.santatracker.launch.TvStartupActivity.java
private void addDebugMenuListRaw(ArrayObjectAdapter objectAdapter) { mMarkers.setPadding(mMarkers.getPaddingLeft(), mMarkers.getPaddingTop() + 150, mMarkers.getPaddingRight(), mMarkers.getPaddingBottom()); Presenter debugMenuPresenter = new Presenter() { @Override//w w w.j av a 2s . com public ViewHolder onCreateViewHolder(ViewGroup parent) { TextView tv = new TextView(parent.getContext()); ViewGroup.MarginLayoutParams params = new ViewGroup.MarginLayoutParams(200, 150); tv.setLayoutParams(params); tv.setGravity(Gravity.CENTER); tv.setBackgroundColor(getResources().getColor(R.color.SantaBlueDark)); tv.setFocusableInTouchMode(false); tv.setFocusable(true); tv.setClickable(true); return new ViewHolder(tv); } @Override public void onBindViewHolder(ViewHolder viewHolder, Object item) { ((TextView) viewHolder.view).setText((String) item); viewHolder.view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String text = ((TextView) v).getText().toString(); if (text.contains("Enable Tracker")) { enableTrackerMode(true); } else if (text.contains("Enable CountDown")) { startCountdown(SantaPreferences.getCurrentTime()); } else { mIsDebug = false; initialiseViews(); resetLauncherStates(); } } }); } @Override public void onUnbindViewHolder(ViewHolder viewHolder) { } }; ObjectAdapter debugMenuAdapter = new ObjectAdapter(debugMenuPresenter) { private final String[] mMenuString = { "Enable Tracker", "Enable CountDown", "Hide DebugMenu" }; @Override public int size() { return mMenuString.length; } @Override public Object get(int position) { return mMenuString[position]; } }; ListRow debugMenuListRow = new ListRow(debugMenuAdapter); objectAdapter.add(debugMenuListRow); }
From source file:com.android.tv.settings.dialog.SettingsLayoutFragment.java
private void initializeContentView(View content) { TextView titleView = (TextView) content.findViewById(R.id.title); TextView breadcrumbView = (TextView) content.findViewById(R.id.breadcrumb); TextView descriptionView = (TextView) content.findViewById(R.id.description); titleView.setText(mTitle);//from w w w . j ava 2s .c o m breadcrumbView.setText(mBreadcrumb); descriptionView.setText(mDescription); final ImageView iconImageView = (ImageView) content.findViewById(R.id.icon); iconImageView.setBackgroundColor(mIconBackgroundColor); // Force text fields to be focusable when accessibility is enabled. if (AccessibilityHelper.forceFocusableViews(getActivity())) { titleView.setFocusable(true); titleView.setFocusableInTouchMode(true); descriptionView.setFocusable(true); descriptionView.setFocusableInTouchMode(true); breadcrumbView.setFocusable(true); breadcrumbView.setFocusableInTouchMode(true); } if (mIcon != null) { iconImageView.setImageDrawable(mIcon); updateViewSize(iconImageView); } else if (mIconBitmap != null) { iconImageView.setImageBitmap(mIconBitmap); updateViewSize(iconImageView); } else if (mIconUri != null) { iconImageView.setVisibility(View.INVISIBLE); /* BitmapDownloader bitmapDownloader = BitmapDownloader.getInstance( content.getContext()); mBitmapCallBack = new BitmapCallback() { @Override public void onBitmapRetrieved(Bitmap bitmap) { if (bitmap != null) { mIconBitmap = bitmap; iconImageView.setVisibility(View.VISIBLE); iconImageView.setImageBitmap(bitmap); updateViewSize(iconImageView); } } }; bitmapDownloader.getBitmap(new BitmapWorkerOptions.Builder( content.getContext()).resource(mIconUri) .width(iconImageView.getLayoutParams().width).build(), mBitmapCallBack); */ } else { iconImageView.setVisibility(View.GONE); } content.setTag(R.id.title, titleView); content.setTag(R.id.breadcrumb, breadcrumbView); content.setTag(R.id.description, descriptionView); content.setTag(R.id.icon, iconImageView); }