Renamed project to BARTRunner
This commit is contained in:
parent
b3e112a845
commit
5a4d549398
2
.project
2
.project
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>DontMissTheBart</name>
|
<name>BARTRunner</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">BART Catcher</string>
|
<string name="app_name">BART Runner</string>
|
||||||
<string name="favorite_routes">Favorite Routes</string>
|
<string name="favorite_routes">Favorite Routes</string>
|
||||||
<string name="empty_favorites_list_message">Press the menu button and select \"Add route\" to
|
<string name="empty_favorites_list_message">Press the menu button and select \"Add route\" to
|
||||||
add a route</string>
|
add a route</string>
|
||||||
|
@ -33,7 +33,7 @@ public abstract class GetRealTimeDeparturesTask
|
|||||||
private final static String API_KEY = "5LD9-IAYI-TRAT-MHHW";
|
private final static String API_KEY = "5LD9-IAYI-TRAT-MHHW";
|
||||||
private final static String API_URL = "http://api.bart.gov/api/etd.aspx?cmd=etd&key="
|
private final static String API_URL = "http://api.bart.gov/api/etd.aspx?cmd=etd&key="
|
||||||
+ API_KEY + "&orig=%1$s&dir=%2$s";
|
+ API_KEY + "&orig=%1$s&dir=%2$s";
|
||||||
private final static int MAX_ATTEMPTS = 3;
|
private final static int MAX_ATTEMPTS = 5;
|
||||||
|
|
||||||
private Exception mException;
|
private Exception mException;
|
||||||
|
|
||||||
@ -93,9 +93,9 @@ public abstract class GetRealTimeDeparturesTask
|
|||||||
if (attemptNumber < MAX_ATTEMPTS - 1) {
|
if (attemptNumber < MAX_ATTEMPTS - 1) {
|
||||||
try {
|
try {
|
||||||
Log.w(Constants.TAG,
|
Log.w(Constants.TAG,
|
||||||
"Attempt to contact server failed... retrying in 5s",
|
"Attempt to contact server failed... retrying in 3s",
|
||||||
e);
|
e);
|
||||||
Thread.sleep(5000);
|
Thread.sleep(3000);
|
||||||
} catch (InterruptedException interrupt) {
|
} catch (InterruptedException interrupt) {
|
||||||
// Ignore... just go on to next attempt
|
// Ignore... just go on to next attempt
|
||||||
}
|
}
|
||||||
|
@ -97,13 +97,23 @@ public class ViewDeparturesActivity extends ListActivity {
|
|||||||
setListAdapter(mDeparturesAdapter);
|
setListAdapter(mDeparturesAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
cancelDataFetch();
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
cancelDataFetch();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelDataFetch() {
|
||||||
if (mGetDeparturesTask != null) {
|
if (mGetDeparturesTask != null) {
|
||||||
mGetDeparturesTask.cancel(true);
|
mGetDeparturesTask.cancel(true);
|
||||||
mDataFetchIsPending = false;
|
mDataFetchIsPending = false;
|
||||||
}
|
}
|
||||||
super.onDestroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -123,8 +133,8 @@ public class ViewDeparturesActivity extends ListActivity {
|
|||||||
if (!mDataFetchIsPending) {
|
if (!mDataFetchIsPending) {
|
||||||
fetchLatestDepartures();
|
fetchLatestDepartures();
|
||||||
}
|
}
|
||||||
PowerManager powerManaer = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = powerManaer
|
mWakeLock = powerManager
|
||||||
.newWakeLock(
|
.newWakeLock(
|
||||||
PowerManager.SCREEN_DIM_WAKE_LOCK,
|
PowerManager.SCREEN_DIM_WAKE_LOCK,
|
||||||
"ViewDeparturesActivity");
|
"ViewDeparturesActivity");
|
||||||
|
Loading…
Reference in New Issue
Block a user