Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/middleware/AsyncDataDownload.java
Show All 21 Lines | |||||
import android.database.SQLException; | import android.database.SQLException; | ||||
import android.net.Uri; | import android.net.Uri; | ||||
import android.os.AsyncTask; | import android.os.AsyncTask; | ||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import android.util.Log; | import android.util.Log; | ||||
import it.reyboz.bustorino.backend.*; | import it.reyboz.bustorino.backend.*; | ||||
import it.reyboz.bustorino.data.AppDataProvider; | |||||
import it.reyboz.bustorino.fragments.FragmentHelper; | import it.reyboz.bustorino.fragments.FragmentHelper; | ||||
import it.reyboz.bustorino.middleware.NextGenDB.Contract.*; | import it.reyboz.bustorino.data.NextGenDB.Contract.*; | ||||
import java.lang.ref.WeakReference; | import java.lang.ref.WeakReference; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.concurrent.atomic.AtomicReference; | import java.util.concurrent.atomic.AtomicReference; | ||||
import java.util.Calendar; | import java.util.Calendar; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | public class AsyncDataDownload extends AsyncTask<String,Fetcher.result,Object>{ | ||||
public enum RequestType { | public enum RequestType { | ||||
ARRIVALS,STOPS,DBUPDATE | ARRIVALS,STOPS,DBUPDATE | ||||
} | } | ||||
public class BranchInserter implements Runnable{ | public class BranchInserter implements Runnable{ | ||||
private final List<Route> routesToInsert; | private final List<Route> routesToInsert; | ||||
private String stopID; | |||||
private final FragmentHelper fragmentHelper; | private final FragmentHelper fragmentHelper; | ||||
public BranchInserter(List<Route> routesToInsert,FragmentHelper fh,String stopID) { | public BranchInserter(List<Route> routesToInsert,FragmentHelper fh,String stopID) { | ||||
this.routesToInsert = routesToInsert; | this.routesToInsert = routesToInsert; | ||||
this.stopID = stopID; | |||||
this.fragmentHelper = fh; | this.fragmentHelper = fh; | ||||
} | } | ||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
ContentValues[] values = new ContentValues[routesToInsert.size()]; | ContentValues[] values = new ContentValues[routesToInsert.size()]; | ||||
ArrayList<ContentValues> connectionsVals = new ArrayList<>(routesToInsert.size()*4); | ArrayList<ContentValues> connectionsVals = new ArrayList<>(routesToInsert.size()*4); | ||||
long starttime,endtime; | long starttime,endtime; | ||||
▲ Show 20 Lines • Show All 71 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