Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/ActivityFavorites.java
Show First 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | private class AsyncGetFavorites extends AsyncTask<Void, Void, List<Stop>> { | ||||
@Override | @Override | ||||
protected void onPostExecute(List<Stop> busStops) { | protected void onPostExecute(List<Stop> busStops) { | ||||
// If no data is found show a friendly message | // If no data is found show a friendly message | ||||
if (busStops.size() == 0) { | if (busStops.size() == 0) { | ||||
favoriteListView.setVisibility(View.INVISIBLE); | favoriteListView.setVisibility(View.INVISIBLE); | ||||
TextView favoriteTipTextView = (TextView) findViewById(R.id.favoriteTipTextView); | TextView favoriteTipTextView = (TextView) findViewById(R.id.favoriteTipTextView); | ||||
assert favoriteTipTextView != null; | assert favoriteTipTextView != null; | ||||
favoriteTipTextView.setVisibility(View.VISIBLE); | favoriteTipTextView.setVisibility(View.VISIBLE); | ||||
ImageView angeryBusImageView = (ImageView) findViewById(R.id.angeryBusImageView); | |||||
angeryBusImageView.setVisibility(View.VISIBLE); | |||||
} | } | ||||
/* There's a nice method called notifyDataSetChanged() to avoid building the ListView | /* There's a nice method called notifyDataSetChanged() to avoid building the ListView | ||||
* all over again. This method exists in a billion answers on Stack Overflow, but | * all over again. This method exists in a billion answers on Stack Overflow, but | ||||
* it's nowhere to be seen around here, Android Studio can't find it no matter what. | * it's nowhere to be seen around here, Android Studio can't find it no matter what. | ||||
* Anyway, it only works from Android 2.3 onward (which is why it refuses to appear, I | * Anyway, it only works from Android 2.3 onward (which is why it refuses to appear, I | ||||
* guess) and requires to modify the list with .add() and .clear() and some other | * guess) and requires to modify the list with .add() and .clear() and some other | ||||
* methods, so to update a single stop we need to completely rebuild the list for no | * methods, so to update a single stop we need to completely rebuild the list for no | ||||
Show All 36 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register