Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/MainScreenFragment.java
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | public class MainScreenFragment extends BaseFragment implements FragmentListenerMain{ | ||||
/* | /* | ||||
* Search mode | * Search mode | ||||
*/ | */ | ||||
private static final int SEARCH_BY_NAME = 0; | private static final int SEARCH_BY_NAME = 0; | ||||
private static final int SEARCH_BY_ID = 1; | private static final int SEARCH_BY_ID = 1; | ||||
private static final int SEARCH_BY_ROUTE = 2; // TODO: implement this -- https://gitpull.it/T12 | private static final int SEARCH_BY_ROUTE = 2; // TODO: implement this -- https://gitpull.it/T12 | ||||
private int searchMode; | private int searchMode; | ||||
//private ImageButton addToFavorites; | //private ImageButton addToFavorites; | ||||
private final ArrivalsFetcher[] arrivalsFetchers = new ArrivalsFetcher[]{new FiveTAPIFetcher(), new GTTJSONFetcher(), new FiveTScraperFetcher()}; | private final ArrivalsFetcher[] arrivalsFetchers = utils.getDefaultArrivalsFetchers(); | ||||
//// HIDDEN BUT IMPORTANT ELEMENTS //// | //// HIDDEN BUT IMPORTANT ELEMENTS //// | ||||
FragmentManager fragMan; | FragmentManager fragMan; | ||||
Handler mainHandler; | Handler mainHandler; | ||||
private final Runnable refreshStop = new Runnable() { | private final Runnable refreshStop = new Runnable() { | ||||
public void run() { | public void run() { | ||||
if(getContext() == null) return; | if(getContext() == null) return; | ||||
if (fragMan.findFragmentById(R.id.resultFrame) instanceof ArrivalsFragment) { | if (fragMan.findFragmentById(R.id.resultFrame) instanceof ArrivalsFragment) { | ||||
ArrivalsFragment fragment = (ArrivalsFragment) fragMan.findFragmentById(R.id.resultFrame); | ArrivalsFragment fragment = (ArrivalsFragment) fragMan.findFragmentById(R.id.resultFrame); | ||||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | public void cancelReloadArrivalsIfNeeded(){ | ||||
fragmentHelper.stopLastRequestIfNeeded(); | fragmentHelper.stopLastRequestIfNeeded(); | ||||
toggleSpinner(false); | toggleSpinner(false); | ||||
} | } | ||||
@Override | @Override | ||||
public void onAttach(@NonNull Context context) { | public void onAttach(@NonNull Context context) { | ||||
super.onAttach(context); | super.onAttach(context); | ||||
Log.d(DEBUG_TAG, "OnAttach called, setupOnAttach: "+setupOnAttached); | Log.d(DEBUG_TAG, "OnAttach called, setupOnAttach: "+setupOnAttached); | ||||
mainHandler = new Handler(); | mainHandler = new Handler(); | ||||
if (context instanceof CommonFragmentListener) { | if (context instanceof CommonFragmentListener) { | ||||
mListener = (CommonFragmentListener) context; | mListener = (CommonFragmentListener) context; | ||||
} else { | } else { | ||||
throw new RuntimeException(context | throw new RuntimeException(context | ||||
+ " must implement CommonFragmentListener"); | + " must implement CommonFragmentListener"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 372 Lines • ▼ Show 20 Lines | class NearbyStopsRequester implements Runnable { | ||||
} else if(!haveProviders){ | } else if(!haveProviders){ | ||||
Log.e(DEBUG_TAG, "NO PROVIDERS FOR POSITION"); | Log.e(DEBUG_TAG, "NO PROVIDERS FOR POSITION"); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register