List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.gammalabs.wifianalyzer.wifi.AccessPointDetail.java
private void setViewVendorLong(@NonNull View view, @NonNull WiFiAdditional wiFiAdditional) { TextView textVendor = ((TextView) view.findViewById(R.id.vendorLong)); String vendor = wiFiAdditional.getVendorName(); if (StringUtils.isBlank(vendor)) { textVendor.setVisibility(View.GONE); } else {//from w w w . j a va 2s. c om textVendor.setVisibility(View.VISIBLE); textVendor.setText(vendor.substring(0, Math.min(VENDOR_LONG_MAX, vendor.length()))); } }
From source file:ca.rmen.android.palidamuerte.app.poem.detail.PoemDetailFragment.java
private void updateView(final Activity activity, final View rootView) { Log.v(TAG, "updateView"); new AsyncTask<Void, Void, PoemCursor>() { @Override/* w ww .j a v a 2 s . c o m*/ protected PoemCursor doInBackground(Void... params) { if (getArguments().containsKey(ARG_ITEM_ID)) { long poemId = getArguments().getLong(ARG_ITEM_ID); PoemCursor poemCursor = new PoemSelection().id(poemId).query(activity.getContentResolver()); if (poemCursor.moveToFirst()) return poemCursor; poemCursor.close(); } return null; } @Override protected void onPostExecute(PoemCursor poemCursor) { boolean favorite = poemCursor.getIsFavorite(); if (favorite != mIsFavorite) { mIsFavorite = favorite; activity.invalidateOptionsMenu(); } TextView tvTitleView = (TextView) rootView.findViewById(R.id.title); tvTitleView.setText(poemCursor.getTitle()); String preContent = poemCursor.getPreContent(); TextView preContentView = (TextView) rootView.findViewById(R.id.pre_content); preContentView.setVisibility(TextUtils.isEmpty(preContent) ? View.GONE : View.VISIBLE); preContentView.setText(preContent); ((TextView) rootView.findViewById(R.id.content)).setText(poemCursor.getContent()); String poemTypeAndNumber = Poems.getPoemNumberString(activity, poemCursor); TextView tvPoemTypeAndNumber = (TextView) rootView.findViewById(R.id.poem_type_and_number); tvPoemTypeAndNumber.setVisibility(TextUtils.isEmpty(poemTypeAndNumber) ? View.GONE : View.VISIBLE); tvPoemTypeAndNumber.setText(poemTypeAndNumber); String locationDateString = Poems.getLocationDateString(activity, poemCursor); ((TextView) rootView.findViewById(R.id.author)).setText(R.string.author); ((TextView) rootView.findViewById(R.id.location_and_date)).setText(locationDateString); poemCursor.close(); } }.execute(); }
From source file:com.gammalabs.wifianalyzer.wifi.AccessPointDetail.java
private void setViewVendorShort(@NonNull View view, @NonNull WiFiAdditional wiFiAdditional) { TextView textVendorShort = ((TextView) view.findViewById(R.id.vendorShort)); String vendor = wiFiAdditional.getVendorName(); if (StringUtils.isBlank(vendor)) { textVendorShort.setVisibility(View.GONE); } else {//from w w w. ja va 2s.c om textVendorShort.setVisibility(View.VISIBLE); textVendorShort.setText(vendor.substring(0, Math.min(VENDOR_SHORT_MAX, vendor.length()))); } }
From source file:com.andclient.SetupConnectionActivity.java
private void saveSettingsOnClick(View v) { int keyboardPort = 0, mousePort = 0; EditText et = (EditText) findViewById(R.id.editTextServerIP); String ip = et.getText().toString(); boolean correctIp = InetAddressUtils.isIPv4Address(ip); if (!correctIp) { Toast.makeText(SetupConnectionActivity.this, "Server IP is not a correct IPv4 address", Toast.LENGTH_SHORT).show(); }/*from w w w . j a v a 2 s . c o m*/ et = (EditText) findViewById(R.id.editTextMousePort); String txt = et.getText().toString(); if (txt.length() != 0) { try { mousePort = Integer.parseInt(txt); } catch (NumberFormatException e) { Toast.makeText(SetupConnectionActivity.this, "Mouse port is not a number", Toast.LENGTH_SHORT) .show(); } if (mousePort < 0) { Toast.makeText(SetupConnectionActivity.this, "Mouse port must be greater than 0", Toast.LENGTH_SHORT).show(); } } et = (EditText) findViewById(R.id.editTextKeyboardPort); txt = et.getText().toString(); if (txt.length() != 0) { try { keyboardPort = Integer.parseInt(txt); } catch (NumberFormatException e) { Toast.makeText(SetupConnectionActivity.this, "Keyboard port must be an integer", Toast.LENGTH_SHORT) .show(); } if (keyboardPort < 0) { Toast.makeText(SetupConnectionActivity.this, "Keyboard port must be greater than 0", Toast.LENGTH_SHORT).show(); } } if (correctIp && mousePort > 0 && keyboardPort > 0) { SharedPreferences.Editor editor = mSettings.edit(); editor.putString(StartActivity.PREF_SERVER_IP, ip).putInt(StartActivity.PREF_MOUSE_PORT, mousePort) .putInt(StartActivity.PREF_KEYBOARD_PORT, keyboardPort); editor.commit(); TextView tv = (TextView) findViewById(R.id.textViewSaveData); tv.setTextColor(Color.GREEN); tv.setText("Settings saved."); tv.setVisibility(View.VISIBLE); } else { TextView tv = (TextView) findViewById(R.id.textViewSaveData); tv.setText("Incorrect input data."); tv.setTextColor(Color.RED); tv.setVisibility(View.VISIBLE); } }
From source file:com.microsoft.onedrive.apiexplorer.DeltaFragment.java
/** * Refresh the UI//from w ww . ja va2 s. c o m */ private void refresh() { if (getView() != null) { getView().findViewById(android.R.id.progress).setVisibility(View.VISIBLE); final TextView jsonView = (TextView) getView().findViewById(R.id.json); jsonView.setVisibility(View.INVISIBLE); jsonView.setText(""); mCurrentPagesCount.set(0); } final String deltaToken = getDeltaInfo().getString(mItemId, null); final Activity activity = getActivity(); ((BaseApplication) activity.getApplication()).getOneDriveClient().getDrive().getItems(mItemId) .getDelta(deltaToken).buildRequest().select("id,name,deleted").get(pageHandler()); }
From source file:com.dwdesign.tweetings.adapter.UserAutoCompleteAdapter.java
@Override public void bindView(final View view, final Context context, final Cursor cursor) { if (mCursorClosed) return;/*from w w w . ja v a2 s .c om*/ super.bindView(view, context, cursor); if (mLookupText != null) { String statusText = cursor.getString(mStatusText); String finalUrl = statusText; SpannableString spannable = new SpannableString(statusText); final Matcher matcher = Regex.VALID_HASHTAG.matcher(spannable); while (matcher.find()) { final String url = matcherGroup(matcher, Regex.VALID_HASHTAG_GROUP_HASHTAG_FULL); if (url.toLowerCase().startsWith(mLookupText.toLowerCase())) { finalUrl = url; //break; } } final ImageView image_view = (ImageView) view.findViewById(android.R.id.icon); image_view.setVisibility(View.GONE); TextView text_view1 = (TextView) view.findViewById(android.R.id.text1); text_view1.setText(finalUrl); TextView text_view2 = (TextView) view.findViewById(android.R.id.text2); text_view2.setVisibility(View.GONE); //text_view2.setText(cursor.getString(mStatusText)); } else { final ImageView image_view = (ImageView) view.findViewById(android.R.id.icon); image_view.setVisibility(mDisplayProfileImage ? View.VISIBLE : View.GONE); if (mDisplayProfileImage && mProfileImageLoader != null) { final String profile_image_url_string = cursor.getString(mProfileImageUrlIdx); mProfileImageLoader.displayProfileImage(image_view, cursor.getString(mProfileImageUrlIdx)); if (mDisplayHiResProfileImage) { mProfileImageLoader.displayProfileImage(image_view, getBiggerTwitterProfileImage(profile_image_url_string)); } else { mProfileImageLoader.displayProfileImage(image_view, profile_image_url_string); } } TextView text_view1 = (TextView) view.findViewById(android.R.id.text1); text_view1.setText(cursor.getString(mScreenNameIdx)); TextView text_view2 = (TextView) view.findViewById(android.R.id.text2); text_view2.setText(cursor.getString(mScreenNameIdx)); } }
From source file:com.foursquare.android.fakecheckin.MainActivity.java
/** * Update the UI. If we already fetched a token, we'll just show a success * message.//from ww w . j ava2 s . c o m */ private void ensureUi() { boolean isAuthorized = !TextUtils.isEmpty(ExampleTokenStore.get().getToken()); TextView tvMessage = (TextView) findViewById(R.id.tvMessage); tvMessage.setVisibility(isAuthorized ? View.VISIBLE : View.GONE); Button btnLogin = (Button) findViewById(R.id.btnLogin); btnLogin.setVisibility(isAuthorized ? View.GONE : View.VISIBLE); btnLogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Start the native auth flow. Intent intent = FoursquareOAuth.getConnectIntent(MainActivity.this, CLIENT_ID); // If the device does not have the Foursquare app installed, // we'd // get an intent back that would open the Play Store for // download. // Otherwise we start the auth flow. if (FoursquareOAuth.isPlayStoreIntent(intent)) { toastMessage(MainActivity.this, getString(R.string.app_not_installed_message)); startActivity(intent); } else { startActivityForResult(intent, REQUEST_CODE_FSQ_CONNECT); } } }); if (isAuthorized) { prefsEditor.putString("accessToken", Venue.ACCESS_TOKEN); prefsEditor.commit(); Intent in = new Intent(this, CheckIn.class); startActivity(in); this.finish(); } }
From source file:com.foursquare.android.masscheckin.MainActivity.java
/** * Update the UI. If we already fetched a token, we'll just show a success * message.//from w w w . j a v a 2 s . co m */ private void ensureUi() { boolean isAuthorized = !TextUtils.isEmpty(ExampleTokenStore.get().getToken()); TextView tvMessage = (TextView) findViewById(R.id.tvMessage); tvMessage.setVisibility(isAuthorized ? View.VISIBLE : View.GONE); Button btnLogin = (Button) findViewById(R.id.btnLogin); btnLogin.setVisibility(isAuthorized ? View.GONE : View.VISIBLE); btnLogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Start the native auth flow. Intent intent = FoursquareOAuth.getConnectIntent(MainActivity.this, CLIENT_ID); // If the device does not have the Foursquare app installed, // we'd // get an intent back that would open the Play Store for // download. // Otherwise we start the auth flow. if (FoursquareOAuth.isPlayStoreIntent(intent)) { toastMessage(MainActivity.this, getString(R.string.app_not_installed_message)); startActivity(intent); } else { startActivityForResult(intent, REQUEST_CODE_FSQ_CONNECT); } } }); if (isAuthorized) { prefsEditor.putString("accessToken", Venue.ACCESS_TOKEN); prefsEditor.commit(); Intent in = new Intent(this, CheckInActivity.class); startActivity(in); this.finish(); } }
From source file:com.example.android.fingerprintdialog.MainActivity.java
private void showConfirmation(byte[] encrypted) { findViewById(R.id.confirmation_message).setVisibility(View.VISIBLE); if (encrypted != null) { TextView v = (TextView) findViewById(R.id.encrypted_message); v.setVisibility(View.VISIBLE); v.setText(Base64.encodeToString(encrypted, 0 /* flags */)); }/*from w w w. j a v a 2 s . c om*/ }
From source file:com.aqnote.app.wifianalyzer.wifi.AccessPointsDetail.java
void setView(@NonNull Resources resources, @NonNull View view, @NonNull WiFiDetail wiFiDetail, boolean isChild) { TextView textSSID = (TextView) view.findViewById(R.id.ssid); textSSID.setText(wiFiDetail.getTitle()); view.findViewById(R.id.ipAddress).setVisibility(View.GONE); view.findViewById(R.id.linkSpeed).setVisibility(View.GONE); ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage); WiFiAdditional wiFiAdditional = wiFiDetail.getWiFiAdditional(); if (wiFiAdditional.isConfiguredNetwork()) { configuredImage.setVisibility(View.VISIBLE); configuredImage.setColorFilter(resources.getColor(R.color.connected)); } else {//from w w w. java 2s. c o m 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(wiFiSignal.getLevel() + "dBm"); textLevel.setTextColor(resources.getColor(strength.colorResource())); ((TextView) view.findViewById(R.id.channel)).setText(wiFiSignal.getChannelDisplay()); ((TextView) view.findViewById(R.id.primaryFrequency)) .setText(wiFiSignal.getPrimaryFrequency() + WifiInfo.FREQUENCY_UNITS); ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance())); ((TextView) view.findViewById(R.id.channel_frequency_range)) .setText(wiFiSignal.getFrequencyStart() + " - " + wiFiSignal.getFrequencyEnd()); ((TextView) view.findViewById(R.id.width)) .setText("(" + wiFiSignal.getWiFiWidth().getFrequencyWidth() + WifiInfo.FREQUENCY_UNITS + ")"); ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities()); TextView textVendor = ((TextView) view.findViewById(R.id.vendor)); String vendor = wiFiAdditional.getVendorName(); if (StringUtils.isBlank(vendor)) { textVendor.setVisibility(View.GONE); } else { textVendor.setVisibility(View.VISIBLE); textVendor.setText(vendor.substring(0, Math.min(VENDOR_NAME_MAX, vendor.length()))); } if (isChild) { view.findViewById(R.id.tab).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.tab).setVisibility(View.GONE); } }