|
12 | 12 | import android.database.sqlite.SQLiteDatabase;
|
13 | 13 | import android.preference.PreferenceManager;
|
14 | 14 |
|
15 |
| -import com.android.volley.RequestQueue; |
16 |
| -import com.android.volley.toolbox.BasicNetwork; |
17 |
| -import com.android.volley.toolbox.DiskBasedCache; |
18 |
| -import com.android.volley.toolbox.HurlStack; |
19 | 15 | import com.facebook.drawee.backends.pipeline.Fresco;
|
20 | 16 | import com.facebook.stetho.Stetho;
|
21 |
| -import com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache; |
22 |
| -import com.nostra13.universalimageloader.core.ImageLoader; |
23 |
| -import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; |
24 |
| -import com.nostra13.universalimageloader.utils.StorageUtils; |
| 17 | + |
| 18 | +import fr.free.nrw.commons.caching.CacheController; |
| 19 | +import fr.free.nrw.commons.category.Category; |
| 20 | +import fr.free.nrw.commons.contributions.Contribution; |
| 21 | +import fr.free.nrw.commons.data.DBOpenHelper; |
| 22 | +import fr.free.nrw.commons.modifications.ModifierSequence; |
| 23 | +import fr.free.nrw.commons.auth.AccountUtil; |
| 24 | +import fr.free.nrw.commons.nearby.NearbyPlaces; |
| 25 | + |
25 | 26 | import com.squareup.leakcanary.LeakCanary;
|
26 | 27 |
|
27 | 28 | import org.acra.ACRA;
|
@@ -84,7 +85,6 @@ public class CommonsApplication extends Application {
|
84 | 85 | private AbstractHttpClient httpClient = null;
|
85 | 86 | private MWApi api = null;
|
86 | 87 | private CacheController cacheData = null;
|
87 |
| - private RequestQueue volleyQueue = null; |
88 | 88 | private DBOpenHelper dbOpenHelper = null;
|
89 | 89 | private NearbyPlaces nearbyPlaces = null;
|
90 | 90 |
|
@@ -139,15 +139,6 @@ public CacheController getCacheData() {
|
139 | 139 | return cacheData;
|
140 | 140 | }
|
141 | 141 |
|
142 |
| - public RequestQueue getVolleyQueue() { |
143 |
| - if (volleyQueue == null) { |
144 |
| - DiskBasedCache cache = new DiskBasedCache(getCacheDir(), 16 * 1024 * 1024); |
145 |
| - volleyQueue = new RequestQueue(cache, new BasicNetwork(new HurlStack())); |
146 |
| - volleyQueue.start(); |
147 |
| - } |
148 |
| - return volleyQueue; |
149 |
| - } |
150 |
| - |
151 | 142 | public synchronized DBOpenHelper getDBOpenHelper() {
|
152 | 143 | if (dbOpenHelper == null) {
|
153 | 144 | dbOpenHelper = new DBOpenHelper(this);
|
@@ -182,26 +173,13 @@ public void onCreate() {
|
182 | 173 | // Fire progress callbacks for every 3% of uploaded content
|
183 | 174 | System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0");
|
184 | 175 |
|
185 |
| - ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(this) |
186 |
| - .discCache(new TotalSizeLimitedDiscCache(StorageUtils.getCacheDirectory(this), 128 * 1024 * 1024)) |
187 |
| - .build(); |
188 |
| - ImageLoader.getInstance().init(imageLoaderConfiguration); |
189 |
| - |
190 | 176 | Fresco.initialize(this);
|
191 | 177 |
|
192 | 178 | // Initialize EventLogging
|
193 | 179 | EventLog.setApp(this);
|
194 | 180 |
|
195 | 181 | //For caching area -> categories
|
196 | 182 | cacheData = new CacheController();
|
197 |
| - |
198 |
| - DiskBasedCache cache = new DiskBasedCache(getCacheDir(), 16 * 1024 * 1024); |
199 |
| - volleyQueue = new RequestQueue(cache, new BasicNetwork(new HurlStack())); |
200 |
| - volleyQueue.start(); |
201 |
| - } |
202 |
| - |
203 |
| - public MWApi getApi() { |
204 |
| - return api; |
205 | 183 | }
|
206 | 184 |
|
207 | 185 | /**
|
@@ -268,15 +246,14 @@ public void clearApplicationData(Context context) {
|
268 | 246 | preferences.edit().clear().commit();
|
269 | 247 | context.getSharedPreferences("prefs", Context.MODE_PRIVATE).edit().clear().commit();
|
270 | 248 | preferences.edit().putBoolean("firstrun", false).apply();
|
271 |
| - updateAllDatabases(context); |
| 249 | + updateAllDatabases(); |
272 | 250 | currentAccount = null;
|
273 | 251 | }
|
274 | 252 |
|
275 | 253 | /**
|
276 | 254 | * Deletes all tables and re-creates them.
|
277 |
| - * @param context context |
278 | 255 | */
|
279 |
| - public void updateAllDatabases(Context context) { |
| 256 | + public void updateAllDatabases() { |
280 | 257 | DBOpenHelper dbOpenHelper = CommonsApplication.getInstance().getDBOpenHelper();
|
281 | 258 | dbOpenHelper.getReadableDatabase().close();
|
282 | 259 | SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
|
0 commit comments