From 7be94bb0402710b112f269a07674a2f19150b54c Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Wed, 23 Mar 2016 12:07:42 -0700 Subject: [PATCH] Bump minSdkVersion from 10 to 15. Privacy Browser was crashing in the API 10 emulator. --- app/build.gradle | 4 ++-- .../privacybrowser/MainWebViewActivity.java | 19 ++++++------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1c50e116..23b828a6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,10 +24,10 @@ android { } compileSdkVersion 23 - buildToolsVersion "23.0.2" + buildToolsVersion "23.0.3" defaultConfig { applicationId "com.stoutner.privacybrowser" - minSdkVersion 10 + minSdkVersion 15 targetSdkVersion 23 versionCode 2 versionName "1.1" diff --git a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java index 61b208a8..c9130db8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java @@ -226,9 +226,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome */ // Set the one flag supported by API >= 14. - if (Build.VERSION.SDK_INT >= 14) { - view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); - } + view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); // Set the two flags that are supported by API >= 16. if (Build.VERSION.SDK_INT >= 16) { @@ -270,11 +268,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome // Add the URL as the description for the download. requestUri.setDescription(url); - // Show the download notification after the download is completed if the API is 11 or greater. - if (Build.VERSION.SDK_INT >= 11) { - requestUri.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); - } + // Show the download notification after the download is completed. + requestUri.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); + // Initiate the download and display a Snackbar. downloadManager.enqueue(requestUri); Snackbar.make(findViewById(R.id.mainWebView), R.string.download_started, Snackbar.LENGTH_SHORT).show(); } @@ -283,10 +280,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome // Allow pinch to zoom. mainWebView.getSettings().setBuiltInZoomControls(true); - // Hide zoom controls if the API is 11 or greater. - if (Build.VERSION.SDK_INT >= 11) { - mainWebView.getSettings().setDisplayZoomControls(false); - } + // Hide zoom controls. + mainWebView.getSettings().setDisplayZoomControls(false); // Initialize the default preference values the first time the program is run. PreferenceManager.setDefaultValues(this, R.xml.preferences, false); @@ -414,8 +409,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome } @Override - // @TargetApi(11) turns off the errors regarding copy and paste, which are removed from view in menu_webview.xml for lower version of Android. - @TargetApi(11) // Remove Android Studio's warning about the dangers of using SetJavaScriptEnabled. @SuppressLint("SetJavaScriptEnabled") // removeAllCookies is deprecated, but it is required for API < 21. -- 2.43.0