Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/FragmentHelper.java
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | public class FragmentHelper { | ||||
private Stop lastSuccessfullySearchedBusStop; | private Stop lastSuccessfullySearchedBusStop; | ||||
//support for multiple frames | //support for multiple frames | ||||
private final int secondaryFrameLayout; | private final int secondaryFrameLayout; | ||||
private final int primaryFrameLayout; | private final int primaryFrameLayout; | ||||
private final Context context; | private final Context context; | ||||
public static final int NO_FRAME = -3; | public static final int NO_FRAME = -3; | ||||
private static final String DEBUG_TAG = "BusTO FragmHelper"; | private static final String DEBUG_TAG = "BusTO FragmHelper"; | ||||
private WeakReference<AsyncTask> lastTaskRef; | private WeakReference<AsyncTask> lastTaskRef; | ||||
private SearchRequestType lastTaskType; | |||||
private boolean shouldHaltAllActivities=false; | private boolean shouldHaltAllActivities=false; | ||||
public FragmentHelper(FragmentListenerMain listener, FragmentManager framan, Context context, int mainFrame) { | public FragmentHelper(FragmentListenerMain listener, FragmentManager framan, Context context, int mainFrame) { | ||||
this(listener,framan, context,mainFrame,NO_FRAME); | this(listener,framan, context,mainFrame,NO_FRAME); | ||||
} | } | ||||
public FragmentHelper(FragmentListenerMain listener, FragmentManager fraMan, Context context, int primaryFrameLayout, int secondaryFrameLayout) { | public FragmentHelper(FragmentListenerMain listener, FragmentManager fraMan, Context context, int primaryFrameLayout, int secondaryFrameLayout) { | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | public class FragmentHelper { | ||||
} | } | ||||
/** | /** | ||||
* Wrapper to show the errors/status that happened | * Wrapper to show the errors/status that happened | ||||
* @param res result from Fetcher | * @param res result from Fetcher | ||||
*/ | */ | ||||
public void showErrorMessage(Fetcher.Result res, SearchRequestType type){ | public void showErrorMessage(Fetcher.Result res, SearchRequestType type){ | ||||
//TODO: implement a common set of errors for all fragments | //TODO: implement a common set of errors for all fragments | ||||
if (res==null){ | |||||
Log.e(DEBUG_TAG, "Asked to show result with null result"); | |||||
return; | |||||
} | |||||
Log.d(DEBUG_TAG, "Showing result for "+res); | Log.d(DEBUG_TAG, "Showing result for "+res); | ||||
switch (res){ | switch (res){ | ||||
case OK: | case OK: | ||||
break; | break; | ||||
case CLIENT_OFFLINE: | case CLIENT_OFFLINE: | ||||
showToastMessage(R.string.network_error, true); | showToastMessage(R.string.network_error, true); | ||||
break; | break; | ||||
case SERVER_ERROR: | case SERVER_ERROR: | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |
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