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"]
path = 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'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(":holoeverywhere-gradle")
compile project(":holoeverywhere-preferences-gradle")
compile project(":drag-sort-listview-gradle")
compile project(':drag-sort-listview-gradle')
compile 'commons-io:commons-io:2.4'
compile 'org.apache.commons:commons-lang3:3.4'
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'
compile "com.googlecode.androidannotations:androidannotations-api:2.7"
}
android {
compileSdkVersion 17
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileOptions {
@ -20,8 +24,13 @@ android {
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main.java.srcDirs += ["../nineoldandroids/library/src"]
defaultConfig {
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 {
@ -31,8 +40,10 @@ android {
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
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"
package="com.dougkeen.bart"
android:installLocation="auto"
android:versionCode="31"
android:versionName="2.2.4">
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<application
android:name=".BartRunnerApplication_"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:allowBackup="true"
>
<activity
android:name=".activities.RoutesListActivity_"
android:configChanges="orientation|keyboardHidden"

View File

@ -8,9 +8,9 @@ import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.holoeverywhere.app.Application;
import android.app.AlarmManager;
import android.app.Application;
import android.content.Context;
import android.media.MediaPlayer;
import android.os.Parcel;
@ -126,10 +126,10 @@ public class BartRunnerApplication extends Application {
.createFromParcel(parcel);
parcel.recycle();
/*
/*
* 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();
if (useOldCache
|| lastBoardedDeparture.getEstimatedArrivalTime() >= now

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -247,14 +247,14 @@ public class BoardedDepartureService extends Service implements
if (mEtdService != null) {
/*
* 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
* think I'd rather keep the weak references to avoid memory leaks
* than move to soft references or some other form of stronger
* reference. Besides, registerListener() should only result in a
* few constant-time map operations, so there shouldn't be a big
* performance hit.
*/
* 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
* think I'd rather keep the weak references to avoid memory leaks
* than move to soft references or some other form of stronger
* reference. Besides, registerListener() should only result in a
* few constant-time map operations, so there shouldn't be a big
* performance hit.
*/
mEtdService.registerListener(this, false);
}

View File

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

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bart="http://schemas.android.com/apk/res/com.dougkeen.bart"
<merge
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_height="fill_parent">

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bart="http://schemas.android.com/apk/res/com.dougkeen.bart"
<merge
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_height="fill_parent">

View File

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

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bart="http://schemas.android.com/apk/res/com.dougkeen.bart"
<RelativeLayout
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_height="fill_parent"
android:paddingLeft="5dp"

View File

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

View File

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

View File

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

View File

@ -1,8 +1,12 @@
<?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
android:id="@+id/boardTrain"
android:icon="@drawable/ic_action_boarding"
android:showAsAction="ifRoom|withText"
android:title="@string/getting_on_this_train"></item>
android:title="@string/getting_on_this_train"
app:showAsAction="ifRoom|withText"
/>
</menu>

View File

@ -1,15 +1,20 @@
<?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
android:id="@+id/view"
android:icon="@drawable/ic_action_departure"
android:showAsAction="ifRoom|withText"
android:title="@string/view_departures"></item>
android:title="@string/view_departures"
app:showAsAction="ifRoom|withText"
/>
<item
android:id="@+id/delete"
android:icon="@drawable/ic_action_delete"
android:showAsAction="ifRoom|withText"
android:title="@string/delete"></item>
android:title="@string/delete"
app:showAsAction="ifRoom|withText"
/>
</menu>

View File

@ -1,15 +1,20 @@
<?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
android:id="@+id/view_on_bart_site_button"
android:icon="@drawable/ic_action_web"
android:showAsAction="never"
android:title="@string/view_on_bart_site"></item>
android:title="@string/view_on_bart_site"
app:showAsAction="never"
/>
<item
android:id="@+id/view_system_map_button"
android:icon="@drawable/ic_action_map"
android:showAsAction="ifRoom|withText"
android:title="@string/view_system_map"></item>
android:title="@string/view_system_map"
app:showAsAction="ifRoom|withText"
/>
</menu>

View File

@ -1,20 +1,26 @@
<?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
android:id="@+id/add_favorite_menu_button"
android:icon="@drawable/ic_action_new"
android:showAsAction="ifRoom|withText"
android:title="@string/add_route"></item>
android:title="@string/add_route"
app:showAsAction="ifRoom|withText"
/>
<item
android:id="@+id/view_system_map_button"
android:icon="@drawable/ic_action_map"
android:showAsAction="ifRoom|withText"
android:title="@string/view_system_map"></item>
android:title="@string/view_system_map"
app:showAsAction="ifRoom|withText"
/>
<item
android:id="@+id/elevator_button"
android:icon="@drawable/ic_action_elevator"
android:showAsAction="ifRoom|withText"
android:title="Check elevator status"></item>
android:title="Check elevator status"
app:showAsAction="ifRoom|withText"
/>
</menu>

View File

@ -1,26 +1,33 @@
<?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
android:id="@+id/cancel_alarm_button"
android:icon="@drawable/ic_action_cancel_alarm"
android:showAsAction="always|withText"
android:title="@string/cancel_alarm"
android:visible="false" />
android:visible="false"
app:showAsAction="always|withText"
/>
<item
android:id="@+id/set_alarm_button"
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
android:id="@+id/share_arrival"
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
android:id="@+id/delete"
android:icon="@drawable/ic_action_delete"
android:showAsAction="always|withText"
android:title="@string/delete"></item>
android:title="@string/delete"
app:showAsAction="always|withText"
/>
</menu>

View File

@ -10,15 +10,15 @@
<string name="destination">Destination</string>
<string name="save">Save</string>
<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_origin">You must select an origin station</string>
<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
route. Note that this route may require a non-standard transfer due to
a temporary change in service. Check for service advisories posted at
http://m.bart.gov/schedules/advisories/</string>
route. Note that this route may require a non-standard transfer due to
a temporary change in service. Check for service advisories posted at
http://m.bart.gov/schedules/advisories/</string>
<string name="view">View</string>
<string name="view_departures">View departures</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="view_on_bart_site">View details on BART site</string>
<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="view_system_map">View system map</string>
<string name="system_map">System map</string>

View File

@ -3,7 +3,7 @@
<!-- 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">
<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.
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:support-v4:22.2.1'
}
android {
compileSdkVersion 7
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
targetSdkVersion 7
targetSdkVersion 22
}
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 ":holoeverywhere-gradle"
include ":holoeverywhere-preferences-gradle"
include ":drag-sort-listview-gradle"