diff --git a/.classpath b/.classpath index 53681c2..bb16dce 100644 --- a/.classpath +++ b/.classpath @@ -4,5 +4,6 @@ - + + diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 52ad070..fe7e62f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,50 +1,74 @@ - - + package="com.dougkeen.bart" + android:versionCode="7" + android:versionName="1.0.2" > - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/default.properties b/default.properties deleted file mode 100644 index 46769a7..0000000 --- a/default.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "build.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-7 diff --git a/res/drawable/map.png b/res/drawable/map.png new file mode 100644 index 0000000..b665cd0 Binary files /dev/null and b/res/drawable/map.png differ diff --git a/res/values/strings.xml b/res/values/strings.xml index ac2e637..7f1f30f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -13,7 +13,7 @@ You must select a destination station You must select an origin station Please wait while real time departure data is - loaded... + loaded No departure data is currently available for this route. Note that this route may require a non-standard transfer due to a temporary change in service. Check for service advisories posted at diff --git a/src/com/dougkeen/bart/AddRouteActivity.java b/src/com/dougkeen/bart/AddRouteActivity.java index fc09fc7..5af8cfd 100644 --- a/src/com/dougkeen/bart/AddRouteActivity.java +++ b/src/com/dougkeen/bart/AddRouteActivity.java @@ -36,7 +36,6 @@ public class AddRouteActivity extends Activity { Button saveButton = (Button) findViewById(R.id.saveButton); saveButton.setOnClickListener(new View.OnClickListener() { - @Override public void onClick(View v) { onSaveButtonClick(); } @@ -45,7 +44,6 @@ public class AddRouteActivity extends Activity { Button cancelButton = (Button) findViewById(R.id.cancelButton); cancelButton.setOnClickListener(new View.OnClickListener() { - @Override public void onClick(View v) { setResult(RESULT_CANCELED); finish(); diff --git a/src/com/dougkeen/bart/RoutesListActivity.java b/src/com/dougkeen/bart/RoutesListActivity.java index b580439..2242fe3 100644 --- a/src/com/dougkeen/bart/RoutesListActivity.java +++ b/src/com/dougkeen/bart/RoutesListActivity.java @@ -42,20 +42,16 @@ public class RoutesListActivity extends ListActivity { setContentView(R.layout.main); mQuery = managedQuery(Constants.FAVORITE_CONTENT_URI, new String[] { - RoutesColumns._ID.string, - RoutesColumns.FROM_STATION.string, + RoutesColumns._ID.string, RoutesColumns.FROM_STATION.string, RoutesColumns.TO_STATION.string }, null, null, RoutesColumns._ID.string); SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, - R.layout.favorite_listing, - mQuery, - new String[] { RoutesColumns.FROM_STATION.string, - RoutesColumns.TO_STATION.string }, - new int[] { R.id.originText, - R.id.destinationText }); + R.layout.favorite_listing, mQuery, new String[] { + RoutesColumns.FROM_STATION.string, + RoutesColumns.TO_STATION.string }, new int[] { + R.id.originText, R.id.destinationText }); adapter.setViewBinder(new ViewBinder() { - @Override public boolean setViewValue(View view, Cursor cursor, int columnIndex) { ((TextView) view).setText(Station.getByAbbreviation(cursor @@ -93,9 +89,7 @@ public class RoutesListActivity extends ListActivity { Constants.FAVORITE_CONTENT_URI)); return true; } else if (itemId == R.id.view_system_map_button) { - startActivity(new Intent( - Intent.ACTION_VIEW, - Uri.parse(Constants.MAP_URL))); + startActivity(new Intent(this, ViewMapActivity.class)); return true; } else { return super.onOptionsItemSelected(item); @@ -132,8 +126,7 @@ public class RoutesListActivity extends ListActivity { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item .getMenuInfo(); mCurrentlySelectedUri = ContentUris.withAppendedId( - Constants.FAVORITE_CONTENT_URI, - info.id); + Constants.FAVORITE_CONTENT_URI, info.id); if (item.getItemId() == R.id.view) { startActivity(new Intent(Intent.ACTION_VIEW, mCurrentlySelectedUri)); @@ -154,7 +147,6 @@ public class RoutesListActivity extends ListActivity { builder.setMessage("Are you sure you want to delete this route?"); builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { - @Override public void onClick(DialogInterface dialog, int which) { getContentResolver().delete(mCurrentlySelectedUri, null, null); @@ -165,7 +157,6 @@ public class RoutesListActivity extends ListActivity { }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - @Override public void onClick(DialogInterface dialog, int which) { mCurrentlySelectedUri = null; mCurrentlySelectedRouteName = null; diff --git a/src/com/dougkeen/bart/ViewDeparturesActivity.java b/src/com/dougkeen/bart/ViewDeparturesActivity.java index f03c7e1..f448c07 100644 --- a/src/com/dougkeen/bart/ViewDeparturesActivity.java +++ b/src/com/dougkeen/bart/ViewDeparturesActivity.java @@ -44,7 +44,6 @@ public class ViewDeparturesActivity extends ListActivity { private boolean mIsAutoUpdating = false; private final Runnable AUTO_UPDATE_RUNNABLE = new Runnable() { - @Override public void run() { runAutoUpdate(); } @@ -135,8 +134,7 @@ public class ViewDeparturesActivity extends ListActivity { } PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = powerManager - .newWakeLock( - PowerManager.SCREEN_DIM_WAKE_LOCK, + .newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "ViewDeparturesActivity"); mWakeLock.acquire(); if (mDeparturesAdapter != null && !mDeparturesAdapter.isEmpty()) { @@ -152,8 +150,8 @@ public class ViewDeparturesActivity extends ListActivity { if (!hasWindowFocus()) return; if (mGetDeparturesTask != null - && mGetDeparturesTask.getStatus() - .equals(AsyncTask.Status.RUNNING)) { + && mGetDeparturesTask.getStatus().equals( + AsyncTask.Status.RUNNING)) { // Don't overlap fetches return; } @@ -172,8 +170,7 @@ public class ViewDeparturesActivity extends ListActivity { mDataFetchIsPending = false; Log.w(Constants.TAG, e.getMessage(), e); Toast.makeText(ViewDeparturesActivity.this, - R.string.could_not_connect, - Toast.LENGTH_LONG).show(); + R.string.could_not_connect, Toast.LENGTH_LONG).show(); ((TextView) findViewById(android.R.id.empty)) .setText(R.string.could_not_connect); // Try again in 60s @@ -182,8 +179,7 @@ public class ViewDeparturesActivity extends ListActivity { }; Log.i(Constants.TAG, "Fetching data from server"); mGetDeparturesTask.execute(new GetRealTimeDeparturesTask.Params( - mOrigin, - mDestination)); + mOrigin, mDestination)); } protected void processLatestDepartures(RealTimeDepartures result) { @@ -241,8 +237,7 @@ public class ViewDeparturesActivity extends ListActivity { mDeparturesAdapter.notifyDataSetChanged(); if (hasWindowFocus() && firstDeparture != null) { - if (needsBetterAccuracy - || firstDeparture.hasDeparted()) { + if (needsBetterAccuracy || firstDeparture.hasDeparted()) { // Get more data in 20s scheduleDataFetch(20000); } else { @@ -277,7 +272,6 @@ public class ViewDeparturesActivity extends ListActivity { private void scheduleDataFetch(int millisUntilExecute) { if (!mDataFetchIsPending) { mListTitleView.postDelayed(new Runnable() { - @Override public void run() { fetchLatestDepartures(); } @@ -314,15 +308,14 @@ public class ViewDeparturesActivity extends ListActivity { Intent.ACTION_VIEW, Uri.parse("http://m.bart.gov/schedules/qp_results.aspx?type=departure&date=today&time=" + DateFormat.format("h:mmaa", - System.currentTimeMillis()) + "&orig=" + System.currentTimeMillis()) + + "&orig=" + mOrigin.abbreviation + "&dest=" + mDestination.abbreviation))); return true; } else if (itemId == R.id.view_system_map_button) { - startActivity(new Intent( - Intent.ACTION_VIEW, - Uri.parse(Constants.MAP_URL))); + startActivity(new Intent(this, ViewMapActivity.class)); return true; } else { return super.onOptionsItemSelected(item); diff --git a/src/com/dougkeen/bart/ViewMapActivity.java b/src/com/dougkeen/bart/ViewMapActivity.java new file mode 100644 index 0000000..f2b5b9f --- /dev/null +++ b/src/com/dougkeen/bart/ViewMapActivity.java @@ -0,0 +1,21 @@ +package com.dougkeen.bart; + +import android.app.Activity; +import android.os.Bundle; +import android.webkit.WebView; + +public class ViewMapActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + WebView webview = new WebView(this); + setContentView(webview); + + webview.getSettings().setBuiltInZoomControls(true); + webview.getSettings().setSupportZoom(true); + + webview.loadUrl("file:///android_res/drawable/map.png"); + } +} diff --git a/src/com/dougkeen/bart/data/Departure.java b/src/com/dougkeen/bart/data/Departure.java index 6c61ced..d0a1da6 100644 --- a/src/com/dougkeen/bart/data/Departure.java +++ b/src/com/dougkeen/bart/data/Departure.java @@ -195,7 +195,6 @@ public class Departure implements Parcelable, Comparable { } } - @Override public int compareTo(Departure another) { return (this.getMinutes() > another.getMinutes()) ? 1 : ( (this.getMinutes() == another.getMinutes()) ? 0 : -1); @@ -270,12 +269,10 @@ public class Departure implements Parcelable, Comparable { return builder.toString(); } - @Override public int describeContents() { return 0; } - @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(destination.abbreviation); dest.writeString(destinationColor);