List of usage examples for android.widget TextView setFocusable
public void setFocusable(boolean focusable)
From source file:com.adarshahd.indianrailinfo.donate.PNRStat.java
private void showOfflinePNRStatus(String trainDetails, ArrayList<String> passnDetails) { LinearLayout ll = new LinearLayout(mActivity); TextView textViewTrnDtls = new TextView(mActivity); TextView textViewPsnDtls = new TextView(mActivity); TextView tvTrainDetails = new TextView(mActivity); TextView[] tvPassnDetails = new TextView[passnDetails.size()]; textViewTrnDtls.setText("Train Details: " + mPNRNumber); textViewTrnDtls.setFocusable(true); textViewPsnDtls.setText("Passenger Details"); tvTrainDetails.setText(trainDetails); textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewPsnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); tvTrainDetails.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Small); textViewTrnDtls.setPadding(10, 10, 10, 10); textViewPsnDtls.setPadding(10, 10, 10, 10); tvTrainDetails.setPadding(10, 10, 10, 10); tvTrainDetails.setBackgroundResource(R.drawable.card_background); textViewTrnDtls.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); textViewPsnDtls.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); ll.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ll.setOrientation(LinearLayout.VERTICAL); ll.addView(textViewTrnDtls);//w w w . j a v a 2 s. co m ll.addView(tvTrainDetails); ll.addView(textViewPsnDtls); for (int i = 0; i < passnDetails.size(); ++i) { tvPassnDetails[i] = new TextView(mActivity); tvPassnDetails[i].setText(passnDetails.get(i)); tvPassnDetails[i].setPadding(10, 10, 10, 10); tvPassnDetails[i].setBackgroundResource(R.drawable.card_background); tvPassnDetails[i].setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium); ll.addView(tvPassnDetails[i]); } mFrameLayout.removeAllViews(); mFrameLayout.addView(ll); }
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);// www . j a 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 va2s .c om 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 w w w .j a va 2 s .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); textView.setFocusableInTouchMode(true); textView.setSelected(true);//ww w. j a va2 s.c om textView.requestFocus(); return textView; }
From source file:com.zhongsou.souyue.ui.indicator.IcommonTabPageIndicator.java
private void addTab(CharSequence text, int index) { // final TabView tabView = new TabView(getContext()); // tabView.mIndex = index; final TextView tabView = new TextView(getContext()); tabView.setTag(index);//from w w w. j a v a 2 s . c om // if (index == 0){ // doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_left); // } else if (index == count - 1){ // doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_right); // } else { // doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_middle); // } tabView.setBackgroundResource(R.drawable.vpi__tab_indicator_blue_line); tabView.setTextColor(getResources().getColor(R.color.bar_center_title_color)); tabView.setGravity(Gravity.CENTER); tabView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tabView.setPadding(30, 0, 30, 0); tabView.setFocusable(true); tabView.setOnClickListener(mTabClickListener); tabView.setText(text); mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, FILL_PARENT, 1)); }
From source file:com.example.oris1991.anotherme.ExternalCalendar.CalendarAdapter.java
public View getView(int position, View convertView, ViewGroup parent) { View v = convertView;//w w w .j ava2 s . c o m TextView dayView; if (convertView == null) { // if it's not recycled, initialize some // attributes LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.calendar_item, null); } dayView = (TextView) v.findViewById(R.id.date); // separates daystring into parts. String[] separatedTime = dayString.get(position).split("-"); // taking last part of date. ie; 2 from 2012-12-02 String gridvalue = separatedTime[2].replaceFirst("^0*", ""); // checking whether the day is in current month or not. if ((Integer.parseInt(gridvalue) > 1) && (position < firstDay)) { // setting offdays to white color. dayView.setTextColor(ContextCompat.getColor(mContext, R.color.summer)); dayView.setClickable(false); dayView.setFocusable(false); } else if ((Integer.parseInt(gridvalue) < 7) && (position > 28)) { dayView.setTextColor(ContextCompat.getColor(mContext, R.color.summer)); dayView.setClickable(false); dayView.setFocusable(false); } else { // setting curent month's days in blue color. dayView.setTextColor(ContextCompat.getColor(mContext, R.color.colorPrimary)); } if (dayString.get(position).equals(curentDateString)) { setSelected(v); previousView = v; } else { v.setBackgroundResource(R.drawable.list_item_background); } dayView.setText(gridvalue); // create date string for comparison String date = dayString.get(position); if (date.length() == 1) { date = "0" + date; } String monthStr = "" + (month.get(GregorianCalendar.MONTH) + 1); if (monthStr.length() == 1) { monthStr = "0" + monthStr; } // show icon if date is not empty and it exists in the items array ImageView iw = (ImageView) v.findViewById(R.id.date_icon); if (date.length() > 0 && items != null && items.contains(date)) { iw.setVisibility(View.VISIBLE); } else { iw.setVisibility(View.INVISIBLE); } return v; }
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/*ww w . j ava 2 s. c o m*/ 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.cssweb.android.base.QuoteGridActivity.java
private void AddViewItem(String paramString, int paramInt1, LinearLayout paramLinearLayout, int paramInt2, int paramInt3, int paramInt4, boolean paramBoolean) { TextView localTextView = new TextView(this); float f = this.mFontSize; localTextView.setTextSize(f);/*w w w .j a v a 2 s.c o m*/ //??4? if (paramInt2 == paramInt4 && paramInt3 == 0 && nameOrcode) { if (this.mPaint.measureText(paramString) > textWeight) localTextView.setTextSize(13); } if (n2 == paramInt2) { String str = (n1 == 0) ? paramString + low : (n1 == 1) ? paramString + top : paramString; localTextView.setText(str); } else { localTextView.setText(paramString); } localTextView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL); localTextView.setFocusable(paramBoolean); localTextView.setOnClickListener(mClickListener); localTextView.setOnLongClickListener(mLongClickListener); localTextView.setOnTouchListener(this); //touch localTextView.setTag(paramInt2); localTextView.setEnabled(paramBoolean); localTextView.setSingleLine(false); if (paramInt4 == 0 && paramInt3 >= 0) {// localTextView.setGravity(Gravity.CENTER); int i1 = this.residTitleCol; int i8 = 0; localTextView.setTextColor(paramInt1); if (paramInt3 == 0) { localDrawable = getResources().getDrawable(i1); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 100) { localDrawable = getResources().getDrawable(this.residTitleScrollCol[2]); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 13) { localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); i8 += 20; } else if (paramInt3 == 8) { localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); i8 += 10; } else if (paramInt3 % 2 == 0) { localDrawable = getResources().getDrawable(this.residTitleScrollCol[1]); i8 = localDrawable.getIntrinsicWidth(); } else { localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); } localTextView.setBackgroundDrawable(localDrawable); int i6 = localDrawable.getIntrinsicHeight(); localTextView.setHeight(i6 + CssSystem.getTableTitleHeight(this)); //int i9 = (int) Math.max(i8, mPaint.measureText(paramString)); localTextView.setWidth(i8); paramLinearLayout.addView(localTextView); return; } if (paramInt4 != 0 && paramInt3 >= 0) { int i8 = 0; localTextView.setTextColor(paramInt1); if (paramInt3 == 0) { localDrawable = getResources().getDrawable(this.residCol); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 100) { localDrawable = getResources().getDrawable(this.residScrollCol[2]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 13) { localDrawable = getResources().getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); i8 += 20; //localTextView.setWidth(i8+20); } else if (paramInt3 == 8) { localDrawable = getResources().getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); i8 += 10; //localTextView.setWidth(i8+20); } else if (paramInt3 % 2 == 0) { localDrawable = getResources().getDrawable(this.residScrollCol[1]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } else { localDrawable = getResources().getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } localTextView.setBackgroundDrawable(localDrawable); int i6 = localDrawable.getIntrinsicHeight(); localTextView.setHeight(i6 + rowHeight); //int i9 = (int) Math.max(i8, mPaint.measureText(paramString)); localTextView.setWidth(i8); paramLinearLayout.addView(localTextView); return; } // if ((paramInt3 == j) && (paramInt4 == l)) { // int i13 = this.residTitleScrollCol[l]; // localDrawable = localResources.getDrawable(i13); // localTextView.setTextColor(paramInt1); // localTextView.setBackgroundDrawable(localDrawable); // paramLinearLayout.addView(localTextView); // return; // } }
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 www . ja va 2 s.co 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); }