eleith
/
calchoochoo
Archived
1
0
Fork 0

bad ignore regex missing important files

This commit is contained in:
eleith 2017-03-30 21:45:49 -07:00
parent 1572b5b5d4
commit cf2aedc70a
17 changed files with 1548 additions and 1 deletions

2
.gitignore vendored
View File

@ -7,4 +7,4 @@
.DS_Store
/build
/captures
app/
*.apk

View File

@ -0,0 +1,300 @@
package com.eleith.calchoochoo;
import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.eleith.calchoochoo.data.PossibleTrain;
import com.eleith.calchoochoo.data.PossibleTrip;
import com.eleith.calchoochoo.data.Stop;
import com.eleith.calchoochoo.data.StopTimes;
import com.eleith.calchoochoo.fragments.MapSearchFragment;
import com.eleith.calchoochoo.fragments.SearchInputConfigureWidgetFragment;
import com.eleith.calchoochoo.fragments.SearchInputFragment;
import com.eleith.calchoochoo.fragments.SearchResultsConfigureWidgetFragment;
import com.eleith.calchoochoo.fragments.SearchResultsFragment;
import com.eleith.calchoochoo.fragments.StopDetailsFragment;
import com.eleith.calchoochoo.fragments.StopSummaryFragment;
import com.eleith.calchoochoo.fragments.TripDetailFragment;
import com.eleith.calchoochoo.fragments.TripFilterFragment;
import com.eleith.calchoochoo.fragments.TripFilterSelectMoreFragment;
import com.eleith.calchoochoo.fragments.TripFilterSuggestionsFragment;
import com.eleith.calchoochoo.fragments.TripSummaryFragment;
import com.eleith.calchoochoo.utils.BundleKeys;
import com.eleith.calchoochoo.utils.IntentKeys;
import com.eleith.calchoochoo.utils.PossibleTripUtils;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageStopsAndDetails;
import org.joda.time.LocalDateTime;
import org.parceler.Parcels;
import java.util.ArrayList;
public class ChooChooRouterManager {
private FragmentManager fragmentManager;
private FragmentTransaction fragmentTransaction;
public static final String STATE_CONFIGURE_WIDGET = "configure_widget";
public static final String STATE_SEARCH_FOR_STOPS = "search_for_stops";
public static final String STATE_SHOW_ALL_STOPS = "show_all_stops";
public static final String STATE_SHOW_TRIP = "show_trip";
public static final String STATE_SHOW_MAP = "show_map";
public static final String STATE_SHOW_TRIP_FILTER = "show_trip_filter";
public ChooChooRouterManager(FragmentManager fragmentManager) {
this.fragmentManager = fragmentManager;
}
private FragmentTransaction getTransaction() {
if (fragmentTransaction == null) {
fragmentTransaction = fragmentManager.beginTransaction();
}
return fragmentTransaction;
}
private void setNextState(String stateID, Bundle arguments) {
Boolean addToBackStack = false;
fragmentTransaction = getTransaction();
switch (stateID) {
case STATE_SEARCH_FOR_STOPS:
SearchInputFragment searchInputFragment = new SearchInputFragment();
SearchResultsFragment searchResultsFragment = new SearchResultsFragment();
searchResultsFragment.setArguments(arguments);
searchInputFragment.setArguments(arguments);
updateLinearLayoutFragments(searchInputFragment, searchResultsFragment, stateID);
break;
case STATE_CONFIGURE_WIDGET:
SearchInputConfigureWidgetFragment searchInputConfigureWidgetFragment = new SearchInputConfigureWidgetFragment();
SearchResultsConfigureWidgetFragment searchResultsConfigureWidgetFragment = new SearchResultsConfigureWidgetFragment();
searchInputConfigureWidgetFragment.setArguments(arguments);
searchResultsConfigureWidgetFragment.setArguments(arguments);
updateAppBarFragments(searchInputConfigureWidgetFragment, searchResultsConfigureWidgetFragment, stateID);
break;
case STATE_SHOW_ALL_STOPS:
StopSummaryFragment stopSummaryFragment = new StopSummaryFragment();
StopDetailsFragment stopDetailsFragment = new StopDetailsFragment();
stopSummaryFragment.setArguments(arguments);
stopDetailsFragment.setArguments(arguments);
updateAppBarFragments(stopSummaryFragment, stopDetailsFragment, stateID);
break;
case STATE_SHOW_TRIP:
TripSummaryFragment tripSummaryFragment = new TripSummaryFragment();
TripDetailFragment tripDetailFragment = new TripDetailFragment();
tripSummaryFragment.setArguments(arguments);
tripDetailFragment.setArguments(arguments);
updateAppBarFragments(tripSummaryFragment, tripDetailFragment, stateID);
break;
case STATE_SHOW_MAP:
MapSearchFragment mapSearchFragment = new MapSearchFragment();
mapSearchFragment.setArguments(arguments);
updateLinearLayoutFragments(null, mapSearchFragment, stateID);
break;
case STATE_SHOW_TRIP_FILTER:
TripFilterFragment tripFilterFragmentResults = new TripFilterFragment();
TripFilterSelectMoreFragment tripFilterSelectMoreFragment = new TripFilterSelectMoreFragment();
TripFilterSuggestionsFragment tripFilterSuggestionsFragment = new TripFilterSuggestionsFragment();
tripFilterFragmentResults.setArguments(arguments);
tripFilterSelectMoreFragment.setArguments(arguments);
tripFilterSuggestionsFragment.setArguments(arguments);
if (arguments.getString(BundleKeys.STOP_DESTINATION) != null && arguments.getString(BundleKeys.STOP_SOURCE) != null) {
updateAppBarFragments(tripFilterFragmentResults, tripFilterSuggestionsFragment, stateID);
} else {
updateAppBarFragments(tripFilterFragmentResults, tripFilterSelectMoreFragment, stateID);
}
break;
}
commit(stateID, addToBackStack);
}
private void updateLinearLayoutFragments(Fragment top, Fragment bottom, String stateId) {
int topId = R.id.activityLinearLayoutTop;
int bottomId = R.id.activityLinearLayoutBottom;
Fragment linearLayoutTop = fragmentManager.findFragmentById(topId);
// Fragment linearLayoutBottom = fragmentManager.findFragmentById(bottomId);
FragmentTransaction ft = getTransaction();
if (top == null) {
if (linearLayoutTop != null) {
ft.hide(linearLayoutTop);
}
} else {
if (linearLayoutTop != null && linearLayoutTop.isHidden()) {
ft.show(linearLayoutTop);
}
ft.replace(topId, top, stateId + "top");
}
ft.replace(bottomId, bottom, stateId + "bottom");
}
private void updateAppBarFragments(Fragment top, Fragment bottom, String stateId) {
int topId = R.id.activityAppBarLayoutFragment;
int bottomId = R.id.activityMainFragment;
Fragment appBar = fragmentManager.findFragmentById(topId);
Fragment main = fragmentManager.findFragmentById(bottomId);
FragmentTransaction ft = getTransaction();
ft.replace(topId, top, stateId + "top");
ft.replace(bottomId, bottom, stateId + "bottom");
}
public void commit(String stateId, Boolean addToBackStack) {
if (fragmentTransaction != null) {
if (addToBackStack) {
fragmentTransaction.addToBackStack(stateId);
}
fragmentTransaction.commit();
fragmentTransaction = null;
}
}
public void loadSearchForSpotFragment(ArrayList<Stop> stops, Integer reason, ArrayList<String> filteredStopIds, Location location) {
Bundle arguments = new Bundle();
arguments.putParcelable(BundleKeys.STOPS, Parcels.wrap(stops));
arguments.putInt(BundleKeys.SEARCH_REASON, reason);
arguments.putStringArrayList(BundleKeys.STOP_IDS, filteredStopIds);
arguments.putParcelable(BundleKeys.LOCATION, location);
setNextState(ChooChooRouterManager.STATE_SEARCH_FOR_STOPS, arguments);
}
public void loadStopsFragments(Stop stop, ArrayList<PossibleTrain> possibleTrains, int direction) {
Bundle arguments = new Bundle();
arguments.putParcelable(BundleKeys.STOP, Parcels.wrap(stop));
arguments.putParcelable(BundleKeys.POSSIBLE_TRAINS, Parcels.wrap(possibleTrains));
arguments.putInt(BundleKeys.DIRECTION, direction);
setNextState(ChooChooRouterManager.STATE_SHOW_ALL_STOPS, arguments);
}
public void loadTripDetailsFragments(PossibleTrip possibleTrip, ArrayList<StopTimes> tripStops) {
Bundle arguments = new Bundle();
arguments.putParcelable(BundleKeys.POSSIBLE_TRIP, Parcels.wrap(possibleTrip));
arguments.putParcelable(BundleKeys.TRIP_STOP_STOPTIMES, Parcels.wrap(tripStops));
setNextState(ChooChooRouterManager.STATE_SHOW_TRIP, arguments);
}
public void loadMapSearchFragment(ArrayList<Stop> stops, Location location) {
Bundle mapSearchArgs = new Bundle();
mapSearchArgs.putParcelable(BundleKeys.STOPS, Parcels.wrap(stops));
mapSearchArgs.putParcelable(BundleKeys.LOCATION, location);
setNextState(ChooChooRouterManager.STATE_SHOW_MAP, mapSearchArgs);
}
public void loadTripFilterActivity(Activity activity, String stopSourceId, String stopDestinationId) {
loadTripFilterActivity(activity, stopSourceId, stopDestinationId, RxMessageStopsAndDetails.DETAIL_DEPARTING, new LocalDateTime().toDateTime().getMillis());
}
public void loadTripFilterActivity(Activity activity, String stopSourceId, String stopDestinationId, Integer stopMethod, Long stopDateTime) {
Intent intent = new Intent(activity, TripFilterActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
Bundle bundle = new Bundle();
if (stopSourceId != null) {
bundle.putString(BundleKeys.STOP_SOURCE, stopSourceId);
}
if (stopDestinationId != null) {
bundle.putString(BundleKeys.STOP_DESTINATION, stopDestinationId);
}
bundle.putLong(BundleKeys.STOP_DATETIME, stopDateTime);
bundle.putInt(BundleKeys.STOP_METHOD, stopMethod);
intent.putExtras(bundle);
activity.startActivity(intent);
}
public void loadTripActivity(Activity activity, PossibleTrip possibleTrip) {
loadTripActivity(activity, possibleTrip, null);
}
public void loadTripActivity(Activity activity, PossibleTrip possibleTrip, ActivityOptionsCompat sharedElements) {
Intent intent = new Intent(activity, TripActivity.class);
//intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
Bundle bundle = new Bundle();
bundle.putParcelable(BundleKeys.POSSIBLE_TRIP, Parcels.wrap(possibleTrip));
intent.putExtras(bundle);
if (sharedElements != null) {
activity.startActivity(intent, sharedElements.toBundle());
} else {
activity.startActivity(intent);
}
}
public void loadStopSearchActivity(Activity activity, Integer reason, ArrayList<String> filterOutStopIds) {
Intent intent = new Intent(activity, StopSearchActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
Bundle bundle = new Bundle();
bundle.putStringArrayList(BundleKeys.STOPS, filterOutStopIds);
bundle.putInt(BundleKeys.SEARCH_REASON, reason);
intent.putExtras(bundle);
activity.startActivityForResult(intent, IntentKeys.STOP_SEARCH_RESULT);
}
public void loadStopActivity(Activity activity, String stopId) {
Intent intent = new Intent(activity, StopActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
Bundle bundle = new Bundle();
bundle.putString(BundleKeys.STOP, stopId);
intent.putExtras(bundle);
activity.startActivity(intent);
}
public void loadStopSearchReturnActivity(Activity activity, Integer reason, String stop_id) {
Intent returnIntent = new Intent();
returnIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
Bundle bundle = new Bundle();
bundle.putString(BundleKeys.STOP, stop_id);
bundle.putInt(BundleKeys.SEARCH_REASON, reason);
returnIntent.putExtras(bundle);
activity.setResult(Activity.RESULT_OK, returnIntent);
activity.finish();
}
public void loadTripFilterFragment(ArrayList<PossibleTrip> possibleTrips, int stopMethod, LocalDateTime stopDateTime, String stopSourceId, String stopDestinationId) {
Bundle arguments = new Bundle();
arguments.putInt(BundleKeys.STOP_METHOD, stopMethod);
if (stopSourceId != null) {
arguments.putString(BundleKeys.STOP_SOURCE, stopSourceId);
}
if (stopDestinationId != null) {
arguments.putString(BundleKeys.STOP_DESTINATION, stopDestinationId);
}
if (stopDateTime != null) {
arguments.putLong(BundleKeys.STOP_DATETIME, stopDateTime.toDateTime().getMillis());
} else {
arguments.putLong(BundleKeys.STOP_DATETIME, new LocalDateTime().toDateTime().getMillis());
}
if (possibleTrips != null && possibleTrips.size() > 0) {
ArrayList<PossibleTrip> possibleTripsFiltered = PossibleTripUtils.filterByDateTimeAndDirection(possibleTrips, stopDateTime, stopMethod == RxMessageStopsAndDetails.DETAIL_ARRIVING);
if (possibleTripsFiltered.size() > 0) {
arguments.putParcelable(BundleKeys.POSSIBLE_TRIPS, Parcels.wrap(possibleTripsFiltered));
}
}
setNextState(ChooChooRouterManager.STATE_SHOW_TRIP_FILTER, arguments);
}
public void loadSearchWidgetConfigureFragment() {
setNextState(ChooChooRouterManager.STATE_CONFIGURE_WIDGET, null);
}
}

View File

@ -0,0 +1,181 @@
package com.eleith.calchoochoo;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.eleith.calchoochoo.dagger.ChooChooComponent;
import com.eleith.calchoochoo.dagger.ChooChooModule;
import com.eleith.calchoochoo.data.ChooChooLoader;
import com.eleith.calchoochoo.data.Stop;
import com.eleith.calchoochoo.utils.BundleKeys;
import com.eleith.calchoochoo.utils.DeviceLocation;
import com.eleith.calchoochoo.utils.IntentKeys;
import com.eleith.calchoochoo.utils.RxBus;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessage;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageKeys;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageLocation;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageStops;
import com.eleith.calchoochoo.utils.StopUtils;
import com.google.android.gms.common.api.GoogleApiClient;
import org.parceler.Parcels;
import java.util.ArrayList;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Subscription;
import rx.functions.Action1;
public class MapSearchActivity extends AppCompatActivity {
private ChooChooComponent chooChooComponent;
private Subscription subscription;
private Subscription subscriptionLocation;
private ArrayList<Stop> stops;
private Location location;
@Inject
RxBus rxBus;
@Inject
GoogleApiClient googleApiClient;
@Inject
ChooChooRouterManager chooChooRouterManager;
@Inject
ChooChooLoader chooChooLoader;
@Inject
DeviceLocation deviceLocation;
@BindView(R.id.activityFloatingActionButton)
FloatingActionButton floatingActionButton;
@OnClick(R.id.activityFloatingActionButton)
void onFabClicked() {
rxBus.send(new RxMessage(RxMessageKeys.FAB_CLICKED));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
chooChooComponent = ChooChooApplication.from(this).getAppComponent().activityComponent(new ChooChooModule(this));
chooChooComponent.inject(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_linear_top_bottom);
ButterKnife.bind(this);
subscription = rxBus.observeEvents(RxMessage.class).subscribe(handleRxMessages());
subscriptionLocation = rxBus.observeEvents(RxMessageLocation.class).take(1).subscribe(handleRxLocationMessages());
unWrapBundle(savedInstanceState);
if (stops == null) {
chooChooLoader.loadParentStops();
}
deviceLocation.requestLocationUpdates();
deviceLocation.requestLocation();
}
@Override
protected void onStart() {
super.onStart();
googleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
googleApiClient.disconnect();
subscription.unsubscribe();
subscriptionLocation.unsubscribe();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
googleApiClient.reconnect();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == IntentKeys.STOP_SEARCH_RESULT) {
if (data != null) {
Bundle bundle = data.getExtras();
String stopId = bundle.getString(BundleKeys.STOP);
Stop closestStop = StopUtils.findStopClosestTo(stops, location);
if (resultCode == RESULT_OK) {
if (closestStop != null) {
chooChooRouterManager.loadTripFilterActivity(this, closestStop.stop_id, stopId);
} else {
chooChooRouterManager.loadTripFilterActivity(this, null, stopId);
}
}
}
}
}
public ChooChooComponent getComponent() {
return chooChooComponent;
}
public void fabEnable(int drawableId) {
floatingActionButton.setVisibility(View.VISIBLE);
floatingActionButton.setImageDrawable(getDrawable(drawableId));
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putParcelable(BundleKeys.STOPS, Parcels.wrap(stops));
super.onSaveInstanceState(outState);
}
private void unWrapBundle(Bundle bundle) {
if (bundle != null) {
stops = Parcels.unwrap(bundle.getParcelable(BundleKeys.STOPS));
}
}
public void initializeFragments() {
if (stops != null && location != null) {
chooChooRouterManager.loadMapSearchFragment(stops, location);
}
}
public void fabDisable() {
floatingActionButton.setVisibility(View.GONE);
}
private Action1<RxMessage> handleRxMessages() {
return new Action1<RxMessage>() {
@Override
public void call(RxMessage rxMessage) {
if (rxMessage.isMessageValidFor(RxMessageKeys.LOADED_STOPS)) {
stops = ((RxMessageStops) rxMessage).getMessage();
initializeFragments();
}
}
};
}
private Action1<RxMessageLocation> handleRxLocationMessages() {
return new Action1<RxMessageLocation>() {
@Override
public void call(RxMessageLocation rxMessage) {
location = rxMessage.getMessage();
initializeFragments();
}
};
}
}

View File

@ -0,0 +1,151 @@
package com.eleith.calchoochoo;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.eleith.calchoochoo.dagger.ChooChooComponent;
import com.eleith.calchoochoo.dagger.ChooChooModule;
import com.eleith.calchoochoo.data.ChooChooLoader;
import com.eleith.calchoochoo.data.PossibleTrain;
import com.eleith.calchoochoo.data.Stop;
import com.eleith.calchoochoo.utils.BundleKeys;
import com.eleith.calchoochoo.utils.RxBus;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessage;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageKeys;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageNextTrains;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageStop;
import com.eleith.calchoochoo.utils.TripUtils;
import com.google.android.gms.common.api.GoogleApiClient;
import org.joda.time.LocalDateTime;
import java.util.ArrayList;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Subscription;
import rx.functions.Action1;
public class StopActivity extends AppCompatActivity {
private ChooChooComponent chooChooComponent;
private Subscription subscription;
private ArrayList<PossibleTrain> possibleTrains;
private Stop stop;
private int direction;
@Inject
RxBus rxBus;
@Inject
GoogleApiClient googleApiClient;
@Inject
ChooChooRouterManager chooChooRouterManager;
@Inject
ChooChooLoader chooChooLoader;
@BindView(R.id.activityFloatingActionButton)
FloatingActionButton floatingActionButton;
@OnClick(R.id.activityFloatingActionButton)
void onFabClicked() {
rxBus.send(new RxMessage(RxMessageKeys.FAB_CLICKED));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
chooChooComponent = ChooChooApplication.from(this).getAppComponent().activityComponent(new ChooChooModule(this));
chooChooComponent.inject(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_appbar_main);
ButterKnife.bind(this);
subscription = rxBus.observeEvents(RxMessage.class).subscribe(new HandleRxMessages());
Intent intent = getIntent();
if (intent != null) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
String stopId = bundle.getString(BundleKeys.STOP);
direction = bundle.getInt(BundleKeys.DIRECTION);
chooChooLoader.loadPossibleTrains(stopId, new LocalDateTime());
chooChooLoader.loadStopByParentId(stopId);
}
}
}
@Override
protected void onStart() {
super.onStart();
googleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
googleApiClient.disconnect();
subscription.unsubscribe();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
googleApiClient.reconnect();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
public ChooChooComponent getComponent() {
return chooChooComponent;
}
public void fabEnable(int drawableId) {
floatingActionButton.setVisibility(View.VISIBLE);
floatingActionButton.setImageDrawable(getDrawable(drawableId));
}
public void fabDisable() {
floatingActionButton.setVisibility(View.GONE);
}
private void loadFragment() {
if (possibleTrains != null && stop != null) {
ArrayList<PossibleTrain> filteredTrains = new ArrayList<>();
for (PossibleTrain possibleTrain : possibleTrains) {
if (possibleTrain.getTripDirectionId() == direction) {
filteredTrains.add(possibleTrain);
}
}
chooChooRouterManager.loadStopsFragments(stop, filteredTrains, direction);
}
}
private class HandleRxMessages implements Action1<RxMessage> {
@Override
public void call(RxMessage rxMessage) {
if (rxMessage.isMessageValidFor(RxMessageKeys.LOADED_NEXT_TRAINS)) {
possibleTrains = ((RxMessageNextTrains) rxMessage).getMessage();
loadFragment();
} else if (rxMessage.isMessageValidFor(RxMessageKeys.LOADED_STOP)) {
stop = ((RxMessageStop) rxMessage).getMessage();
loadFragment();
} else if (rxMessage.isMessageValidFor(RxMessageKeys.SWITCH_SOURCE_DESTINATION_SELECTED)) {
direction = direction == TripUtils.DIRECTION_NORTH ? TripUtils.DIRECTION_SOUTH: TripUtils.DIRECTION_NORTH;
loadFragment();
}
}
}
}

View File

@ -0,0 +1,143 @@
package com.eleith.calchoochoo;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import com.eleith.calchoochoo.dagger.ChooChooComponent;
import com.eleith.calchoochoo.dagger.ChooChooModule;
import com.eleith.calchoochoo.data.ChooChooLoader;
import com.eleith.calchoochoo.data.Stop;
import com.eleith.calchoochoo.utils.BundleKeys;
import com.eleith.calchoochoo.utils.DeviceLocation;
import com.eleith.calchoochoo.utils.RxBus;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessage;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageKeys;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageLocation;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageStops;
import com.google.android.gms.common.api.GoogleApiClient;
import java.util.ArrayList;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Subscription;
import rx.functions.Action1;
public class StopSearchActivity extends AppCompatActivity {
private ChooChooComponent chooChooComponent;
private Subscription subscription;
private Subscription subscriptionLocation;
private Location location;
private ArrayList<Stop> stops;
private ArrayList<String> filteredStopIds;
private Integer reason;
@Inject
RxBus rxBus;
@Inject
GoogleApiClient googleApiClient;
@Inject
ChooChooRouterManager chooChooRouterManager;
@Inject
ChooChooLoader chooChooLoader;
@Inject
DeviceLocation deviceLocation;
@BindView(R.id.activityFloatingActionButton)
FloatingActionButton floatingActionButton;
@OnClick(R.id.activityFloatingActionButton)
void onFabClicked() {
rxBus.send(new RxMessage(RxMessageKeys.FAB_CLICKED));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
chooChooComponent = ChooChooApplication.from(this).getAppComponent().activityComponent(new ChooChooModule(this));
chooChooComponent.inject(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_linear_top_bottom);
ButterKnife.bind(this);
subscription = rxBus.observeEvents(RxMessage.class).subscribe(handleRxMessages());
subscriptionLocation = rxBus.observeEvents(RxMessageLocation.class).take(1).subscribe(handleRxLocationMessages());
chooChooLoader.loadParentStops();
deviceLocation.requestLocation();
}
@Override
protected void onStart() {
super.onStart();
googleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
googleApiClient.disconnect();
subscription.unsubscribe();
subscriptionLocation.unsubscribe();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
googleApiClient.reconnect();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
public ChooChooComponent getComponent() {
return chooChooComponent;
}
private void loadFragments() {
if (stops != null && location != null) {
chooChooRouterManager.loadSearchForSpotFragment(stops, reason, filteredStopIds, location);
}
}
private Action1<RxMessage> handleRxMessages() {
return new Action1<RxMessage>() {
@Override
public void call(RxMessage rxMessage) {
if (rxMessage.isMessageValidFor(RxMessageKeys.LOADED_STOPS)) {
stops = ((RxMessageStops) rxMessage).getMessage();
Intent intent = getIntent();
if (intent != null) {
Bundle bundle = intent.getExtras();
filteredStopIds = bundle.getStringArrayList(BundleKeys.STOPS);
reason = bundle.getInt(BundleKeys.SEARCH_REASON);
loadFragments();
}
}
}
};
}
private Action1<RxMessageLocation> handleRxLocationMessages() {
return new Action1<RxMessageLocation>() {
@Override
public void call(RxMessageLocation rxMessage) {
location = rxMessage.getMessage();
loadFragments();
}
};
}
}

View File

@ -0,0 +1,108 @@
package com.eleith.calchoochoo;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.eleith.calchoochoo.dagger.ChooChooComponent;
import com.eleith.calchoochoo.dagger.ChooChooModule;
import com.eleith.calchoochoo.data.ChooChooLoader;
import com.eleith.calchoochoo.data.PossibleTrip;
import com.eleith.calchoochoo.data.StopTimes;
import com.eleith.calchoochoo.utils.BundleKeys;
import com.eleith.calchoochoo.utils.RxBus;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessage;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageKeys;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageTripStops;
import com.google.android.gms.common.api.GoogleApiClient;
import org.parceler.Parcels;
import java.util.ArrayList;
import javax.inject.Inject;
import butterknife.ButterKnife;
import rx.Subscription;
import rx.functions.Action1;
public class TripActivity extends AppCompatActivity {
private ChooChooComponent chooChooComponent;
private Subscription subscription;
private PossibleTrip possibleTrip;
@Inject
RxBus rxBus;
@Inject
GoogleApiClient googleApiClient;
@Inject
ChooChooRouterManager chooChooRouterManager;
@Inject
ChooChooLoader chooChooLoader;
@Override
protected void onCreate(Bundle savedInstanceState) {
chooChooComponent = ChooChooApplication.from(this).getAppComponent().activityComponent(new ChooChooModule(this));
chooChooComponent.inject(this);
super.onCreate(savedInstanceState);
postponeEnterTransition();
setContentView(R.layout.activity_appbar_main);
ButterKnife.bind(this);
subscription = rxBus.observeEvents(RxMessage.class).subscribe(new HandleRxMessages());
Intent intent = getIntent();
if (intent != null) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
possibleTrip = Parcels.unwrap(bundle.getParcelable(BundleKeys.POSSIBLE_TRIP));
chooChooLoader.loadTripStops(possibleTrip.getTripId(), possibleTrip.getFirstStopId(), possibleTrip.getLastStopId());
}
}
}
@Override
protected void onStart() {
super.onStart();
googleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
googleApiClient.disconnect();
subscription.unsubscribe();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
googleApiClient.reconnect();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
public ChooChooComponent getComponent() {
return chooChooComponent;
}
private class HandleRxMessages implements Action1<RxMessage> {
@Override
public void call(RxMessage rxMessage) {
if (rxMessage.isMessageValidFor(RxMessageKeys.LOADED_TRIP_DETAILS)) {
ArrayList<StopTimes> tripStops = ((RxMessageTripStops) rxMessage).getMessage();
chooChooRouterManager.loadTripDetailsFragments(possibleTrip, tripStops);
}
}
}
}

View File

@ -0,0 +1,159 @@
package com.eleith.calchoochoo;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.eleith.calchoochoo.dagger.ChooChooComponent;
import com.eleith.calchoochoo.dagger.ChooChooModule;
import com.eleith.calchoochoo.data.ChooChooLoader;
import com.eleith.calchoochoo.data.PossibleTrip;
import com.eleith.calchoochoo.utils.BundleKeys;
import com.eleith.calchoochoo.utils.IntentKeys;
import com.eleith.calchoochoo.utils.RxBus;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessage;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageKeys;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessagePossibleTrip;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessagePossibleTrips;
import com.google.android.gms.common.api.GoogleApiClient;
import org.joda.time.LocalDateTime;
import java.util.ArrayList;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Subscription;
import rx.functions.Action1;
public class TripFilterActivity extends AppCompatActivity {
private ChooChooComponent chooChooComponent;
private Subscription subscription;
private ArrayList<PossibleTrip> possibleTrips;
private String stopSourceId;
private String stopDestinationId;
private Integer stopMethod;
private Long stopDateTime;
@Inject
RxBus rxBus;
@Inject
GoogleApiClient googleApiClient;
@Inject
ChooChooRouterManager chooChooRouterManager;
@Inject
ChooChooLoader chooChooLoader;
@BindView(R.id.activityFloatingActionButton)
FloatingActionButton floatingActionButton;
@OnClick(R.id.activityFloatingActionButton)
void onFabClicked() {
rxBus.send(new RxMessage(RxMessageKeys.FAB_CLICKED));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
chooChooComponent = ChooChooApplication.from(this).getAppComponent().activityComponent(new ChooChooModule(this));
chooChooComponent.inject(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_appbar_main);
ButterKnife.bind(this);
Intent intent = getIntent();
if (intent != null) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
stopSourceId = bundle.getString(BundleKeys.STOP_SOURCE);
stopDestinationId = bundle.getString(BundleKeys.STOP_DESTINATION);
stopMethod = bundle.getInt(BundleKeys.STOP_METHOD);
stopDateTime = bundle.getLong(BundleKeys.STOP_DATETIME, new LocalDateTime().toDateTime().getMillis());
if (stopDestinationId != null && stopSourceId != null) {
subscription = rxBus.observeEvents(RxMessagePossibleTrips.class).take(1).subscribe(handleRxMessages());
chooChooLoader.loadPossibleTrips(stopSourceId, stopDestinationId, new LocalDateTime(stopDateTime));
} else {
chooChooRouterManager.loadTripFilterFragment(null, stopMethod, new LocalDateTime(stopDateTime), stopSourceId, stopDestinationId);
}
}
}
}
@Override
protected void onStart() {
super.onStart();
googleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
googleApiClient.disconnect();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
googleApiClient.reconnect();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == IntentKeys.STOP_SEARCH_RESULT) {
if (data != null) {
Bundle bundle = data.getExtras();
String stopId = bundle.getString(BundleKeys.STOP);
Integer reason = bundle.getInt(BundleKeys.SEARCH_REASON);
if (resultCode == RESULT_OK) {
if (reason == 1) {
stopDestinationId = stopId;
} else {
stopSourceId = stopId;
}
subscription = rxBus.observeEvents(RxMessagePossibleTrips.class).take(1).subscribe(handleRxMessages());
chooChooLoader.loadPossibleTrips(stopSourceId, stopDestinationId, new LocalDateTime(stopDateTime));
}
}
}
}
public ChooChooComponent getComponent() {
return chooChooComponent;
}
public void fabEnable(int drawableId) {
floatingActionButton.setVisibility(View.VISIBLE);
floatingActionButton.setImageDrawable(getDrawable(drawableId));
}
public void fabDisable() {
floatingActionButton.setVisibility(View.GONE);
}
private Action1<RxMessagePossibleTrips> handleRxMessages() {
return new Action1<RxMessagePossibleTrips>() {
@Override
public void call(RxMessagePossibleTrips rxMessage) {
possibleTrips = rxMessage.getMessage();
chooChooRouterManager.loadTripFilterFragment(possibleTrips, stopMethod, new LocalDateTime(stopDateTime), stopSourceId, stopDestinationId);
}
};
}
}

