List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.asburymotors.android.disneysocal.ui.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true);// ww w . j ava 2 s . c o m View view = inflater.inflate(R.layout.fragment_detail, container, false); String attractionName = getArguments().getString(EXTRA_ATTRACTION); mAttraction = findAttraction(attractionName); if (mAttraction == null) { getActivity().finish(); return null; } TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView); TextView descTextView = (TextView) view.findViewById(R.id.descriptionTextView); TextView distanceTextView = (TextView) view.findViewById(R.id.distanceTextView); ImageView imageView = (ImageView) view.findViewById(R.id.imageView); FloatingActionButton mapFab = (FloatingActionButton) view.findViewById(R.id.mapFab); LatLng location = Utils.getLocation(getActivity()); String distance = Utils.formatDistanceBetween(location, mAttraction.location); if (TextUtils.isEmpty(distance)) { distanceTextView.setVisibility(View.GONE); } nameTextView.setText(attractionName); distanceTextView.setText(distance); descTextView.setText(mAttraction.longDescription); int imageSize = getResources().getDimensionPixelSize(R.dimen.image_size) * Constants.IMAGE_ANIM_MULTIPLIER; Glide.with(getActivity()).load(mAttraction.imageUrl).diskCacheStrategy(DiskCacheStrategy.SOURCE) .placeholder(R.color.lighter_gray).override(imageSize, imageSize).into(imageView); mapFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri .parse(Constants.MAPS_INTENT_URI + Uri.encode(mAttraction.name + ", " + mAttraction.city))); startActivity(intent); } }); return view; }
From source file:com.example.android.xyztouristattractions.ui.ToursListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true);/*from ww w. j av a 2 s.com*/ View view = inflater.inflate(R.layout.parc_detail, container, false); String attractionName = getArguments().getString(EXTRA_ATTRACTION); mAttraction = findAttraction(attractionName); if (mAttraction == null) { getActivity().finish(); return null; } TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView); TextView descTextView = (TextView) view.findViewById(R.id.descriptionTextView); TextView numeriUtiliTextView = (TextView) view.findViewById(R.id.numeriUtiliTextView); TextView distanceTextView = (TextView) view.findViewById(R.id.distanceTextView); ImageView imageView = (ImageView) view.findViewById(R.id.imageView); FloatingActionButton mapFab = (FloatingActionButton) view.findViewById(R.id.mapFab); LatLng location = Utils.getLocation(getActivity()); String distance = Utils.formatDistanceBetween(location, mAttraction.location); if (TextUtils.isEmpty(distance)) { distanceTextView.setVisibility(View.GONE); } nameTextView.setText(attractionName); distanceTextView.setText(distance); numeriUtiliTextView.setText(mAttraction.numeriUtili); descTextView.setText(mAttraction.longDescription); int imageSize = getResources().getDimensionPixelSize(R.dimen.image_size) * Constants.IMAGE_ANIM_MULTIPLIER; Glide.with(getActivity()).load(mAttraction.secondaryImageUrl).diskCacheStrategy(DiskCacheStrategy.SOURCE) .placeholder(R.color.lighter_gray).override(imageSize, imageSize).into(imageView); mapFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(Constants.MAPS_INTENT_URI + Uri.encode(mAttraction.city))); startActivity(intent); } }); return view; }
From source file:com.irccloud.android.activity.PastebinsActivity.java
private void checkEmpty() { if (adapter.getCount() == 0 && !canLoadMore) { findViewById(android.R.id.list).setVisibility(View.GONE); TextView empty = (TextView) findViewById(android.R.id.empty); empty.setVisibility(View.VISIBLE); empty.setText("You haven't created any pastebins yet."); } else {/*from w ww. j a v a 2s .co m*/ findViewById(android.R.id.list).setVisibility(View.VISIBLE); findViewById(android.R.id.empty).setVisibility(View.GONE); } }
From source file:fr.cph.chicago.adapter.SearchAdapter.java
@Override public final View getView(final int position, View convertView, final ViewGroup parent) { LayoutInflater vi = (LayoutInflater) ChicagoTracker.getAppContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.list_search, null); TextView rounteName = (TextView) convertView.findViewById(R.id.station_name); if (position < mTrains.size()) { final Station station = (Station) getItem(position); Set<TrainLine> lines = station.getLines(); rounteName.setText(station.getName()); LinearLayout stationColorView = (LinearLayout) convertView.findViewById(R.id.station_color); int indice = 0; for (TrainLine tl : lines) { TextView textView = new TextView(mContext); textView.setBackgroundColor(tl.getColor()); textView.setText(" "); textView.setTextSize(mContext.getResources().getDimension(R.dimen.activity_list_station_colors)); stationColorView.addView(textView); if (indice != lines.size()) { textView = new TextView(mContext); textView.setText(""); textView.setPadding(0, 0, (int) mContext.getResources().getDimension(R.dimen.activity_list_station_colors_space), 0);//from w w w. ja v a 2s.c om textView.setTextSize( mContext.getResources().getDimension(R.dimen.activity_list_station_colors)); stationColorView.addView(textView); } indice++; } convertView.setOnClickListener( new FavoritesTrainOnClickListener(mActivity, mContainer, station.getId(), lines)); } else if (position < mTrains.size() + mBuses.size()) { final BusRoute busRoute = (BusRoute) getItem(position); TextView type = (TextView) convertView.findViewById(R.id.train_bus_type); type.setText("B"); rounteName.setText(busRoute.getId() + " " + busRoute.getName()); final TextView loadingTextView = (TextView) convertView.findViewById(R.id.loading_text_view); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadingTextView.setVisibility(LinearLayout.VISIBLE); mActivity.startRefreshAnimation(); new DirectionAsyncTask().execute(busRoute, loadingTextView); } }); } else { final BikeStation bikeStation = (BikeStation) getItem(position); TextView type = (TextView) convertView.findViewById(R.id.train_bus_type); type.setText("D"); rounteName.setText(bikeStation.getName()); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(ChicagoTracker.getAppContext(), BikeStationActivity.class); Bundle extras = new Bundle(); extras.putParcelable("station", bikeStation); intent.putExtras(extras); mActivity.startActivity(intent); mActivity.overridePendingTransition(R.anim.slide_in, R.anim.slide_out); } }); } return convertView; }
From source file:com.daoofdev.weatherday.MainActivity.java
private void setTextForTextViewAndShow(String formatter, Object value, String unitStr, TextView textView) { if (value != null) { textView.setText(String.format(formatter, value.toString(), unitStr)); textView.setVisibility(View.VISIBLE); } else {//from w w w .j a va 2 s . c o m textView.setText(""); textView.setVisibility(View.GONE); } }
From source file:com.example.ramesh.p2pfileshare.ClientActivity.java
public void setClientWifiStatus(String message, boolean enabled) { TextView connectionStatusText = (TextView) findViewById(R.id.client_wifi_status_text); connectionStatusText.setText(message); if (enabled) { discoverPeersButton.setEnabled(true); connectionStatusText.setVisibility(View.INVISIBLE); } else {/*from w ww.jav a 2s .c o m*/ discoverPeersButton.setEnabled(false); connectionStatusText.setVisibility(View.VISIBLE); } }
From source file:com.github.mobile.util.HttpImageGetter.java
private HttpImageGetter show(final TextView view, final CharSequence html, final Object id) { if (TextUtils.isEmpty(html)) return hide(view, id); view.setText(html);// w w w . ja v a 2 s .c o m view.setVisibility(VISIBLE); view.setTag(null); return this; }
From source file:org.anhonesteffort.flock.SubscriptionStripeFragment.java
private void handleSetupFormForEditingCard() { TextView statusView = (TextView) subscriptionActivity.findViewById(R.id.card_subscription_status); statusView.setVisibility(View.VISIBLE); if (AccountStore.getLastChargeFailed(subscriptionActivity)) { statusView.setText(R.string.payment_failed); statusView.setTextColor(getResources().getColor(R.color.error_red)); } else {/*from ww w . jav a 2 s . co m*/ statusView.setText(R.string.subscription_is_active); statusView.setTextColor(getResources().getColor(R.color.success_green)); } EditText cardNumberView = (EditText) subscriptionActivity.findViewById(R.id.card_number); EditText cardExpirationView = (EditText) subscriptionActivity.findViewById(R.id.card_expiration); if (cardInformation.isPresent()) { if (StringUtils.isEmpty(cardNumberView.getText().toString())) cardNumberView.setText("**** **** **** " + cardInformation.get().getCardLastFour()); if (StringUtils.isEmpty(cardExpirationView.getText().toString())) cardExpirationView.setText(cardInformation.get().getCardExpiration()); } Button buttonCancel = (Button) subscriptionActivity.findViewById(R.id.button_card_cancel); Button buttonStartSubscription = (Button) subscriptionActivity.findViewById(R.id.button_card_action); buttonCancel.setVisibility(View.VISIBLE); buttonCancel.setText(R.string.cancel_subscription); buttonCancel.setBackgroundColor(getResources().getColor(R.color.error_red)); buttonCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { handlePromptCancelSubscription(); } }); buttonStartSubscription.setText(R.string.save_card); buttonStartSubscription.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { handleVerifyCardAndPutToServer(); } }); initCardNumberHelper(); initCardExpirationHelper(); }
From source file:com.android.calendar.event.EventLocationAdapter.java
@Override public View getView(final int position, final View convertView, final ViewGroup parent) { View view = convertView;/*from ww w .ja v a 2 s . co m*/ if (view == null) { view = mInflater.inflate(R.layout.location_dropdown_item, parent, false); } final Result result = getItem(position); if (result == null) { return view; } // Update the display name in the item in auto-complete list. TextView nameView = (TextView) view.findViewById(R.id.location_name); if (nameView != null) { if (result.mName == null) { nameView.setVisibility(View.GONE); } else { nameView.setVisibility(View.VISIBLE); nameView.setText(result.mName); } } // Update the address line. TextView addressView = (TextView) view.findViewById(R.id.location_address); if (addressView != null) { addressView.setText(result.mAddress); } // Update the icon. final ImageView imageView = (ImageView) view.findViewById(R.id.icon); if (imageView != null) { if (result.mDefaultIcon == null) { imageView.setVisibility(View.INVISIBLE); } else { imageView.setVisibility(View.VISIBLE); imageView.setImageResource(result.mDefaultIcon); // Save the URI on the view, so we can check against it later when updating // the image. Otherwise the async image update with using 'convertView' above // resulted in the wrong list items being updated. imageView.setTag(result.mContactPhotoUri); if (result.mContactPhotoUri != null) { Bitmap cachedPhoto = mPhotoCache.get(result.mContactPhotoUri); if (cachedPhoto != null) { // Use photo in cache. imageView.setImageBitmap(cachedPhoto); } else { // Asynchronously load photo and update. asyncLoadPhotoAndUpdateView(result.mContactPhotoUri, imageView); } } } } return view; }
From source file:com.digitalobstaclecourse.bluefinder.FindCar.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_find_car, menu); MenuItem _menuItemAction = menu.findItem(R.id.menu_ammo); View actionView = null;/*w w w .j a v a 2s . co m*/ if (_menuItemAction != null) { actionView = _menuItemAction.getActionView(); } else { //Log.e(TAG, "getActionView()"); } assert actionView != null; mActionView = actionView; actionView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //Log.d(TAG, "onclick actionView"); if (get_data_access().hasPurchasedInfiniteUse()) { Toast.makeText(getApplicationContext(), "No need to purchase anything else; you already own infinite uses", Toast.LENGTH_LONG) .show(); } else { DialogFragment newFragment = new BuyInAppDialogFragment(); newFragment.show(getFragmentManager(), "miss"); } } }); TextView uses_remaining_textview = (TextView) actionView.findViewById(R.id.uses_remaining); if (hasInfiniteLicense()) { actionView.findViewById(R.id.infinity_icon).setVisibility(View.VISIBLE); uses_remaining_textview.setVisibility(View.INVISIBLE); uses_remaining_textview.setText(String.format("\u00ec")); } else { actionView.findViewById(R.id.infinity_icon).setVisibility(View.INVISIBLE); uses_remaining_textview.setVisibility(View.VISIBLE); int remaining_locations = getUsesRemaining(); uses_remaining_textview.setText(String.format("%d", remaining_locations)); } return true; }