List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:org.geometerplus.fbreader.plugin.local_opds_scanner.ScanLocalNetworkActivity.java
private void setErrorText(final int errorTextId) { final View listView = findViewById(android.R.id.list); final TextView errorView = (TextView) findViewById(R.id.scan_local_network_error); listView.setVisibility(View.GONE); errorView.setVisibility(View.VISIBLE); errorView.setText(errorTextId);/*w w w .jav a 2 s .c o m*/ }
From source file:org.geometerplus.fbreader.plugin.local_opds_scanner.ScanLocalNetworkActivity.java
private void clear() { getListAdapter().clear();/*from www . ja va 2 s . c om*/ final View listView = findViewById(android.R.id.list); final TextView errorView = (TextView) findViewById(R.id.scan_local_network_error); listView.setVisibility(View.VISIBLE); errorView.setVisibility(View.GONE); }
From source file:tr.com.turkcellteknoloji.turkcellupdater.UpdaterDialogManager.java
@SuppressLint("NewApi") private static View createMessageDialogContentsView(Activity activity, MessageDescription messageDescription) { Context context = activity;// w w w .j ava 2 s.c o m final AlertDialog.Builder builder; // Workaround for dialog theme problems if (android.os.Build.VERSION.SDK_INT > 10) { builder = new AlertDialog.Builder(context); context = builder.getContext(); } else { context = new ContextThemeWrapper(context, android.R.style.Theme_Dialog); builder = new AlertDialog.Builder(context); } builder.setTitle("Send feedback"); final LayoutInflater inflater = LayoutInflater.from(context); final View dialogContentsView = inflater.inflate(R.layout.updater_dialog_message, null, false); final TextView textView = (TextView) dialogContentsView.findViewById(R.id.dialog_update_message_text); final ImageView imageView = (ImageView) dialogContentsView.findViewById(R.id.dialog_update_message_image); final ViewSwitcher switcher = (ViewSwitcher) dialogContentsView .findViewById(R.id.dialog_update_message_switcher); String messageText = null; String imageUrl = null; if (messageDescription != null) { messageText = messageDescription.get(MessageDescription.KEY_MESSAGE); imageUrl = messageDescription.get(MessageDescription.KEY_IMAGE_URL); } if (Utilities.isNullOrEmpty(messageText)) { textView.setVisibility(View.GONE); } else { textView.setText(messageText); } if (Utilities.isNullOrEmpty(imageUrl)) { switcher.setVisibility(View.GONE); } else { URI uri; try { uri = new URI(imageUrl); } catch (URISyntaxException e) { uri = null; } if (uri != null) { DownloadRequest request = new DownloadRequest(); request.setUri(uri); request.setDownloadHandler(new DownloadHandler() { @Override public void onSuccess(byte[] result) { // Load image from byte array final Bitmap bitmap = BitmapFactory.decodeByteArray(result, 0, result.length); imageView.setImageBitmap(bitmap); // Hide progress bar and display image if (switcher != null) { switcher.setDisplayedChild(1); } } @Override public void onProgress(Integer percent) { } @Override public void onFail(Exception ex) { Log.e("Message image couldn't be loaded", ex); } @Override public void onCancelled() { } }); HttpClient client = Utilities.createClient("Turkcell Updater/1.0 ", false); try { request.executeAsync(client); } catch (Exception e) { Log.e("Message image couldn't be loaded", e); } } else { switcher.setVisibility(View.GONE); } } return dialogContentsView; }
From source file:com.eyekabob.ArtistInfo.java
/** * This method is called after the last.fm response is received. It will * parse the XML document response and put attributes on the Artist object. */// w w w. j a va 2 s. c om protected void handleArtistResponse(JSONObject response) { try { JSONObject jsonArtist = response.optJSONObject("artist"); if (jsonArtist == null) { Toast.makeText(this, R.string.no_results, Toast.LENGTH_SHORT).show(); artistInfoReturned = true; dismissDialogIfReady(); return; } artist.setName(jsonArtist.getString("name")); artist.setMbid(jsonArtist.getString("mbid")); artist.setUrl(jsonArtist.getString("url")); JSONObject jsonImage = EyekabobHelper.LastFM.getLargestJSONImage(jsonArtist.getJSONArray("image")); // Get artist image, if one exists. if (null != jsonImage) { new ArtistImageTask().execute(new URL(jsonImage.getString("#text"))); } else { imageInfoReturned = true; dismissDialogIfReady(); } JSONObject bio = jsonArtist.getJSONObject("bio"); artist.setSummary(bio.getString("summary")); artist.setContent(bio.getString("content")); } catch (JSONException e) { Log.e(getClass().getName(), "", e); } catch (MalformedURLException e) { Log.e(getClass().getName(), "", e); } TextView artistNameView = (TextView) findViewById(R.id.infoMainHeader); artistNameView.setText(artist.getName()); if (!(artist.getSummary() == null) && !artist.getSummary().equals("")) { TextView bioHeaderView = (TextView) findViewById(R.id.infoBioHeader); // TODO: I18N bioHeaderView.setText("Bio"); TextView bioView = (TextView) findViewById(R.id.infoBioContent); String contentHtml = artist.getSummary(); bioView.setText(Html.fromHtml(contentHtml)); bioView.setVisibility(View.VISIBLE); } if (!(artist.getContent() == null) && !artist.getContent().equals("")) { ToggleButton tb = (ToggleButton) findViewById(R.id.infoBioToggleButton); tb.setVisibility(View.VISIBLE); } artistInfoReturned = true; dismissDialogIfReady(); }
From source file:com.android.browser.GearsBaseDialog.java
/** * Utility method to set a text./*from w ww. ja v a 2 s .com*/ */ void setText(View v, int rsc, CharSequence text) { if (rsc == 0) { return; } View view = v.findViewById(rsc); if (view != null) { TextView textView = (TextView) view; textView.setText(text); textView.setVisibility(View.VISIBLE); } }
From source file:com.github.mobile.util.HttpImageGetter.java
private HttpImageGetter hide(final TextView view, final Object id) { view.setText(null);// ww w. j av a2 s .c om view.setVisibility(GONE); view.setTag(null); return this; }
From source file:com.frostwire.android.gui.adapters.SearchResultListAdapter.java
private void populateFilePart(View view, FileSearchResult sr) { ImageView fileTypeIcon = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon); fileTypeIcon.setImageResource(getFileTypeIconId()); TextView adIndicator = findView(view, R.id.view_bittorrent_search_result_list_item_ad_indicator); adIndicator.setVisibility(View.GONE); TextView title = findView(view, R.id.view_bittorrent_search_result_list_item_title); title.setText(sr.getDisplayName());/* www .j a v a2 s . com*/ TextView fileSize = findView(view, R.id.view_bittorrent_search_result_list_item_file_size); if (sr.getSize() > 0) { fileSize.setText(UIUtils.getBytesInHuman(sr.getSize())); } else { fileSize.setText("..."); } TextView extra = findView(view, R.id.view_bittorrent_search_result_list_item_text_extra); extra.setText(FilenameUtils.getExtension(sr.getFilename())); TextView seeds = findView(view, R.id.view_bittorrent_search_result_list_item_text_seeds); seeds.setText(""); String license = sr.getLicense().equals(Licenses.UNKNOWN) ? "" : " - " + sr.getLicense(); TextView sourceLink = findView(view, R.id.view_bittorrent_search_result_list_item_text_source); sourceLink.setText(sr.getSource() + license); // TODO: ask for design sourceLink.setTag(sr.getDetailsUrl()); sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); sourceLink.setOnClickListener(linkListener); }
From source file:com.app.blockydemo.content.bricks.SetVariableBrick.java
@Override public View getView(final Context context, int brickId, BaseAdapter baseAdapter) { if (animationState) { return view; }//from w w w . j a va 2 s. c o m if (view == null) { alphaValue = 255; } view = View.inflate(context, R.layout.brick_set_variable, null); view = getViewWithAlpha(alphaValue); setCheckboxView(R.id.brick_set_variable_checkbox); final Brick brickInstance = this; checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { checked = isChecked; adapter.handleCheck(brickInstance, isChecked); } }); TextView prototypeText = (TextView) view.findViewById(R.id.brick_set_variable_prototype_view); TextView textField = (TextView) view.findViewById(R.id.brick_set_variable_edit_text); prototypeText.setVisibility(View.GONE); variableFormula.setTextFieldId(R.id.brick_set_variable_edit_text); variableFormula.refreshTextField(view); textField.setVisibility(View.VISIBLE); textField.setOnClickListener(this); Spinner variableSpinner = (Spinner) view.findViewById(R.id.set_variable_spinner); UserVariableAdapter userVariableAdapter = ProjectManager.getInstance().getCurrentProject() .getUserVariables().createUserVariableAdapter(context, sprite); UserVariableAdapterWrapper userVariableAdapterWrapper = new UserVariableAdapterWrapper(context, userVariableAdapter); userVariableAdapterWrapper.setItemLayout(android.R.layout.simple_spinner_item, android.R.id.text1); variableSpinner.setAdapter(userVariableAdapterWrapper); if (!(checkbox.getVisibility() == View.VISIBLE)) { variableSpinner.setClickable(true); variableSpinner.setEnabled(true); } else { variableSpinner.setClickable(false); variableSpinner.setFocusable(false); } setSpinnerSelection(variableSpinner, null); variableSpinner.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { if (((Spinner) view).getSelectedItemPosition() == 0 && ((Spinner) view).getAdapter().getCount() == 1) { NewVariableDialog dialog = new NewVariableDialog((Spinner) view); dialog.addVariableDialogListener(SetVariableBrick.this); dialog.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(), NewVariableDialog.DIALOG_FRAGMENT_TAG); return true; } } return false; } }); variableSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position == 0 && ((UserVariableAdapterWrapper) parent.getAdapter()).isTouchInDropDownView()) { NewVariableDialog dialog = new NewVariableDialog((Spinner) parent); dialog.addVariableDialogListener(SetVariableBrick.this); dialog.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(), NewVariableDialog.DIALOG_FRAGMENT_TAG); } ((UserVariableAdapterWrapper) parent.getAdapter()).resetIsTouchInDropDownView(); userVariable = (UserVariable) parent.getItemAtPosition(position); adapterView = parent; } @Override public void onNothingSelected(AdapterView<?> arg0) { userVariable = null; } }); return view; }
From source file:org.npr.android.news.StationListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View line = super.getView(position, convertView, parent); Station station = getItem(position); TextView name = (TextView) line.findViewById(R.id.StationItemNameText); name.setText(Html.fromHtml(station.getName())); TextView location = (TextView) line.findViewById(R.id.StationItemLocationText); location.setText(Html.fromHtml(station.getMarketCity())); TextView frequency = (TextView) line.findViewById(R.id.StationItemFrequencyText); if (station.getFrequency() != null && station.getBand() != null) { frequency.setText(Html.fromHtml(String.format("%s %s", station.getFrequency(), station.getBand()))); } else {/*from www . ja va 2 s .c o m*/ frequency.setText(""); } if (favoriteStationsRepository != null) { TextView preset = (TextView) line.findViewById(R.id.StationPresetView); FavoriteStationEntry favoriteStationEntry = favoriteStationsRepository .getFavoriteStationForStationId(station.getId()); if (favoriteStationEntry != null && favoriteStationEntry.preset != null) { preset.setText(favoriteStationEntry.preset); preset.setVisibility(View.VISIBLE); } else { preset.setVisibility(View.INVISIBLE); } } return line; }
From source file:com.android.browser.GearsBaseDialog.java
/** * Utility method to set a text.//from w ww . j av a 2 s. co m */ void setText(View v, int rsc, int txtRsc) { if (rsc == 0) { return; } View view = v.findViewById(rsc); if (view != null) { TextView textView = (TextView) view; if (txtRsc == 0) { textView.setVisibility(View.GONE); } else { CharSequence text = getString(txtRsc); textView.setText(text); textView.setVisibility(View.VISIBLE); } } }