View File

@ -0,0 +1,110 @@
package com.eleith.calchoochoo.adapters;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.eleith.calchoochoo.ChooChooRouterManager;
import com.eleith.calchoochoo.R;
import com.eleith.calchoochoo.TripFilterActivity;
import com.eleith.calchoochoo.dagger.ChooChooScope;
import com.eleith.calchoochoo.data.PossibleTrip;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.parceler.Parcel;
import java.util.ArrayList;
import java.util.Locale;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ChooChooScope
public class TripFilterSuggestionAdapter extends RecyclerView.Adapter<TripFilterSuggestionAdapter.RouteViewHolder> {
private ArrayList<PossibleTrip> possibleTrips;
private TripFilterActivity tripFilterActivity;
private ChooChooRouterManager chooChooRouterManager;
@Inject
public TripFilterSuggestionAdapter(TripFilterActivity tripFilterActivity, ChooChooRouterManager chooChooRouterManager) {
this.tripFilterActivity = tripFilterActivity;
this.chooChooRouterManager = chooChooRouterManager;
}
public void setPossibleTrips(ArrayList<PossibleTrip> possibleTrips) {
this.possibleTrips = possibleTrips;
}
@Override
public RouteViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_trip_possible, parent, false);
return new RouteViewHolder(view);
}
@Override
public void onBindViewHolder(RouteViewHolder holder, int position) {
PossibleTrip possibleTrip = possibleTrips.get(position);
Float price = possibleTrip.getPrice();
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("h:mma");
holder.arrivalTime.setText(dateTimeFormatter.print(possibleTrip.getArrivalTime()));
holder.departureTime.setText(dateTimeFormatter.print(possibleTrip.getDepartureTime()));
holder.tripPrice.setText(String.format(Locale.getDefault(), "$%.2f", price));
if (possibleTrip.getRouteLongName().contains("Bullet")) {
holder.trainImage.setImageDrawable(tripFilterActivity.getDrawable(R.drawable.ic_train_bullet));
holder.trainImage.setContentDescription(tripFilterActivity.getString(R.string.bullet_train));
} else {
holder.trainImage.setImageDrawable(tripFilterActivity.getDrawable(R.drawable.ic_train_local));
holder.trainImage.setContentDescription(tripFilterActivity.getString(R.string.local_train));
}
holder.tripNumber.setText(possibleTrip.getTripId());
}
@Override
public int getItemCount() {
return possibleTrips.size();
}
public class RouteViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.trip_possible_trip_stop_start_time)
TextView arrivalTime;
@BindView(R.id.trip_possible_trip_stop_end_time)
TextView departureTime;
@BindView(R.id.trip_possible_trip_price)
TextView tripPrice;
@BindView(R.id.trip_possible_trip_id)
TextView tripNumber;
@BindView(R.id.trip_possible_train_image)
ImageView trainImage;
@BindView(R.id.trip_possible_train_number_text)
TextView tripNumberText;
@OnClick(R.id.trip_possible_summary)
void onClickTripSummary() {
PossibleTrip possibleTrip = possibleTrips.get(getAdapterPosition());
Pair<View, String> p1 = new Pair<>((View) trainImage, tripFilterActivity.getString(R.string.transition_train_image));
Pair<View, String> p2 = new Pair<>((View) tripNumber, tripFilterActivity.getString(R.string.transition_train_number));
Pair<View, String> p3 = new Pair<>((View) tripNumberText, tripFilterActivity.getString(R.string.transition_train_number_text));
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(tripFilterActivity, p1, p2, p3);
chooChooRouterManager.loadTripActivity(tripFilterActivity, possibleTrip, options);
}
private RouteViewHolder(View v) {
super(v);
ButterKnife.bind(this, v);
}
}
}

