Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/MainScreenFragment.java
Show First 20 Lines • Show All 444 Lines • ▼ Show 20 Lines | public class MainScreenFragment extends BaseFragment implements FragmentListenerMain{ | ||||
*/ | */ | ||||
public void onSearchClick(View v) { | public void onSearchClick(View v) { | ||||
final StopsFinderByName[] stopsFinderByNames = new StopsFinderByName[]{new GTTStopsFetcher(), new FiveTStopsFetcher()}; | final StopsFinderByName[] stopsFinderByNames = new StopsFinderByName[]{new GTTStopsFetcher(), new FiveTStopsFetcher()}; | ||||
if (searchMode == SEARCH_BY_ID) { | if (searchMode == SEARCH_BY_ID) { | ||||
String busStopID = busStopSearchByIDEditText.getText().toString(); | String busStopID = busStopSearchByIDEditText.getText().toString(); | ||||
requestArrivalsForStopID(busStopID); | requestArrivalsForStopID(busStopID); | ||||
} else { // searchMode == SEARCH_BY_NAME | } else { // searchMode == SEARCH_BY_NAME | ||||
String query = busStopSearchByNameEditText.getText().toString(); | String query = busStopSearchByNameEditText.getText().toString(); | ||||
//new asyncWgetBusStopSuggestions(query, stopsDB, StopsFindersByNameRecursionHelper); | query = query.trim(); | ||||
if(getContext()!=null) | if(getContext()!=null) { | ||||
if (query.length() < 1) { | |||||
Toast.makeText(getContext(), R.string.insert_bus_stop_name_error, Toast.LENGTH_SHORT).show(); | |||||
} else if(query.length()< 3){ | |||||
Toast.makeText(getContext(), R.string.query_too_short, Toast.LENGTH_SHORT).show(); | |||||
} | |||||
else | |||||
new AsyncDataDownload(fragmentHelper, stopsFinderByNames, getContext()).execute(query); | new AsyncDataDownload(fragmentHelper, stopsFinderByNames, getContext()).execute(query); | ||||
} | } | ||||
} | } | ||||
} | |||||
public void onToggleKeyboardLayout(View v) { | public void onToggleKeyboardLayout(View v) { | ||||
if (searchMode == SEARCH_BY_NAME) { | if (searchMode == SEARCH_BY_NAME) { | ||||
setSearchModeBusStopID(); | setSearchModeBusStopID(); | ||||
if (busStopSearchByIDEditText.requestFocus()) { | if (busStopSearchByIDEditText.requestFocus()) { | ||||
showKeyboard(); | showKeyboard(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 244 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