List of usage examples for android.widget TextView setEnabled
@android.view.RemotableViewMethod @Override public void setEnabled(boolean enabled)
From source file:Main.java
/** * Enables a {@link TextView}.//w w w . j a v a 2s. c o m * * @param textview text view instance * @param enabled {@code true} for enabled, {@code false} disabled */ public static void setEnabled(TextView textview, boolean enabled) { textview.setEnabled(enabled); textview.invalidate(); }
From source file:com.sonymobile.androidapp.gridcomputing.utils.ViewUtils.java
/** * Updates the status bar with the current conditions. * * @param parent parent view.//from w w w. j a v a2 s. c om * @param enabled the enabled condition. * @param paused the paused condition. * @param battery the battery condition. * @param charger the charger condition. * @param wifi the wifi condition. */ public static void updateStatusBar(final View parent, final boolean enabled, final boolean paused, final boolean battery, final boolean charger, final boolean wifi) { final boolean progress = battery && charger && wifi && !paused; final CheckableImageButton enableView = (CheckableImageButton) parent .findViewById(R.id.summary_menu_power_toggle); final View batteryView = parent.findViewById(R.id.iv_battery); final View chargerView = parent.findViewById(R.id.iv_charger); final View wifiView = parent.findViewById(R.id.iv_wifi); final StatusProgressBar progressView = (StatusProgressBar) parent.findViewById(R.id.progress); //final View standByProgressView = parent.findViewById(R.id.progress_stand_by); final TextView textView = (TextView) parent.findViewById(R.id.summary_status_text); boolean running = enabled && !paused; enableView.setChecked(running && progress); batteryView.setEnabled(running); chargerView.setEnabled(running); wifiView.setEnabled(running); textView.setEnabled(running); batteryView.setActivated(running && battery); chargerView.setActivated(running && charger); wifiView.setActivated(running && wifi); textView.setActivated(running && progress); if (running) { enableView.setImageResource(R.drawable.power_bt); if (progress) { textView.setText(R.string.helping_out); progressView.changeMode(StatusProgressBar.ProgressStatus.RUNNING); } else { textView.setText(R.string.stand_by); progressView.changeMode(StatusProgressBar.ProgressStatus.STAND_BY); } } else { progressView.changeMode(StatusProgressBar.ProgressStatus.NONE); if (!enabled) { enableView.setImageResource(R.drawable.power_bt_disabled); textView.setText(R.string.disabled); } else { enableView.setImageResource(R.drawable.power_bt_paused); textView.setText(R.string.paused); } } }
From source file:cl.monsoon.s1next.binding.TextViewBindingAdapter.java
@BindingAdapter({ "themeManager", "thread", "user" }) public static void setThread(TextView textView, ThemeManager themeManager, Thread thread, User user) { textView.setText(thread.getTitle()); if (thread.getPermission() != 0) { // add thread's permission hint ViewUtil.concatWithTwoSpacesForRtlSupport(textView, "[" + textView.getContext().getString(R.string.thread_permission_hint) + thread.getPermission() + "]"); }// w ww . j ava2 s. c o m // disable TextView if user has no permission to access this thread boolean hasPermission = user.getPermission() >= thread.getPermission(); textView.setEnabled(hasPermission); // add thread's replies count to each thread ViewUtil.concatWithTwoSpacesForRtlSupport(textView, String.valueOf(thread.getReplies()), hasPermission ? themeManager.getGentleAccentColor() : themeManager.getHintOrDisabledGentleAccentColor()); }
From source file:com.francetelecom.rd.app.nodessimulator.NodeDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { nodeView = inflater.inflate(R.layout.fragment_device_detail, container, false); // Show the device content as text in a TextView. if (currentNode != null) { TextView tv = (TextView) nodeView.findViewById(R.id.device_detail); tv.setText("contact dev team to add new nodes"); tv.setEnabled(false); }//from w ww. ja v a2 s.c o m return nodeView; }
From source file:com.palebluepagos.androidwallet.charge.AccountsListChargeFragment.java
public void createNewCharge(Account account) { // Disable Edits TextView amount = (TextView) getActivity().findViewById(R.id.charge_detail_amount); amount.setEnabled(false); getActivity().findViewById(R.id.edition_pencil_icon).setVisibility(View.GONE); TextView desc = (TextView) getActivity().findViewById(R.id.charge_desc_text); // Hide list with animation AnimationHelper.hideToTop(getActivity().findViewById(R.id.charge_details_choose_list)); // Hide the List title getActivity().findViewById(R.id.charge_accounts_title).setVisibility(View.GONE); this.setCharge(new Charge()); this.getCharge().setAmount(amount.getText().toString()); this.getCharge().setDesc(desc.getText().toString()); this.getCharge().setCbu(account.cbu); this.getCharge().setBankCode(account.bankcode); this.getCharge().setType(ChargeDataContract.ONE_TIME_CHARGE); this.getCharge().setStatus(ChargeDataContract.PENDING); this.getCharge().setDate(System.currentTimeMillis()); UserData userData = new UserData(getActivity()); this.getCharge().setCuit(userData.getCurrentUser().getCuit()); this.getCharge().setPhone(userData.getCurrentUser().getPhone()); this.getCharge().save(); Long id = charge.getId();/*w w w . j a va2s . com*/ this.getCharge().setUid(String.valueOf(id)); this.getCharge().save(); QrHelper qrHelper = new QrHelper(getActivity(), this.getCharge()); qrHelper.createQrCode(); }
From source file:nl.privacybarometer.privacyvandaag.adapter.FeedsCursorAdapter.java
@Override protected void bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded) { ImageView indicatorImage = (ImageView) view.findViewById(R.id.indicator); if (cursor.getInt(mIsGroupPos) == 1) { indicatorImage.setVisibility(View.VISIBLE); TextView textView = ((TextView) view.findViewById(android.R.id.text1)); textView.setEnabled(true); textView.setText(cursor.getString(mNamePos)); textView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); textView.setText(cursor.getString(mNamePos)); if (isExpanded) indicatorImage.setImageResource(R.drawable.group_expanded); else//from www. j a va 2 s. co m indicatorImage.setImageResource(R.drawable.group_collapsed); } else { bindChildView(view, context, cursor); indicatorImage.setVisibility(View.GONE); } }
From source file:com.sweetiepiggy.littlepro.QuestionFragment.java
private void createFillInBlank(View v) { v.findViewById(R.id.answerRadioGroup).setVisibility(View.GONE); TextView answerView = (TextView) v.findViewById(R.id.answer); answerView.setText(mAnswer);//from w w w .ja va 2 s. co m if (mSubmitted) { answerView.setEnabled(false); } }
From source file:org.peercast.pecaport.WanConnectionsAdapter.java
private void bindView(int position, View view) { WanConnection conn = getItem(position); TextView vServiceId = (TextView) view.findViewById(R.id.vServiceId); TextView vStatus = (TextView) view.findViewById(R.id.vStatus); vServiceId.setText(conn.getService().getServiceId().getId()); if (vStatus != null) { vStatus.setText(getStatusString(conn.getStatus())); vStatus.setEnabled(conn.getStatus() == Connection.Status.Connected); }/*from w w w. j av a 2 s . com*/ }
From source file:net.kjmaster.cookiemom.editor.EditDataActivity.java
private void populateTable(final List<CookieTransactions> cookieTransactionsList, Context mContext) { edit_data_table.setShrinkAllColumns(true); for (final CookieTransactions cookieTransactions : cookieTransactionsList) { if ((cookieTransactions.getTransBoxes() != 0) || (cookieTransactions.getTransCash() != 0)) { TableRow tr = new TableRow(mContext); tr.setTag(cookieTransactions); TextView textView = new TextView(mContext); textView.setText(java.text.DateFormat.getInstance().format(cookieTransactions.getTransDate())); textView.setEnabled(false); tr.addView(textView);//from ww w . j av a2 s . com TextView textView2 = new TextView(mContext); try { if (cookieTransactions.getTransScoutId() < 0) { if (cookieTransactions.getTransBoothId() > 0) { textView2.setText(cookieTransactions.getBooth().getBoothLocation()); } else { textView2.setText("Cupboard"); } } else { textView2.setText(cookieTransactions.getScout().getScoutName()); } } catch (Exception e) { textView2.setText(""); } textView2.setEnabled(false); tr.addView(textView2); TextView textView1 = new TextView(mContext); textView1.setText(cookieTransactions.getCookieType()); textView1.setEnabled(false); tr.addView(textView1); EditText textView3 = new EditText(mContext); textView3.setText(cookieTransactions.getTransBoxes().toString()); textView3.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (mActionMode == null) { startActionMode(actionCall); } } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { try { cookieTransactions.setTransBoxes(Integer.valueOf(editable.toString())); cookieTransactionsList.add(cookieTransactions); //Main.daoSession.getCookieTransactionsDao().update(cookieTransactions); } catch (Exception ignored) { } } }); tr.addView(textView3); EditText textView4 = new EditText(mContext); textView4.setText( NumberFormat.getCurrencyInstance().format(cookieTransactions.getTransCash().floatValue())); textView4.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (mActionMode == null) { startActionMode(actionCall); } } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { try { cookieTransactions.setTransCash(Double.valueOf(editable.toString())); cookieTransactionsList.add(cookieTransactions); } catch (Exception ignored) { } } }); tr.addView(textView4); edit_data_table.addView(tr); } } }
From source file:org.travey.travey.SettingsFragment.java
@Override public void onResume() { super.onResume(); Log.i("**************", "Resuming Main Activity"); load();/*from w ww .j a v a2s . c o m*/ Log.i("**************", "isChecked=" + mActiveCheckboxChecked + " isUpdates=" + mRequestingLocationUpdates); final CheckBox checkBox = (CheckBox) rootView.findViewById(R.id.checkBox); EditText editText = (EditText) rootView.findViewById(R.id.editText); Button button = (Button) rootView.findViewById(R.id.button); if (mActiveCheckboxChecked) { checkBox.setChecked(true); } if (mActiveCheckboxChecked && !mRequestingLocationUpdates) { startLocationUpdates(); } if (mRegistered) { editText.setText(participantID); checkBox.setEnabled(true); editText.setEnabled(false); TextView textView4 = (TextView) rootView.findViewById(R.id.textView4); TextView textView5 = (TextView) rootView.findViewById(R.id.textView5); textView4.setEnabled(false); textView5.setEnabled(true); button.setText(R.string.reset_button); } else { checkBox.setEnabled(false); } }