View File

@ -0,0 +1,144 @@
package com.eleith.calchoochoo.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.util.Pair;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.eleith.calchoochoo.R;
import com.eleith.calchoochoo.TripFilterActivity;
import com.eleith.calchoochoo.adapters.TripFilterSuggestionAdapter;
import com.eleith.calchoochoo.data.ChooChooLoader;
import com.eleith.calchoochoo.data.PossibleTrip;
import com.eleith.calchoochoo.utils.BundleKeys;
import com.eleith.calchoochoo.utils.PossibleTripUtils;
import com.eleith.calchoochoo.utils.RxBus;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessage;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageKeys;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessagePossibleTrips;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageStopMethodAndDateTime;
import com.eleith.calchoochoo.utils.RxBusMessage.RxMessageStopsAndDetails;
import org.joda.time.LocalDateTime;
import org.parceler.Parcels;
import java.util.ArrayList;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import rx.Subscription;
import rx.functions.Action1;
public class TripFilterSuggestionsFragment extends Fragment {
private ArrayList<PossibleTrip> possibleTrips = new ArrayList<>();
private LocalDateTime stopDateTime = new LocalDateTime();
private int stopMethod = RxMessageStopsAndDetails.DETAIL_ARRIVING;
private Subscription subscription;
private TripFilterActivity tripFilterActivity;
@Inject
RxBus rxBus;
@Inject
TripFilterSuggestionAdapter tripFilterSuggestionAdapter;
@Inject
ChooChooLoader chooChooLoader;
@BindView(R.id.trips_possible_empty_state)
TextView tripsPossibleEmptyState;
@BindView(R.id.trips_possible_recyclerview)
RecyclerView tripsPossibleRecyclerView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tripFilterActivity = ((TripFilterActivity) getActivity());
tripFilterActivity.getComponent().inject(this);
unWrapBundle(savedInstanceState != null ? savedInstanceState : getArguments());
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
unWrapBundle(savedInstanceState);
View view = inflater.inflate(R.layout.fragment_trips_possible, container, false);
ButterKnife.bind(this, view);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.trips_possible_recyclerview);
recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
recyclerView.setNestedScrollingEnabled(false);
setPossibleTrips(possibleTrips);
recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
recyclerView.setAdapter(tripFilterSuggestionAdapter);
tripFilterActivity.fabEnable(R.drawable.ic_swap_vert_black_24dp);
subscription = rxBus.observeEvents(RxMessage.class).subscribe(handleRxMessages());
chooChooLoader.loadRoutes();
return view;
}
@Override
public void onDestroyView() {
super.onDestroyView();
subscription.unsubscribe();
tripFilterActivity.fabDisable();
}
public void setPossibleTrips(ArrayList<PossibleTrip> possibleTrips) {
if (possibleTrips != null && possibleTrips.size() > 0) {
this.possibleTrips = PossibleTripUtils.filterByDateTimeAndDirection(possibleTrips, stopDateTime, stopMethod == RxMessageStopsAndDetails.DETAIL_ARRIVING);
}
if (this.possibleTrips != null && this.possibleTrips.size() > 0) {
tripFilterSuggestionAdapter.setPossibleTrips(this.possibleTrips);
tripFilterSuggestionAdapter.notifyDataSetChanged();
tripsPossibleEmptyState.setVisibility(View.GONE);
tripsPossibleRecyclerView.setVisibility(View.VISIBLE);
} else {
tripsPossibleRecyclerView.setVisibility(View.GONE);
tripsPossibleEmptyState.setVisibility(View.VISIBLE);
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putParcelable(BundleKeys.POSSIBLE_TRIPS, Parcels.wrap(possibleTrips));
outState.putLong(BundleKeys.STOP_DATETIME, stopDateTime.toDate().getTime());
outState.putInt(BundleKeys.STOP_METHOD, stopMethod);
super.onSaveInstanceState(outState);
}
private void unWrapBundle(Bundle bundle) {
if (bundle != null) {
possibleTrips = Parcels.unwrap(bundle.getParcelable(BundleKeys.POSSIBLE_TRIPS));
stopDateTime = new LocalDateTime(bundle.getLong(BundleKeys.STOP_DATETIME));
stopMethod = bundle.getInt(BundleKeys.STOP_METHOD);
}
}
private Action1<RxMessage> handleRxMessages() {
return new Action1<RxMessage>() {
@Override
public void call(RxMessage rxMessage) {
if (rxMessage.isMessageValidFor(RxMessageKeys.FAB_CLICKED)) {
rxBus.send(new RxMessage(RxMessageKeys.SWITCH_SOURCE_DESTINATION_SELECTED));
} else if (rxMessage.isMessageValidFor(RxMessageKeys.LOADED_POSSIBLE_TRIPS)) {
ArrayList<PossibleTrip> possibleTrips = ((RxMessagePossibleTrips) rxMessage).getMessage();
setPossibleTrips(possibleTrips);
} else if (rxMessage.isMessageValidFor(RxMessageKeys.DATE_TIME_SELECTED)) {
Pair<Integer, LocalDateTime> pair = ((RxMessageStopMethodAndDateTime) rxMessage).getMessage();
stopMethod = pair.first;
stopDateTime = pair.second;
}
}
};
}
}

