Remove redundant type casts.

This commit is contained in:
Andreas Schildbach 2021-01-21 00:11:21 +01:00
parent d2a0d878b8
commit 0f9e241fe8
23 changed files with 150 additions and 150 deletions

View file

@ -76,12 +76,12 @@ public class MyActionBar extends LinearLayout {
backButtonView = findViewById(R.id.action_bar_back_button); backButtonView = findViewById(R.id.action_bar_back_button);
menuButtonView = findViewById(R.id.action_bar_menu_button); menuButtonView = findViewById(R.id.action_bar_menu_button);
titlesGroup = (ViewGroup) findViewById(R.id.action_bar_titles); titlesGroup = findViewById(R.id.action_bar_titles);
primaryTitleView = (TextView) findViewById(R.id.action_bar_primary_title); primaryTitleView = findViewById(R.id.action_bar_primary_title);
secondaryTitleView = (TextView) findViewById(R.id.action_bar_secondary_title); secondaryTitleView = findViewById(R.id.action_bar_secondary_title);
progressView = findViewById(R.id.action_bar_progress); progressView = findViewById(R.id.action_bar_progress);
progressButton = (ImageButton) findViewById(R.id.action_bar_progress_button); progressButton = findViewById(R.id.action_bar_progress_button);
progressImage = (ImageView) findViewById(R.id.action_bar_progress_image); progressImage = findViewById(R.id.action_bar_progress_image);
// Make sure action bar isn't stuck under a transparent status bar. // Make sure action bar isn't stuck under a transparent status bar.
final int statusHeight = res final int statusHeight = res

View file

@ -70,7 +70,7 @@ public abstract class OeffiActivity extends Activity {
listFrame.getLayoutParams().width = listShow && mapShow ? res.getDimensionPixelSize(R.dimen.layout_list_width) listFrame.getLayoutParams().width = listShow && mapShow ? res.getDimensionPixelSize(R.dimen.layout_list_width)
: LinearLayout.LayoutParams.MATCH_PARENT; : LinearLayout.LayoutParams.MATCH_PARENT;
final ViewGroup navigationDrawer = (ViewGroup) findViewById(R.id.navigation_drawer_layout); final ViewGroup navigationDrawer = findViewById(R.id.navigation_drawer_layout);
if (navigationDrawer != null) { if (navigationDrawer != null) {
final View child = navigationDrawer.getChildAt(1); final View child = navigationDrawer.getChildAt(1);
child.getLayoutParams().width = res.getDimensionPixelSize(R.dimen.layout_navigation_drawer_width); child.getLayoutParams().width = res.getDimensionPixelSize(R.dimen.layout_navigation_drawer_width);
@ -111,7 +111,7 @@ public abstract class OeffiActivity extends Activity {
} }
protected final MyActionBar getMyActionBar() { protected final MyActionBar getMyActionBar() {
return (MyActionBar) findViewById(R.id.action_bar); return findViewById(R.id.action_bar);
} }
protected final void setPrimaryColor(final int colorResId) { protected final void setPrimaryColor(final int colorResId) {

View file

@ -296,9 +296,9 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
initNavigation(); initNavigation();
((Button) findViewById(R.id.directions_network_missing_capability_button)) findViewById(R.id.directions_network_missing_capability_button)
.setOnClickListener((OnClickListener) v -> NetworkPickerActivity.start(DirectionsActivity.this)); .setOnClickListener(v -> NetworkPickerActivity.start(DirectionsActivity.this));
connectivityWarningView = (TextView) findViewById(R.id.directions_connectivity_warning_box); connectivityWarningView = findViewById(R.id.directions_connectivity_warning_box);
initLayoutTransitions(); initLayoutTransitions();
@ -310,19 +310,19 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
requestFocusFirst(); requestFocusFirst();
}; };
viewFromLocation = (LocationView) findViewById(R.id.directions_from); viewFromLocation = findViewById(R.id.directions_from);
viewFromLocation.setAdapter(autoCompleteAdapter); viewFromLocation.setAdapter(autoCompleteAdapter);
viewFromLocation.setListener(locationChangeListener); viewFromLocation.setListener(locationChangeListener);
viewFromLocation.setContextMenuItemClickListener(new LocationContextMenuItemClickListener(viewFromLocation, viewFromLocation.setContextMenuItemClickListener(new LocationContextMenuItemClickListener(viewFromLocation,
REQUEST_CODE_LOCATION_PERMISSION_FROM, REQUEST_CODE_PICK_CONTACT_FROM, REQUEST_CODE_PICK_STATION_FROM)); REQUEST_CODE_LOCATION_PERMISSION_FROM, REQUEST_CODE_PICK_CONTACT_FROM, REQUEST_CODE_PICK_STATION_FROM));
viewViaLocation = (LocationView) findViewById(R.id.directions_via); viewViaLocation = findViewById(R.id.directions_via);
viewViaLocation.setAdapter(autoCompleteAdapter); viewViaLocation.setAdapter(autoCompleteAdapter);
viewViaLocation.setListener(locationChangeListener); viewViaLocation.setListener(locationChangeListener);
viewViaLocation.setContextMenuItemClickListener(new LocationContextMenuItemClickListener(viewViaLocation, viewViaLocation.setContextMenuItemClickListener(new LocationContextMenuItemClickListener(viewViaLocation,
REQUEST_CODE_LOCATION_PERMISSION_VIA, REQUEST_CODE_PICK_CONTACT_VIA, REQUEST_CODE_PICK_STATION_VIA)); REQUEST_CODE_LOCATION_PERMISSION_VIA, REQUEST_CODE_PICK_CONTACT_VIA, REQUEST_CODE_PICK_STATION_VIA));
viewToLocation = (LocationView) findViewById(R.id.directions_to); viewToLocation = findViewById(R.id.directions_to);
viewToLocation.setAdapter(autoCompleteAdapter); viewToLocation.setAdapter(autoCompleteAdapter);
viewToLocation.setListener(locationChangeListener); viewToLocation.setListener(locationChangeListener);
viewToLocation.setOnEditorActionListener((v, actionId, event) -> { viewToLocation.setOnEditorActionListener((v, actionId, event) -> {
@ -340,15 +340,15 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
REQUEST_CODE_LOCATION_PERMISSION_TO, REQUEST_CODE_PICK_CONTACT_TO, REQUEST_CODE_PICK_STATION_TO)); REQUEST_CODE_LOCATION_PERMISSION_TO, REQUEST_CODE_PICK_CONTACT_TO, REQUEST_CODE_PICK_STATION_TO));
viewProducts = findViewById(R.id.directions_products); viewProducts = findViewById(R.id.directions_products);
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_i)); viewProductToggles.add(findViewById(R.id.directions_products_i));
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_r)); viewProductToggles.add(findViewById(R.id.directions_products_r));
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_s)); viewProductToggles.add(findViewById(R.id.directions_products_s));
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_u)); viewProductToggles.add(findViewById(R.id.directions_products_u));
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_t)); viewProductToggles.add(findViewById(R.id.directions_products_t));
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_b)); viewProductToggles.add(findViewById(R.id.directions_products_b));
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_p)); viewProductToggles.add(findViewById(R.id.directions_products_p));
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_f)); viewProductToggles.add(findViewById(R.id.directions_products_f));
viewProductToggles.add((ToggleImageButton) findViewById(R.id.directions_products_c)); viewProductToggles.add(findViewById(R.id.directions_products_c));
initProductToggles(); initProductToggles();
final OnLongClickListener productLongClickListener = v -> { final OnLongClickListener productLongClickListener = v -> {
@ -372,9 +372,9 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
for (final View view : viewProductToggles) for (final View view : viewProductToggles)
view.setOnLongClickListener(productLongClickListener); view.setOnLongClickListener(productLongClickListener);
viewBike = (CheckBox) findViewById(R.id.directions_option_bike); viewBike = findViewById(R.id.directions_option_bike);
viewTimeDepArr = (Button) findViewById(R.id.directions_time_dep_arr); viewTimeDepArr = findViewById(R.id.directions_time_dep_arr);
viewTimeDepArr.setOnClickListener(v -> { viewTimeDepArr.setOnClickListener(v -> {
final DialogBuilder builder = DialogBuilder.get(DirectionsActivity.this); final DialogBuilder builder = DialogBuilder.get(DirectionsActivity.this);
builder.setTitle(R.string.directions_set_time_prompt); builder.setTitle(R.string.directions_set_time_prompt);
@ -400,13 +400,13 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
builder.show(); builder.show();
}); });
viewTime1 = (Button) findViewById(R.id.directions_time_1); viewTime1 = findViewById(R.id.directions_time_1);
viewTime2 = (Button) findViewById(R.id.directions_time_2); viewTime2 = findViewById(R.id.directions_time_2);
viewGo = (Button) findViewById(R.id.directions_go); viewGo = findViewById(R.id.directions_go);
viewGo.setOnClickListener(v -> handleGo()); viewGo.setOnClickListener(v -> handleGo());
viewQueryHistoryList = (RecyclerView) findViewById(android.R.id.list); viewQueryHistoryList = findViewById(android.R.id.list);
viewQueryHistoryList.setLayoutManager(new LinearLayoutManager(this)); viewQueryHistoryList.setLayoutManager(new LinearLayoutManager(this));
viewQueryHistoryList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); viewQueryHistoryList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
queryHistoryListAdapter = new QueryHistoryAdapter(this, network, this, this); queryHistoryListAdapter = new QueryHistoryAdapter(this, network, this, this);
@ -430,7 +430,7 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
viewQueryMissingCapability.getPaddingRight(), viewQueryMissingCapability.getPaddingBottom()); viewQueryMissingCapability.getPaddingRight(), viewQueryMissingCapability.getPaddingBottom());
}); });
mapView = (OeffiMapView) findViewById(R.id.directions_map); mapView = findViewById(R.id.directions_map);
if (ContextCompat.checkSelfPermission(DirectionsActivity.this, if (ContextCompat.checkSelfPermission(DirectionsActivity.this,
Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
android.location.Location location = locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER); android.location.Location location = locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
@ -453,7 +453,7 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
pinLocation = Location.coord(Point.fromDouble(p.getLatitude(), p.getLongitude())); pinLocation = Location.coord(Point.fromDouble(p.getLatitude(), p.getLongitude()));
final View view = getLayoutInflater().inflate(R.layout.directions_map_pin, null); final View view = getLayoutInflater().inflate(R.layout.directions_map_pin, null);
final LocationTextView locationView = (LocationTextView) view final LocationTextView locationView = view
.findViewById(R.id.directions_map_pin_location); .findViewById(R.id.directions_map_pin_location);
final View buttonGroup = view.findViewById(R.id.directions_map_pin_buttons); final View buttonGroup = view.findViewById(R.id.directions_map_pin_buttons);
buttonGroup.findViewById(R.id.directions_map_pin_button_from).setOnClickListener(v -> { buttonGroup.findViewById(R.id.directions_map_pin_button_from).setOnClickListener(v -> {
@ -496,7 +496,7 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
((TextView) findViewById(R.id.directions_map_disclaimer)) ((TextView) findViewById(R.id.directions_map_disclaimer))
.setText(mapView.getTileProvider().getTileSource().getCopyrightNotice()); .setText(mapView.getTileProvider().getTileSource().getCopyrightNotice());
final ZoomControls zoom = (ZoomControls) findViewById(R.id.directions_map_zoom); final ZoomControls zoom = findViewById(R.id.directions_map_zoom);
mapView.setZoomControls(zoom); mapView.setZoomControls(zoom);
connectivityReceiver = new ConnectivityBroadcastReceiver(connectivityManager) { connectivityReceiver = new ConnectivityBroadcastReceiver(connectivityManager) {

View file

@ -262,7 +262,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
.setOnClickListener(v -> startActivity(scheduleTripIntent)); .setOnClickListener(v -> startActivity(scheduleTripIntent));
} }
legsGroup = (ViewGroup) findViewById(R.id.directions_trip_details_legs_group); legsGroup = findViewById(R.id.directions_trip_details_legs_group);
updateLocations(); updateLocations();
updateFares(trip.fares); updateFares(trip.fares);
@ -278,10 +278,10 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
((TextView) findViewById(R.id.directions_trip_details_footer)) ((TextView) findViewById(R.id.directions_trip_details_footer))
.setText(Html.fromHtml(getString(R.string.directions_trip_details_realtime))); .setText(Html.fromHtml(getString(R.string.directions_trip_details_realtime)));
final TextView disclaimerSourceView = (TextView) findViewById(R.id.directions_trip_details_disclaimer_source); final TextView disclaimerSourceView = findViewById(R.id.directions_trip_details_disclaimer_source);
updateDisclaimerSource(disclaimerSourceView, network.name(), null); updateDisclaimerSource(disclaimerSourceView, network.name(), null);
mapView = (OeffiMapView) findViewById(R.id.directions_trip_details_map); mapView = findViewById(R.id.directions_trip_details_map);
mapView.setTripAware(new TripAware() { mapView.setTripAware(new TripAware() {
public Trip getTrip() { public Trip getTrip() {
return trip; return trip;
@ -527,16 +527,16 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
} }
private void updateLocations() { private void updateLocations() {
final LocationTextView fromView = (LocationTextView) findViewById(R.id.directions_trip_details_location_from); final LocationTextView fromView = findViewById(R.id.directions_trip_details_location_from);
fromView.setLabel(R.string.directions_overview_from); fromView.setLabel(R.string.directions_overview_from);
fromView.setLocation(trip.from); fromView.setLocation(trip.from);
final LocationTextView toView = (LocationTextView) findViewById(R.id.directions_trip_details_location_to); final LocationTextView toView = findViewById(R.id.directions_trip_details_location_to);
toView.setLabel(R.string.directions_overview_to); toView.setLabel(R.string.directions_overview_to);
toView.setLocation(trip.to); toView.setLocation(trip.to);
} }
private void updateFares(final List<Fare> fares) { private void updateFares(final List<Fare> fares) {
final TableLayout faresTable = (TableLayout) findViewById(R.id.directions_trip_details_fares); final TableLayout faresTable = findViewById(R.id.directions_trip_details_fares);
if (trip.fares != null && !trip.fares.isEmpty()) { if (trip.fares != null && !trip.fares.isEmpty()) {
faresTable.setVisibility(View.VISIBLE); faresTable.setVisibility(View.VISIBLE);
@ -550,7 +550,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
((TextView) fareRow.findViewById(R.id.directions_trip_details_fare_entry_row_name)).setText(fare.name); ((TextView) fareRow.findViewById(R.id.directions_trip_details_fare_entry_row_name)).setText(fare.name);
((TextView) fareRow.findViewById(R.id.directions_trip_details_fare_entry_row_fare)) ((TextView) fareRow.findViewById(R.id.directions_trip_details_fare_entry_row_fare))
.setText(String.format(Locale.US, "%s%.2f", fare.currency.getSymbol(), fare.fare)); .setText(String.format(Locale.US, "%s%.2f", fare.currency.getSymbol(), fare.fare));
final TextView unitView = (TextView) fareRow final TextView unitView = fareRow
.findViewById(R.id.directions_trip_details_fare_entry_row_unit); .findViewById(R.id.directions_trip_details_fare_entry_row_unit);
if (fare.units != null && fare.unitName != null) if (fare.units != null && fare.unitName != null)
unitView.setText(String.format("(%s %s)", fare.units, fare.unitName)); unitView.setText(String.format("(%s %s)", fare.units, fare.unitName));
@ -573,12 +573,12 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
final boolean showBicycleCarriage = leg.line.hasAttr(Line.Attr.BICYCLE_CARRIAGE); final boolean showBicycleCarriage = leg.line.hasAttr(Line.Attr.BICYCLE_CARRIAGE);
final List<Stop> intermediateStops = leg.intermediateStops; final List<Stop> intermediateStops = leg.intermediateStops;
final LineView lineView = (LineView) row.findViewById(R.id.directions_trip_details_public_entry_line); final LineView lineView = row.findViewById(R.id.directions_trip_details_public_entry_line);
lineView.setLine(leg.line); lineView.setLine(leg.line);
if (showDestination || showAccessibility) if (showDestination || showAccessibility)
lineView.setMaxWidth(res.getDimensionPixelSize(R.dimen.line_max_width)); lineView.setMaxWidth(res.getDimensionPixelSize(R.dimen.line_max_width));
final LinearLayout lineGroup = (LinearLayout) row final LinearLayout lineGroup = row
.findViewById(R.id.directions_trip_details_public_entry_line_group); .findViewById(R.id.directions_trip_details_public_entry_line_group);
if (showDestination) if (showDestination)
lineGroup.setBaselineAlignedChildIndex(0); lineGroup.setBaselineAlignedChildIndex(0);
@ -587,7 +587,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
else if (showBicycleCarriage) else if (showBicycleCarriage)
lineGroup.setBaselineAlignedChildIndex(2); lineGroup.setBaselineAlignedChildIndex(2);
final TextView destinationView = (TextView) row final TextView destinationView = row
.findViewById(R.id.directions_trip_details_public_entry_destination); .findViewById(R.id.directions_trip_details_public_entry_destination);
if (destination != null) { if (destination != null) {
destinationView.setVisibility(View.VISIBLE); destinationView.setVisibility(View.VISIBLE);
@ -603,7 +603,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
final View bicycleCarriageView = row.findViewById(R.id.directions_trip_details_public_entry_bicycle_carriage); final View bicycleCarriageView = row.findViewById(R.id.directions_trip_details_public_entry_bicycle_carriage);
bicycleCarriageView.setVisibility(showBicycleCarriage ? View.VISIBLE : View.GONE); bicycleCarriageView.setVisibility(showBicycleCarriage ? View.VISIBLE : View.GONE);
final ToggleImageButton expandButton = (ToggleImageButton) row final ToggleImageButton expandButton = row
.findViewById(R.id.directions_trip_details_public_entry_expand); .findViewById(R.id.directions_trip_details_public_entry_expand);
final Boolean checked = legExpandStates.get(leg); final Boolean checked = legExpandStates.get(leg);
expandButton expandButton
@ -614,7 +614,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
updateGUI(); updateGUI();
}); });
final TableLayout stopsView = (TableLayout) row.findViewById(R.id.directions_trip_details_public_entry_stops); final TableLayout stopsView = row.findViewById(R.id.directions_trip_details_public_entry_stops);
stopsView.removeAllViews(); stopsView.removeAllViews();
final CollapseColumns collapseColumns = new CollapseColumns(); final CollapseColumns collapseColumns = new CollapseColumns();
collapseColumns.dateChanged(now); collapseColumns.dateChanged(now);
@ -658,14 +658,14 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
stopsView.setColumnCollapsed(3, collapseColumns.collapseDelayColumn); stopsView.setColumnCollapsed(3, collapseColumns.collapseDelayColumn);
stopsView.setColumnCollapsed(4, collapseColumns.collapsePositionColumn); stopsView.setColumnCollapsed(4, collapseColumns.collapsePositionColumn);
final TextView messageView = (TextView) row.findViewById(R.id.directions_trip_details_public_entry_message); final TextView messageView = row.findViewById(R.id.directions_trip_details_public_entry_message);
final String message = leg.message != null ? leg.message : leg.line.message; final String message = leg.message != null ? leg.message : leg.line.message;
messageView.setText(message); messageView.setText(message);
messageView.setVisibility(message != null ? View.VISIBLE : View.GONE); messageView.setVisibility(message != null ? View.VISIBLE : View.GONE);
} }
private void updateIndividualLeg(final View row, final Individual leg) { private void updateIndividualLeg(final View row, final Individual leg) {
final TextView textView = (TextView) row.findViewById(R.id.directions_trip_details_individual_entry_text); final TextView textView = row.findViewById(R.id.directions_trip_details_individual_entry_text);
final String distanceStr = leg.distance != 0 ? "(" + leg.distance + "m) " : ""; final String distanceStr = leg.distance != 0 ? "(" + leg.distance + "m) " : "";
final int textResId, iconResId; final int textResId, iconResId;
if (leg.type == Individual.Type.WALK) { if (leg.type == Individual.Type.WALK) {
@ -686,7 +686,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
textView.setText(Html.fromHtml(getString(textResId, leg.min, distanceStr, leg.arrival.uniqueShortName()))); textView.setText(Html.fromHtml(getString(textResId, leg.min, distanceStr, leg.arrival.uniqueShortName())));
textView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0); textView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
final ImageButton mapView = (ImageButton) row.findViewById(R.id.directions_trip_details_individual_entry_map); final ImageButton mapView = row.findViewById(R.id.directions_trip_details_individual_entry_map);
mapView.setVisibility(View.GONE); mapView.setVisibility(View.GONE);
mapView.setOnClickListener(null); mapView.setOnClickListener(null);
if (leg.arrival.hasCoord()) { if (leg.arrival.hasCoord()) {
@ -745,7 +745,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
} }
// name // name
final TextView stopNameView = (TextView) row.findViewById(R.id.directions_trip_details_public_entry_stop_name); final TextView stopNameView = row.findViewById(R.id.directions_trip_details_public_entry_stop_name);
stopNameView.setText(stop.location.uniqueShortName()); stopNameView.setText(stop.location.uniqueShortName());
setStrikeThru(stopNameView, isCancelled); setStrikeThru(stopNameView, isCancelled);
if (highlightLocation) { if (highlightLocation) {
@ -767,14 +767,14 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
stopNameView.setOnClickListener(null); stopNameView.setOnClickListener(null);
// pearl // pearl
final PearlView pearlView = (PearlView) row.findViewById(R.id.directions_trip_details_public_entry_stop_pearl); final PearlView pearlView = row.findViewById(R.id.directions_trip_details_public_entry_stop_pearl);
pearlView.setType(pearlType); pearlView.setType(pearlType);
pearlView.setStyle(style); pearlView.setStyle(style);
pearlView.setFontMetrics(stopNameView.getPaint().getFontMetrics()); pearlView.setFontMetrics(stopNameView.getPaint().getFontMetrics());
// time // time
final TextView stopDateView = (TextView) row.findViewById(R.id.directions_trip_details_public_entry_stop_date); final TextView stopDateView = row.findViewById(R.id.directions_trip_details_public_entry_stop_date);
final TextView stopTimeView = (TextView) row.findViewById(R.id.directions_trip_details_public_entry_stop_time); final TextView stopTimeView = row.findViewById(R.id.directions_trip_details_public_entry_stop_time);
stopDateView.setText(null); stopDateView.setText(null);
stopTimeView.setText(null); stopTimeView.setText(null);
boolean highlightTime = false; boolean highlightTime = false;
@ -796,7 +796,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
+ (isTimePredicted ? Typeface.ITALIC : 0)); + (isTimePredicted ? Typeface.ITALIC : 0));
// delay // delay
final TextView stopDelayView = (TextView) row final TextView stopDelayView = row
.findViewById(R.id.directions_trip_details_public_entry_stop_delay); .findViewById(R.id.directions_trip_details_public_entry_stop_delay);
if (delay != null) { if (delay != null) {
final long delayMins = delay / DateUtils.MINUTE_IN_MILLIS; final long delayMins = delay / DateUtils.MINUTE_IN_MILLIS;
@ -808,7 +808,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
} }
// position // position
final TextView stopPositionView = (TextView) row final TextView stopPositionView = row
.findViewById(R.id.directions_trip_details_public_entry_stop_position); .findViewById(R.id.directions_trip_details_public_entry_stop_position);
if (position != null && !isCancelled) { if (position != null && !isCancelled) {
collapseColumns.collapsePositionColumn = false; collapseColumns.collapsePositionColumn = false;
@ -834,7 +834,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
final View row = inflater.inflate(R.layout.directions_trip_details_public_entry_collapsed, null); final View row = inflater.inflate(R.layout.directions_trip_details_public_entry_collapsed, null);
// message // message
final TextView stopNameView = (TextView) row final TextView stopNameView = row
.findViewById(R.id.directions_trip_details_public_entry_collapsed_message); .findViewById(R.id.directions_trip_details_public_entry_collapsed_message);
stopNameView.setText( stopNameView.setText(
res.getQuantityString(R.plurals.directions_trip_details_public_entry_collapsed_intermediate_stops, res.getQuantityString(R.plurals.directions_trip_details_public_entry_collapsed_intermediate_stops,
@ -842,7 +842,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
stopNameView.setTextColor(colorInsignificant); stopNameView.setTextColor(colorInsignificant);
// pearl // pearl
final PearlView pearlView = (PearlView) row final PearlView pearlView = row
.findViewById(R.id.directions_trip_details_public_entry_collapsed_pearl); .findViewById(R.id.directions_trip_details_public_entry_collapsed_pearl);
pearlView.setType(PearlView.Type.PASSING); pearlView.setType(PearlView.Type.PASSING);
pearlView.setStyle(style); pearlView.setStyle(style);

View file

@ -147,7 +147,7 @@ public class TripsGallery extends Gallery {
long maxTime = 0; long maxTime = 0;
for (int i = first; i <= last; i++) { for (int i = first; i <= last; i++) {
final Trip trip = (Trip) adapter.getItem(i); final Trip trip = adapter.getItem(i);
if (trip != null) { if (trip != null) {
final Date tripMinTime = trip.getMinTime(); final Date tripMinTime = trip.getMinTime();
if (tripMinTime != null && tripMinTime.getTime() < minTime) if (tripMinTime != null && tripMinTime.getTime() < minTime)

View file

@ -144,7 +144,7 @@ public class TripsOverviewActivity extends OeffiActivity {
actionBar.setCustomTitles(R.layout.directions_trip_overview_custom_title); actionBar.setCustomTitles(R.layout.directions_trip_overview_custom_title);
actionBar.addProgressButton().setOnClickListener(v -> handler.post(checkMoreRunnable)); actionBar.addProgressButton().setOnClickListener(v -> handler.post(checkMoreRunnable));
barView = (TripsGallery) findViewById(R.id.trips_bar_view); barView = findViewById(R.id.trips_bar_view);
barView.setOnItemClickListener((parent, v, position, id) -> { barView.setOnItemClickListener((parent, v, position, id) -> {
final Trip trip = (Trip) barView.getAdapter().getItem(position); final Trip trip = (Trip) barView.getAdapter().getItem(position);
@ -330,7 +330,7 @@ public class TripsOverviewActivity extends OeffiActivity {
// update server product // update server product
if (result.header != null) { if (result.header != null) {
final TextView serverProductView = (TextView) findViewById(R.id.trips_server_product); final TextView serverProductView = findViewById(R.id.trips_server_product);
serverProductView.setText(product(result.header)); serverProductView.setText(product(result.header));
serverProductView.setVisibility(View.VISIBLE); serverProductView.setVisibility(View.VISIBLE);
} }

View file

@ -52,11 +52,11 @@ public class QueryHistoryViewHolder extends RecyclerView.ViewHolder {
this.context = context; this.context = context;
this.network = network; this.network = network;
fromView = (LocationTextView) itemView.findViewById(R.id.directions_query_history_entry_from); fromView = itemView.findViewById(R.id.directions_query_history_entry_from);
toView = (LocationTextView) itemView.findViewById(R.id.directions_query_history_entry_to); toView = itemView.findViewById(R.id.directions_query_history_entry_to);
favoriteView = itemView.findViewById(R.id.directions_query_history_entry_favorite); favoriteView = itemView.findViewById(R.id.directions_query_history_entry_favorite);
tripView = (Button) itemView.findViewById(R.id.directions_query_history_entry_trip); tripView = itemView.findViewById(R.id.directions_query_history_entry_trip);
contextButton = (ImageButton) itemView.findViewById(R.id.directions_query_history_entry_context_button); contextButton = itemView.findViewById(R.id.directions_query_history_entry_context_button);
} }
public void bind(final long rowId, final Location from, final Location to, final boolean isFavorite, public void bind(final long rowId, final Location from, final Location to, final boolean isFavorite,

View file

@ -122,23 +122,23 @@ public class NetworkPickerActivity extends Activity implements ActivityCompat.On
backgroundHandler = new Handler(backgroundThread.getLooper()); backgroundHandler = new Handler(backgroundThread.getLooper());
setContentView(R.layout.network_picker_content); setContentView(R.layout.network_picker_content);
actionBar = (MyActionBar) findViewById(R.id.action_bar); actionBar = findViewById(R.id.action_bar);
setPrimaryColor(R.color.bg_action_bar); setPrimaryColor(R.color.bg_action_bar);
actionBar.setPrimaryTitle(getTitle()); actionBar.setPrimaryTitle(getTitle());
listView = (RecyclerView) findViewById(android.R.id.list); listView = findViewById(android.R.id.list);
listView.setLayoutManager(new LinearLayoutManager(this)); listView.setLayoutManager(new LinearLayoutManager(this));
listView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); listView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
final String network = prefsGetNetwork(); final String network = prefsGetNetwork();
listAdapter = new NetworksAdapter(this, network, this, this); listAdapter = new NetworksAdapter(this, network, this, this);
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
mapView = (OeffiMapView) findViewById(R.id.network_picker_map); mapView = findViewById(R.id.network_picker_map);
((TextView) findViewById(R.id.network_picker_map_disclaimer)) ((TextView) findViewById(R.id.network_picker_map_disclaimer))
.setText(mapView.getTileProvider().getTileSource().getCopyrightNotice()); .setText(mapView.getTileProvider().getTileSource().getCopyrightNotice());
if (network == null) { if (network == null) {
((FrameLayout) findViewById(R.id.network_picker_firsttime_message_shadow)).setForeground(null); findViewById(R.id.network_picker_firsttime_message_shadow).setForeground(null);
} else { } else {
findViewById(R.id.network_picker_firsttime_message).setVisibility(View.GONE); findViewById(R.id.network_picker_firsttime_message).setVisibility(View.GONE);
actionBar.setBack(v -> finish()); actionBar.setBack(v -> finish());

View file

@ -54,12 +54,12 @@ public class NetworkViewHolder extends RecyclerView.ViewHolder {
this.colorSignificant = res.getColor(R.color.fg_significant); this.colorSignificant = res.getColor(R.color.fg_significant);
this.colorGrey600 = res.getColor(R.color.grey600); this.colorGrey600 = res.getColor(R.color.grey600);
iconView = (ImageView) itemView.findViewById(R.id.network_picker_entry_icon); iconView = itemView.findViewById(R.id.network_picker_entry_icon);
labelView = (TextView) itemView.findViewById(R.id.network_picker_entry_label); labelView = itemView.findViewById(R.id.network_picker_entry_label);
stateView = (TextView) itemView.findViewById(R.id.network_picker_entry_state); stateView = itemView.findViewById(R.id.network_picker_entry_state);
commentView = (TextView) itemView.findViewById(R.id.network_picker_entry_comment); commentView = itemView.findViewById(R.id.network_picker_entry_comment);
usageView = (TextView) itemView.findViewById(R.id.network_picker_entry_usage); usageView = itemView.findViewById(R.id.network_picker_entry_usage);
contextButton = (ImageButton) itemView.findViewById(R.id.network_picker_entry_context_button); contextButton = itemView.findViewById(R.id.network_picker_entry_context_button);
contextButtonSpace = itemView.findViewById(R.id.network_picker_entry_context_button_space); contextButtonSpace = itemView.findViewById(R.id.network_picker_entry_context_button_space);
} }

View file

@ -27,7 +27,7 @@ public class SeparatorViewHolder extends RecyclerView.ViewHolder {
public SeparatorViewHolder(final View itemView) { public SeparatorViewHolder(final View itemView) {
super(itemView); super(itemView);
textView = ((TextView) itemView.findViewById(android.R.id.text1)); textView = itemView.findViewById(android.R.id.text1);
} }
public void bind(final NetworkListEntry.Separator entry) { public void bind(final NetworkListEntry.Separator entry) {

View file

@ -138,10 +138,10 @@ public class PlanActivity extends Activity {
final Animation zoomControlsAnimation = AnimationUtils.loadAnimation(this, R.anim.zoom_controls); final Animation zoomControlsAnimation = AnimationUtils.loadAnimation(this, R.anim.zoom_controls);
zoomControlsAnimation.setFillAfter(true); // workaround: set through code because XML does not work zoomControlsAnimation.setFillAfter(true); // workaround: set through code because XML does not work
viewAnimator = (ViewAnimator) findViewById(R.id.plans_layout); viewAnimator = findViewById(R.id.plans_layout);
viewAnimator.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); viewAnimator.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
plan = (ScrollImageView) findViewById(R.id.plans_plan); plan = findViewById(R.id.plans_plan);
plan.setOnMoveListener(() -> { plan.setOnMoveListener(() -> {
updateBubble(); updateBubble();
updateScale(); updateScale();
@ -167,11 +167,11 @@ public class PlanActivity extends Activity {
contextMenu.show(); contextMenu.show();
}); });
bubbleName = (TextView) findViewById(R.id.plans_bubble_name); bubbleName = findViewById(R.id.plans_bubble_name);
bubbleLinesView = (LineView) findViewById(R.id.plans_bubble_lines); bubbleLinesView = findViewById(R.id.plans_bubble_lines);
zoom = (ZoomControls) findViewById(R.id.plans_zoom); zoom = findViewById(R.id.plans_zoom);
zoom.setOnZoomInClickListener(v -> { zoom.setOnZoomInClickListener(v -> {
plan.animateScaleStepIn(); plan.animateScaleStepIn();
updateScale(); updateScale();

View file

@ -119,13 +119,13 @@ public class PlansPickerActivity extends OeffiMainActivity implements ActivityCo
cursor = getContentResolver().query(PlanContentProvider.CONTENT_URI, null, null, null, null); cursor = getContentResolver().query(PlanContentProvider.CONTENT_URI, null, null, null, null);
listView = (RecyclerView) findViewById(android.R.id.list); listView = findViewById(android.R.id.list);
listView.setLayoutManager(new LinearLayoutManager(this)); listView.setLayoutManager(new LinearLayoutManager(this));
listView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); listView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
listAdapter = new PlansAdapter(this, cursor, thumbCache, this, this, application.okHttpClient()); listAdapter = new PlansAdapter(this, cursor, thumbCache, this, this, application.okHttpClient());
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
connectivityWarningView = (TextView) findViewById(R.id.plans_picker_connectivity_warning_box); connectivityWarningView = findViewById(R.id.plans_picker_connectivity_warning_box);
filterBox = findViewById(R.id.plans_picker_filter_box); filterBox = findViewById(R.id.plans_picker_filter_box);
findViewById(R.id.plans_picker_filter_clear).setOnClickListener(v -> clearListFilter()); findViewById(R.id.plans_picker_filter_clear).setOnClickListener(v -> clearListFilter());

View file

@ -59,14 +59,14 @@ public class PlanViewHolder extends RecyclerView.ViewHolder {
this.context = context; this.context = context;
this.dateFormat = DateFormat.getDateFormat(context); this.dateFormat = DateFormat.getDateFormat(context);
thumbView = (ImageView) itemView.findViewById(R.id.plans_picker_entry_thumb); thumbView = itemView.findViewById(R.id.plans_picker_entry_thumb);
nameView = (TextView) itemView.findViewById(R.id.plans_picker_entry_name); nameView = itemView.findViewById(R.id.plans_picker_entry_name);
disclaimerView = (TextView) itemView.findViewById(R.id.plans_picker_entry_disclaimer); disclaimerView = itemView.findViewById(R.id.plans_picker_entry_disclaimer);
loadedView = (ImageView) itemView.findViewById(R.id.plans_picker_entry_loaded); loadedView = itemView.findViewById(R.id.plans_picker_entry_loaded);
progressView = (ProgressBar) itemView.findViewById(R.id.plans_picker_entry_progress); progressView = itemView.findViewById(R.id.plans_picker_entry_progress);
validFromView = (TextView) itemView.findViewById(R.id.plans_picker_entry_valid_from); validFromView = itemView.findViewById(R.id.plans_picker_entry_valid_from);
networkLogoView = (ImageView) itemView.findViewById(R.id.plans_picker_entry_network_logo); networkLogoView = itemView.findViewById(R.id.plans_picker_entry_network_logo);
contextButton = (ImageButton) itemView.findViewById(R.id.plans_picker_entry_context_button); contextButton = itemView.findViewById(R.id.plans_picker_entry_context_button);
} }
public void bind(final PlansAdapter.Plan plan, final PlanClickListener clickListener, public void bind(final PlansAdapter.Plan plan, final PlanClickListener clickListener,

View file

@ -79,9 +79,9 @@ public class FavoriteStationsActivity extends OeffiActivity
actionBar.setPrimaryTitle(getTitle()); actionBar.setPrimaryTitle(getTitle());
actionBar.setBack(v -> finish()); actionBar.setBack(v -> finish());
viewAnimator = (ViewAnimator) findViewById(R.id.favorites_layout); viewAnimator = findViewById(R.id.favorites_layout);
listView = (RecyclerView) findViewById(R.id.favorites_list); listView = findViewById(R.id.favorites_list);
listView.setLayoutManager(new LinearLayoutManager(this)); listView.setLayoutManager(new LinearLayoutManager(this));
listView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); listView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
adapter = new FavoriteStationsAdapter(this, network, this, network == null ? this : null); adapter = new FavoriteStationsAdapter(this, network, this, network == null ? this : null);

View file

@ -85,8 +85,8 @@ public class StationContextMenu extends PopupMenu {
builder.setTitle(R.string.station_context_launcher_shortcut_title); builder.setTitle(R.string.station_context_launcher_shortcut_title);
builder.setView(view); builder.setView(view);
builder.setPositiveButton(R.string.create_launcher_shortcut_dialog_button_ok, builder.setPositiveButton(R.string.create_launcher_shortcut_dialog_button_ok,
(DialogInterface.OnClickListener) (dialog, which) -> { (dialog, which) -> {
final EditText nameView = (EditText) view final EditText nameView = view
.findViewById(R.id.create_launcher_shortcut_dialog_name); .findViewById(R.id.create_launcher_shortcut_dialog_name);
final String shortcutName = nameView.getText().toString(); final String shortcutName = nameView.getText().toString();
final String shortcutId = "directions-to-" + networkId.name() + "-" + location.id; final String shortcutId = "directions-to-" + networkId.name() + "-" + location.id;

View file

@ -167,20 +167,20 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
} }
}); });
viewAnimator = (ViewAnimator) findViewById(R.id.stations_station_details_list_layout); viewAnimator = findViewById(R.id.stations_station_details_list_layout);
listView = (RecyclerView) findViewById(R.id.stations_station_details_list); listView = findViewById(R.id.stations_station_details_list);
listView.setLayoutManager(new LinearLayoutManager(this)); listView.setLayoutManager(new LinearLayoutManager(this));
listView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); listView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
listAdapter = new DeparturesAdapter(this); listAdapter = new DeparturesAdapter(this);
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
mapView = (OeffiMapView) findViewById(R.id.stations_station_details_map); mapView = findViewById(R.id.stations_station_details_map);
mapView.setStationsAware(this); mapView.setStationsAware(this);
((TextView) findViewById(R.id.stations_station_details_map_disclaimer)) ((TextView) findViewById(R.id.stations_station_details_map_disclaimer))
.setText(mapView.getTileProvider().getTileSource().getCopyrightNotice()); .setText(mapView.getTileProvider().getTileSource().getCopyrightNotice());
resultStatusView = (TextView) findViewById(R.id.stations_station_details_result_status); resultStatusView = findViewById(R.id.stations_station_details_result_status);
final Intent intent = getIntent(); final Intent intent = getIntent();
final Uri uri = intent.getData(); final Uri uri = intent.getData();
@ -267,7 +267,7 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
favoriteButton favoriteButton
.setChecked(selectedFavState != null && selectedFavState == FavoriteStationsProvider.TYPE_FAVORITE); .setChecked(selectedFavState != null && selectedFavState == FavoriteStationsProvider.TYPE_FAVORITE);
disclaimerSourceView = (TextView) findViewById(R.id.stations_station_details_disclaimer_source); disclaimerSourceView = findViewById(R.id.stations_station_details_disclaimer_source);
updateDisclaimerSource(disclaimerSourceView, selectedNetwork.name(), null); updateDisclaimerSource(disclaimerSourceView, selectedNetwork.name(), null);
} }
@ -550,9 +550,9 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
public HeaderViewHolder(final Context context, final View itemView) { public HeaderViewHolder(final Context context, final View itemView) {
super(itemView); super(itemView);
idView = (TextView) itemView.findViewById(R.id.stations_station_details_header_id); idView = itemView.findViewById(R.id.stations_station_details_header_id);
linesGroup = (LinearLayout) itemView.findViewById(R.id.stations_station_details_header_lines); linesGroup = itemView.findViewById(R.id.stations_station_details_header_lines);
additionalLinesView = (LineView) itemView additionalLinesView = itemView
.findViewById(R.id.stations_station_details_header_additional_lines); .findViewById(R.id.stations_station_details_header_additional_lines);
inflater = LayoutInflater.from(context); inflater = LayoutInflater.from(context);
@ -577,11 +577,11 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
final View lineRow = inflater.inflate(R.layout.stations_station_details_header_line, null); final View lineRow = inflater.inflate(R.layout.stations_station_details_header_line, null);
linesGroup.addView(lineRow, LINES_LAYOUT_PARAMS); linesGroup.addView(lineRow, LINES_LAYOUT_PARAMS);
final LineView lineView = (LineView) lineRow final LineView lineView = lineRow
.findViewById(R.id.stations_station_details_header_line_line); .findViewById(R.id.stations_station_details_header_line_line);
lineView.setLine(line); lineView.setLine(line);
final TextView destinationView = (TextView) lineRow final TextView destinationView = lineRow
.findViewById(R.id.stations_station_details_header_line_destination); .findViewById(R.id.stations_station_details_header_line_destination);
final StringBuilder text = new StringBuilder(); final StringBuilder text = new StringBuilder();
for (final Location destination : destinations) { for (final Location destination : destinations) {
@ -618,15 +618,15 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
public DepartureViewHolder(final Context context, final View itemView) { public DepartureViewHolder(final Context context, final View itemView) {
super(itemView); super(itemView);
timeRelView = (TextView) itemView.findViewById(R.id.stations_station_entry_time_rel); timeRelView = itemView.findViewById(R.id.stations_station_entry_time_rel);
timeAbsView = (TextView) itemView.findViewById(R.id.stations_station_entry_time_abs); timeAbsView = itemView.findViewById(R.id.stations_station_entry_time_abs);
delayView = (TextView) itemView.findViewById(R.id.stations_station_entry_delay); delayView = itemView.findViewById(R.id.stations_station_entry_delay);
lineView = (LineView) itemView.findViewById(R.id.stations_station_entry_line); lineView = itemView.findViewById(R.id.stations_station_entry_line);
destinationView = (TextView) itemView.findViewById(R.id.stations_station_entry_destination); destinationView = itemView.findViewById(R.id.stations_station_entry_destination);
positionView = (TextView) itemView.findViewById(R.id.stations_station_entry_position); positionView = itemView.findViewById(R.id.stations_station_entry_position);
capacity1stView = (TextView) itemView.findViewById(R.id.stations_station_entry_capacity_1st_class); capacity1stView = itemView.findViewById(R.id.stations_station_entry_capacity_1st_class);
capacity2ndView = (TextView) itemView.findViewById(R.id.stations_station_entry_capacity_2nd_class); capacity2ndView = itemView.findViewById(R.id.stations_station_entry_capacity_2nd_class);
msgView = (TextView) itemView.findViewById(R.id.stations_station_entry_msg); msgView = itemView.findViewById(R.id.stations_station_entry_msg);
this.context = context; this.context = context;
this.timeFormat = DateFormat.getTimeFormat(context); this.timeFormat = DateFormat.getTimeFormat(context);
@ -673,7 +673,7 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
final Location destination = departure.destination; final Location destination = departure.destination;
if (destination != null) { if (destination != null) {
destinationView.setText(Constants.DESTINATION_ARROW_PREFIX + destination.uniqueShortName()); destinationView.setText(Constants.DESTINATION_ARROW_PREFIX + destination.uniqueShortName());
itemView.setOnClickListener(destination.id != null ? (OnClickListener) v -> start(context, network, destination) : null); itemView.setOnClickListener(destination.id != null ? v -> start(context, network, destination) : null);
} else { } else {
destinationView.setText(null); destinationView.setText(null);
itemView.setOnClickListener(null); itemView.setOnClickListener(null);

View file

@ -242,33 +242,33 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
initNavigation(); initNavigation();
locationProvidersView = (ViewGroup) findViewById(R.id.stations_list_location_providers); locationProvidersView = findViewById(R.id.stations_list_location_providers);
final Button locationPermissionRequestButton = (Button) findViewById( final Button locationPermissionRequestButton = findViewById(
R.id.stations_location_permission_request_button); R.id.stations_location_permission_request_button);
locationPermissionRequestButton.setOnClickListener(v -> ActivityCompat.requestPermissions(StationsActivity.this, locationPermissionRequestButton.setOnClickListener(v -> ActivityCompat.requestPermissions(StationsActivity.this,
new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, 0)); new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, 0));
final Button locationSettingsButton = (Button) findViewById(R.id.stations_list_location_settings); final Button locationSettingsButton = findViewById(R.id.stations_list_location_settings);
locationSettingsButton.setOnClickListener(v -> startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))); locationSettingsButton.setOnClickListener(v -> startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)));
final OnClickListener selectNetworkListener = v -> NetworkPickerActivity.start(StationsActivity.this); final OnClickListener selectNetworkListener = v -> NetworkPickerActivity.start(StationsActivity.this);
final Button networkSettingsButton = (Button) findViewById(R.id.stations_list_empty_network_settings); final Button networkSettingsButton = findViewById(R.id.stations_list_empty_network_settings);
networkSettingsButton.setOnClickListener(selectNetworkListener); networkSettingsButton.setOnClickListener(selectNetworkListener);
final Button missingCapabilityButton = (Button) findViewById(R.id.stations_network_missing_capability_button); final Button missingCapabilityButton = findViewById(R.id.stations_network_missing_capability_button);
missingCapabilityButton.setOnClickListener(selectNetworkListener); missingCapabilityButton.setOnClickListener(selectNetworkListener);
mapView = (OeffiMapView) findViewById(R.id.stations_map); mapView = findViewById(R.id.stations_map);
mapView.setStationsAware(this); mapView.setStationsAware(this);
mapView.setLocationAware(this); mapView.setLocationAware(this);
((TextView) findViewById(R.id.stations_map_disclaimer)) ((TextView) findViewById(R.id.stations_map_disclaimer))
.setText(mapView.getTileProvider().getTileSource().getCopyrightNotice()); .setText(mapView.getTileProvider().getTileSource().getCopyrightNotice());
final ZoomControls zoom = (ZoomControls) findViewById(R.id.stations_map_zoom); final ZoomControls zoom = findViewById(R.id.stations_map_zoom);
mapView.setZoomControls(zoom); mapView.setZoomControls(zoom);
connectivityWarningView = (TextView) findViewById(R.id.stations_connectivity_warning_box); connectivityWarningView = findViewById(R.id.stations_connectivity_warning_box);
disclaimerSourceView = (TextView) findViewById(R.id.stations_disclaimer_source); disclaimerSourceView = findViewById(R.id.stations_disclaimer_source);
// initialize stations list // initialize stations list
maxDeparturesPerStation = res.getInteger(R.integer.max_departures_per_station); maxDeparturesPerStation = res.getInteger(R.integer.max_departures_per_station);
@ -394,7 +394,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
throw new IllegalStateException(); throw new IllegalStateException();
} }
}); });
stationList = (RecyclerView) findViewById(R.id.stations_list); stationList = findViewById(R.id.stations_list);
stationListLayoutManager = new LinearLayoutManager(this); stationListLayoutManager = new LinearLayoutManager(this);
stationList.setLayoutManager(stationListLayoutManager); stationList.setLayoutManager(stationListLayoutManager);
stationList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); stationList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
@ -640,7 +640,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
final boolean isActive = products.size() < Product.values().length; final boolean isActive = products.size() < Product.values().length;
filterActionButton.setSelected(isActive); filterActionButton.setSelected(isActive);
final ViewAnimator viewAnimator = (ViewAnimator) findViewById(R.id.stations_list_layout); final ViewAnimator viewAnimator = findViewById(R.id.stations_list_layout);
if (network == null || !NetworkProviderFactory.provider(network).hasCapabilities(Capability.DEPARTURES)) { if (network == null || !NetworkProviderFactory.provider(network).hasCapabilities(Capability.DEPARTURES)) {
viewAnimator.setDisplayedChild(1); // Missing capability viewAnimator.setDisplayedChild(1); // Missing capability
} else if (searchQuery == null && ContextCompat.checkSelfPermission(this, } else if (searchQuery == null && ContextCompat.checkSelfPermission(this,
@ -1279,9 +1279,9 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
final boolean enabled = locationManager.isProviderEnabled(provider); final boolean enabled = locationManager.isProviderEnabled(provider);
final boolean acquiring = provider.equals(accurateLocationProvider) final boolean acquiring = provider.equals(accurateLocationProvider)
|| provider.equals(lowPowerLocationProvider); || provider.equals(lowPowerLocationProvider);
final View row = (View) getLayoutInflater().inflate(R.layout.stations_location_provider_row, null); final View row = getLayoutInflater().inflate(R.layout.stations_location_provider_row, null);
((TextView) row.findViewById(R.id.stations_location_provider_row_provider)).setText(provider + ":"); ((TextView) row.findViewById(R.id.stations_location_provider_row_provider)).setText(provider + ":");
final TextView enabledView = (TextView) row.findViewById(R.id.stations_location_provider_row_enabled); final TextView enabledView = row.findViewById(R.id.stations_location_provider_row_enabled);
enabledView.setText(enabled enabledView.setText(enabled
? (acquiring ? R.string.stations_location_provider_acquiring ? (acquiring ? R.string.stations_location_provider_acquiring
: R.string.stations_location_provider_enabled) : R.string.stations_location_provider_enabled)

View file

@ -53,7 +53,7 @@ public class StationsFilterPopup extends PopupWindow
final View contentView = getContentView(); final View contentView = getContentView();
for (final Product product : Product.ALL) { for (final Product product : Product.ALL) {
final CheckBox checkBox = (CheckBox) contentView.findViewWithTag(Character.toString(product.code)); final CheckBox checkBox = contentView.findViewWithTag(Character.toString(product.code));
checkBox.setChecked(filter.contains(product)); checkBox.setChecked(filter.contains(product));
checkBox.setOnCheckedChangeListener(this); checkBox.setOnCheckedChangeListener(this);
checkBox.setOnLongClickListener(this); checkBox.setOnLongClickListener(this);
@ -73,7 +73,7 @@ public class StationsFilterPopup extends PopupWindow
final Product product = Product.fromCode(((String) v.getTag()).charAt(0)); final Product product = Product.fromCode(((String) v.getTag()).charAt(0));
final View contentView = getContentView(); final View contentView = getContentView();
for (final Product p : Product.ALL) { for (final Product p : Product.ALL) {
final CheckBox checkBox = (CheckBox) contentView.findViewWithTag(Character.toString(p.code)); final CheckBox checkBox = contentView.findViewWithTag(Character.toString(p.code));
checkBox.setChecked(p != product); // Implicit notify checkBox.setChecked(p != product); // Implicit notify
} }
return true; return true;

View file

@ -50,10 +50,10 @@ public class FavoriteStationViewHolder extends RecyclerView.ViewHolder {
this.clickListener = clickListener; this.clickListener = clickListener;
this.contextMenuItemListener = contextMenuItemListener; this.contextMenuItemListener = contextMenuItemListener;
networkView = (TextView) itemView.findViewById(R.id.favorites_list_entry_network); networkView = itemView.findViewById(R.id.favorites_list_entry_network);
placeView = (TextView) itemView.findViewById(R.id.favorites_list_entry_place); placeView = itemView.findViewById(R.id.favorites_list_entry_place);
nameView = (TextView) itemView.findViewById(R.id.favorites_list_entry_name); nameView = itemView.findViewById(R.id.favorites_list_entry_name);
contextButton = (ImageButton) itemView.findViewById(R.id.favorites_list_entry_context_button); contextButton = itemView.findViewById(R.id.favorites_list_entry_context_button);
} }
public void bind(final long rowId, final NetworkId network, final Location station, final boolean showNetwork, public void bind(final long rowId, final NetworkId network, final Location station, final boolean showNetwork,

View file

@ -94,16 +94,16 @@ public class StationViewHolder extends RecyclerView.ViewHolder {
super(itemView); super(itemView);
favoriteView = itemView.findViewById(R.id.station_entry_favorite); favoriteView = itemView.findViewById(R.id.station_entry_favorite);
nameView = (TextView) itemView.findViewById(R.id.station_entry_name); nameView = itemView.findViewById(R.id.station_entry_name);
name2View = (TextView) itemView.findViewById(R.id.station_entry_name2); name2View = itemView.findViewById(R.id.station_entry_name2);
linesView = (LineView) itemView.findViewById(R.id.station_entry_lines); linesView = itemView.findViewById(R.id.station_entry_lines);
distanceView = (TextView) itemView.findViewById(R.id.station_entry_distance); distanceView = itemView.findViewById(R.id.station_entry_distance);
bearingView = (CompassNeedleView) itemView.findViewById(R.id.station_entry_bearing); bearingView = itemView.findViewById(R.id.station_entry_bearing);
contextButton = (ImageButton) itemView.findViewById(R.id.station_entry_context_button); contextButton = itemView.findViewById(R.id.station_entry_context_button);
contextButtonSpace = itemView.findViewById(R.id.station_entry_context_button_space); contextButtonSpace = itemView.findViewById(R.id.station_entry_context_button_space);
departuresViewGroup = (ViewGroup) itemView.findViewById(R.id.station_entry_departures); departuresViewGroup = itemView.findViewById(R.id.station_entry_departures);
departuresStatusView = (TextView) itemView.findViewById(R.id.station_entry_status); departuresStatusView = itemView.findViewById(R.id.station_entry_status);
messagesViewGroup = (ViewGroup) itemView.findViewById(R.id.station_entry_messages); messagesViewGroup = itemView.findViewById(R.id.station_entry_messages);
this.context = context; this.context = context;
this.res = context.getResources(); this.res = context.getResources();
@ -188,7 +188,7 @@ public class StationViewHolder extends RecyclerView.ViewHolder {
// context button // context button
contextButton.setVisibility(itemView.isActivated() ? View.VISIBLE : View.GONE); contextButton.setVisibility(itemView.isActivated() ? View.VISIBLE : View.GONE);
contextButtonSpace.setVisibility(itemView.isActivated() ? View.VISIBLE : View.GONE); contextButtonSpace.setVisibility(itemView.isActivated() ? View.VISIBLE : View.GONE);
contextButton.setOnClickListener(itemView.isActivated() ? (View.OnClickListener) v -> { contextButton.setOnClickListener(itemView.isActivated() ? v -> {
final PopupMenu contextMenu = new StationContextMenu(context, v, station.network, station.location, final PopupMenu contextMenu = new StationContextMenu(context, v, station.network, station.location,
favState, true, true, true, true, true); favState, true, true, true, true, true);
contextMenu.setOnMenuItemClickListener(item -> { contextMenu.setOnMenuItemClickListener(item -> {
@ -240,15 +240,15 @@ public class StationViewHolder extends RecyclerView.ViewHolder {
departureView = (ViewGroup) inflater.inflate(R.layout.stations_station_entry_departure, departureView = (ViewGroup) inflater.inflate(R.layout.stations_station_entry_departure,
departuresViewGroup, false); departuresViewGroup, false);
departureViewHolder = new DepartureViewHolder(); departureViewHolder = new DepartureViewHolder();
departureViewHolder.line = (LineView) departureView departureViewHolder.line = departureView
.findViewById(R.id.departure_entry_line); .findViewById(R.id.departure_entry_line);
departureViewHolder.destination = (TextView) departureView departureViewHolder.destination = departureView
.findViewById(R.id.departure_entry_destination); .findViewById(R.id.departure_entry_destination);
departureViewHolder.messageIndex = departureView departureViewHolder.messageIndex = departureView
.findViewById(R.id.departure_entry_message_index); .findViewById(R.id.departure_entry_message_index);
departureViewHolder.time = (TextView) departureView departureViewHolder.time = departureView
.findViewById(R.id.departure_entry_time); .findViewById(R.id.departure_entry_time);
departureViewHolder.delay = (TextView) departureView departureViewHolder.delay = departureView
.findViewById(R.id.departure_entry_delay); .findViewById(R.id.departure_entry_delay);
departureView.setTag(departureViewHolder); departureView.setTag(departureViewHolder);

View file

@ -102,9 +102,9 @@ public class NavigationMenuAdapter extends RecyclerView.Adapter<NavigationMenuAd
public ViewHolder(final View itemView, final MenuItem.OnMenuItemClickListener menuClickListener) { public ViewHolder(final View itemView, final MenuItem.OnMenuItemClickListener menuClickListener) {
super(itemView); super(itemView);
iconView = (ImageView) itemView.findViewById(R.id.navigation_drawer_entry_icon); iconView = itemView.findViewById(R.id.navigation_drawer_entry_icon);
titleView = (TextView) itemView.findViewById(R.id.navigation_drawer_entry_title); titleView = itemView.findViewById(R.id.navigation_drawer_entry_title);
commentView = (TextView) itemView.findViewById(R.id.navigation_drawer_entry_comment); commentView = itemView.findViewById(R.id.navigation_drawer_entry_comment);
this.menuClickListener = menuClickListener; this.menuClickListener = menuClickListener;
} }

View file

@ -57,7 +57,7 @@ public class Toast {
private void customToast(final int imageResId, final CharSequence text, final int duration) { private void customToast(final int imageResId, final CharSequence text, final int duration) {
final android.widget.Toast toast = android.widget.Toast.makeText(context, text, duration); final android.widget.Toast toast = android.widget.Toast.makeText(context, text, duration);
final TextView toastText = (TextView) toast.getView().findViewById(android.R.id.message); final TextView toastText = toast.getView().findViewById(android.R.id.message);
if (imageResId != 0 && toastText != null) { if (imageResId != 0 && toastText != null) {
toastText.setCompoundDrawablesWithIntrinsicBounds(imageResId, 0, 0, 0); toastText.setCompoundDrawablesWithIntrinsicBounds(imageResId, 0, 0, 0);
toastText.setCompoundDrawablePadding( toastText.setCompoundDrawablePadding(

View file

@ -43,8 +43,8 @@ public class ZoomControls extends LinearLayout {
final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.zoom_controls, this, true); inflater.inflate(R.layout.zoom_controls, this, true);
mZoomIn = (ZoomButton) findViewById(R.id.zoomIn); mZoomIn = findViewById(R.id.zoomIn);
mZoomOut = (ZoomButton) findViewById(R.id.zoomOut); mZoomOut = findViewById(R.id.zoomOut);
setZoomSpeed(250); setZoomSpeed(250);
} }