Index: src/org/adblockplus/android/AdblockPlus.java |
=================================================================== |
--- a/src/org/adblockplus/android/AdblockPlus.java |
+++ b/src/org/adblockplus/android/AdblockPlus.java |
@@ -62,6 +62,7 @@ |
import android.content.res.AssetManager; |
import android.net.ConnectivityManager; |
import android.net.NetworkInfo; |
+import android.net.Uri; |
import android.os.AsyncTask; |
import android.os.Build; |
import android.os.Bundle; |
@@ -69,6 +70,7 @@ |
import android.os.Message; |
import android.os.SystemClock; |
import android.preference.PreferenceManager; |
+import android.provider.Settings; |
import android.util.Log; |
import android.widget.Toast; |
@@ -124,6 +126,32 @@ |
} |
/** |
+ * Opens Android application settings |
+ */ |
+ public static void showAppDetails(Context context) |
+ { |
+ String packageName = context.getPackageName(); |
+ Intent intent = new Intent(); |
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) |
+ { |
+ // above 2.3 |
+ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); |
+ Uri uri = Uri.fromParts("package", packageName, null); |
+ intent.setData(uri); |
+ } |
+ else |
+ { |
+ // below 2.3 |
+ final String appPkgName = (Build.VERSION.SDK_INT == Build.VERSION_CODES.FROYO ? "pkg" : "com.android.settings.ApplicationPkgName"); |
+ intent.setAction(Intent.ACTION_VIEW); |
+ intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); |
+ intent.putExtra(appPkgName, packageName); |
+ } |
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
+ context.startActivity(intent); |
+ } |
+ |
+ /** |
* Returns device name in user-friendly format |
*/ |
public static String getDeviceName() |
@@ -225,7 +253,7 @@ |
/** |
* Returns subscription information. |
- * |
+ * |
Thomas Greiner
2013/02/27 16:34:29
How did that happen? I noticed that there are 8 oc
|
* @param url |
* subscription url |
*/ |
@@ -243,7 +271,7 @@ |
/** |
* Adds provided subscription and removes previous subscriptions if any. |
- * |
+ * |
* @param subscription |
* Subscription to add |
*/ |
@@ -292,7 +320,7 @@ |
/** |
* Selects which subscription to offer for the first time. |
- * |
+ * |
* @return offered subscription |
*/ |
public Subscription offerSubscription() |
@@ -337,7 +365,7 @@ |
/** |
* Verifies that subscriptions are loaded and returns flag of subscription |
* presence. |
- * |
+ * |
* @return true if at least one subscription is present and downloaded |
*/ |
public boolean verifySubscriptions() |
@@ -370,7 +398,7 @@ |
/** |
* Returns ElemHide selectors for domain. |
- * |
+ * |
* @return ready to use HTML element with CSS selectors |
*/ |
public String getSelectorsForDomain(final String domain) |
@@ -428,7 +456,7 @@ |
/** |
* Checks if filters match request parameters. |
- * |
+ * |
* @param url |
* Request URL |
* @param query |
@@ -476,7 +504,7 @@ |
// by Android system |
if (js == null) |
return; |
- |
+ |
js.execute(new Runnable() |
{ |
@Override |
@@ -530,7 +558,7 @@ |
/** |
* Stops JS engine. |
- * |
+ * |
* @param implicitly |
* stop even in interactive mode |
*/ |
@@ -555,7 +583,7 @@ |
* Sets Alarm to call updater after specified number of minutes or after one |
* day if |
* minutes are set to 0. |
- * |
+ * |
* @param minutes |
* number of minutes to wait |
*/ |