Added progress bar
Changed manifest to allow SD card installations
This commit is contained in:
parent
934341a1b0
commit
38c4c3bd03
@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dougkeen.bart"
|
||||
android:versionCode="18"
|
||||
android:versionName="2.0.0" >
|
||||
android:installLocation="auto"
|
||||
android:versionCode="19"
|
||||
android:versionName="2.0.1" >
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
@ -90,14 +90,21 @@
|
||||
bart:tickInterval="5" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
<ProgressBar
|
||||
android:id="@android:id/progress"
|
||||
style="@style/ProgressBarHolo.Horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:visibility="invisible" />
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">BART Runner</string>
|
||||
<string name="favorite_routes">Favorite routes</string>
|
||||
<string name="empty_favorites_list_message">No favorite routes have been added yet</string>
|
||||
@ -19,7 +20,7 @@
|
||||
http://m.bart.gov/schedules/advisories/</string>
|
||||
<string name="view">View</string>
|
||||
<string name="view_departures">View departures</string>
|
||||
<string name="missing_departure">Missing departure? Inaccurate time? Please report to bartrunner@dougkeen.com</string>
|
||||
<string name="missing_departure">Missing/inaccurate departure? Feature request? Please report to bartrunner@dougkeen.com</string>
|
||||
<string name="delete">Delete</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
@ -35,4 +36,5 @@
|
||||
<string name="getting_on_this_train">I will board this train</string>
|
||||
<string name="departure_options">Departure options</string>
|
||||
<string name="your_train">Your train</string>
|
||||
|
||||
</resources>
|
@ -21,6 +21,7 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -62,6 +63,7 @@ public class ViewDeparturesActivity extends SherlockListActivity {
|
||||
private ScheduleInformation mLatestScheduleInfo;
|
||||
|
||||
private TextView mEmptyView;
|
||||
private ProgressBar mProgress;
|
||||
|
||||
private AsyncTask<StationPair, Integer, RealTimeDepartures> mGetDeparturesTask;
|
||||
private AsyncTask<StationPair, Integer, ScheduleInformation> mGetScheduleInformationTask;
|
||||
@ -107,6 +109,8 @@ public class ViewDeparturesActivity extends SherlockListActivity {
|
||||
mEmptyView = (TextView) findViewById(android.R.id.empty);
|
||||
mEmptyView.setText(R.string.departure_wait_message);
|
||||
|
||||
mProgress = (ProgressBar) findViewById(android.R.id.progress);
|
||||
|
||||
mDeparturesAdapter = new DepartureArrayAdapter(this,
|
||||
R.layout.departure_listing);
|
||||
if (savedInstanceState != null) {
|
||||
@ -115,6 +119,7 @@ public class ViewDeparturesActivity extends SherlockListActivity {
|
||||
for (Parcelable departure : savedInstanceState
|
||||
.getParcelableArray("departures")) {
|
||||
mDeparturesAdapter.add((Departure) departure);
|
||||
mDeparturesAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
if (savedInstanceState.containsKey("boardedDeparture")) {
|
||||
@ -125,7 +130,8 @@ public class ViewDeparturesActivity extends SherlockListActivity {
|
||||
mSelectedDeparture = (Departure) savedInstanceState
|
||||
.getParcelable("selectedDeparture");
|
||||
}
|
||||
if(savedInstanceState.getBoolean("hasActionMode") && mSelectedDeparture != null) {
|
||||
if (savedInstanceState.getBoolean("hasActionMode")
|
||||
&& mSelectedDeparture != null) {
|
||||
startDepartureActionMode();
|
||||
}
|
||||
}
|
||||
@ -218,6 +224,7 @@ public class ViewDeparturesActivity extends SherlockListActivity {
|
||||
public void onResult(RealTimeDepartures result) {
|
||||
mDepartureFetchIsPending = false;
|
||||
Log.i(Constants.TAG, "Processing data from server");
|
||||
mProgress.setVisibility(View.INVISIBLE);
|
||||
processLatestDepartures(result);
|
||||
Log.i(Constants.TAG, "Done processing data from server");
|
||||
}
|
||||
@ -229,12 +236,15 @@ public class ViewDeparturesActivity extends SherlockListActivity {
|
||||
Toast.makeText(ViewDeparturesActivity.this,
|
||||
R.string.could_not_connect, Toast.LENGTH_LONG).show();
|
||||
mEmptyView.setText(R.string.could_not_connect);
|
||||
mProgress.setVisibility(View.INVISIBLE);
|
||||
// Try again in 60s
|
||||
scheduleDepartureFetch(60000);
|
||||
}
|
||||
};
|
||||
Log.i(Constants.TAG, "Fetching data from server");
|
||||
mGetDeparturesTask.execute(new StationPair(mOrigin, mDestination));
|
||||
mProgress.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
private void fetchLatestSchedule() {
|
||||
@ -264,6 +274,8 @@ public class ViewDeparturesActivity extends SherlockListActivity {
|
||||
Toast.makeText(ViewDeparturesActivity.this,
|
||||
R.string.could_not_connect, Toast.LENGTH_LONG).show();
|
||||
mEmptyView.setText(R.string.could_not_connect);
|
||||
mProgress.setVisibility(View.GONE);
|
||||
|
||||
// Try again in 60s
|
||||
scheduleScheduleInfoFetch(60000);
|
||||
}
|
||||
@ -290,6 +302,7 @@ public class ViewDeparturesActivity extends SherlockListActivity {
|
||||
if (result.getDepartures().isEmpty()) {
|
||||
final TextView textView = mEmptyView;
|
||||
textView.setText(R.string.no_data_message);
|
||||
mProgress.setVisibility(View.GONE);
|
||||
Linkify.addLinks(textView, Linkify.WEB_URLS);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user