List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.glabs.homegenie.adapters.MediaRendererWidgetAdapter.java
@Override public void updateViewModel() { if (_module.View == null) return;//from ww w . ja v a2 s. c om _updateRendererDisplayData(); TextView title = (TextView) _module.View.findViewById(R.id.titleText); TextView subtitle = (TextView) _module.View.findViewById(R.id.subtitleText); TextView infotext = (TextView) _module.View.findViewById(R.id.infoText); title.setText(_module.getDisplayName()); infotext.setVisibility(View.GONE); subtitle.setText(Control.getUpnpDisplayName(_module)); // if (_module.getParameter("UPnP.StandardDeviceType") != null && !_module.getParameter("UPnP.StandardDeviceType").Value.trim().equals("")) { infotext.setText(_module.getParameter("UPnP.StandardDeviceType").Value); infotext.setVisibility(View.VISIBLE); } // final ImageView image = (ImageView) _module.View.findViewById(R.id.iconImage); if (image.getTag() == null && !(image.getDrawable() instanceof AsyncImageDownloadTask.DownloadedDrawable)) { AsyncImageDownloadTask asyncDownloadTask = new AsyncImageDownloadTask(image, true, new AsyncImageDownloadTask.ImageDownloadListener() { @Override public void imageDownloadFailed(String imageUrl) { } @Override public void imageDownloaded(String imageUrl, Bitmap downloadedImage) { image.setTag("CACHED"); } }); asyncDownloadTask.download(Control.getHgBaseHttpAddress() + getModuleIcon(_module), image); } }
From source file:com.example.android.saddacampus.MainActivity.java
public void updateHotCount(final int new_hot_number, View view) { TextView txtViewCount = (TextView) view.findViewById(R.id.txtCount); int c = new_hot_number; if (c < 0) return;//from w w w . j a v a 2s. c om else if (c == 0) { txtViewCount.setVisibility(View.VISIBLE); txtViewCount.setText(Integer.toString(c)); } else { txtViewCount.setVisibility(View.VISIBLE); txtViewCount.setText(Integer.toString(c)); } }
From source file:com.vrem.wifianalyzer.wifi.AccessPointsDetail.java
public void setView(@NonNull Resources resources, @NonNull View view, @NonNull WiFiDetail wiFiDetail, boolean child, boolean frequencyRange) { ((TextView) view.findViewById(R.id.ssid)).setText(wiFiDetail.getTitle()); TextView textIPAddress = (TextView) view.findViewById(R.id.ipAddress); TextView textLinkSpeed = (TextView) view.findViewById(R.id.linkSpeed); String ipAddress = wiFiDetail.getWiFiAdditional().getIPAddress(); if (StringUtils.isBlank(ipAddress)) { textIPAddress.setVisibility(View.GONE); textLinkSpeed.setVisibility(View.GONE); } else {//from w ww . j a v a2 s.com textIPAddress.setVisibility(View.VISIBLE); textIPAddress.setText(ipAddress); int linkSpeed = wiFiDetail.getWiFiAdditional().getLinkSpeed(); if (linkSpeed == WiFiConnection.LINK_SPEED_INVALID) { textLinkSpeed.setVisibility(View.GONE); } else { textLinkSpeed.setVisibility(View.VISIBLE); textLinkSpeed.setText(String.format("%d%s", linkSpeed, WifiInfo.LINK_SPEED_UNITS)); } } ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage); if (wiFiDetail.getWiFiAdditional().isConfiguredNetwork()) { configuredImage.setVisibility(View.VISIBLE); configuredImage.setColorFilter(resources.getColor(R.color.connected)); } else { configuredImage.setVisibility(View.GONE); } WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); ImageView imageView = (ImageView) view.findViewById(R.id.levelImage); imageView.setImageResource(strength.imageResource()); imageView.setColorFilter(resources.getColor(strength.colorResource())); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage.setColorFilter(resources.getColor(R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(R.id.level); textLevel.setText(String.format("%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(resources.getColor(strength.colorResource())); ((TextView) view.findViewById(R.id.channel)) .setText(String.format("%d", wiFiSignal.getWiFiChannel().getChannel())); ((TextView) view.findViewById(R.id.frequency)) .setText(String.format("%d%s", wiFiSignal.getFrequency(), WifiInfo.FREQUENCY_UNITS)); ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance())); ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities()); TextView textVendor = ((TextView) view.findViewById(R.id.vendor)); String vendor = wiFiDetail.getWiFiAdditional().getVendorName(); if (StringUtils.isBlank(vendor)) { textVendor.setVisibility(View.GONE); } else { textVendor.setVisibility(View.VISIBLE); textVendor.setText(vendor); } if (child) { view.findViewById(R.id.tab).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.tab).setVisibility(View.GONE); } if (frequencyRange) { view.findViewById(R.id.channel_frequency_range_row).setVisibility(View.VISIBLE); ((TextView) view.findViewById(R.id.channel_frequency_range)).setText(String.format("%d - %d %s", wiFiSignal.getFrequencyStart(), wiFiSignal.getFrequencyEnd(), WifiInfo.FREQUENCY_UNITS)); } else { view.findViewById(R.id.channel_frequency_range_row).setVisibility(View.GONE); } }
From source file:com.cerema.cloud2.ui.preview.FileDownloadFragment.java
/** * Enables or disables buttons for a file being downloaded *//*from w w w .j a v a 2s . c o m*/ private void setButtonsForTransferring() { getView().findViewById(R.id.cancelBtn).setVisibility(View.VISIBLE); // show the progress bar for the transfer getView().findViewById(R.id.progressBar).setVisibility(View.VISIBLE); TextView progressText = (TextView) getView().findViewById(R.id.progressText); progressText.setText(R.string.downloader_download_in_progress_ticker); 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:com.mobileobservinglog.AvailableCatalogsTab.java
/** * Internal method to handle preparation of the list view upon creation or to be called by setLayout when session mode changes or onResume. *///from w ww . j a v a 2s . c o m protected void prepareListView() { super.prepareListView(); if (availableCatalogList.size() == 0) { submitButton.setVisibility(View.GONE); TextView nothingLeft = (TextView) findViewById(R.id.nothing_left); nothingLeft.setText(R.string.no_available_catalogs); nothingLeft.setVisibility(0); } else { setListAdapter(new CatalogAdapter(this, settingsRef.getAddCatalogsListLayout(), availableCatalogList)); } }
From source file:eu.operando.operandoapp.wifi.AccessPointsDetail.java
public void setView(@NonNull Resources resources, @NonNull View view, @NonNull final WiFiDetail wiFiDetail) { TextView ssidLabel = (TextView) view.findViewById(R.id.ssid); ssidLabel.setText(wiFiDetail.getTitle()); TextView textLinkSpeed = (TextView) view.findViewById(R.id.linkSpeed); textLinkSpeed.setTextColor(Color.BLACK); String ipAddress = wiFiDetail.getWiFiAdditional().getIPAddress(); boolean isConnected = StringUtils.isNotBlank(ipAddress); if (!isConnected) { textLinkSpeed.setVisibility(View.GONE); ssidLabel.setTextColor(resources.getColor(android.R.color.black)); } else {/*from w w w.ja v a 2 s. c om*/ ssidLabel.setTextColor(resources.getColor(R.color.connected)); int linkSpeed = wiFiDetail.getWiFiAdditional().getLinkSpeed(); if (linkSpeed == WiFiConnection.LINK_SPEED_INVALID) { textLinkSpeed.setVisibility(View.GONE); } else { textLinkSpeed.setVisibility(View.VISIBLE); textLinkSpeed.setText(String.format("%d%s", linkSpeed, WifiInfo.LINK_SPEED_UNITS)); } } WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); ImageView imageView = (ImageView) view.findViewById(R.id.levelImage); imageView.setImageResource(strength.imageResource()); imageView.setColorFilter(resources.getColor(strength.colorResource())); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage.setColorFilter(resources.getColor(R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(R.id.level); textLevel.setText(String.format("%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(Color.BLACK); //textLevel.setTextColor(resources.getColor(strength.colorResource())); ((TextView) view.findViewById(R.id.channel)) .setText(String.format("%d", wiFiSignal.getWiFiChannel().getChannel())); ((TextView) view.findViewById(R.id.frequency)) .setText(String.format("%d%s", wiFiSignal.getFrequency(), WifiInfo.FREQUENCY_UNITS)); ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance())); ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities()); LayoutInflater layoutInflater = mainContext.getLayoutInflater(); final WiFiApConfig wiFiApConfig = wiFiDetail.getWiFiAdditional().getWiFiApConfig(); ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage); if (wiFiApConfig != null) { configuredImage.setVisibility(View.VISIBLE); if (isOperandoCompatible(wiFiApConfig)) { configuredImage.setColorFilter(resources.getColor(android.R.color.holo_green_light)); view.setOnClickListener( new ConfiguredClickListener(context, wiFiDetail, wiFiApConfig, isConnected)); } else { configuredImage.setColorFilter(resources.getColor(android.R.color.holo_red_light)); view.setOnClickListener(new ForgetClickListener(context, wiFiDetail)); } } else { configuredImage.setVisibility(View.GONE); view.setOnClickListener(new ConnectClickListener(context, wiFiDetail, layoutInflater)); } }
From source file:com.starwood.anglerslong.LicenseActivity.java
/****************************************************************************** * Reads in all of the items in that should be populated. ******************************************************************************/ private void populateTabs(boolean isRestart) { try {// w ww .ja v a 2s. co m JsonStorage jsonStorage = new JsonStorage(getApplicationContext()); String wholeString = jsonStorage.loadTabs(); if (!wholeString.equals("")) isLicensePopulated = true; populateLicense(wholeString, isRestart); if (numItems == 0) { isCreateTextViewSet = false; createTextView(); } else { try { TextView tv = (TextView) findViewById(0); if (tv.getVisibility() == View.VISIBLE || numItems > 0) { tv.setVisibility(View.GONE); isCreateTextViewSet = false; } } catch (NullPointerException e) { Log.d("KENNY", "The text view was null."); } } } catch (IOException | JSONException e) { if (!isLicensePopulated) isArrayEmpty = true; createTextView(); e.printStackTrace(); } }
From source file:com.gh4a.fragment.UserFragment.java
private void fillTextView(int id, String text) { TextView view = (TextView) mContentView.findViewById(id); if (!StringUtils.isBlank(text)) { view.setText(text);/*from ww w . j av a 2 s . c o m*/ view.setVisibility(View.VISIBLE); } else { view.setVisibility(View.GONE); } }
From source file:com.enadein.carlogbook.core.BaseActivity.java
protected boolean validateOdometer(int errorViewId, EditText editView) { TextView errorView = (TextView) findViewById(errorViewId); int value = CommonUtils.getOdometerInt(editView); boolean result = value > 0 && value < 1000000; errorView.setVisibility((!result) ? View.VISIBLE : View.GONE); return result; }
From source file:com.jamesgiang.aussnowcam.Utils.java
public static void loadWeather(final Activity a, int i) { final TextView title; final TextView data1; final TextView data2; final TextView data3; final TextView data4; final TextView data5; final TextView data6; title = (TextView) a.findViewById(R.id.weatherTitle); data1 = (TextView) a.findViewById(R.id.data1); data2 = (TextView) a.findViewById(R.id.data2); data3 = (TextView) a.findViewById(R.id.data3); data4 = (TextView) a.findViewById(R.id.data4); data5 = (TextView) a.findViewById(R.id.data5); data6 = (TextView) a.findViewById(R.id.data6); String end_point = getEndPoint(i); if (end_point != null) { BOMClient.get(end_point, null, new JsonHttpResponseHandler() { @Override//from ww w. j av a2 s. c o m public void onSuccess(JSONObject response) { try { JSONObject result = (JSONObject) response.getJSONObject("observations").getJSONArray("data") .get(0); JSONObject header = (JSONObject) response.getJSONObject("observations") .getJSONArray("header").get(0); data1.setVisibility(View.VISIBLE); data2.setVisibility(View.VISIBLE); data3.setVisibility(View.VISIBLE); data4.setVisibility(View.VISIBLE); data5.setVisibility(View.VISIBLE); data6.setVisibility(View.VISIBLE); title.setText("Weather Observations for " + header.getString("name")); if (result.isNull("air_temp")) { data1.setText("Temperature: - "); } else { data1.setText("Temperature: " + result.getString("air_temp")); } if (result.isNull("wind_dir")) { data2.setText("Wind Direction: - "); } else { data2.setText("Wind Direction: " + result.getString("wind_dir")); } if (result.isNull("wind_spd_kmh")) { data3.setText("Wind Speed (km/h): - "); } else { data3.setText("Wind Speed (km/h): " + result.getString("wind_spd_kmh")); } if (result.isNull("gust_kmh")) { data4.setText("Gust Speed (km/h): - "); } else { data4.setText("Gust Speed (km/h): " + result.getString("gust_kmh")); } if (result.isNull("rain_trace")) { data5.setText("Rain since 9am (mm): - "); } else { data5.setText("Rain since 9am (mm): " + result.getString("rain_trace")); } data6.setText(header.getString("refresh_message")); } catch (JSONException e) { title.setText("Weather data not available"); data1.setVisibility(View.GONE); data2.setVisibility(View.GONE); data3.setVisibility(View.GONE); data4.setVisibility(View.GONE); data5.setVisibility(View.GONE); data6.setVisibility(View.GONE); } } }); } else { title.setText("Weather data not available"); data1.setVisibility(View.GONE); data2.setVisibility(View.GONE); data3.setVisibility(View.GONE); data4.setVisibility(View.GONE); data5.setVisibility(View.GONE); data6.setVisibility(View.GONE); } }