List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.android.deskclock.Utils.java
/** Clock views can call this to refresh their date. **/ public static void updateDate(String dateSkeleton, String descriptionSkeleton, View clock) { final TextView dateDisplay = (TextView) clock.findViewById(R.id.date); if (dateDisplay == null) { return;//from w ww .ja v a2 s. c o m } final Locale l = Locale.getDefault(); final String datePattern = DateFormat.getBestDateTimePattern(l, dateSkeleton); final String descriptionPattern = DateFormat.getBestDateTimePattern(l, descriptionSkeleton); final Date now = new Date(); dateDisplay.setText(new SimpleDateFormat(datePattern, l).format(now)); dateDisplay.setVisibility(View.VISIBLE); dateDisplay.setContentDescription(new SimpleDateFormat(descriptionPattern, l).format(now)); }
From source file:com.booksaround.me.title.LoginDialogFragment.java
/** * Show error message/*from www . j ava 2 s . c om*/ * @param message is error message */ void showErrorMessage(String message) { Dialog dialog = getDialog(); if (dialog == null) { return; } TextView text = (TextView) dialog.findViewById(R.id.text_message); text.setVisibility(View.VISIBLE); text.setText(message); }
From source file:com.chatwing.whitelabel.adapters.ConversationsAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { Conversation conversation = ConversationTable.getConversation(cursor); TextView aliasTv = (TextView) view.findViewById(android.R.id.text1); aliasTv.setText(conversation.getConversationAlias(mCurrentUser.getId())); int countIndexColumn = cursor.getColumnIndex(ConversationTable.UNREAD_COUNT); int count = cursor.getInt(countIndexColumn); TextView countTv = (TextView) view.findViewById(R.id.unread_count); if (count == 0) { countTv.setVisibility(View.GONE); } else {/*from w ww. j a v a2 s.c o m*/ countTv.setText(String.valueOf(count)); countTv.setVisibility(View.VISIBLE); } LogUtils.v("Conversation " + aliasTv.getText() + ":" + conversation.isModerator()); if (conversation.isModerator()) { aliasTv.setTypeface(null, Typeface.ITALIC); } else { aliasTv.setTypeface(null, Typeface.NORMAL); } }
From source file:com.cw.litenote.note.Note.java
/** Set outline for selected view mode * * Determined by view mode: all, picture, text * * Controlled factor://from w ww. j av a 2s. co m * - action bar: hide, show * - full screen: full, not full */ public static void setOutline(AppCompatActivity act) { // Set full screen or not, and action bar if (isViewAllMode() || isTextMode()) { Util.setFullScreen_noImmersive(act); if (act.getSupportActionBar() != null) act.getSupportActionBar().show(); } else if (isPictureMode()) { Util.setFullScreen(act); if (act.getSupportActionBar() != null) act.getSupportActionBar().hide(); } // renew pager showSelectedView(); LinearLayout buttonGroup = (LinearLayout) act.findViewById(R.id.view_button_group); // button group if (Note.isPictureMode()) buttonGroup.setVisibility(View.GONE); else buttonGroup.setVisibility(View.VISIBLE); TextView audioTitle = (TextView) act.findViewById(R.id.pager_audio_title); // audio title if (!Note.isPictureMode()) { if (!Util.isEmptyString(audioTitle.getText().toString())) audioTitle.setVisibility(View.VISIBLE); else audioTitle.setVisibility(View.GONE); } // renew options menu act.invalidateOptionsMenu(); }
From source file:com.keepsafe.switchboard.example.SwitchBoardExampleAppActivity.java
@Override protected void onResume() { super.onResume(); //see if we're in experiment "homeScreenMessage" that we defined on the server if (SwitchBoard.isInExperiment(this, "homeScreenMessage")) { Log.d(TAG, "isInExperiment homeScreen"); //check if the experiment has values. Only needed when passing custom variables if (SwitchBoard.hasExperimentValues(this, "homeScreenMessage")) { Log.d(TAG, "has values"); TextView tv = (TextView) findViewById(R.id.messagebox); tv.setVisibility(View.VISIBLE); //get experiment values JSONObject values = SwitchBoard.getExperimentValueFromJson(this, "homeScreenMessage"); try { //getting the user specific values String message = values.getString("message"); String messageTitle = values.getString("messageTitle"); tv.setText(Html.fromHtml(message)); Log.d(TAG, "set message text in UI"); /* Track the view in your preferred analytics * using messageTitle to track test *//*from w ww . j a v a2 s .c om*/ //tracks when user clicks on HTML link from your A/B test tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { /* Track the click in your preferred analytics * using messageTitle to track test */ } }); } catch (JSONException e) { //catches if your requested JSON object is not in values e.printStackTrace(); } } } }
From source file:com.arconus.dicecommander.ui.dialogs.PowerRollResultDialog.java
private void prepareRollResultDialog(View view) { if (roll.getHasAttackRoll()) { TextView attkRollResult = (TextView) view.findViewById(R.id.attack_roll_result); attkRollResult.setText(String.valueOf(roll.getAttackRollResult())); TextView targetDefense = (TextView) view.findViewById(R.id.attack_roll_target_defense); targetDefense.setText(roll.getTargetDefenseResID()); showCritStatus(view);//from w w w. ja va2 s . co m } else { TextView attackRollTitle = (TextView) view.findViewById(R.id.attack_roll_title); attackRollTitle.setVisibility(View.GONE); LinearLayout attackRollLayout = (LinearLayout) view.findViewById(R.id.attack_roll_result_layout); attackRollLayout.setVisibility(View.GONE); } TextView dmgRollResult = (TextView) view.findViewById(R.id.damage_roll_result); if (roll.getHasDamageRoll()) { dmgRollResult.setText(String.valueOf(roll.getDamageRollResult())); } else { TextView damageRollTitle = (TextView) view.findViewById(R.id.damage_roll_title); damageRollTitle.setVisibility(View.GONE); dmgRollResult.setVisibility(View.GONE); } }
From source file:mil.nga.giat.mage.help.OpensourceItemFragment.java
private void initView(Context context, AttributeSet attrs) { View view = inflate(getContext(), R.layout.fragment_opensource_item, null); if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OpensourceItemFragment); CharSequence name = a.getText(R.styleable.OpensourceItemFragment_name); CharSequence copyright = a.getText(R.styleable.OpensourceItemFragment_copyright); CharSequence license = a.getText(R.styleable.OpensourceItemFragment_license); a.recycle();/*from www .ja v a 2 s . c o m*/ TextView nameTextView = (TextView) view.findViewById(R.id.opensource_item_name); if (StringUtils.isBlank(name)) { nameTextView.setVisibility(View.GONE); } else { nameTextView.setText(name); } TextView copyrightTextView = (TextView) view.findViewById(R.id.opensource_item_copyright); if (StringUtils.isBlank(copyright)) { copyrightTextView.setVisibility(View.GONE); } else { copyrightTextView.setText(copyright); } TextView licenseTextView = (TextView) view.findViewById(R.id.opensource_item_license); if (StringUtils.isBlank(license)) { licenseTextView.setVisibility(View.GONE); } else { licenseTextView.setText(license); } } addView(view); }
From source file:com.aqnote.app.wifianalyzer.about.AboutActivity.java
private void setPackageName() { Configuration configuration = MainContext.INSTANCE.getConfiguration(); if (configuration != null && configuration.isDevelopmentMode()) { TextView textView = (TextView) findViewById(R.id.about_package_name); textView.setText(getPackageName()); textView.setVisibility(View.VISIBLE); }// w w w . j a va 2s . c o m }
From source file:com.giovanniterlingen.windesheim.view.DownloadsActivity.java
public void showEmptyTextview() { TextView empty = view.findViewById(R.id.empty_textview); empty.setVisibility(View.VISIBLE); RecyclerView recyclerView = view.findViewById(R.id.downloads_recyclerview); recyclerView.setVisibility(View.GONE); }
From source file:com.giovanniterlingen.windesheim.view.DownloadsActivity.java
private void hideEmptyTextview() { TextView empty = view.findViewById(R.id.empty_textview); empty.setVisibility(View.GONE); RecyclerView recyclerView = view.findViewById(R.id.downloads_recyclerview); recyclerView.setVisibility(View.VISIBLE); }