Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/NearbyStopsFragment.java
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||||
} | } | ||||
} | } | ||||
} | } | ||||
}; | }; | ||||
scrollListener = new CommonScrollListener(mListener,false); | scrollListener = new CommonScrollListener(mListener,false); | ||||
switchButton.setOnClickListener(v -> { | switchButton.setOnClickListener(v -> { | ||||
switchFragmentType(); | switchFragmentType(); | ||||
}); | }); | ||||
Log.d(DEBUG_TAG, "onCreateView"); | |||||
return root; | return root; | ||||
} | } | ||||
protected ArrayList<Stop> createStopListFromCursor(Cursor data){ | protected ArrayList<Stop> createStopListFromCursor(Cursor data){ | ||||
ArrayList<Stop> stopList = new ArrayList<>(); | ArrayList<Stop> stopList = new ArrayList<>(); | ||||
final int col_id = data.getColumnIndex(StopsTable.COL_ID); | final int col_id = data.getColumnIndex(StopsTable.COL_ID); | ||||
final int latInd = data.getColumnIndex(StopsTable.COL_LAT); | final int latInd = data.getColumnIndex(StopsTable.COL_LAT); | ||||
final int lonInd = data.getColumnIndex(StopsTable.COL_LONG); | final int lonInd = data.getColumnIndex(StopsTable.COL_LONG); | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | public void onAttach(Context context) { | ||||
super.onAttach(context); | super.onAttach(context); | ||||
/// TODO: RISOLVERE PROBLEMA: il context qui e' l'Activity non il Fragment | /// TODO: RISOLVERE PROBLEMA: il context qui e' l'Activity non il Fragment | ||||
if (context instanceof FragmentListenerMain) { | if (context instanceof FragmentListenerMain) { | ||||
mListener = (FragmentListenerMain) context; | mListener = (FragmentListenerMain) context; | ||||
} else { | } else { | ||||
throw new RuntimeException(context.toString() | throw new RuntimeException(context.toString() | ||||
+ " must implement OnFragmentInteractionListener"); | + " must implement OnFragmentInteractionListener"); | ||||
} | } | ||||
Log.d(DEBUG_TAG, "OnAttach called"); | |||||
} | } | ||||
@Override | @Override | ||||
public void onPause() { | public void onPause() { | ||||
super.onPause(); | super.onPause(); | ||||
canStartDBQuery = false; | canStartDBQuery = false; | ||||
Show All 31 Lines | public void onResume() { | ||||
//Re-read preferences | //Re-read preferences | ||||
SharedPreferences shpr = PreferenceManager.getDefaultSharedPreferences(getContext().getApplicationContext()); | SharedPreferences shpr = PreferenceManager.getDefaultSharedPreferences(getContext().getApplicationContext()); | ||||
//For some reason, they are all saved as strings | //For some reason, they are all saved as strings | ||||
MAX_DISTANCE = shpr.getInt(getString(R.string.pref_key_radius_recents),1000); | MAX_DISTANCE = shpr.getInt(getString(R.string.pref_key_radius_recents),1000); | ||||
MIN_NUM_STOPS = Integer.parseInt(shpr.getString(getString(R.string.pref_key_num_recents),"12")); | MIN_NUM_STOPS = Integer.parseInt(shpr.getString(getString(R.string.pref_key_num_recents),"12")); | ||||
} | } | ||||
@Override | @Override | ||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) { | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||||
super.onActivityCreated(savedInstanceState); | super.onViewCreated(view, savedInstanceState); | ||||
gridRecyclerView.setVisibility(View.INVISIBLE); | gridRecyclerView.setVisibility(View.INVISIBLE); | ||||
gridRecyclerView.addOnScrollListener(scrollListener); | gridRecyclerView.addOnScrollListener(scrollListener); | ||||
} | } | ||||
@Override | @Override | ||||
public void onDetach() { | public void onDetach() { | ||||
super.onDetach(); | super.onDetach(); | ||||
mListener = null; | mListener = null; | ||||
if(arrivalsManager!=null) arrivalsManager.cancelAllRequests(); | if(arrivalsManager!=null) arrivalsManager.cancelAllRequests(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 365 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