Changed "departed" to "leaving". Abstracted out string value.

This commit is contained in:
Doug Keen 2012-10-09 13:51:00 -07:00
parent f5ba6d27cc
commit 8955bd209b
30 changed files with 3166 additions and 3151 deletions

View File

@ -42,5 +42,6 @@
<string name="silence_alarm">Silence alarm</string>
<string name="cancel_alarm">Cancel alarm</string>
<string name="set_alarm">Set alarm</string>
<string name="leaving">Leaving</string>
</resources>

View File

@ -31,6 +31,18 @@ public class BartRunnerApplication extends Application {
private MediaPlayer mAlarmMediaPlayer;
private static Context context;
@Override
public void onCreate() {
super.onCreate();
context = getApplicationContext();
}
public static Context getAppContext() {
return context;
}
public boolean shouldPlayAlarmRingtone() {
return mPlayAlarmRingtone;
}

View File

@ -18,11 +18,10 @@ import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import com.WazaBe.HoloEverywhere.widget.TextView;
import com.WazaBe.HoloEverywhere.app.AlertDialog;
import com.WazaBe.HoloEverywhere.app.DialogFragment;
import com.WazaBe.HoloEverywhere.sherlock.SActivity;
import com.WazaBe.HoloEverywhere.widget.TextView;
import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;

View File

@ -86,8 +86,8 @@ public class SwipeHelper implements View.OnTouchListener {
private float mTranslationX;
/**
* The callback interface used by {@link SwipeHelper} to inform its
* client about a successful dismissal of the view for which it was created.
* The callback interface used by {@link SwipeHelper} to inform its client
* about a successful dismissal of the view for which it was created.
*/
public interface OnDismissCallback {
/**

View File

@ -95,7 +95,7 @@ public class YourTrainLayout extends RelativeLayout implements Checkable {
@Override
public String getText(long tickNumber) {
if (boardedDeparture.hasDeparted()) {
return "Departed";
return getContext().getString(R.string.leaving);
} else {
return "Leaves in " + boardedDeparture.getCountdownText()
+ " " + boardedDeparture.getUncertaintyText();

View File

@ -1,6 +1,5 @@
package com.dougkeen.bart.data;
public enum RoutesColumns {
_ID("_id", "INTEGER", false),
FROM_STATION("FROM_STATION", "TEXT", false),
@ -10,7 +9,6 @@ public enum RoutesColumns {
AVERAGE_TRIP_SAMPLE_COUNT("AVE_TRIP_SAMPLE_COUNT", "INTEGER", true),
AVERAGE_TRIP_LENGTH("AVE_TRIP_LENGTH", "INTEGER", true);
// This class cannot be instantiated
private RoutesColumns(String string, String type, Boolean nullable) {
this.string = string;
@ -23,6 +21,6 @@ public enum RoutesColumns {
public final Boolean nullable;
protected String getColumnDef() {
return string + " " + sqliteType + (nullable?"":" NOT NULL");
return string + " " + sqliteType + (nullable ? "" : " NOT NULL");
}
}

View File

@ -17,6 +17,7 @@ import android.support.v4.app.NotificationCompat.Builder;
import android.text.format.DateFormat;
import android.util.Log;
import com.dougkeen.bart.BartRunnerApplication;
import com.dougkeen.bart.R;
import com.dougkeen.bart.services.BoardedDepartureService;
import com.dougkeen.util.Observable;
@ -463,7 +464,8 @@ public class Departure implements Parcelable, Comparable<Departure> {
if (origin != null && origin.longStationLinger && beganAsDeparted) {
builder.append("At station");
} else {
builder.append("Departed");
builder.append(BartRunnerApplication.getAppContext().getString(
R.string.leaving));
}
} else {
builder.append(secondsLeft / 60);

View File

@ -89,10 +89,12 @@ public enum Line {
return lines;
}
public static Collection<Line> getLinesWithStations(Station station1, Station station2) {
public static Collection<Line> getLinesWithStations(Station station1,
Station station2) {
Collection<Line> lines = new ArrayList<Line>();
for (Line line : Line.values()) {
if (line.stations.contains(station1) && line.stations.contains(station2)) {
if (line.stations.contains(station1)
&& line.stations.contains(station2)) {
lines.add(line);
}
}

View File

@ -23,8 +23,7 @@ public enum Station {
COLM("colm", "Colma", "Colma", false, false, "balb", "balb"),
CONC("conc", "Concord", "Concord", false, false, "mcar", "mcar"),
DALY("daly", "Daly City", "Daly City", false, false),
DBRK("dbrk", "Downtown Berkeley", "Dtwn Berk", false, false, "mcar",
"mcar"),
DBRK("dbrk", "Downtown Berkeley", "Dtwn Berk", false, false, "mcar", "mcar"),
DUBL("dubl", "Dublin/Pleasanton", "Dbln/Plsntn", false, true, "bayf",
"bayf", true, 719999),
DELN("deln", "El Cerrito del Norte", "El Cer/Norte", false, false, "mcar",

View File

@ -1,6 +1,5 @@
package com.dougkeen.bart.model;
public interface TextProvider {
String getText(long tickNumber);

View File

@ -18,8 +18,10 @@ public class NetworkUtils {
final HttpParams params = client.getParams();
HttpConnectionParams.setConnectionTimeout(params,
NetworkUtils.CONNECTION_TIMEOUT_MILLIS);
HttpConnectionParams.setSoTimeout(params, NetworkUtils.CONNECTION_TIMEOUT_MILLIS);
ConnManagerParams.setTimeout(params, NetworkUtils.CONNECTION_TIMEOUT_MILLIS);
HttpConnectionParams.setSoTimeout(params,
NetworkUtils.CONNECTION_TIMEOUT_MILLIS);
ConnManagerParams.setTimeout(params,
NetworkUtils.CONNECTION_TIMEOUT_MILLIS);
return client;
}

View File

@ -24,7 +24,8 @@ public class AlarmBroadcastReceiver extends BroadcastReceiver {
application.setPlayAlarmRingtone(true);
Intent targetIntent = new Intent(Intent.ACTION_VIEW, boardedDeparture.getStationPair().getUri());
Intent targetIntent = new Intent(Intent.ACTION_VIEW, boardedDeparture
.getStationPair().getUri());
targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(targetIntent);