Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java

Issue 29375826: Issue 4903 - Allow to specify file system root (Closed)
Patch Set: removed init(), added doc Created March 17, 2017, 7:36 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java
diff --git a/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java b/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java
index 0840fa3e182bd8896eae3fb937c1415504657cdb..b9bbd92a88305dd2c978a3331f2b763f5f009bc1 100644
--- a/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java
+++ b/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java
@@ -42,6 +42,7 @@ public class AdblockHelper
private static AdblockHelper _instance;
private Context context;
+ private String basePath;
private boolean developmentBuild;
private String preferenceName;
private AdblockEngine engine;
@@ -88,12 +89,19 @@ public class AdblockHelper
/**
* Init with context
* @param context application context
+ * @param basePath file system root to store files
+ *
+ * Adblock Plus library will download subscription files and store them on
+ * the path passed. The path should exist and the directory content should not be
+ * cleared out occasionally. Using `context.getCacheDir().getAbsolutePath()` is not
+ * recommended because it can be cleared by the system.
* @param developmentBuild debug or release?
* @param preferenceName Shared Preferences name
*/
- public void init(Context context, boolean developmentBuild, String preferenceName)
+ public void init(Context context, String basePath, boolean developmentBuild, String preferenceName)
{
this.context = context.getApplicationContext();
+ this.basePath = basePath;
this.developmentBuild = developmentBuild;
this.preferenceName = preferenceName;
}
@@ -111,8 +119,7 @@ public class AdblockHelper
engine = AdblockEngine.create(
AdblockEngine.generateAppInfo(context, developmentBuild),
- context.getCacheDir().getAbsolutePath(),
- true); // `true` as we need element hiding
+ basePath, true); // `true` as we need element hiding
Log.d(TAG, "AdblockHelper engine created");
AdblockSettings settings = storage.load();
« no previous file with comments | « README.md ('k') | libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld