Remove old third party shims for backwards compatibility, and replace them with the corresponding material support libraries. Has a number of visual issues, but these can be corrected in a subsequent diff to keep this self-contained.

Finish converting from tabs to spaces and remove more old eclipse files.
This commit is contained in:
Danny Weinberg 2015-08-11 17:56:05 -07:00
parent 00faa9ec76
commit 440b2112d0
47 changed files with 337 additions and 383 deletions

6
.gitmodules vendored
View File

@ -1,9 +1,3 @@
[submodule "holoeverywhere"]
path = holoeverywhere
url = https://github.com/Prototik/HoloEverywhere.git
[submodule "nineoldandroids"]
path = nineoldandroids
url = https://github.com/JakeWharton/NineOldAndroids
[submodule "drag-sort-listview"] [submodule "drag-sort-listview"]
path = drag-sort-listview path = drag-sort-listview
url = https://github.com/bauerca/drag-sort-listview url = https://github.com/bauerca/drag-sort-listview

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>BARTRunner</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.rim.ajde.internal.verifier</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.rim.ajde.BlackBerryAndroidNature</nature>
</natures>
</projectDescription>

View File

@ -2,17 +2,21 @@ apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt' apply plugin: 'com.neenbedankt.android-apt'
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':drag-sort-listview-gradle')
compile project(":holoeverywhere-gradle") compile 'commons-io:commons-io:2.4'
compile project(":holoeverywhere-preferences-gradle") compile 'org.apache.commons:commons-lang3:3.4'
compile project(":drag-sort-listview-gradle") compile 'com.fasterxml.jackson.core:jackson-databind:2.6.1'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.code-troopers.betterpickers:library:2.0.0'
compile 'com.android.support:appcompat-v7:22.2.1'
apt 'com.googlecode.androidannotations:androidannotations:2.7' apt 'com.googlecode.androidannotations:androidannotations:2.7'
compile "com.googlecode.androidannotations:androidannotations-api:2.7" compile "com.googlecode.androidannotations:androidannotations-api:2.7"
} }
android { android {
compileSdkVersion 17 compileSdkVersion 22
buildToolsVersion "22.0.1" buildToolsVersion "22.0.1"
compileOptions { compileOptions {
@ -20,8 +24,13 @@ android {
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
sourceSets { defaultConfig {
main.java.srcDirs += ["../nineoldandroids/library/src"] versionName "2.2.4"
versionCode 31
// TODO(fuegofro) - bring this back down to 8 if it's easy by using a different number picker library
minSdkVersion 9
targetSdkVersion 22
} }
buildTypes { buildTypes {
@ -31,8 +40,10 @@ android {
} }
packagingOptions { packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt' exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt' exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt' exclude 'META-INF/notice.txt'
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,22 +2,19 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dougkeen.bart" package="com.dougkeen.bart"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="31" >
android:versionName="2.2.4">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<application <application
android:name=".BartRunnerApplication_" android:name=".BartRunnerApplication_"
android:icon="@drawable/icon" android:icon="@drawable/icon"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme"
android:allowBackup="true"
>
<activity <activity
android:name=".activities.RoutesListActivity_" android:name=".activities.RoutesListActivity_"
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"
@ -81,4 +78,4 @@
</receiver> </receiver>
</application> </application>
</manifest> </manifest>

View File

@ -8,9 +8,9 @@ import java.util.List;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.holoeverywhere.app.Application;
import android.app.AlarmManager; import android.app.AlarmManager;
import android.app.Application;
import android.content.Context; import android.content.Context;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Parcel; import android.os.Parcel;
@ -126,10 +126,10 @@ public class BartRunnerApplication extends Application {
.createFromParcel(parcel); .createFromParcel(parcel);
parcel.recycle(); parcel.recycle();
/* /*
* Ooptionally check if the cached one is relatively recent. * Ooptionally check if the cached one is relatively recent.
* If so, restore that to the application context * If so, restore that to the application context
*/ */
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if (useOldCache if (useOldCache
|| lastBoardedDeparture.getEstimatedArrivalTime() >= now || lastBoardedDeparture.getEstimatedArrivalTime() >= now

View File

@ -1,20 +1,21 @@
package com.dougkeen.bart.activities; package com.dougkeen.bart.activities;
import org.holoeverywhere.LayoutInflater; import android.annotation.SuppressLint;
import org.holoeverywhere.app.AlertDialog; import android.app.Dialog;
import org.holoeverywhere.app.Dialog;
import org.holoeverywhere.app.DialogFragment;
import org.holoeverywhere.widget.ArrayAdapter;
import org.holoeverywhere.widget.Spinner;
import org.holoeverywhere.widget.Toast;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
import com.dougkeen.bart.R; import com.dougkeen.bart.R;
import com.dougkeen.bart.model.Station; import com.dougkeen.bart.model.Station;
@ -57,22 +58,23 @@ public abstract class AbstractRouteSelectionFragment extends DialogFragment {
final Dialog dialog = getDialog(); final Dialog dialog = getDialog();
final FragmentActivity activity = getActivity(); final FragmentActivity activity = getActivity();
ArrayAdapter<Station> originSpinnerAdapter = new ArrayAdapter<Station>(
activity, R.layout.simple_spinner_item, ArrayAdapter<Station> originSpinnerAdapter = new ArrayAdapter<>(
activity, R.layout.support_simple_spinner_dropdown_item,
Station.getStationList()); Station.getStationList());
originSpinnerAdapter originSpinnerAdapter
.setDropDownViewResource(R.layout.simple_spinner_dropdown_item); .setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
final Spinner originSpinner = (Spinner) dialog final Spinner originSpinner = (Spinner) dialog
.findViewById(R.id.origin_spinner); .findViewById(R.id.origin_spinner);
originSpinner.setAdapter(originSpinnerAdapter); originSpinner.setAdapter(originSpinnerAdapter);
originSpinner.setSelection(lastSelectedOriginPosition); originSpinner.setSelection(lastSelectedOriginPosition);
ArrayAdapter<Station> destinationSpinnerAdapter = new ArrayAdapter<Station>( ArrayAdapter<Station> destinationSpinnerAdapter = new ArrayAdapter<>(
activity, R.layout.simple_spinner_item, activity, R.layout.support_simple_spinner_dropdown_item,
Station.getStationList()); Station.getStationList());
destinationSpinnerAdapter destinationSpinnerAdapter
.setDropDownViewResource(R.layout.simple_spinner_dropdown_item); .setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
final Spinner destinationSpinner = (Spinner) dialog final Spinner destinationSpinner = (Spinner) dialog
.findViewById(R.id.destination_spinner); .findViewById(R.id.destination_spinner);
@ -80,12 +82,14 @@ public abstract class AbstractRouteSelectionFragment extends DialogFragment {
destinationSpinner.setSelection(lastSelectedDestinationPosition); destinationSpinner.setSelection(lastSelectedDestinationPosition);
} }
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final FragmentActivity activity = getActivity(); final FragmentActivity activity = getActivity();
final View dialogView = LayoutInflater.inflate(activity, @SuppressLint("InflateParams")
R.layout.route_form); final View dialogView = LayoutInflater.from(activity)
.inflate(R.layout.route_form, null /* root */);
return new AlertDialog.Builder(activity) return new AlertDialog.Builder(activity)
.setTitle(mTitle) .setTitle(mTitle)
@ -117,6 +121,7 @@ public abstract class AbstractRouteSelectionFragment extends DialogFragment {
Station origin = (Station) originSpinner.getSelectedItem(); Station origin = (Station) originSpinner.getSelectedItem();
Station destination = (Station) destinationSpinner.getSelectedItem(); Station destination = (Station) destinationSpinner.getSelectedItem();
// TODO(fuegofro) - convert these toasts to error messages on the dialog.
if (origin == null) { if (origin == null) {
Toast.makeText(dialog.getContext(), Toast.makeText(dialog.getContext(),
com.dougkeen.bart.R.string.error_null_origin, com.dougkeen.bart.R.string.error_null_origin,

View File

@ -9,6 +9,8 @@ import com.dougkeen.bart.model.Station;
import com.dougkeen.bart.model.StationPair; import com.dougkeen.bart.model.StationPair;
public class AddRouteDialogFragment extends AbstractRouteSelectionFragment { public class AddRouteDialogFragment extends AbstractRouteSelectionFragment {
public static final String TAG = "ADD_ROUTE_DIALOG_FRAGMENT_TAG";
public AddRouteDialogFragment() { public AddRouteDialogFragment() {
super(BartRunnerApplication.getAppContext().getString( super(BartRunnerApplication.getAppContext().getString(
R.string.add_route)); R.string.add_route));

View File

@ -10,6 +10,8 @@ import com.dougkeen.bart.model.StationPair;
public class QuickRouteDialogFragment extends AbstractRouteSelectionFragment { public class QuickRouteDialogFragment extends AbstractRouteSelectionFragment {
public static final String TAG = "QUICK_ROUTE_DIALOG_FRAGMENT_TAG";
public QuickRouteDialogFragment() { public QuickRouteDialogFragment() {
super(BartRunnerApplication.getAppContext().getString( super(BartRunnerApplication.getAppContext().getString(
R.string.quick_departure_lookup)); R.string.quick_departure_lookup));

View File

@ -3,26 +3,25 @@ package com.dougkeen.bart.activities;
import java.util.Calendar; import java.util.Calendar;
import java.util.TimeZone; import java.util.TimeZone;
import org.holoeverywhere.app.Activity;
import org.holoeverywhere.app.AlertDialog;
import org.holoeverywhere.app.AlertDialog.Builder;
import org.holoeverywhere.app.DialogFragment;
import org.holoeverywhere.widget.TextView;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.view.ActionMode;
import android.util.Log; import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.Button; import android.widget.Button;
import android.widget.ListAdapter; import android.widget.ListAdapter;
import android.widget.TextView;
import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.dougkeen.bart.BartRunnerApplication; import com.dougkeen.bart.BartRunnerApplication;
import com.dougkeen.bart.R; import com.dougkeen.bart.R;
import com.dougkeen.bart.controls.Ticker; import com.dougkeen.bart.controls.Ticker;
@ -49,7 +48,7 @@ import com.googlecode.androidannotations.annotations.rest.RestService;
import com.mobeta.android.dslv.DragSortListView; import com.mobeta.android.dslv.DragSortListView;
@EActivity(R.layout.main) @EActivity(R.layout.main)
public class RoutesListActivity extends Activity implements TickSubscriber { public class RoutesListActivity extends AppCompatActivity implements TickSubscriber {
private static final String NO_DELAYS_REPORTED = "No delays reported"; private static final String NO_DELAYS_REPORTED = "No delays reported";
private static final TimeZone PACIFIC_TIME = TimeZone private static final TimeZone PACIFIC_TIME = TimeZone
@ -88,7 +87,7 @@ public class RoutesListActivity extends Activity implements TickSubscriber {
@Click(R.id.quickLookupButton) @Click(R.id.quickLookupButton)
void quickLookupButtonClick() { void quickLookupButtonClick() {
DialogFragment dialog = new QuickRouteDialogFragment(); DialogFragment dialog = new QuickRouteDialogFragment();
dialog.show(getSupportFragmentManager().beginTransaction()); dialog.show(getSupportFragmentManager(), QuickRouteDialogFragment.TAG);
} }
@ItemClick(android.R.id.list) @ItemClick(android.R.id.list)
@ -273,8 +272,9 @@ public class RoutesListActivity extends Activity implements TickSubscriber {
} }
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater(); MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.routes_list_menu, menu); inflater.inflate(R.menu.routes_list_menu, menu);
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
@ -282,11 +282,12 @@ public class RoutesListActivity extends Activity implements TickSubscriber {
private MenuItem elevatorMenuItem; private MenuItem elevatorMenuItem;
private View origElevatorActionView; private View origElevatorActionView;
@Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId(); int itemId = item.getItemId();
if (itemId == R.id.add_favorite_menu_button) { if (itemId == R.id.add_favorite_menu_button) {
new AddRouteDialogFragment().show(getSupportFragmentManager() new AddRouteDialogFragment().show(getSupportFragmentManager(),
.beginTransaction()); AddRouteDialogFragment.TAG);
return true; return true;
} else if (itemId == R.id.view_system_map_button) { } else if (itemId == R.id.view_system_map_button) {
startActivity(new Intent(this, ViewMapActivity.class)); startActivity(new Intent(this, ViewMapActivity.class));
@ -294,8 +295,8 @@ public class RoutesListActivity extends Activity implements TickSubscriber {
} else if (itemId == R.id.elevator_button) { } else if (itemId == R.id.elevator_button) {
elevatorMenuItem = item; elevatorMenuItem = item;
fetchElevatorInfo(); fetchElevatorInfo();
origElevatorActionView = elevatorMenuItem.getActionView(); origElevatorActionView = MenuItemCompat.getActionView(elevatorMenuItem);
elevatorMenuItem.setActionView(R.layout.progress_spinner); MenuItemCompat.setActionView(elevatorMenuItem, R.layout.progress_spinner);
return true; return true;
} else { } else {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
@ -336,7 +337,7 @@ public class RoutesListActivity extends Activity implements TickSubscriber {
if (messageText == null) { if (messageText == null) {
hideAlertMessage(); hideAlertMessage();
return; return;
} else if (messageText == NO_DELAYS_REPORTED) { } else if (messageText.equals(NO_DELAYS_REPORTED)) {
alertMessages.setCompoundDrawablesWithIntrinsicBounds( alertMessages.setCompoundDrawablesWithIntrinsicBounds(
R.drawable.ic_allgood, 0, 0, 0); R.drawable.ic_allgood, 0, 0, 0);
} else { } else {
@ -360,19 +361,19 @@ public class RoutesListActivity extends Activity implements TickSubscriber {
@UiThread @UiThread
void resetElevatorMenuGraphic() { void resetElevatorMenuGraphic() {
ActivityCompat.invalidateOptionsMenu(this); ActivityCompat.invalidateOptionsMenu(this);
elevatorMenuItem.setActionView(origElevatorActionView); MenuItemCompat.setActionView(elevatorMenuItem, origElevatorActionView);
} }
@UiThread @UiThread
void showElevatorMessage(String message) { void showElevatorMessage(String message) {
Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(message); builder.setMessage(message);
builder.setTitle("Elevator status"); builder.setTitle("Elevator status");
builder.show(); builder.show();
} }
private void startContextualActionMode() { private void startContextualActionMode() {
mActionMode = startActionMode(new RouteActionMode()); mActionMode = startSupportActionMode(new RouteActionMode());
mActionMode.setTitle(mCurrentlySelectedStationPair.getOrigin().name); mActionMode.setTitle(mCurrentlySelectedStationPair.getOrigin().name);
mActionMode.setSubtitle("to " mActionMode.setSubtitle("to "
+ mCurrentlySelectedStationPair.getDestination().name); + mCurrentlySelectedStationPair.getDestination().name);
@ -446,4 +447,4 @@ public class RoutesListActivity extends Activity implements TickSubscriber {
public void onTick(long mTickCount) { public void onTick(long mTickCount) {
fetchAlerts(); fetchAlerts();
} }
} }

View File

@ -1,25 +1,27 @@
package com.dougkeen.bart.activities; package com.dougkeen.bart.activities;
import org.holoeverywhere.LayoutInflater; import android.annotation.SuppressLint;
import org.holoeverywhere.app.AlertDialog; import android.app.Dialog;
import org.holoeverywhere.app.Dialog;
import org.holoeverywhere.app.DialogFragment;
import org.holoeverywhere.widget.NumberPicker;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import com.codetroopers.betterpickers.numberpicker.NumberPicker;
import com.dougkeen.bart.BartRunnerApplication; import com.dougkeen.bart.BartRunnerApplication;
import com.dougkeen.bart.R; import com.dougkeen.bart.R;
import com.dougkeen.bart.model.Departure; import com.dougkeen.bart.model.Departure;
public class TrainAlarmDialogFragment extends DialogFragment { public class TrainAlarmDialogFragment extends DialogFragment {
public static final String TAG = "TRAIN_ALARM_DIALOG_FRAGMENT_TAG";
private static final String KEY_LAST_ALARM_LEAD_TIME = "lastAlarmLeadTime"; private static final String KEY_LAST_ALARM_LEAD_TIME = "lastAlarmLeadTime";
public TrainAlarmDialogFragment() { public TrainAlarmDialogFragment() {
@ -52,33 +54,35 @@ public class TrainAlarmDialogFragment extends DialogFragment {
final Departure boardedDeparture = application.getBoardedDeparture(); final Departure boardedDeparture = application.getBoardedDeparture();
final int maxValue = boardedDeparture.getMeanSecondsLeft() / 60; final int maxValue = boardedDeparture.getMeanSecondsLeft() / 60;
String[] displayedValues = new String[maxValue]; numberPicker.setMin(1);
for (int i = 1; i <= maxValue; i++) { numberPicker.setMax(maxValue);
displayedValues[i - 1] = String.valueOf(i);
}
numberPicker.setMinValue(1);
numberPicker.setMaxValue(maxValue);
numberPicker.setDisplayedValues(displayedValues);
if (boardedDeparture.isAlarmPending()) { if (boardedDeparture.isAlarmPending()) {
numberPicker.setValue(boardedDeparture.getAlarmLeadTimeMinutes()); setNumber(numberPicker, boardedDeparture.getAlarmLeadTimeMinutes());
} else if (maxValue >= lastAlarmLeadTime) { } else if (maxValue >= lastAlarmLeadTime) {
numberPicker.setValue(lastAlarmLeadTime); setNumber(numberPicker, lastAlarmLeadTime);
} else if (maxValue >= 5) { } else if (maxValue >= 5) {
numberPicker.setValue(5); setNumber(numberPicker, 5);
} else if (maxValue >= 3) { } else if (maxValue >= 3) {
numberPicker.setValue(3); setNumber(numberPicker, 3);
} else { } else {
numberPicker.setValue(1); setNumber(numberPicker, 1);
} }
} }
private void setNumber(NumberPicker numberPicker, int value) {
// Passing in null for the decimalPart and sign doesn't change them.
numberPicker.setNumber(value, null /* decimalPart */, null /* sign */);
}
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final FragmentActivity activity = getActivity(); final FragmentActivity activity = getActivity();
final View dialogView = LayoutInflater.inflate(activity, @SuppressLint("InflateParams")
R.layout.train_alarm_dialog); final View dialogView = LayoutInflater.from(activity)
.inflate(R.layout.train_alarm_dialog, null /* root */);
return new AlertDialog.Builder(activity) return new AlertDialog.Builder(activity)
.setTitle(R.string.set_up_departure_alarm) .setTitle(R.string.set_up_departure_alarm)
@ -88,11 +92,10 @@ public class TrainAlarmDialogFragment extends DialogFragment {
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, public void onClick(DialogInterface dialog,
int which) { int which) {
NumberPicker numberPicker = (NumberPicker) getDialog() NumberPicker numberPicker = (NumberPicker) getDialog()
.findViewById(R.id.numberPicker); .findViewById(R.id.numberPicker);
final int alarmLeadTime = numberPicker final int alarmLeadTime = numberPicker.getNumber();
.getValue();
// Save most recent selection // Save most recent selection
Editor editor = getActivity().getPreferences( Editor editor = getActivity().getPreferences(

View File

@ -2,12 +2,6 @@ package com.dougkeen.bart.activities;
import java.util.List; import java.util.List;
import org.holoeverywhere.app.Activity;
import org.holoeverywhere.widget.ListView;
import org.holoeverywhere.widget.ProgressBar;
import org.holoeverywhere.widget.TextView;
import org.holoeverywhere.widget.Toast;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.AlertDialog.Builder; import android.app.AlertDialog.Builder;
import android.content.ComponentName; import android.content.ComponentName;
@ -23,18 +17,23 @@ import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Parcelable; import android.os.Parcelable;
import android.os.Vibrator; import android.os.Vibrator;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.view.ActionMode;
import android.text.format.DateFormat; import android.text.format.DateFormat;
import android.text.util.Linkify; import android.text.util.Linkify;
import android.util.Log; import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.Checkable; import android.widget.Checkable;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.dougkeen.bart.BartRunnerApplication; import com.dougkeen.bart.BartRunnerApplication;
import com.dougkeen.bart.R; import com.dougkeen.bart.R;
import com.dougkeen.bart.controls.SwipeHelper; import com.dougkeen.bart.controls.SwipeHelper;
@ -52,7 +51,7 @@ import com.dougkeen.bart.services.EtdService_;
import com.dougkeen.util.Observer; import com.dougkeen.util.Observer;
import com.dougkeen.util.WakeLocker; import com.dougkeen.util.WakeLocker;
public class ViewDeparturesActivity extends Activity implements public class ViewDeparturesActivity extends AppCompatActivity implements
EtdServiceListener { EtdServiceListener {
private StationPair mStationPair; private StationPair mStationPair;
@ -286,15 +285,15 @@ public class ViewDeparturesActivity extends Activity implements
if (mActionMode != null) { if (mActionMode != null) {
/* /*
* If action mode is displayed, cancel out of that * If action mode is displayed, cancel out of that
*/ */
mActionMode.finish(); mActionMode.finish();
getListView().clearChoices(); getListView().clearChoices();
} else { } else {
/* /*
* Otherwise select the clicked departure as the one the user * Otherwise select the clicked departure as the one the user
* wants to board * wants to board
*/ */
setBoardedDeparture( setBoardedDeparture(
getListAdapter().getItem(position), true); getListAdapter().getItem(position), true);
} }
@ -350,10 +349,10 @@ public class ViewDeparturesActivity extends Activity implements
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
if (mStationPair != null) { if (mStationPair != null) {
/* /*
* If origin or destination are null, this thing was never * If origin or destination are null, this thing was never
* initialized in the first place, so there's really nothing to save * initialized in the first place, so there's really nothing to save
*/ */
Departure[] departures = new Departure[mDeparturesAdapter Departure[] departures = new Departure[mDeparturesAdapter
.getCount()]; .getCount()];
for (int i = mDeparturesAdapter.getCount() - 1; i >= 0; i--) { for (int i = mDeparturesAdapter.getCount() - 1; i >= 0; i--) {
@ -399,7 +398,7 @@ public class ViewDeparturesActivity extends Activity implements
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater(); MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.route_menu, menu); inflater.inflate(R.menu.route_menu, menu);
return true; return true;
} }
@ -453,15 +452,10 @@ public class ViewDeparturesActivity extends Activity implements
&& departure.getStationPair().equals(getStationPair()); && departure.getStationPair().equals(getStationPair());
} }
private void setBoardedDeparture(Departure selectedDeparture) {
setBoardedDeparture(selectedDeparture, false);
}
private void setBoardedDeparture(Departure selectedDeparture, private void setBoardedDeparture(Departure selectedDeparture,
boolean startActionMode) { boolean startActionMode) {
final BartRunnerApplication application = (BartRunnerApplication) getApplication(); final BartRunnerApplication application = (BartRunnerApplication) getApplication();
selectedDeparture selectedDeparture.setPassengerDestination(mStationPair.getDestination());
.setPassengerDestination(mStationPair.getDestination());
application.setBoardedDeparture(selectedDeparture); application.setBoardedDeparture(selectedDeparture);
refreshBoardedDeparture(true); refreshBoardedDeparture(true);
@ -479,7 +473,7 @@ public class ViewDeparturesActivity extends Activity implements
private void startDepartureActionMode() { private void startDepartureActionMode() {
if (mActionMode == null) if (mActionMode == null)
mActionMode = startActionMode(new DepartureActionMode()); mActionMode = startSupportActionMode(new DepartureActionMode());
mActionMode.setTitle(mSelectedDeparture.getTrainDestinationName()); mActionMode.setTitle(mSelectedDeparture.getTrainDestinationName());
mActionMode.setSubtitle(mSelectedDeparture.getTrainLengthAndPlatform()); mActionMode.setSubtitle(mSelectedDeparture.getTrainLengthAndPlatform());
} }
@ -519,7 +513,7 @@ public class ViewDeparturesActivity extends Activity implements
private void startYourTrainActionMode() { private void startYourTrainActionMode() {
if (mActionMode == null) if (mActionMode == null)
mActionMode = startActionMode(new YourTrainActionMode()); mActionMode = startSupportActionMode(new YourTrainActionMode());
mActionMode.setTitle(R.string.your_train); mActionMode.setTitle(R.string.your_train);
Departure boardedDeparture = getBoardedDeparture(); Departure boardedDeparture = getBoardedDeparture();
if (boardedDeparture != null && boardedDeparture.isAlarmPending()) { if (boardedDeparture != null && boardedDeparture.isAlarmPending()) {
@ -624,8 +618,7 @@ public class ViewDeparturesActivity extends Activity implements
// Don't prompt for alarm if train is about to leave // Don't prompt for alarm if train is about to leave
if (boardedDeparture.getMeanSecondsLeft() > 60) { if (boardedDeparture.getMeanSecondsLeft() > 60) {
new TrainAlarmDialogFragment() new TrainAlarmDialogFragment()
.show(getSupportFragmentManager() .show(getSupportFragmentManager(), TrainAlarmDialogFragment.TAG);
.beginTransaction());
} }
return true; return true;
@ -733,7 +726,6 @@ public class ViewDeparturesActivity extends Activity implements
existingDeparture.mergeEstimate(departure); existingDeparture.mergeEstimate(departure);
} else { } else {
mDeparturesAdapter.add(departure); mDeparturesAdapter.add(departure);
existingDeparture = departure;
} }
} }
} else { } else {
@ -762,6 +754,7 @@ public class ViewDeparturesActivity extends Activity implements
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
// TODO(fuegofro) - see if there's a way to not use toasts
Toast.makeText(ViewDeparturesActivity.this, errorMessage, Toast.makeText(ViewDeparturesActivity.this, errorMessage,
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
} }
@ -821,4 +814,4 @@ public class ViewDeparturesActivity extends Activity implements
private Departure getBoardedDeparture() { private Departure getBoardedDeparture() {
return ((BartRunnerApplication) getApplication()).getBoardedDeparture(); return ((BartRunnerApplication) getApplication()).getBoardedDeparture();
} }
} }

View File

@ -1,16 +1,15 @@
package com.dougkeen.bart.activities; package com.dougkeen.bart.activities;
import org.holoeverywhere.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.webkit.WebView; import android.webkit.WebView;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.dougkeen.bart.R; import com.dougkeen.bart.R;
public class ViewMapActivity extends Activity { public class ViewMapActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -30,7 +29,7 @@ public class ViewMapActivity extends Activity {
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater(); MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.system_map_menu, menu); inflater.inflate(R.menu.system_map_menu, menu);
return true; return true;
} }

View File

@ -1,9 +1,11 @@
package com.dougkeen.bart.controls; package com.dougkeen.bart.controls;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.widget.TextView; import android.widget.TextView;
import com.dougkeen.bart.R;
import com.dougkeen.bart.model.TextProvider; import com.dougkeen.bart.model.TextProvider;
public class CountdownTextView extends TextView implements public class CountdownTextView extends TextView implements
@ -27,9 +29,9 @@ public class CountdownTextView extends TextView implements
} }
private void setInstanceVarsFromAttrs(AttributeSet attrs) { private void setInstanceVarsFromAttrs(AttributeSet attrs) {
int tickInterval = attrs.getAttributeIntValue( TypedArray typedArray = getContext().getTheme()
"http://schemas.android.com/apk/res/com.dougkeen.bart", .obtainStyledAttributes(attrs, R.styleable.CountdownTextView, 0, 0);
"tickInterval", 0); int tickInterval = typedArray.getInteger(R.styleable.CountdownTextView_tickInterval, 0);
if (tickInterval > 0) { if (tickInterval > 0) {
setTickInterval(tickInterval); setTickInterval(tickInterval);
} }

View File

@ -56,11 +56,11 @@ import com.nineoldandroids.animation.ValueAnimator;
* <p> * <p>
* <pre> * <pre>
* view.setOnTouchListener(new SwipeDismisser(view, null, // Optional * view.setOnTouchListener(new SwipeDismisser(view, null, // Optional
* // token/cookie * // token/cookie
* // object * // object
* new SwipeDismisser.OnDismissCallback() { * new SwipeDismisser.OnDismissCallback() {
* public void onDismiss(View view, Object token) { * public void onDismiss(View view, Object token) {
* parent.removeView(view); * parent.removeView(view);
* } * }
* })); * }));
* </pre> * </pre>
@ -244,10 +244,10 @@ public class SwipeHelper implements View.OnTouchListener {
mCallback.onDismiss(mView, mToken); mCallback.onDismiss(mView, mToken);
// Reset view presentation // Reset view presentation
/* /*
* Alpha stays at 0, otherwise Android 2.x leaves weird * Alpha stays at 0, otherwise Android 2.x leaves weird
* artifacts * artifacts
*/ */
// setAlpha(mView, 1f); // setAlpha(mView, 1f);
setTranslationX(mView, 0); setTranslationX(mView, 0);
@ -269,14 +269,14 @@ public class SwipeHelper implements View.OnTouchListener {
public void showWithAnimation() { public void showWithAnimation() {
final int measureSpec = MeasureSpec.makeMeasureSpec( final int measureSpec = MeasureSpec.makeMeasureSpec(
ViewGroup.LayoutParams.WRAP_CONTENT, MeasureSpec.EXACTLY); ViewGroup.LayoutParams.WRAP_CONTENT, MeasureSpec.UNSPECIFIED);
mView.measure(measureSpec, measureSpec); mView.measure(measureSpec, measureSpec);
mViewWidth = mView.getMeasuredWidth(); mViewWidth = mView.getMeasuredWidth();
final int viewHeight = mView.getMeasuredHeight(); final int viewHeight = mView.getMeasuredHeight();
setAlpha(mView, 0f); setAlpha(mView, 0f);
final ViewGroup.LayoutParams lp = mView.getLayoutParams(); final ViewGroup.LayoutParams lp = mView.getLayoutParams();
lp.width = mViewWidth; final int originalHeight = lp.height;
setTranslationX(mView, mViewWidth); setTranslationX(mView, mViewWidth);
@ -288,11 +288,13 @@ public class SwipeHelper implements View.OnTouchListener {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
// Reset view presentation // Reset view presentation
// mView.requestLayout(); lp.height = originalHeight;
mView.setLayoutParams(lp);
// Swipe view into space that opened up // Swipe view into space that opened up
animate(mView).translationX(0).alpha(1) animate(mView).translationX(0).alpha(1)
.setDuration(mAnimationTime) .setDuration(mAnimationTime)
// Dummy listener so the default doesn't run
.setListener(new AnimatorListenerAdapter() { .setListener(new AnimatorListenerAdapter() {
}); });
} }
@ -308,4 +310,4 @@ public class SwipeHelper implements View.OnTouchListener {
animator.start(); animator.start();
} }
} }

View File

@ -3,9 +3,11 @@ package com.dougkeen.bart.controls;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.widget.TextSwitcher; import android.widget.TextSwitcher;
import com.dougkeen.bart.R;
import com.dougkeen.bart.model.TextProvider; import com.dougkeen.bart.model.TextProvider;
public class TimedTextSwitcher extends TextSwitcher implements public class TimedTextSwitcher extends TextSwitcher implements
@ -21,9 +23,9 @@ public class TimedTextSwitcher extends TextSwitcher implements
} }
private void setInstanceVarsFromAttrs(AttributeSet attrs) { private void setInstanceVarsFromAttrs(AttributeSet attrs) {
int tickInterval = attrs.getAttributeIntValue( TypedArray typedArray = getContext().getTheme()
"http://schemas.android.com/apk/res/com.dougkeen.bart", .obtainStyledAttributes(attrs, R.styleable.TimedTextSwitcher, 0, 0);
"tickInterval", 0); int tickInterval = typedArray.getInteger(R.styleable.TimedTextSwitcher_tickInterval, 0);
if (tickInterval > 0) { if (tickInterval > 0) {
setTickInterval(tickInterval); setTickInterval(tickInterval);
} }

View File

@ -363,9 +363,9 @@ public class Departure implements Parcelable, Comparable<Departure> {
if (departure.hasDeparted() && origin.longStationLinger if (departure.hasDeparted() && origin.longStationLinger
&& getMinEstimate() > 0 && !beganAsDeparted) { && getMinEstimate() > 0 && !beganAsDeparted) {
/* /*
* This is probably not a true departure, but an indication that the * This is probably not a true departure, but an indication that the
* train is in the station. Don't update the estimates. * train is in the station. Don't update the estimates.
*/ */
return; return;
} }
@ -380,19 +380,19 @@ public class Departure implements Parcelable, Comparable<Departure> {
if ((getMaxEstimate() - departure.getMinEstimate()) < MINIMUM_MERGE_OVERLAP_MILLIS if ((getMaxEstimate() - departure.getMinEstimate()) < MINIMUM_MERGE_OVERLAP_MILLIS
|| departure.getMaxEstimate() - getMinEstimate() < MINIMUM_MERGE_OVERLAP_MILLIS) { || departure.getMaxEstimate() - getMinEstimate() < MINIMUM_MERGE_OVERLAP_MILLIS) {
/* /*
* The estimate must have changed... just use the latest incoming * The estimate must have changed... just use the latest incoming
* values * values
*/ */
newMin = departure.getMinEstimate(); newMin = departure.getMinEstimate();
newMax = departure.getMaxEstimate(); newMax = departure.getMaxEstimate();
} }
/* /*
* If the new departure would mark this as departed, and we have < 60 * If the new departure would mark this as departed, and we have < 60
* seconds left on a fairly accurate local estimate, ignore the incoming * seconds left on a fairly accurate local estimate, ignore the incoming
* departure * departure
*/ */
if (!wasDeparted && getMeanSecondsLeft(newMin, newMax) <= 0 if (!wasDeparted && getMeanSecondsLeft(newMin, newMax) <= 0
&& getMeanSecondsLeft() < 60 && getUncertaintySeconds() < 30) { && getMeanSecondsLeft() < 60 && getUncertaintySeconds() < 30) {
Log.d(Constants.TAG, Log.d(Constants.TAG,
@ -736,4 +736,4 @@ public class Departure implements Parcelable, Comparable<Departure> {
public void notifyAlarmHasBeenHandled() { public void notifyAlarmHasBeenHandled() {
this.alarmPending.setValue(false); this.alarmPending.setValue(false);
} }
} }

View File

@ -247,14 +247,14 @@ public class BoardedDepartureService extends Service implements
if (mEtdService != null) { if (mEtdService != null) {
/* /*
* Make sure we're still listening for ETD changes (in case weak ref * Make sure we're still listening for ETD changes (in case weak ref
* was garbage collected). Not a huge fan of this approach, but I * was garbage collected). Not a huge fan of this approach, but I
* think I'd rather keep the weak references to avoid memory leaks * think I'd rather keep the weak references to avoid memory leaks
* than move to soft references or some other form of stronger * than move to soft references or some other form of stronger
* reference. Besides, registerListener() should only result in a * reference. Besides, registerListener() should only result in a
* few constant-time map operations, so there shouldn't be a big * few constant-time map operations, so there shouldn't be a big
* performance hit. * performance hit.
*/ */
mEtdService.registerListener(this, false); mEtdService.registerListener(this, false);
} }

View File

@ -367,10 +367,10 @@ public class EtdService extends Service {
mStationPair.setAverageTripSampleCount(newAverageSampleCount); mStationPair.setAverageTripSampleCount(newAverageSampleCount);
} }
/* /*
* If we still have some departures without estimates, try again * If we still have some departures without estimates, try again
* later * later
*/ */
if (departuresWithoutEstimates > 0) { if (departuresWithoutEstimates > 0) {
scheduleScheduleInfoFetch(20000); scheduleScheduleInfoFetch(20000);
} }
@ -386,12 +386,12 @@ public class EtdService extends Service {
if (result.getDepartures().isEmpty() if (result.getDepartures().isEmpty()
&& mStationPair.isBetweenStations(Station.MLBR, && mStationPair.isBetweenStations(Station.MLBR,
Station.SFIA)) { Station.SFIA)) {
/* /*
* Let's try again, ignoring direction (this sometimes comes up * Let's try again, ignoring direction (this sometimes comes up
* when you travel between Millbrae and SFO... sometimes you * when you travel between Millbrae and SFO... sometimes you
* need to travel north and transfer, sometimes you can travel * need to travel north and transfer, sometimes you can travel
* south for a direct line) * south for a direct line)
*/ */
mIgnoreDepartureDirection = true; mIgnoreDepartureDirection = true;
scheduleDepartureFetch(50); scheduleDepartureFetch(50);
return; return;
@ -402,10 +402,10 @@ public class EtdService extends Service {
final Departure boardedDeparture = ((BartRunnerApplication) getApplication()) final Departure boardedDeparture = ((BartRunnerApplication) getApplication())
.getBoardedDeparture(); .getBoardedDeparture();
/* /*
* Keep track of first departure, since we'll request another quick * Keep track of first departure, since we'll request another quick
* refresh if it has departed. * refresh if it has departed.
*/ */
Departure firstDeparture = null; Departure firstDeparture = null;
final List<Departure> departures = result.getDepartures(); final List<Departure> departures = result.getDepartures();
@ -424,16 +424,16 @@ public class EtdService extends Service {
} }
} }
/* /*
* Since all the departures are new, we'll definitely need * Since all the departures are new, we'll definitely need
* better accuracy * better accuracy
*/ */
needsBetterAccuracy = true; needsBetterAccuracy = true;
} else { } else {
/* /*
* Let's merge the latest departure list with the instance * Let's merge the latest departure list with the instance
* departure list * departure list
*/ */
int instanceListIndex = -1; int instanceListIndex = -1;
for (Departure departure : departures) { for (Departure departure : departures) {
instanceListIndex++; instanceListIndex++;
@ -442,20 +442,20 @@ public class EtdService extends Service {
existingDeparture = mLatestDepartures existingDeparture = mLatestDepartures
.get(instanceListIndex); .get(instanceListIndex);
} }
/* /*
* Looks for departures at the beginning of the adapter that * Looks for departures at the beginning of the adapter that
* aren't in the latest list of departures * aren't in the latest list of departures
*/ */
while (existingDeparture != null while (existingDeparture != null
&& !departure.equals(existingDeparture)) { && !departure.equals(existingDeparture)) {
// Remove old departure // Remove old departure
mLatestDepartures.remove(existingDeparture); mLatestDepartures.remove(existingDeparture);
if (instanceListIndex < mLatestDepartures.size()) { if (instanceListIndex < mLatestDepartures.size()) {
/* /*
* Try again with next departure (keep in mind the * Try again with next departure (keep in mind the
* next departure is now at the current index, since * next departure is now at the current index, since
* we removed a member) * we removed a member)
*/ */
existingDeparture = mLatestDepartures existingDeparture = mLatestDepartures
.get(instanceListIndex); .get(instanceListIndex);
} else { } else {
@ -463,10 +463,10 @@ public class EtdService extends Service {
existingDeparture = null; existingDeparture = null;
} }
} }
/* /*
* Merge the estimate if we found a matching departure, * Merge the estimate if we found a matching departure,
* otherwise add a new one to the adapter * otherwise add a new one to the adapter
*/ */
if (existingDeparture != null) { if (existingDeparture != null) {
existingDeparture.mergeEstimate(departure); existingDeparture.mergeEstimate(departure);
} else { } else {
@ -502,10 +502,10 @@ public class EtdService extends Service {
// Get more data in 20s // Get more data in 20s
scheduleDepartureFetch(20000); scheduleDepartureFetch(20000);
} else { } else {
/* /*
* Get more 90 seconds before next train arrives, right when * Get more 90 seconds before next train arrives, right when
* next train arrives, or 3 minutes, whichever is sooner * next train arrives, or 3 minutes, whichever is sooner
*/ */
final int intervalUntilNextDeparture = firstDeparture final int intervalUntilNextDeparture = firstDeparture
.getMinSecondsLeft() * 1000; .getMinSecondsLeft() * 1000;
final int alternativeInterval = 3 * 60 * 1000; final int alternativeInterval = 3 * 60 * 1000;
@ -539,10 +539,10 @@ public class EtdService extends Service {
return; return;
} }
/* /*
* Otherwise, check if the latest departure doesn't have schedule * Otherwise, check if the latest departure doesn't have schedule
* info... if not, fetch * info... if not, fetch
*/ */
Departure lastDeparture = mLatestDepartures.get(mLatestDepartures Departure lastDeparture = mLatestDepartures.get(mLatestDepartures
.size() - 1); .size() - 1);
if (mLatestScheduleInfo.getLatestDepartureTime() < lastDeparture if (mLatestScheduleInfo.getLatestDepartureTime() < lastDeparture

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <merge
xmlns:bart="http://schemas.android.com/apk/res/com.dougkeen.bart" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bart="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
@ -73,4 +74,4 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_below="@id/uncertainty" /> android:layout_below="@id/uncertainty" />
</merge> </merge>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <merge
xmlns:bart="http://schemas.android.com/apk/res/com.dougkeen.bart" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bart="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
@ -60,4 +61,4 @@
android:layout_below="@id/topRow" android:layout_below="@id/topRow"
bart:tickInterval="1" /> bart:tickInterval="1" />
</merge> </merge>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:bart="http://schemas.android.com/apk/res/com.dougkeen.bart" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
@ -20,7 +20,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:padding="10dp" android:padding="10dp"
android:visibility="gone"></com.dougkeen.bart.controls.YourTrainLayout> android:visibility="gone"
/>
<TextView <TextView
android:id="@android:id/empty" android:id="@android:id/empty"
@ -36,7 +37,7 @@
<ProgressBar <ProgressBar
android:id="@android:id/progress" android:id="@android:id/progress"
style="@style/Holo.ProgressBar.Horizontal" style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout
xmlns:bart="http://schemas.android.com/apk/res/com.dougkeen.bart" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bart="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="5dp" android:paddingLeft="5dp"
@ -56,4 +57,4 @@
android:layout_toRightOf="@id/to" android:layout_toRightOf="@id/to"
android:text="Destination" /> android:text="Destination" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:app="http://schemas.android.com/apk/res/com.dougkeen.bart" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:gravity="center" android:gravity="center"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout
xmlns:holo="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical"> android:gravity="center_vertical">
@ -22,7 +22,7 @@
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:paddingTop="15dip" android:paddingTop="15dip"
holo:spinnerMode="dialog" /> />
<TextView <TextView
android:id="@+id/origin_label" android:id="@+id/origin_label"
@ -48,7 +48,7 @@
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:paddingTop="15dip" android:paddingTop="15dip"
holo:spinnerMode="dialog" /> />
<TextView <TextView
android:id="@+id/destination_label" android:id="@+id/destination_label"
@ -74,4 +74,4 @@
android:text="@string/also_add_return_route" android:text="@string/also_add_return_route"
android:visibility="gone" /> android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,15 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:holo="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="vertical"
>
<NumberPicker
android:id="@+id/numberPicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"></NumberPicker>
<TextView <TextView
android:id="@+id/textView1" android:id="@+id/textView1"
@ -20,6 +15,14 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="3" android:maxLines="3"
android:singleLine="false" android:singleLine="false"
android:text="minutes before departure" /> android:text="minutes before departure"
/>
</LinearLayout> <com.codetroopers.betterpickers.numberpicker.NumberPicker
android:id="@+id/numberPicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <merge
xmlns:bart="http://schemas.android.com/apk/res/com.dougkeen.bart"> xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bart="http://schemas.android.com/apk/res-auto" >
<TextView <TextView
android:id="@+id/alarmText" android:id="@+id/alarmText"
@ -78,4 +79,4 @@
android:ellipsize="end" android:ellipsize="end"
bart:tickInterval="5" /> bart:tickInterval="5" />
</merge> </merge>

View File

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item <item
android:id="@+id/boardTrain" android:id="@+id/boardTrain"
android:icon="@drawable/ic_action_boarding" android:icon="@drawable/ic_action_boarding"
android:showAsAction="ifRoom|withText" android:title="@string/getting_on_this_train"
android:title="@string/getting_on_this_train"></item> app:showAsAction="ifRoom|withText"
</menu> />
</menu>

View File

@ -1,15 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item <item
android:id="@+id/view" android:id="@+id/view"
android:icon="@drawable/ic_action_departure" android:icon="@drawable/ic_action_departure"
android:showAsAction="ifRoom|withText" android:title="@string/view_departures"
android:title="@string/view_departures"></item> app:showAsAction="ifRoom|withText"
/>
<item <item
android:id="@+id/delete" android:id="@+id/delete"
android:icon="@drawable/ic_action_delete" android:icon="@drawable/ic_action_delete"
android:showAsAction="ifRoom|withText" android:title="@string/delete"
android:title="@string/delete"></item> app:showAsAction="ifRoom|withText"
/>
</menu> </menu>

View File

@ -1,15 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item <item
android:id="@+id/view_on_bart_site_button" android:id="@+id/view_on_bart_site_button"
android:icon="@drawable/ic_action_web" android:icon="@drawable/ic_action_web"
android:showAsAction="never" android:title="@string/view_on_bart_site"
android:title="@string/view_on_bart_site"></item> app:showAsAction="never"
/>
<item <item
android:id="@+id/view_system_map_button" android:id="@+id/view_system_map_button"
android:icon="@drawable/ic_action_map" android:icon="@drawable/ic_action_map"
android:showAsAction="ifRoom|withText" android:title="@string/view_system_map"
android:title="@string/view_system_map"></item> app:showAsAction="ifRoom|withText"
/>
</menu> </menu>

View File

@ -1,20 +1,26 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item <item
android:id="@+id/add_favorite_menu_button" android:id="@+id/add_favorite_menu_button"
android:icon="@drawable/ic_action_new" android:icon="@drawable/ic_action_new"
android:showAsAction="ifRoom|withText" android:title="@string/add_route"
android:title="@string/add_route"></item> app:showAsAction="ifRoom|withText"
/>
<item <item
android:id="@+id/view_system_map_button" android:id="@+id/view_system_map_button"
android:icon="@drawable/ic_action_map" android:icon="@drawable/ic_action_map"
android:showAsAction="ifRoom|withText" android:title="@string/view_system_map"
android:title="@string/view_system_map"></item> app:showAsAction="ifRoom|withText"
/>
<item <item
android:id="@+id/elevator_button" android:id="@+id/elevator_button"
android:icon="@drawable/ic_action_elevator" android:icon="@drawable/ic_action_elevator"
android:showAsAction="ifRoom|withText" android:title="Check elevator status"
android:title="Check elevator status"></item> app:showAsAction="ifRoom|withText"
/>
</menu> </menu>

View File

@ -1,26 +1,33 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item <item
android:id="@+id/cancel_alarm_button" android:id="@+id/cancel_alarm_button"
android:icon="@drawable/ic_action_cancel_alarm" android:icon="@drawable/ic_action_cancel_alarm"
android:showAsAction="always|withText"
android:title="@string/cancel_alarm" android:title="@string/cancel_alarm"
android:visible="false" /> android:visible="false"
app:showAsAction="always|withText"
/>
<item <item
android:id="@+id/set_alarm_button" android:id="@+id/set_alarm_button"
android:icon="@drawable/ic_action_alarm" android:icon="@drawable/ic_action_alarm"
android:showAsAction="always|withText" android:title="@string/set_alarm"
android:title="@string/set_alarm" /> app:showAsAction="always|withText"
/>
<item <item
android:id="@+id/share_arrival" android:id="@+id/share_arrival"
android:icon="@drawable/ic_action_mail" android:icon="@drawable/ic_action_mail"
android:showAsAction="always|withText" android:title="@string/share_arrival_time"
android:title="@string/share_arrival_time" /> app:showAsAction="always|withText"
/>
<item <item
android:id="@+id/delete" android:id="@+id/delete"
android:icon="@drawable/ic_action_delete" android:icon="@drawable/ic_action_delete"
android:showAsAction="always|withText" android:title="@string/delete"
android:title="@string/delete"></item> app:showAsAction="always|withText"
/>
</menu> </menu>

View File

@ -25,4 +25,4 @@
<attr name="tickInterval" /> <attr name="tickInterval" />
</declare-styleable> </declare-styleable>
</resources> </resources>

View File

@ -10,15 +10,15 @@
<string name="destination">Destination</string> <string name="destination">Destination</string>
<string name="save">Save</string> <string name="save">Save</string>
<string name="error_matching_origin_and_destination">The origin and destination stations must be <string name="error_matching_origin_and_destination">The origin and destination stations must be
different</string> different</string>
<string name="error_null_destination">You must select a destination station</string> <string name="error_null_destination">You must select a destination station</string>
<string name="error_null_origin">You must select an origin station</string> <string name="error_null_origin">You must select an origin station</string>
<string name="departure_wait_message">Please wait while real time departure data is <string name="departure_wait_message">Please wait while real time departure data is
loaded</string> loaded</string>
<string name="no_data_message">No departure data is currently available for this <string name="no_data_message">No departure data is currently available for this
route. Note that this route may require a non-standard transfer due to route. Note that this route may require a non-standard transfer due to
a temporary change in service. Check for service advisories posted at a temporary change in service. Check for service advisories posted at
http://m.bart.gov/schedules/advisories/</string> http://m.bart.gov/schedules/advisories/</string>
<string name="view">View</string> <string name="view">View</string>
<string name="view_departures">View departures</string> <string name="view_departures">View departures</string>
<string name="missing_departure">Missing/inaccurate departure? Feature request? Please report to bartrunner@dougkeen.com</string> <string name="missing_departure">Missing/inaccurate departure? Feature request? Please report to bartrunner@dougkeen.com</string>
@ -27,7 +27,7 @@
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="view_on_bart_site">View details on BART site</string> <string name="view_on_bart_site">View details on BART site</string>
<string name="could_not_connect">Could not connect to BART services. Please try <string name="could_not_connect">Could not connect to BART services. Please try
again later.</string> again later.</string>
<string name="also_add_return_route">Also add return route</string> <string name="also_add_return_route">Also add return route</string>
<string name="view_system_map">View system map</string> <string name="view_system_map">View system map</string>
<string name="system_map">System map</string> <string name="system_map">System map</string>
@ -48,4 +48,4 @@
<string name="arrival_message">I\'ll be arriving at %1$s around %2$s</string> <string name="arrival_message">I\'ll be arriving at %1$s around %2$s</string>
<string name="share_arrival_time">Share arrival time</string> <string name="share_arrival_time">Share arrival time</string>
</resources> </resources>

View File

@ -3,7 +3,7 @@
<!-- Base application theme is the default theme. --> <!-- Base application theme is the default theme. -->
<style name="AppTheme" parent="@style/Holo.Theme"></style> <style name="AppTheme" parent="Theme.AppCompat"></style>
<style name="ButtonBar"> <style name="ButtonBar">
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">fill_parent</item>

View File

@ -4,15 +4,15 @@ apply plugin: 'com.android.library'
// so we can control how it builds without having to submit pull requests. // so we can control how it builds without having to submit pull requests.
dependencies { dependencies {
compile 'com.android.support:support-v4:19.1.0' compile 'com.android.support:support-v4:22.2.1'
} }
android { android {
compileSdkVersion 7 compileSdkVersion 22
buildToolsVersion "22.0.1" buildToolsVersion "22.0.1"
defaultConfig { defaultConfig {
targetSdkVersion 7 targetSdkVersion 22
} }
sourceSets { sourceSets {

@ -1 +0,0 @@
Subproject commit 57b0ecd306cf50d44af779a58f09761e65f3b3bd

View File

@ -1,27 +0,0 @@
apply plugin: 'com.android.library'
// This file is here (rather than in the holoeverywhere project)
// so we can control how it builds without having to submit pull requests.
dependencies {
compile 'com.android.support:support-v4:13.0.0'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
}
android {
compileSdkVersion 17
buildToolsVersion "22.0.1"
defaultConfig {
targetSdkVersion 17
}
sourceSets {
main {
manifest.srcFile '../holoeverywhere/library/AndroidManifest.xml'
java.srcDirs = ['../holoeverywhere/library/src']
res.srcDirs = ['../holoeverywhere/library/res']
}
}
}

View File

@ -1,25 +0,0 @@
apply plugin: 'com.android.library'
// This file is here (rather than in the holoeverywhere project)
// so we can control how it builds without having to submit pull requests.
dependencies {
compile project(':holoeverywhere-gradle')
}
android {
compileSdkVersion 17
buildToolsVersion '22.0.1'
defaultConfig {
targetSdkVersion 17
}
sourceSets {
main {
manifest.srcFile '../holoeverywhere/addons/preferences/AndroidManifest.xml'
java.srcDirs = ['../holoeverywhere/addons/preferences/src']
res.srcDirs = ['../holoeverywhere/addons/preferences/res']
}
}
}

@ -1 +0,0 @@
Subproject commit 9f20fd77e04942fd50b95aeb1c492a38e36c06dd

View File

@ -1,4 +1,2 @@
include ':app' include ':app'
include ":holoeverywhere-gradle"
include ":holoeverywhere-preferences-gradle"
include ":drag-sort-listview-gradle" include ":drag-sort-listview-gradle"