View File

@ -0,0 +1,5 @@
package com.eleith.calchoochoo.utils;
public class IntentKeys {
public static final int STOP_SEARCH_RESULT = 10;
}

View File

@ -0,0 +1,28 @@
<vector android:height="24dp" android:viewportHeight="128.0"
android:viewportWidth="128.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="1" android:fillColor="#ffc107" android:pathData="M127.85,64.08A63.92,63.92 0,0 1,63.92 128,63.92 63.92,0 0,1 0,64.08 63.92,63.92 0,0 1,63.92 0.15,63.92 63.92,0 0,1 127.85,64.08Z"/>
<path android:fillColor="#ed6c30" android:pathData="m60.45,64.86c-3.72,0 -6.73,-2.5 -6.73,-5.59l0,-15.63c0,-3.08 3.01,-5.58 6.73,-5.58 3.71,0 6.73,2.49 6.73,5.58l0,15.63c0.01,3.08 -3.01,5.59 -6.73,5.59z"/>
<path android:fillColor="#ed6c30" android:pathData="m43.54,68.94c-3.72,0 -6.72,-2.5 -6.72,-5.58l0,-15.62c0,-3.09 3,-5.59 6.72,-5.59 3.72,0 6.74,2.49 6.74,5.59l0,15.63c-0.01,3.07 -3.03,5.57 -6.74,5.57z"/>
<path android:fillColor="#2f2f2f" android:pathData="M17.87,91.44L17.87,108.39A63.92,63.92 67.4,0 0,18.81 109.31L109.04,109.31A63.92,63.92 0,0 0,121.61 91.44L17.87,91.44z"/>
<path android:fillColor="#ed6c30" android:pathData="M3.18,54.88L3.18,83.75A63.92,63.92 97.07,0 0,9.15 96.9L106.3,96.9L106.3,54.88L3.18,54.88z"/>
<path android:fillColor="#ed6c30" android:pathData="M75.72,28.31L75.72,96.9L118.69,96.9A63.92,63.92 0,0 0,125.05 82.76L125.05,45.55A63.92,63.92 0,0 0,116.84 28.31L75.72,28.31z"/>
<path android:fillColor="#2f2f2f" android:pathData="m27.53,54.89c4.78,0 8.67,9.41 8.67,21.01 0,11.6 -3.89,21 -8.67,21 -4.8,0 -8.68,-9.4 -8.68,-21 0.01,-11.6 3.9,-21.01 8.68,-21.01z"/>
<path android:fillColor="#fcc21b" android:pathData="m27.53,98.08c-5.53,0 -9.85,-9.74 -9.85,-22.17 0,-12.43 4.32,-22.17 9.85,-22.17 5.51,0 9.84,9.74 9.84,22.17 0,12.43 -4.32,22.17 -9.84,22.17zM27.53,56.06c-3.55,0 -7.51,8.15 -7.51,19.85 0,11.69 3.96,19.84 7.51,19.84 3.55,0 7.5,-8.14 7.5,-19.84 0,-11.69 -3.95,-19.85 -7.5,-19.85z"/>
<path android:fillColor="#2f2f2f" android:pathData="M3.67,54.86L3.67,85.2A63.92,63.92 76.64,0 0,9.47 97.46L28.13,97.46L28.13,54.86L3.67,54.86z"/>
<path android:fillColor="#2f2f2f" android:pathData="M69,20.54L69,28.33L116.85,28.33A63.92,63.92 0,0 0,110.66 20.54L69,20.54z"/>
<path android:fillColor="#2f2f2f" android:pathData="M15.9,21.97A63.92,63.92 0,0 0,6.13 36.94L11.67,54.88L27.98,54.88L38.15,21.97L15.9,21.97z"/>
<path android:fillColor="#2f2f2f" android:pathData="M29.67,10.32A63.92,63.92 0,0 0,16.12 21.97L38.15,21.97L32.92,10.32L29.67,10.32z"/>
<path android:fillColor="#2f2f2f" android:pathData="M9.15,96.9A63.92,63.92 125.84,0 0,20.38 110.76L20.38,96.9L9.15,96.9z"/>
<path android:fillColor="#ffffff" android:pathData="m119.04,35.02c0,-1.73 -1.4,-3.14 -3.16,-3.14l-14.05,0c-1.75,0 -3.18,1.42 -3.18,3.14l0,24.31c0,1.74 1.43,3.14 3.18,3.14l14.05,0c1.75,0 3.16,-1.39 3.16,-3.14l0,-24.31z"/>
<path android:fillColor="#78a3ad" android:pathData="m81.16,101.82c0,9.58 -7.76,17.34 -17.32,17.34 -9.58,0 -17.35,-7.76 -17.35,-17.34 0,-9.58 7.77,-17.34 17.35,-17.34 9.57,0 17.32,7.76 17.32,17.34z"/>
<path android:fillColor="#2f2f2f" android:pathData="m73.82,101.82c0,5.51 -4.47,10 -9.98,10 -5.53,0 -10.01,-4.47 -10.01,-10 0,-5.53 4.48,-9.98 10.01,-9.98 5.51,0 9.98,4.47 9.98,9.98z"/>
<path android:fillColor="#78a3ad" android:pathData="M98.53,84.47C88.95,84.47 81.18,92.23 81.18,101.81C81.18,110.69 87.85,117.99 96.45,119.02A63.92,63.92 112.6,0 0,115.83 101.29C115.55,91.95 107.92,84.47 98.53,84.47z"/>
<path android:fillColor="#2f2f2f" android:pathData="m108.5,101.82c0,5.51 -4.47,10 -10,10 -5.51,0 -10,-4.47 -10,-10 0,-5.53 4.48,-9.98 10,-9.98 5.53,0 10,4.47 10,9.98z"/>
<path android:fillColor="#ffffff" android:pathData="m66.84,100.95c-1.59,0 -2.9,-1.3 -2.9,-2.91l0,0c0,-1.59 1.3,-2.9 2.9,-2.9l28.69,0c1.59,0 2.89,1.29 2.89,2.9l0,0c0,1.61 -1.29,2.91 -2.89,2.91l-28.69,0z"/>
<path android:fillColor="#78a3ad" android:pathData="M32.63,94.71C25.85,94.71 20.38,100.16 20.38,106.93C20.38,108.6 20.71,110.19 21.32,111.64A63.92,63.92 0,0 0,31.53 119.1C31.89,119.13 32.26,119.16 32.63,119.16C39.38,119.16 44.86,113.69 44.86,106.93C44.86,100.16 39.38,94.69 32.63,94.71z"/>
<path android:fillColor="#fcc21b" android:pathData="m53.69,44.54 l13.49,0 0,8.64 -13.49,0z"/>
<path android:fillColor="#fcc21b" android:pathData="m36.88,47.66 l13.37,0 0,5.65 -13.37,0z"/>
<path android:fillColor="#2f2f2f" android:pathData="M3.18,54.88C2.28,54.88 1.42,55.21 0.6,55.83A63.92,63.92 67.4,0 0,0 64.08A63.92,63.92 67.4,0 0,7.52 94.06C10.11,90.43 11.85,83.66 11.85,75.89C11.85,64.28 7.98,54.88 3.18,54.88z"/>
<path android:fillColor="#fcc21b" android:pathData="M3.18,53.72C2.37,53.72 1.58,53.96 0.82,54.37A63.92,63.92 67.4,0 0,0.32 57.75C1.25,56.66 2.23,56.05 3.18,56.05C6.74,56.05 10.7,64.2 10.69,75.89C10.69,83.48 9.02,89.56 6.88,92.9A63.92,63.92 103.36,0 0,8.13 95.13C11.08,91.34 13.03,84.23 13.02,75.89C13.02,63.46 8.71,53.72 3.18,53.72z"/>
<path android:fillColor="#2f2f2f" android:pathData="M17.19,20.58A63.92,63.92 99.28,0 0,14.55 23.53L39.58,23.53L39.58,20.58L17.19,20.58z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z"
android:fillColor="#ffffff"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFF"
android:pathData="M4,12l1.41,1.41L11,7.83V20h2V7.83l5.58,5.59L20,12l-8,-8 -8,8z"/>
</vector>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.eleith.calchoochoo.MapSearchActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/activityAppBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<FrameLayout
android:id="@+id/activityAppBarLayoutFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/activityMainFragment"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/activityFloatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:layout_anchor="@id/activityMainFragment"
app:layout_anchorGravity="bottom|right|end"/>
</android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/activityLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/activityLinearLayoutTop"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</FrameLayout>
<FrameLayout
android:id="@+id/activityLinearLayoutBottom"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/activityFloatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:visibility="gone"
app:layout_anchor="@id/activityLinearLayout"
app:layout_anchorGravity="bottom|right|end"/>
</android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.eleith.calchoochoo.MapSearchActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/activityAppBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<FrameLayout
android:id="@+id/activityAppBarLayoutFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:id="@+id/activityNestedScrollView"
android:layout_width="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_height="match_parent"/>
<LinearLayout
android:id="@+id/activityLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/activityLinearLayoutTop"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</FrameLayout>
<FrameLayout
android:id="@+id/activityLinearLayoutBottom"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/activityFloatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:visibility="gone"
app:layout_anchor="@id/activityNestedScrollView"
app:layout_anchorGravity="bottom|right|end"/>
</android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/search_result_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1.5"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:contentDescription="@string/stop"
android:src="@drawable/ic_room_black_24dp"
android:tint="@android:color/secondary_text_dark"/>
<LinearLayout
android:id="@+id/search_result_distance_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/search_result_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="3dp"
android:paddingStart="2dp"
android:textStyle="italic"
tools:text="15.45"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/miles"
android:textStyle="italic"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/search_result_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textStyle="italic"
android:layout_margin="10dp"
android:layout_weight="5"
android:textSize="20sp"
tools:text="name"
/>
</LinearLayout>