List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:de.hackerspacebremen.fragments.StatusFragment.java
private void outputStatus(final SpaceData data) { if (statusAnimation != null) { statusAnimation.stop();/*ww w . jav a 2 s . c om*/ } if (messageAnimation != null) { messageAnimation.stop(); } StatusViewHolder.get().imgStatus.setVisibility(ImageView.GONE); if (data == null) { StatusViewHolder.get().imgConnErr.setVisibility(ImageView.VISIBLE); final TextView statusView = StatusViewHolder.get().statusMessage; statusView.setText(this.getText(R.string.connection_error)); } else { this.spaceData = data; final TextView text = StatusViewHolder.get().statusMessage; String timeString = getString(R.string.unknown); if (data.getTime() != null) { timeString = SpeakingDateFormat.format(data.getTime()); } ((HackerspaceApplication) this.getActivity().getApplication()).spaceOpen = data.isSpaceOpen(); if (data.isSpaceOpen()) { text.setText(getString(R.string.space_open, timeString)); } else { text.setText(getString(R.string.space_closed, timeString)); } text.setTypeface(null, Typeface.BOLD); if (data.getMessage() != null && data.getMessage().length() > 0) { String message = data.getMessage(); final TextView messageView = StatusViewHolder.get().messageText; messageView.setText(message); final TextView messageLabel = StatusViewHolder.get().messageLabel; messageLabel.setVisibility(TextView.VISIBLE); StatusViewHolder.get().messageBlock.setVisibility(RelativeLayout.VISIBLE); } else { StatusViewHolder.get().messageBlock.setVisibility(RelativeLayout.INVISIBLE); } // TODO EventBus nutzen updateAppWidget(data); } }
From source file:com.apptentive.android.sdk.module.engagement.interaction.view.survey.SurveyInteractionView.java
@Override public void doOnCreate(final Activity activity, Bundle savedInstanceState) { if (savedInstanceState != null) { surveySubmitted = savedInstanceState.getBoolean(KEY_SURVEY_SUBMITTED, false); }/*from w w w. ja va 2 s.c o m*/ if (interaction == null || surveySubmitted) { activity.finish(); return; } activity.setContentView(R.layout.apptentive_survey); // Hide branding if needed. final View branding = activity.findViewById(R.id.apptentive_branding_view); if (branding != null) { if (Configuration.load(activity).isHideBranding(activity)) { branding.setVisibility(View.GONE); } } TextView title = (TextView) activity.findViewById(R.id.title); title.setFocusable(true); title.setFocusableInTouchMode(true); title.setText(interaction.getName()); String descriptionText = interaction.getDescription(); if (descriptionText != null) { TextView description = (TextView) activity.findViewById(R.id.description); description.setText(descriptionText); description.setVisibility(View.VISIBLE); } final Button send = (Button) activity.findViewById(R.id.send); send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Util.hideSoftKeyboard(activity, view); surveySubmitted = true; if (interaction.isShowSuccessMessage() && interaction.getSuccessMessage() != null) { SurveyThankYouDialog dialog = new SurveyThankYouDialog(activity); dialog.setMessage(interaction.getSuccessMessage()); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { activity.finish(); } }); dialog.show(); } else { activity.finish(); } EngagementModule.engageInternal(activity, interaction, EVENT_SUBMIT, data.toString()); ApptentiveDatabase.getInstance(activity).addPayload(new SurveyResponse(interaction, surveyState)); Log.d("Survey Submitted."); callListener(true); cleanup(); } }); LinearLayout questions = (LinearLayout) activity.findViewById(R.id.questions); questions.removeAllViews(); // Then render all the questions for (final Question question : interaction.getQuestions()) { if (question.getType() == Question.QUESTION_TYPE_SINGLELINE) { TextSurveyQuestionView textQuestionView = new TextSurveyQuestionView(activity, surveyState, (SinglelineQuestion) question); textQuestionView.setOnSurveyQuestionAnsweredListener(new OnSurveyQuestionAnsweredListener() { public void onAnswered() { sendMetricForQuestion(activity, question); send.setEnabled(isSurveyValid()); } }); questions.addView(textQuestionView); } else if (question.getType() == Question.QUESTION_TYPE_MULTICHOICE) { MultichoiceSurveyQuestionView multichoiceQuestionView = new MultichoiceSurveyQuestionView(activity, surveyState, (MultichoiceQuestion) question); multichoiceQuestionView.setOnSurveyQuestionAnsweredListener(new OnSurveyQuestionAnsweredListener() { public void onAnswered() { sendMetricForQuestion(activity, question); send.setEnabled(isSurveyValid()); } }); questions.addView(multichoiceQuestionView); } else if (question.getType() == Question.QUESTION_TYPE_MULTISELECT) { MultiselectSurveyQuestionView multiselectQuestionView = new MultiselectSurveyQuestionView(activity, surveyState, (MultiselectQuestion) question); multiselectQuestionView.setOnSurveyQuestionAnsweredListener(new OnSurveyQuestionAnsweredListener() { public void onAnswered() { sendMetricForQuestion(activity, question); send.setEnabled(isSurveyValid()); } }); questions.addView(multiselectQuestionView); } } send.setEnabled(isSurveyValid()); // Force the top of the survey to be shown first. title.requestFocus(); }
From source file:de.hackerspacebremen.fragments.StatusFragment.java
@Override public void onStart() { super.onStart(); EventBus.getDefault().register(this); // initializing the statusview holder StatusViewHolder.init(this.getView()); StatusViewHolder.get().statusLayout.setOnLongClickListener(new OnLongClickListener() { @Override/*from www . j av a2s. c o m*/ public boolean onLongClick(View v) { if (statusAnimation != null) { statusAnimation.start(); } if (messageAnimation != null) { messageAnimation.start(); } StatusViewHolder.get().messageBlock.setVisibility(RelativeLayout.GONE); StatusViewHolder.get().imgStatus.setVisibility(ImageView.VISIBLE); StatusViewHolder.get().imgConnErr.setVisibility(ImageView.GONE); final TextView text = StatusViewHolder.get().statusMessage; text.setTypeface(null, Typeface.NORMAL); text.setText(getString(R.string.fetch_status)); final TextView messageText = StatusViewHolder.get().messageText; messageText.setText(getString(R.string.fetch_message)); final TextView messageLabel = StatusViewHolder.get().messageLabel; messageLabel.setVisibility(TextView.GONE); startStatusCommunication(); return true; } }); if (this.spaceData == null) { this.startAnimation(); this.startStatusCommunication(); if (notificationRegistry == null) { this.notificationRegistry = new NotificationRegistry(this.getActivity()); } this.notificationRegistry.register(); } else { this.outputStatus(this.spaceData); } }
From source file:com.brq.wallet.activity.main.BalanceFragment.java
private void updateUiKnownBalance(CurrencyBasedBalance balance) { // Set Balance String valueString = Utils.getFormattedValueWithUnit(balance.confirmed, _mbwManager.getBitcoinDenomination()); ((TextView) _root.findViewById(R.id.tvBalance)).setText(valueString); _root.findViewById(R.id.pbProgress).setVisibility(balance.isSynchronizing ? View.VISIBLE : View.GONE); // Show alternative values _tcdFiatDisplay.setFiatOnly(balance.confirmed.isBtc()); _tcdFiatDisplay.setValue(balance.confirmed); // Show/Hide Receiving if (balance.receiving.getValue().compareTo(BigDecimal.ZERO) > 0) { String receivingString = Utils.getFormattedValueWithUnit(balance.receiving, _mbwManager.getBitcoinDenomination()); String receivingText = getResources().getString(R.string.receiving, receivingString); TextView tvReceiving = (TextView) _root.findViewById(R.id.tvReceiving); tvReceiving.setText(receivingText); tvReceiving.setVisibility(View.VISIBLE); } else {/*from ww w . ja v a 2 s. c o m*/ _root.findViewById(R.id.tvReceiving).setVisibility(View.GONE); } // show fiat value (if balance is in btc) setFiatValue(R.id.tvReceivingFiat, balance.receiving, true); // Show/Hide Sending if (balance.sending.getValue().compareTo(BigDecimal.ZERO) > 0) { String sendingString = Utils.getFormattedValueWithUnit(balance.sending, _mbwManager.getBitcoinDenomination()); String sendingText = getResources().getString(R.string.sending, sendingString); TextView tvSending = (TextView) _root.findViewById(R.id.tvSending); tvSending.setText(sendingText); tvSending.setVisibility(View.VISIBLE); } else { _root.findViewById(R.id.tvSending).setVisibility(View.GONE); } // show fiat value (if balance is in btc) setFiatValue(R.id.tvSendingFiat, balance.sending, true); }
From source file:net.sf.asap.Player.java
private void setTag(int controlId, String value) { TextView control = (TextView) findViewById(controlId); if (value.length() == 0) control.setVisibility(View.GONE); else {//from www .j av a2 s . c o m control.setText(value); control.setVisibility(View.VISIBLE); } }
From source file:com.enadein.carlogbook.core.BaseActivity.java
protected boolean validateTextView(int errorViewId, EditText editView) { TextView errorView = (TextView) findViewById(errorViewId); boolean result = CommonUtils.isNotEmpty(editView.getText().toString()); errorView.setVisibility((!result) ? View.VISIBLE : View.GONE); return result; }
From source file:com.cerema.cloud2.ui.preview.FileDownloadFragment.java
/** * Enables or disables buttons for a file locally available *//* www.j a va 2 s. c o m*/ private void setButtonsForDown() { getView().findViewById(R.id.cancelBtn).setVisibility(View.GONE); // hides the progress bar getView().findViewById(R.id.progressBar).setVisibility(View.GONE); // updates the text message TextView progressText = (TextView) getView().findViewById(R.id.progressText); progressText.setText(R.string.common_loading); progressText.setVisibility(View.VISIBLE); // hides the error icon getView().findViewById(R.id.errorText).setVisibility(View.GONE); getView().findViewById(R.id.error_image).setVisibility(View.GONE); }
From source file:am.roadpolice.roadpolice.AboutUsDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_about_us, null); TextView tvVersion = (TextView) dialogView.findViewById(R.id.tvAboutUsVersion); try {/*from w w w . j a va 2 s .co m*/ PackageManager manager = getActivity().getPackageManager(); PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0); tvVersion.setText(tvVersion.getText() + " " + info.versionName); } catch (PackageManager.NameNotFoundException e) { tvVersion.setVisibility(View.GONE); } // Makes the link in the text view clickable. TextView t2 = (TextView) dialogView.findViewById(R.id.tvAboutUsDeveloper); t2.setMovementMethod(LinkMovementMethod.getInstance()); // Creates About Us Alert dialog which extends from DialogFragment. return new AlertDialog.Builder(getActivity()).setTitle(R.string.txtAboutUs) .setNeutralButton(R.string.about_us_close, null).setView(dialogView).create(); }
From source file:com.android.settingslib.RestrictedSwitchPreference.java
@Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); mHelper.onBindViewHolder(holder);/*ww w. ja v a 2 s . co m*/ final View restrictedIcon = holder.findViewById(R.id.restricted_icon); final View switchWidget = holder.findViewById(android.R.id.switch_widget); if (restrictedIcon != null) { restrictedIcon.setVisibility(isDisabledByAdmin() ? View.VISIBLE : View.GONE); } if (switchWidget != null) { switchWidget.setVisibility(isDisabledByAdmin() ? View.GONE : View.VISIBLE); } if (mUseAdditionalSummary) { final TextView additionalSummaryView = (TextView) holder.findViewById(R.id.additional_summary); if (additionalSummaryView != null) { if (isDisabledByAdmin()) { additionalSummaryView.setText(mRestrictedSwitchSummary); additionalSummaryView.setVisibility(View.VISIBLE); } else { additionalSummaryView.setVisibility(View.GONE); } } } else { final TextView summaryView = (TextView) holder.findViewById(android.R.id.summary); if (summaryView != null) { if (isDisabledByAdmin()) { summaryView.setText(mRestrictedSwitchSummary); summaryView.setVisibility(View.VISIBLE); } // No need to change the visibility to GONE in the else case here since Preference // class would have already changed it if there is no summary to display. } } }
From source file:com.armtimes.dialogs.DialogAboutUs.java
@SuppressWarnings("NullableProblems") @Override/*from w ww .j a v a 2 s .c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_about_us, null); TextView tvVersion = (TextView) dialogView.findViewById(R.id.tvAboutUsVersion); try { PackageManager manager = getActivity().getPackageManager(); PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0); tvVersion.setText(tvVersion.getText() + " " + info.versionName); } catch (PackageManager.NameNotFoundException e) { tvVersion.setVisibility(View.GONE); } // Makes the link in the text view clickable. TextView t2 = (TextView) dialogView.findViewById(R.id.tvAboutUsDeveloper); t2.setMovementMethod(LinkMovementMethod.getInstance()); // Creates About Us Alert dialog which extends from DialogFragment. return new AlertDialog.Builder(getActivity()).setTitle(R.string.about_us) .setNeutralButton(R.string.about_us_close, null).setView(dialogView).create(); }