Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/StopListFragment.java
Show All 14 Lines | BusTO - Fragments components | ||||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | ||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
package it.reyboz.bustorino.fragments; | package it.reyboz.bustorino.fragments; | ||||
import android.database.Cursor; | import android.database.Cursor; | ||||
import android.net.Uri; | import android.net.Uri; | ||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.support.v4.app.LoaderManager; | import androidx.loader.app.LoaderManager; | ||||
import android.support.v4.content.CursorLoader; | import androidx.loader.content.CursorLoader; | ||||
import android.support.v4.content.Loader; | import androidx.loader.content.Loader; | ||||
import android.util.Log; | import android.util.Log; | ||||
import it.reyboz.bustorino.backend.Route; | import it.reyboz.bustorino.backend.Route; | ||||
import it.reyboz.bustorino.backend.Stop; | import it.reyboz.bustorino.backend.Stop; | ||||
import it.reyboz.bustorino.middleware.AppDataProvider; | import it.reyboz.bustorino.middleware.AppDataProvider; | ||||
import it.reyboz.bustorino.middleware.NextGenDB.Contract.StopsTable; | import it.reyboz.bustorino.middleware.NextGenDB.Contract.StopsTable; | ||||
import it.reyboz.bustorino.adapters.StopAdapter; | import it.reyboz.bustorino.adapters.StopAdapter; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
Show All 31 Lines | public class StopListFragment extends ResultListFragment implements LoaderManager.LoaderCallbacks<Cursor> { | ||||
@Override | @Override | ||||
public void onResume() { | public void onResume() { | ||||
super.onResume(); | super.onResume(); | ||||
LoaderManager loaderManager = getLoaderManager(); | LoaderManager loaderManager = getLoaderManager(); | ||||
if(stopList!=null) { | if(stopList!=null) { | ||||
mListAdapter = new StopAdapter(getContext(),stopList); | mListAdapter = new StopAdapter(getContext(),stopList); | ||||
setListAdapter(mListAdapter); | resetListAdapter(mListAdapter); | ||||
for (int i = 0; i < stopList.size(); i++) { | for (int i = 0; i < stopList.size(); i++) { | ||||
final Bundle b = new Bundle(); | final Bundle b = new Bundle(); | ||||
b.putString(KEY_STOP_ID, stopList.get(i).ID); | b.putString(KEY_STOP_ID, stopList.get(i).ID); | ||||
loaderManager.restartLoader(i, b, this); | loaderManager.restartLoader(i, b, this); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 64 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