From 8ae8f58cc6f9ba42570ff3a3dc63bad4c21661a5 Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Mon, 19 Sep 2016 21:50:36 -0400 Subject: [PATCH] Fixing deprecated API usage and lint warnings --- .../activity/ThemableBrowserActivity.java | 4 +- .../lightning/async/ImageDownloadTask.java | 1 - .../lightning/constant/BookmarkPage.java | 32 ++++---- .../lightning/database/BookmarkLocalSync.java | 4 +- .../lightning/dialog/BrowserDialog.java | 2 +- .../lightning/fragment/BookmarksFragment.java | 3 +- .../fragment/GeneralSettingsFragment.java | 1 - .../fragment/anim/HorizontalItemAnimator.java | 31 ++++---- .../fragment/anim/VerticalItemAnimator.java | 31 ++++---- .../browser/lightning/reading/MapEntry.java | 78 ------------------- .../lightning/receiver/NetworkReceiver.java | 1 - .../browser/lightning/search/Suggestions.java | 2 +- .../lightning/utils/KeyboardHelper.java | 4 +- .../browser/lightning/utils/ThemeUtils.java | 2 +- .../browser/lightning/view/LightningView.java | 73 +++++++++-------- .../lightning/view/LightningWebClient.java | 17 +++- 16 files changed, 115 insertions(+), 171 deletions(-) delete mode 100644 app/src/main/java/acr/browser/lightning/reading/MapEntry.java diff --git a/app/src/main/java/acr/browser/lightning/activity/ThemableBrowserActivity.java b/app/src/main/java/acr/browser/lightning/activity/ThemableBrowserActivity.java index 25c6ab0..b4d112f 100644 --- a/app/src/main/java/acr/browser/lightning/activity/ThemableBrowserActivity.java +++ b/app/src/main/java/acr/browser/lightning/activity/ThemableBrowserActivity.java @@ -49,7 +49,7 @@ public abstract class ThemableBrowserActivity extends AppCompatActivity { * Called by onWindowFocusChanged only if * onResume has been called. */ - public void onWindowVisibleToUserAfterResume() { + void onWindowVisibleToUserAfterResume() { } @@ -68,7 +68,7 @@ public abstract class ThemableBrowserActivity extends AppCompatActivity { return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE; } - protected void restart() { + void restart() { finish(); startActivity(new Intent(this, getClass())); } diff --git a/app/src/main/java/acr/browser/lightning/async/ImageDownloadTask.java b/app/src/main/java/acr/browser/lightning/async/ImageDownloadTask.java index 8ff8f2f..60cd9bf 100644 --- a/app/src/main/java/acr/browser/lightning/async/ImageDownloadTask.java +++ b/app/src/main/java/acr/browser/lightning/async/ImageDownloadTask.java @@ -1,7 +1,6 @@ package acr.browser.lightning.async; import android.app.Application; -import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; diff --git a/app/src/main/java/acr/browser/lightning/constant/BookmarkPage.java b/app/src/main/java/acr/browser/lightning/constant/BookmarkPage.java index 7016483..c6d64dd 100644 --- a/app/src/main/java/acr/browser/lightning/constant/BookmarkPage.java +++ b/app/src/main/java/acr/browser/lightning/constant/BookmarkPage.java @@ -34,25 +34,25 @@ public final class BookmarkPage extends AsyncTask { public static final String FILENAME = "bookmarks.html"; private static final String HEADING_1 = "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - ""; + "<head>\n" + + "<meta content=en-us http-equiv=Content-Language />\n" + + "<meta content='text/html; charset=utf-8' http-equiv=Content-Type />\n" + + "<meta name=viewport content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'>\n" + + "<title>"; private static final String HEADING_2 = "\n" + - "\n" + - "\n" + - "
"; + "\n" + + "\n" + + "
"; private static final String PART1 = "
\n" + - "
\n" + - "
\n" + - "

\n" + - " { private static final String END = "

"; + private static final String FOLDER_ICON = "folder.png"; + private File mFilesDir; private File mCacheDir; @@ -101,7 +103,7 @@ public final class BookmarkPage extends AsyncTask { private void cacheDefaultFolderIcon() { FileOutputStream outputStream = null; - File image = new File(mCacheDir, "folder.png"); + File image = new File(mCacheDir, FOLDER_ICON); try { outputStream = new FileOutputStream(image); mFolderIcon.compress(Bitmap.CompressFormat.PNG, 100, outputStream); @@ -123,7 +125,7 @@ public final class BookmarkPage extends AsyncTask { } final StringBuilder bookmarkBuilder = new StringBuilder(HEADING_1 + mTitle + HEADING_2); - final String folderIconPath = Constants.FILE + mCacheDir + "/folder.png"; + final String folderIconPath = Constants.FILE + mCacheDir + '/' + FOLDER_ICON; for (int n = 0, size = list.size(); n < size; n++) { final HistoryItem item = list.get(n); bookmarkBuilder.append(PART1); diff --git a/app/src/main/java/acr/browser/lightning/database/BookmarkLocalSync.java b/app/src/main/java/acr/browser/lightning/database/BookmarkLocalSync.java index 9d0476c..bf15463 100644 --- a/app/src/main/java/acr/browser/lightning/database/BookmarkLocalSync.java +++ b/app/src/main/java/acr/browser/lightning/database/BookmarkLocalSync.java @@ -42,7 +42,7 @@ public class BookmarkLocalSync { mContext = context; } - public List getBookmarksFromContentUri(String contentUri) { + private List getBookmarksFromContentUri(String contentUri) { List list = new ArrayList<>(); Cursor cursor = getBrowserCursor(contentUri); try { @@ -186,7 +186,7 @@ public class BookmarkLocalSync { printColumns(STOCK_BOOKMARKS_CONTENT); } - public void printColumns(String contentProvider) { + private void printColumns(String contentProvider) { Cursor cursor = null; Log.e(TAG, contentProvider); Uri uri = Uri.parse(contentProvider); diff --git a/app/src/main/java/acr/browser/lightning/dialog/BrowserDialog.java b/app/src/main/java/acr/browser/lightning/dialog/BrowserDialog.java index dae8072..15a240c 100644 --- a/app/src/main/java/acr/browser/lightning/dialog/BrowserDialog.java +++ b/app/src/main/java/acr/browser/lightning/dialog/BrowserDialog.java @@ -54,7 +54,7 @@ public class BrowserDialog { public static abstract class Item { - private int mTitle; + private final int mTitle; private boolean mCondition = true; public Item(@StringRes int title, boolean condition) { diff --git a/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java b/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java index b1f2d73..79e641e 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java +++ b/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java @@ -374,8 +374,9 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener, this.context = context; } + @NonNull @Override - public View getView(int position, View convertView, ViewGroup parent) { + public View getView(int position, View convertView, @NonNull ViewGroup parent) { View row = convertView; BookmarkViewHolder holder; diff --git a/app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java b/app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java index 8439b07..7714bab 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java +++ b/app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java @@ -26,7 +26,6 @@ import acr.browser.lightning.R; import acr.browser.lightning.constant.Constants; import acr.browser.lightning.dialog.BrowserDialog; import acr.browser.lightning.download.DownloadHandler; -import acr.browser.lightning.preference.PreferenceManager; import acr.browser.lightning.utils.ProxyUtils; import acr.browser.lightning.utils.ThemeUtils; import acr.browser.lightning.utils.Utils; diff --git a/app/src/main/java/acr/browser/lightning/fragment/anim/HorizontalItemAnimator.java b/app/src/main/java/acr/browser/lightning/fragment/anim/HorizontalItemAnimator.java index 2015f3c..0fa4838 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/anim/HorizontalItemAnimator.java +++ b/app/src/main/java/acr/browser/lightning/fragment/anim/HorizontalItemAnimator.java @@ -39,23 +39,26 @@ import java.util.List; public class HorizontalItemAnimator extends SimpleItemAnimator { private static final boolean DEBUG = false; - private ArrayList mPendingRemovals = new ArrayList<>(); - private ArrayList mPendingAdditions = new ArrayList<>(); - private ArrayList mPendingMoves = new ArrayList<>(); - private ArrayList mPendingChanges = new ArrayList<>(); + private final ArrayList mPendingRemovals = new ArrayList<>(); + private final ArrayList mPendingAdditions = new ArrayList<>(); + private final ArrayList mPendingMoves = new ArrayList<>(); + private final ArrayList mPendingChanges = new ArrayList<>(); - private ArrayList> mAdditionsList = new ArrayList<>(); - private ArrayList> mMovesList = new ArrayList<>(); - private ArrayList> mChangesList = new ArrayList<>(); + private final ArrayList> mAdditionsList = new ArrayList<>(); + private final ArrayList> mMovesList = new ArrayList<>(); + private final ArrayList> mChangesList = new ArrayList<>(); - private ArrayList mAddAnimations = new ArrayList<>(); - private ArrayList mMoveAnimations = new ArrayList<>(); - private ArrayList mRemoveAnimations = new ArrayList<>(); - private ArrayList mChangeAnimations = new ArrayList<>(); + private final ArrayList mAddAnimations = new ArrayList<>(); + private final ArrayList mMoveAnimations = new ArrayList<>(); + private final ArrayList mRemoveAnimations = new ArrayList<>(); + private final ArrayList mChangeAnimations = new ArrayList<>(); private static class MoveInfo { - public ViewHolder holder; - public int fromX, fromY, toX, toY; + public final ViewHolder holder; + public final int fromX; + public final int fromY; + public final int toX; + public final int toY; private MoveInfo(ViewHolder holder, int fromX, int fromY, int toX, int toY) { this.holder = holder; @@ -656,7 +659,7 @@ public class HorizontalItemAnimator extends SimpleItemAnimator { dispatchAnimationsFinished(); } - static void cancelAll(List viewHolders) { + private static void cancelAll(List viewHolders) { for (int i = viewHolders.size() - 1; i >= 0; i--) { ViewCompat.animate(viewHolders.get(i).itemView).cancel(); } diff --git a/app/src/main/java/acr/browser/lightning/fragment/anim/VerticalItemAnimator.java b/app/src/main/java/acr/browser/lightning/fragment/anim/VerticalItemAnimator.java index 3db62e9..b6ee56e 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/anim/VerticalItemAnimator.java +++ b/app/src/main/java/acr/browser/lightning/fragment/anim/VerticalItemAnimator.java @@ -39,23 +39,26 @@ import java.util.List; public class VerticalItemAnimator extends SimpleItemAnimator { private static final boolean DEBUG = false; - private ArrayList mPendingRemovals = new ArrayList<>(); - private ArrayList mPendingAdditions = new ArrayList<>(); - private ArrayList mPendingMoves = new ArrayList<>(); - private ArrayList mPendingChanges = new ArrayList<>(); + private final ArrayList mPendingRemovals = new ArrayList<>(); + private final ArrayList mPendingAdditions = new ArrayList<>(); + private final ArrayList mPendingMoves = new ArrayList<>(); + private final ArrayList mPendingChanges = new ArrayList<>(); - private ArrayList> mAdditionsList = new ArrayList<>(); - private ArrayList> mMovesList = new ArrayList<>(); - private ArrayList> mChangesList = new ArrayList<>(); + private final ArrayList> mAdditionsList = new ArrayList<>(); + private final ArrayList> mMovesList = new ArrayList<>(); + private final ArrayList> mChangesList = new ArrayList<>(); - private ArrayList mAddAnimations = new ArrayList<>(); - private ArrayList mMoveAnimations = new ArrayList<>(); - private ArrayList mRemoveAnimations = new ArrayList<>(); - private ArrayList mChangeAnimations = new ArrayList<>(); + private final ArrayList mAddAnimations = new ArrayList<>(); + private final ArrayList mMoveAnimations = new ArrayList<>(); + private final ArrayList mRemoveAnimations = new ArrayList<>(); + private final ArrayList mChangeAnimations = new ArrayList<>(); private static class MoveInfo { - public ViewHolder holder; - public int fromX, fromY, toX, toY; + public final ViewHolder holder; + public final int fromX; + public final int fromY; + public final int toX; + public final int toY; private MoveInfo(ViewHolder holder, int fromX, int fromY, int toX, int toY) { this.holder = holder; @@ -655,7 +658,7 @@ public class VerticalItemAnimator extends SimpleItemAnimator { dispatchAnimationsFinished(); } - static void cancelAll(List viewHolders) { + private static void cancelAll(List viewHolders) { for (int i = viewHolders.size() - 1; i >= 0; i--) { ViewCompat.animate(viewHolders.get(i).itemView).cancel(); } diff --git a/app/src/main/java/acr/browser/lightning/reading/MapEntry.java b/app/src/main/java/acr/browser/lightning/reading/MapEntry.java deleted file mode 100644 index 7e1bef7..0000000 --- a/app/src/main/java/acr/browser/lightning/reading/MapEntry.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright (C) 2010 Peter Karich <> - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package acr.browser.lightning.reading; - -import java.io.Serializable; -import java.util.Map; - -/** - * Simple impl of Map.Entry. So that we can have ordered maps. - * - * @author Peter Karich, peat_hal ‘at’ users ‘dot’ sourceforge ‘dot’ - * net - */ -public class MapEntry implements Map.Entry, Serializable { - - private static final long serialVersionUID = 1L; - private final K key; - private V value; - - public MapEntry(K key, V value) { - this.key = key; - this.value = value; - } - - @Override - public K getKey() { - return key; - } - - @Override - public V getValue() { - return value; - } - - @Override - public V setValue(V value) { - this.value = value; - return value; - } - - @Override - public String toString() { - return key + ", " + value; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) - return false; - if (!(obj instanceof Map)) - return false; - final MapEntry other = (MapEntry) obj; - - return !(this.key != other.key && (this.key == null || !this.key.equals(other.key))) && - !(this.value != other.value && (this.value == null || !this.value.equals(other.value))); - } - - @Override - public int hashCode() { - int hash = 7; - hash = 19 * hash + (this.key != null ? this.key.hashCode() : 0); - hash = 19 * hash + (this.value != null ? this.value.hashCode() : 0); - return hash; - } -} diff --git a/app/src/main/java/acr/browser/lightning/receiver/NetworkReceiver.java b/app/src/main/java/acr/browser/lightning/receiver/NetworkReceiver.java index 5c394a9..a5a3825 100644 --- a/app/src/main/java/acr/browser/lightning/receiver/NetworkReceiver.java +++ b/app/src/main/java/acr/browser/lightning/receiver/NetworkReceiver.java @@ -6,7 +6,6 @@ import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.annotation.NonNull; -import android.util.Log; public abstract class NetworkReceiver extends BroadcastReceiver { diff --git a/app/src/main/java/acr/browser/lightning/search/Suggestions.java b/app/src/main/java/acr/browser/lightning/search/Suggestions.java index 317b04c..d567310 100644 --- a/app/src/main/java/acr/browser/lightning/search/Suggestions.java +++ b/app/src/main/java/acr/browser/lightning/search/Suggestions.java @@ -72,7 +72,7 @@ public class Suggestions extends BaseAdapter implements Filterable { private final boolean mDarkTheme; private boolean mIsIncognito = true; @NonNull private final Context mContext; - PreferenceManager.Suggestion mSuggestionChoice; + private PreferenceManager.Suggestion mSuggestionChoice; public Suggestions(@NonNull Context context, boolean dark, boolean incognito) { super(); diff --git a/app/src/main/java/acr/browser/lightning/utils/KeyboardHelper.java b/app/src/main/java/acr/browser/lightning/utils/KeyboardHelper.java index b7bbe80..d6ed3ec 100644 --- a/app/src/main/java/acr/browser/lightning/utils/KeyboardHelper.java +++ b/app/src/main/java/acr/browser/lightning/utils/KeyboardHelper.java @@ -5,9 +5,9 @@ import android.support.annotation.NonNull; import android.view.View; import android.view.ViewTreeObserver; -public class KeyboardHelper { +class KeyboardHelper { - public interface KeyboardListener { + interface KeyboardListener { /** * Called when the visibility of the keyboard changes. * Parameter tells whether the keyboard has been shown diff --git a/app/src/main/java/acr/browser/lightning/utils/ThemeUtils.java b/app/src/main/java/acr/browser/lightning/utils/ThemeUtils.java index 8d2c02b..593fc5f 100644 --- a/app/src/main/java/acr/browser/lightning/utils/ThemeUtils.java +++ b/app/src/main/java/acr/browser/lightning/utils/ThemeUtils.java @@ -78,7 +78,7 @@ public class ThemeUtils { // http://stackoverflow.com/a/38244327/1499541 @NonNull - public static Bitmap getBitmapFromVectorDrawable(@NonNull Context context, int drawableId) { + private static Bitmap getBitmapFromVectorDrawable(@NonNull Context context, int drawableId) { Drawable drawable = getVectorDrawable(context, drawableId); Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), diff --git a/app/src/main/java/acr/browser/lightning/view/LightningView.java b/app/src/main/java/acr/browser/lightning/view/LightningView.java index e81396e..0c143c4 100644 --- a/app/src/main/java/acr/browser/lightning/view/LightningView.java +++ b/app/src/main/java/acr/browser/lightning/view/LightningView.java @@ -50,11 +50,13 @@ import acr.browser.lightning.database.BookmarkManager; import acr.browser.lightning.dialog.LightningDialogBuilder; import acr.browser.lightning.download.LightningDownloadListener; import acr.browser.lightning.preference.PreferenceManager; + import com.anthonycr.bonsai.Action; import com.anthonycr.bonsai.Observable; import com.anthonycr.bonsai.Schedulers; import com.anthonycr.bonsai.Subscriber; import com.anthonycr.bonsai.OnSubscribe; + import acr.browser.lightning.utils.ProxyUtils; import acr.browser.lightning.utils.UrlUtils; import acr.browser.lightning.utils.Utils; @@ -79,16 +81,16 @@ public class LightningView { private static String sDefaultUserAgent; private static float sMaxFling; private static final float[] sNegativeColorArray = { - -1.0f, 0, 0, 0, 255, // red - 0, -1.0f, 0, 0, 255, // green - 0, 0, -1.0f, 0, 255, // blue - 0, 0, 0, 1.0f, 0 // alpha + -1.0f, 0, 0, 0, 255, // red + 0, -1.0f, 0, 0, 255, // green + 0, 0, -1.0f, 0, 255, // blue + 0, 0, 0, 1.0f, 0 // alpha }; private static final float[] sIncreaseContrastColorArray = { - 2.0f, 0, 0, 0, -160.f, // red - 0, 2.0f, 0, 0, -160.f, // green - 0, 0, 2.0f, 0, -160.f, // blue - 0, 0, 0, 1.0f, 0 // alpha + 2.0f, 0, 0, 0, -160.f, // red + 0, 2.0f, 0, 0, -160.f, // green + 0, 0, 2.0f, 0, -160.f, // blue + 0, 0, 0, 1.0f, 0 // alpha }; @NonNull private final LightningViewTitle mTitle; @@ -351,7 +353,7 @@ public class LightningView { } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, - !mPreferences.getBlockThirdPartyCookiesEnabled()); + !mPreferences.getBlockThirdPartyCookiesEnabled()); } } @@ -404,46 +406,49 @@ public class LightningView { } getPathObservable("appcache") - .subscribeOn(Schedulers.io()) - .observeOn(Schedulers.main()) - .subscribe(new OnSubscribe() { - @Override - public void onNext(File item) { - settings.setAppCachePath(item.getPath()); - } + .subscribeOn(Schedulers.io()) + .observeOn(Schedulers.main()) + .subscribe(new OnSubscribe() { + @Override + public void onNext(File item) { + settings.setAppCachePath(item.getPath()); + } - @Override - public void onComplete() {} - }); + @Override + public void onComplete() {} + }); - getPathObservable("geolocation") + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + getPathObservable("geolocation") .subscribeOn(Schedulers.io()) .observeOn(Schedulers.main()) .subscribe(new OnSubscribe() { @Override public void onNext(File item) { + //noinspection deprecation settings.setGeolocationDatabasePath(item.getPath()); } @Override public void onComplete() {} }); + } getPathObservable("databases") - .subscribeOn(Schedulers.io()) - .observeOn(Schedulers.main()) - .subscribe(new OnSubscribe() { - @Override - public void onNext(File item) { - if (API < Build.VERSION_CODES.KITKAT) { - //noinspection deprecation - settings.setDatabasePath(item.getPath()); - } + .subscribeOn(Schedulers.io()) + .observeOn(Schedulers.main()) + .subscribe(new OnSubscribe() { + @Override + public void onNext(File item) { + if (API < Build.VERSION_CODES.KITKAT) { + //noinspection deprecation + settings.setDatabasePath(item.getPath()); } + } - @Override - public void onComplete() {} - }); + @Override + public void onComplete() {} + }); } @@ -698,7 +703,7 @@ public class LightningView { break; case 1: ColorMatrixColorFilter filterInvert = new ColorMatrixColorFilter( - sNegativeColorArray); + sNegativeColorArray); mPaint.setColorFilter(filterInvert); setHardwareRendering(); @@ -727,7 +732,7 @@ public class LightningView { case 4: ColorMatrixColorFilter IncreaseHighContrast = new ColorMatrixColorFilter( - sIncreaseContrastColorArray); + sIncreaseContrastColorArray); mPaint.setColorFilter(IncreaseHighContrast); setHardwareRendering(); break; diff --git a/app/src/main/java/acr/browser/lightning/view/LightningWebClient.java b/app/src/main/java/acr/browser/lightning/view/LightningWebClient.java index e59d119..57f45e9 100644 --- a/app/src/main/java/acr/browser/lightning/view/LightningWebClient.java +++ b/app/src/main/java/acr/browser/lightning/view/LightningWebClient.java @@ -278,8 +278,19 @@ public class LightningWebClient extends WebViewClient { BrowserDialog.setDialogSize(mActivity, alert); } + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + @Override + public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { + return shouldOverrideLoading(view, request.getUrl().toString()) || super.shouldOverrideUrlLoading(view, request); + } + + @SuppressWarnings("deprecation") @Override public boolean shouldOverrideUrlLoading(@NonNull WebView view, @NonNull String url) { + return shouldOverrideLoading(view, url) || super.shouldOverrideUrlLoading(view, url); + } + + private boolean shouldOverrideLoading(WebView view, String url) { // Check if configured proxy is available if (!mProxyUtils.isProxyReady()) { // User has been notified @@ -293,11 +304,11 @@ public class LightningWebClient extends WebViewClient { if (headers.isEmpty()) { if (mLightningView.isIncognito()) { // If we are in incognito, immediately load, we don't want the url to leave the app - return super.shouldOverrideUrlLoading(view, url); + return false; } if (url.startsWith(Constants.ABOUT)) { // If this is an about page, immediately load, we don't need to leave the app - return super.shouldOverrideUrlLoading(view, url); + return false; } if (isMailOrIntent(url, view) || mIntentUtils.startActivityForUrl(view, url)) { @@ -326,7 +337,7 @@ public class LightningWebClient extends WebViewClient { } } // If none of those instances was true, revert back to the old way of loading - return super.shouldOverrideUrlLoading(view, url); + return false; } private boolean isMailOrIntent(@NonNull String url, @NonNull WebView view) {