diff --git a/res/drawable/basic_rectangle.xml b/res/drawable/basic_rectangle.xml index abb8504..57c7709 100644 --- a/res/drawable/basic_rectangle.xml +++ b/res/drawable/basic_rectangle.xml @@ -1,5 +1,7 @@ - + android:shape="rectangle" > + + + \ No newline at end of file diff --git a/res/layout-h480dp/departure_listing.xml b/res/layout-h480dp/departure_listing.xml new file mode 100644 index 0000000..1d2a2e9 --- /dev/null +++ b/res/layout-h480dp/departure_listing.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/departure_listing.xml b/res/layout/departure_listing.xml index 4c5f95b..0b08e13 100644 --- a/res/layout/departure_listing.xml +++ b/res/layout/departure_listing.xml @@ -7,7 +7,7 @@ diff --git a/res/layout/your_train.xml b/res/layout/your_train.xml index bf1873e..a22ed75 100644 --- a/res/layout/your_train.xml +++ b/res/layout/your_train.xml @@ -28,7 +28,7 @@ diff --git a/src/com/dougkeen/bart/data/DepartureArrayAdapter.java b/src/com/dougkeen/bart/data/DepartureArrayAdapter.java index b54dc76..5468b9c 100644 --- a/src/com/dougkeen/bart/data/DepartureArrayAdapter.java +++ b/src/com/dougkeen/bart/data/DepartureArrayAdapter.java @@ -89,37 +89,48 @@ public class DepartureArrayAdapter extends ArrayAdapter { ((TextView) view.findViewById(R.id.destinationText)).setText(departure .getTrainDestination().toString()); - TimedTextSwitcher textSwitcher = (TimedTextSwitcher) view - .findViewById(R.id.trainLengthText); - initTextSwitcher(textSwitcher, R.layout.train_length_arrival_textview); - final String arrivesAtDestinationPrefix = getContext().getString( R.string.arrives_at_destination); final String estimatedArrivalTimeText = departure .getEstimatedArrivalTimeText(getContext()); - if (!StringUtils.isBlank(estimatedArrivalTimeText)) { - textSwitcher.setCurrentText(arrivesAtDestinationPrefix + + TextView estimatedArrival = (TextView) view + .findViewById(R.id.estimatedArrival); + if (estimatedArrival != null) { + ((TextView) view.findViewById(R.id.trainLengthText)) + .setText(departure.getTrainLengthText()); + estimatedArrival.setText(arrivesAtDestinationPrefix + estimatedArrivalTimeText); } else { - textSwitcher.setCurrentText(departure.getTrainLengthText()); - } - textSwitcher.setTextProvider(new TextProvider() { - @Override - public String getText(long tickNumber) { - if (tickNumber % 4 == 0) { - return departure.getTrainLengthText(); - } else { - final String estimatedArrivalTimeText = departure - .getEstimatedArrivalTimeText(getContext()); - if (StringUtils.isBlank(estimatedArrivalTimeText)) { - return ""; + TimedTextSwitcher textSwitcher = (TimedTextSwitcher) view + .findViewById(R.id.trainLengthText); + initTextSwitcher(textSwitcher, + R.layout.train_length_arrival_textview); + + if (!StringUtils.isBlank(estimatedArrivalTimeText)) { + textSwitcher.setCurrentText(arrivesAtDestinationPrefix + + estimatedArrivalTimeText); + } else { + textSwitcher.setCurrentText(departure.getTrainLengthText()); + } + textSwitcher.setTextProvider(new TextProvider() { + @Override + public String getText(long tickNumber) { + if (tickNumber % 4 == 0) { + return departure.getTrainLengthText(); } else { - return arrivesAtDestinationPrefix - + estimatedArrivalTimeText; + final String estimatedArrivalTimeText = departure + .getEstimatedArrivalTimeText(getContext()); + if (StringUtils.isBlank(estimatedArrivalTimeText)) { + return ""; + } else { + return arrivesAtDestinationPrefix + + estimatedArrivalTimeText; + } } } - } - }); + }); + } ImageView colorBar = (ImageView) view .findViewById(R.id.destinationColorBar); @@ -135,22 +146,32 @@ public class DepartureArrayAdapter extends ArrayAdapter { } }); - TimedTextSwitcher uncertaintySwitcher = (TimedTextSwitcher) view - .findViewById(R.id.uncertainty); - initTextSwitcher(uncertaintySwitcher, R.layout.uncertainty_textview); + TextView departureTime = (TextView) view + .findViewById(R.id.departureTime); - uncertaintySwitcher.setTextProvider(new TextProvider() { - @Override - public String getText(long tickNumber) { - if (tickNumber % 4 == 0) { - return departure.getUncertaintyText(); - } else { - return departure - .getEstimatedDepartureTimeText(getContext()); + if (departureTime != null) { + ((TextView) view.findViewById(R.id.uncertainty)).setText(departure + .getUncertaintyText()); + departureTime.setText(departure + .getEstimatedDepartureTimeText(getContext())); + } else { + TimedTextSwitcher uncertaintySwitcher = (TimedTextSwitcher) view + .findViewById(R.id.uncertainty); + initTextSwitcher(uncertaintySwitcher, R.layout.uncertainty_textview); + + uncertaintySwitcher.setTextProvider(new TextProvider() { + @Override + public String getText(long tickNumber) { + if (tickNumber % 4 == 0) { + return departure.getUncertaintyText(); + } else { + return departure + .getEstimatedDepartureTimeText(getContext()); + } } - } - }); - + }); + } + ImageView bikeIcon = (ImageView) view.findViewById(R.id.bikeIcon); if (departure.isBikeAllowed()) { bikeIcon.setImageDrawable(bikeDrawable);