use of com.example.androidforios.app.adapters.TripArrayAdapter in project AndroidForiOS by smbarne.
the class TripListFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mViewHolder.populate(view);
mTripArrayAdapter = new TripArrayAdapter(getActivity());
mViewHolder.tripListView.setAdapter(mTripArrayAdapter);
mViewHolder.tripListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mListener != null) {
mListener.onTripSelected(mTripArrayAdapter.getItem(position));
}
}
});
getLoaderManager().initLoader(0, savedInstanceState, new LoaderManager.LoaderCallbacks<TripList>() {
@Override
public Loader<TripList> onCreateLoader(int id, Bundle args) {
return new DataManager.SubwayLineLoader(getActivity(), mLineType);
}
@Override
public void onLoadFinished(Loader<TripList> loader, TripList data) {
setTripList(data);
if (mViewHolder != null) {
int displayIndex = mViewHolder.viewFlipper.indexOfChild(mViewHolder.tripListView);
mViewHolder.viewFlipper.setDisplayedChild(displayIndex);
}
}
@Override
public void onLoaderReset(Loader<TripList> loader) {
}
}).forceLoad();
}
Aggregations