From f73f82030f79dc7bc8395291837feabc5f562691 Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Sun, 24 Jan 2016 00:20:31 -0500 Subject: [PATCH] Use Application object instead of explicit Context --- .../acr/browser/lightning/object/SearchAdapter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/acr/browser/lightning/object/SearchAdapter.java b/app/src/main/java/acr/browser/lightning/object/SearchAdapter.java index 20fe97f..6c93bc5 100644 --- a/app/src/main/java/acr/browser/lightning/object/SearchAdapter.java +++ b/app/src/main/java/acr/browser/lightning/object/SearchAdapter.java @@ -94,7 +94,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { mSearchSubtitle = mContext.getString(R.string.suggestion); mDarkTheme = dark || incognito; mIncognito = incognito; - Thread delete = new Thread(new ClearCacheRunnable(context)); + Thread delete = new Thread(new ClearCacheRunnable(BrowserApp.get(context))); mSearchDrawable = ThemeUtils.getThemedDrawable(context, R.drawable.ic_search, mDarkTheme); mBookmarkDrawable = ThemeUtils.getThemedDrawable(context, R.drawable.ic_bookmark, mDarkTheme); mHistoryDrawable = ThemeUtils.getThemedDrawable(context, R.drawable.ic_history, mDarkTheme); @@ -209,15 +209,15 @@ public class SearchAdapter extends BaseAdapter implements Filterable { private static class ClearCacheRunnable implements Runnable { - private Context context; + private Application app; - public ClearCacheRunnable(Context context) { - this.context = BrowserApp.get(context); + public ClearCacheRunnable(Application app) { + this.app = app; } @Override public void run() { - File dir = new File(context.getCacheDir().toString()); + File dir = new File(app.getCacheDir().toString()); String[] fileList = dir.list(new NameFilter()); long earliestTimeAllowed = System.currentTimeMillis() - INTERVAL_DAY; for (String fileName : fileList) {