From: Soren Stoutner Date: Sun, 23 Oct 2016 00:28:58 +0000 (-0700) Subject: Partial Find on Page implimentation. X-Git-Tag: v1.11~4 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=e4395e4c0786da8ce5c00cb2762e78ad706e86db;p=PrivacyBrowserAndroid.git Partial Find on Page implimentation. --- diff --git a/app/build.gradle b/app/build.gradle index 3f2a08d4..823eb5e8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -60,5 +60,5 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:design:24.2.1' // Only compile `com.google.android.gms:play-services-ads` for the free flavor. - freeCompile 'com.google.android.gms:play-services-ads:9.6.1' + freeCompile 'com.google.android.gms:play-services-ads:9.8.00' } diff --git a/app/src/main/assets/de/about_licenses.html b/app/src/main/assets/de/about_licenses.html index 83ee46c0..a4aa2f0c 100644 --- a/app/src/main/assets/de/about_licenses.html +++ b/app/src/main/assets/de/about_licenses.html @@ -105,6 +105,13 @@

ic_vertical_align_top.

ic_web.

+ +

ic_expand_less.

+ +

ic_expand_more.

+ +

ic_close.

+

GNU General Public License

diff --git a/app/src/main/assets/en/about_licenses.html b/app/src/main/assets/en/about_licenses.html index 9c46415e..3ee97602 100644 --- a/app/src/main/assets/en/about_licenses.html +++ b/app/src/main/assets/en/about_licenses.html @@ -103,11 +103,18 @@

ic_web.

+

ic_expand_less.

+ +

ic_expand_more.

+ +

ic_close.

+

cookie was created by Google. It is released under the Apache License 2.0 and can be downloaded from Material Design Icons.

+

GNU General Public License

diff --git a/app/src/main/assets/en/images/ic_close.png b/app/src/main/assets/en/images/ic_close.png new file mode 100644 index 00000000..0f1086a5 Binary files /dev/null and b/app/src/main/assets/en/images/ic_close.png differ diff --git a/app/src/main/assets/en/images/ic_expand_less.png b/app/src/main/assets/en/images/ic_expand_less.png new file mode 100644 index 00000000..1140aa2d Binary files /dev/null and b/app/src/main/assets/en/images/ic_expand_less.png differ diff --git a/app/src/main/assets/en/images/ic_expand_more.png b/app/src/main/assets/en/images/ic_expand_more.png new file mode 100644 index 00000000..897b3061 Binary files /dev/null and b/app/src/main/assets/en/images/ic_expand_more.png differ diff --git a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java index a27dddb2..7872677d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java @@ -81,7 +81,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation SslCertificateError.SslCertificateErrorListener, DownloadFile.DownloadFileListener { // `appBar` is public static so it can be accessed from `OrbotProxyHelper`. - // It is also used in `onCreate()`. + // It is also used in `onCreate()` and `onOptionsItemSelected()`. public static ActionBar appBar; // `favoriteIcon` is public static so it can be accessed from `CreateHomeScreenShortcut`, `BookmarksActivity`, `CreateBookmark`, `CreateBookmarkFolder`, and `EditBookmark`. @@ -154,6 +154,8 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation // `sslErrorHandler` is used in `onCreate()`, `onSslErrorCancel()`, and `onSslErrorProceed`. private SslErrorHandler sslErrorHandler; + private MenuItem toggleJavaScript; + @Override // Remove Android Studio's warning about the dangers of using SetJavaScriptEnabled. The whole premise of Privacy Browser is built around an understanding of these dangers. @SuppressLint("SetJavaScriptEnabled") @@ -169,8 +171,8 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation // This is needed to get rid of the Android Studio warning that appBar might be null. assert appBar != null; - // Add the custom url_bar layout, which shows the favoriteIcon, urlTextBar, and progressBar. - appBar.setCustomView(R.layout.url_bar); + // Add the custom url_app_bar layout, which shows the favoriteIcon, urlTextBar, and progressBar. + appBar.setCustomView(R.layout.url_app_bar); appBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); // Set the "go" button on the keyboard to load the URL in urlTextBox. @@ -441,6 +443,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation updatePrivacyIcons(); // Get handles for the menu items. + toggleJavaScript = menu.findItem(R.id.toggleJavaScript); MenuItem toggleFirstPartyCookies = menu.findItem(R.id.toggleFirstPartyCookies); MenuItem toggleThirdPartyCookies = menu.findItem(R.id.toggleThirdPartyCookies); MenuItem toggleDomStorage = menu.findItem(R.id.toggleDomStorage); @@ -732,6 +735,12 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation mainWebView.getSettings().setTextZoom(200); return true; + case R.id.find_on_page: + appBar.setCustomView(R.layout.find_on_page_app_bar); + toggleJavaScript.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); + appBar.invalidateOptionsMenu(); + return true; + case R.id.share: Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); @@ -896,7 +905,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation adView = findViewById(R.id.adView); // `invalidateOptionsMenu` should recalculate the number of action buttons from the menu to display on the app bar, but it doesn't because of the this bug: https://code.google.com/p/android/issues/detail?id=20493#c8 - invalidateOptionsMenu(); + // invalidateOptionsMenu(); } @Override diff --git a/app/src/main/res/drawable/close.xml b/app/src/main/res/drawable/close.xml new file mode 100644 index 00000000..003e13bc --- /dev/null +++ b/app/src/main/res/drawable/close.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/app/src/main/res/drawable/next.xml b/app/src/main/res/drawable/next.xml new file mode 100644 index 00000000..0ed52fca --- /dev/null +++ b/app/src/main/res/drawable/next.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/app/src/main/res/drawable/previous.xml b/app/src/main/res/drawable/previous.xml new file mode 100644 index 00000000..9908d7f4 --- /dev/null +++ b/app/src/main/res/drawable/previous.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/app/src/main/res/layout/find_on_page_app_bar.xml b/app/src/main/res/layout/find_on_page_app_bar.xml new file mode 100644 index 00000000..3cb0f995 --- /dev/null +++ b/app/src/main/res/layout/find_on_page_app_bar.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/url_app_bar.xml b/app/src/main/res/layout/url_app_bar.xml new file mode 100644 index 00000000..b2c7fb57 --- /dev/null +++ b/app/src/main/res/layout/url_app_bar.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/url_bar.xml b/app/src/main/res/layout/url_bar.xml deleted file mode 100644 index afe8651c..00000000 --- a/app/src/main/res/layout/url_bar.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/webview_options_menu.xml b/app/src/main/res/menu/webview_options_menu.xml index 89f1bfbd..8dee5b1d 100644 --- a/app/src/main/res/menu/webview_options_menu.xml +++ b/app/src/main/res/menu/webview_options_menu.xml @@ -129,27 +129,33 @@ + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 57c2c0a0..1a540fce 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -112,12 +112,17 @@ 150% 175% 200% + Find on Page Share Add to Home Screen Print Privacy Browser Web Page Refresh + + Previous + Next + Create shortcut Shortcut name diff --git a/build.gradle b/build.gradle index 573f4fd6..ef7ae5ac 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.1' + classpath 'com.android.tools.build:gradle:2.2.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files