Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/NearbyStopsFragment.java
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | public class NearbyStopsFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> { | ||||
} | } | ||||
@Override | @Override | ||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||||
Bundle savedInstanceState) { | Bundle savedInstanceState) { | ||||
// Inflate the layout for this fragment | // Inflate the layout for this fragment | ||||
View root = inflater.inflate(R.layout.fragment_nearby_stops, container, false); | View root = inflater.inflate(R.layout.fragment_nearby_stops, container, false); | ||||
gridRecyclerView = (RecyclerView) root.findViewById(R.id.stopGridRecyclerView); | gridRecyclerView = root.findViewById(R.id.stopGridRecyclerView); | ||||
gridLayoutManager = new AutoFitGridLayoutManager(getContext().getApplicationContext(), utils.convertDipToPixels(getContext(),COLUMN_WIDTH_DP)); | gridLayoutManager = new AutoFitGridLayoutManager(getContext().getApplicationContext(), utils.convertDipToPixels(getContext(),COLUMN_WIDTH_DP)); | ||||
gridRecyclerView.setLayoutManager(gridLayoutManager); | gridRecyclerView.setLayoutManager(gridLayoutManager); | ||||
gridRecyclerView.setHasFixedSize(false); | gridRecyclerView.setHasFixedSize(false); | ||||
circlingProgressBar = (ProgressBar) root.findViewById(R.id.loadingBar); | circlingProgressBar = root.findViewById(R.id.loadingBar); | ||||
flatProgressBar = (ProgressBar) root.findViewById(R.id.horizontalProgressBar); | flatProgressBar = root.findViewById(R.id.horizontalProgressBar); | ||||
messageTextView = (TextView) root.findViewById(R.id.messageTextView); | messageTextView = root.findViewById(R.id.messageTextView); | ||||
titleTextView = (TextView) root.findViewById(R.id.titleTextView); | titleTextView = root.findViewById(R.id.titleTextView); | ||||
switchButton = (AppCompatButton) root.findViewById(R.id.switchButton); | switchButton = root.findViewById(R.id.switchButton); | ||||
preferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() { | preferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() { | ||||
@Override | @Override | ||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { | ||||
Log.d(DEBUG_TAG,"Key "+key+" was changed"); | Log.d(DEBUG_TAG,"Key "+key+" was changed"); | ||||
if(key.equals(getString(R.string.databaseUpdatingPref))){ | if(key.equals(getString(R.string.databaseUpdatingPref))){ | ||||
if(!sharedPreferences.getBoolean(getString(R.string.databaseUpdatingPref),true)){ | if(!sharedPreferences.getBoolean(getString(R.string.databaseUpdatingPref),true)){ | ||||
canStartDBQuery = true; | canStartDBQuery = true; | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | private void setFragmentType(int type){ | ||||
} | } | ||||
} | } | ||||
@Override | @Override | ||||
public void onAttach(Context context) { | public void onAttach(Context context) { | ||||
super.onAttach(context); | super.onAttach(context); | ||||
/// 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"); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 424 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