From: Soren Stoutner Date: Mon, 20 Nov 2017 22:17:45 +0000 (-0700) Subject: Add support for `tel:` links. https://redmine.stoutner.com/issues/226 X-Git-Tag: v2.7.2~2 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=8adccbcf10a89fe03859b80a539c1187f23a3d4e;p=PrivacyBrowserAndroid.git Add support for `tel:` links. https://redmine.stoutner.com/issues/226 --- diff --git a/app/build.gradle b/app/build.gradle index 50c0c2cf..ad44a2b8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -67,7 +67,7 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:design:26.1.0' // Only compile `com.google.firebase:firebase-ads:9.8.0` for the free flavor. - freeImplementation 'com.google.firebase:firebase-ads:11.4.2' + freeImplementation 'com.google.firebase:firebase-ads:11.6.0' } // Google's documentation says the following line is required for `firebase-ads` but things work correctly without it. I have no interest in applying the Google Mobile Services plugin in the standard flavor if I don't have to. diff --git a/app/src/main/assets/de/about_changelog_dark.html b/app/src/main/assets/de/about_changelog_dark.html index 67926e54..3c19e767 100644 --- a/app/src/main/assets/de/about_changelog_dark.html +++ b/app/src/main/assets/de/about_changelog_dark.html @@ -30,7 +30,7 @@

2.7.1 (version code 28)

-

9. November 2017 - minimum API 19, target API 26

+

9. November 2017 - minimum API 19, target API 26

diff --git a/app/src/main/assets/de/about_changelog_light.html b/app/src/main/assets/de/about_changelog_light.html index ca438446..4b474a38 100644 --- a/app/src/main/assets/de/about_changelog_light.html +++ b/app/src/main/assets/de/about_changelog_light.html @@ -30,7 +30,7 @@

2.7.1 (version code 28)

-

9. November 2017 - minimum API 19, target API 26

+

9. November 2017 - minimum API 19, target API 26

diff --git a/app/src/main/assets/en/about_changelog_dark.html b/app/src/main/assets/en/about_changelog_dark.html index f994a3bd..c7078a16 100644 --- a/app/src/main/assets/en/about_changelog_dark.html +++ b/app/src/main/assets/en/about_changelog_dark.html @@ -25,7 +25,7 @@

2.7.1 (version code 28)

-

9 November 2017 - minimum API 19, target API 26

+

9 November 2017 - minimum API 19, target API 26

diff --git a/app/src/main/assets/en/about_changelog_light.html b/app/src/main/assets/en/about_changelog_light.html index 6877439b..ac7c1f51 100644 --- a/app/src/main/assets/en/about_changelog_light.html +++ b/app/src/main/assets/en/about_changelog_light.html @@ -25,7 +25,7 @@

2.7.1 (version code 28)

-

9 November 2017 - minimum API 19, target API 26

+

9 November 2017 - minimum API 19, target API 26

diff --git a/app/src/main/assets/es/about_changelog_dark.html b/app/src/main/assets/es/about_changelog_dark.html index 6c7e8df4..c5fd9de1 100644 --- a/app/src/main/assets/es/about_changelog_dark.html +++ b/app/src/main/assets/es/about_changelog_dark.html @@ -27,7 +27,7 @@

2.7.1 (código de versión 28)

-

9 de noviembre de 2017 - API mínimo 19, API dirigido 26

+

9 de noviembre de 2017 - API mínimo 19, API dirigido 26

diff --git a/app/src/main/assets/es/about_changelog_light.html b/app/src/main/assets/es/about_changelog_light.html index 5abd0a83..254d64f0 100644 --- a/app/src/main/assets/es/about_changelog_light.html +++ b/app/src/main/assets/es/about_changelog_light.html @@ -27,7 +27,7 @@

2.7.1 (código de versión 28)

-

9 de noviembre de 2017 - API mínimo 19, API dirigido 26

+

9 de noviembre de 2017 - API mínimo 19, API dirigido 26

diff --git a/app/src/main/assets/it/about_changelog_dark.html b/app/src/main/assets/it/about_changelog_dark.html index c9e592ae..b55c002e 100644 --- a/app/src/main/assets/it/about_changelog_dark.html +++ b/app/src/main/assets/it/about_changelog_dark.html @@ -27,7 +27,7 @@

2.7.1 (versione codice 28)

-

9 Novembre 2017 - minima API 19, target API 26

+

9 Novembre 2017 - minima API 19, target API 26

diff --git a/app/src/main/assets/it/about_changelog_light.html b/app/src/main/assets/it/about_changelog_light.html index bbae4cd9..ee963d50 100644 --- a/app/src/main/assets/it/about_changelog_light.html +++ b/app/src/main/assets/it/about_changelog_light.html @@ -27,7 +27,7 @@

2.7.1 (versione codice 28)

-

9 Novembre 2017 - minima API 19, target API 26

+

9 Novembre 2017 - minima API 19, target API 26

diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index c6f04a0f..29332ebc 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -812,8 +812,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @SuppressWarnings("deprecation") @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - if (url.startsWith("mailto:")) { // Load the URL in an external email program because it begins with `mailto:`. - // We use `ACTION_SENDTO` instead of `ACTION_SEND` so that only email programs are launched. + if (url.startsWith("mailto:")) { // Load the email address in an external email program. + // Use `ACTION_SENDTO` instead of `ACTION_SEND` so that only email programs are launched. Intent emailIntent = new Intent(Intent.ACTION_SENDTO); // Parse the url and set it as the data for the `Intent`. @@ -825,6 +825,21 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Make it so. startActivity(emailIntent); + // Returning `true` indicates the application is handling the URL. + return true; + } else if (url.startsWith("tel:")) { // Load the phone number in the dialer. + // `ACTION_DIAL` open the dialer and loads the phone number, but waits for the user to place the call. + Intent dialIntent = new Intent(Intent.ACTION_DIAL); + + // Add the phone number to the intent. + dialIntent.setData(Uri.parse(url)); + + // `FLAG_ACTIVITY_NEW_TASK` opens the dialer in a new task instead as part of Privacy Browser. + dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + + // Make it so. + startActivity(dialIntent); + // Returning `true` indicates the application is handling the URL. return true; } else { // Load the URL in Privacy Browser. diff --git a/build.gradle b/build.gradle index 5aa4870f..f903bec3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,34 @@ +/* + * Copyright © 2016-2017 Soren Stoutner . + * + * This file is part of Privacy Browser . + * + * Privacy Browser is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser. If not, see . + */ + // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0' + classpath 'com.android.tools.build:gradle:3.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -15,6 +38,9 @@ buildscript { allprojects { repositories { jcenter() - google() + maven { + url 'https://maven.google.com/' + name 'Google' + } } }