Fixing deprecated API usage and lint warnings
This commit is contained in:
parent
2badaa4ac8
commit
8ae8f58cc6
@ -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()));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -34,25 +34,25 @@ public final class BookmarkPage extends AsyncTask<Void, Void, Void> {
|
||||
public static final String FILENAME = "bookmarks.html";
|
||||
|
||||
private static final String HEADING_1 = "<!DOCTYPE html><html xmlns=http://www.w3.org/1999/xhtml>\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>";
|
||||
"<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 = "</title>\n" +
|
||||
"</head>\n" +
|
||||
"<style>body{background:#f5f5f5;max-width:100%;min-height:100%}#content{width:100%;max-width:800px;margin:0 auto;text-align:center}.box{vertical-align:middle;text-align:center;position:relative;display:inline-block;height:45px;width:150px;margin:10px;background-color:#fff;box-shadow:0 3px 6px rgba(0,0,0,0.25);font-family:Arial;color:#444;font-size:12px;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}.box-content{height:25px;width:100%;vertical-align:middle;text-align:center;display:table-cell}p.ellipses{" +
|
||||
"width:130px;font-size: small;font-family: Arial, Helvetica, 'sans-serif';white-space:nowrap;overflow:hidden;text-align:left;vertical-align:middle;margin:auto;text-overflow:ellipsis;-o-text-overflow:ellipsis;-ms-text-overflow:ellipsis}.box a{width:100%;height:100%;position:absolute;left:0;top:0}img{vertical-align:middle;margin-right:10px;width:20px;height:20px;}.margin{margin:10px}</style>\n" +
|
||||
"<body><div id=content>";
|
||||
"</head>\n" +
|
||||
"<style>body{background:#f5f5f5;max-width:100%;min-height:100%}#content{width:100%;max-width:800px;margin:0 auto;text-align:center}.box{vertical-align:middle;text-align:center;position:relative;display:inline-block;height:45px;width:150px;margin:10px;background-color:#fff;box-shadow:0 3px 6px rgba(0,0,0,0.25);font-family:Arial;color:#444;font-size:12px;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}.box-content{height:25px;width:100%;vertical-align:middle;text-align:center;display:table-cell}p.ellipses{" +
|
||||
"width:130px;font-size: small;font-family: Arial, Helvetica, 'sans-serif';white-space:nowrap;overflow:hidden;text-align:left;vertical-align:middle;margin:auto;text-overflow:ellipsis;-o-text-overflow:ellipsis;-ms-text-overflow:ellipsis}.box a{width:100%;height:100%;position:absolute;left:0;top:0}img{vertical-align:middle;margin-right:10px;width:20px;height:20px;}.margin{margin:10px}</style>\n" +
|
||||
"<body><div id=content>";
|
||||
|
||||
private static final String PART1 = "<div class=box><a href='";
|
||||
|
||||
private static final String PART2 = "'></a>\n" +
|
||||
"<div class=margin>\n" +
|
||||
"<div class=box-content>\n" +
|
||||
"<p class=ellipses>\n" +
|
||||
"<img src='";
|
||||
"<div class=margin>\n" +
|
||||
"<div class=box-content>\n" +
|
||||
"<p class=ellipses>\n" +
|
||||
"<img src='";
|
||||
|
||||
private static final String PART3 = "https://www.google.com/s2/favicons?domain=";
|
||||
|
||||
@ -62,6 +62,8 @@ public final class BookmarkPage extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private static final String END = "</div></body></html>";
|
||||
|
||||
private static final String FOLDER_ICON = "folder.png";
|
||||
|
||||
private File mFilesDir;
|
||||
private File mCacheDir;
|
||||
|
||||
@ -101,7 +103,7 @@ public final class BookmarkPage extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
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<Void, Void, Void> {
|
||||
}
|
||||
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);
|
||||
|
@ -42,7 +42,7 @@ public class BookmarkLocalSync {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public List<HistoryItem> getBookmarksFromContentUri(String contentUri) {
|
||||
private List<HistoryItem> getBookmarksFromContentUri(String contentUri) {
|
||||
List<HistoryItem> 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);
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -39,23 +39,26 @@ import java.util.List;
|
||||
public class HorizontalItemAnimator extends SimpleItemAnimator {
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private ArrayList<ViewHolder> mPendingRemovals = new ArrayList<>();
|
||||
private ArrayList<ViewHolder> mPendingAdditions = new ArrayList<>();
|
||||
private ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
|
||||
private ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mPendingRemovals = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mPendingAdditions = new ArrayList<>();
|
||||
private final ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
|
||||
private final ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
|
||||
|
||||
private ArrayList<ArrayList<ViewHolder>> mAdditionsList = new ArrayList<>();
|
||||
private ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
|
||||
private ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<ViewHolder>> mAdditionsList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
|
||||
|
||||
private ArrayList<ViewHolder> mAddAnimations = new ArrayList<>();
|
||||
private ArrayList<ViewHolder> mMoveAnimations = new ArrayList<>();
|
||||
private ArrayList<ViewHolder> mRemoveAnimations = new ArrayList<>();
|
||||
private ArrayList<ViewHolder> mChangeAnimations = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mAddAnimations = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mMoveAnimations = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mRemoveAnimations = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> 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<ViewHolder> viewHolders) {
|
||||
private static void cancelAll(List<ViewHolder> viewHolders) {
|
||||
for (int i = viewHolders.size() - 1; i >= 0; i--) {
|
||||
ViewCompat.animate(viewHolders.get(i).itemView).cancel();
|
||||
}
|
||||
|
@ -39,23 +39,26 @@ import java.util.List;
|
||||
public class VerticalItemAnimator extends SimpleItemAnimator {
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private ArrayList<ViewHolder> mPendingRemovals = new ArrayList<>();
|
||||
private ArrayList<ViewHolder> mPendingAdditions = new ArrayList<>();
|
||||
private ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
|
||||
private ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mPendingRemovals = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mPendingAdditions = new ArrayList<>();
|
||||
private final ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
|
||||
private final ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
|
||||
|
||||
private ArrayList<ArrayList<ViewHolder>> mAdditionsList = new ArrayList<>();
|
||||
private ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
|
||||
private ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<ViewHolder>> mAdditionsList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
|
||||
|
||||
private ArrayList<ViewHolder> mAddAnimations = new ArrayList<>();
|
||||
private ArrayList<ViewHolder> mMoveAnimations = new ArrayList<>();
|
||||
private ArrayList<ViewHolder> mRemoveAnimations = new ArrayList<>();
|
||||
private ArrayList<ViewHolder> mChangeAnimations = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mAddAnimations = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mMoveAnimations = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> mRemoveAnimations = new ArrayList<>();
|
||||
private final ArrayList<ViewHolder> 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<ViewHolder> viewHolders) {
|
||||
private static void cancelAll(List<ViewHolder> viewHolders) {
|
||||
for (int i = viewHolders.size() - 1; i >= 0; i--) {
|
||||
ViewCompat.animate(viewHolders.get(i).itemView).cancel();
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2010 Peter Karich <>
|
||||
* <p/>
|
||||
* 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
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* 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<K, V> implements Map.Entry<K, V>, 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;
|
||||
}
|
||||
}
|
@ -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 {
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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(),
|
||||
|
@ -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<File>() {
|
||||
@Override
|
||||
public void onNext(File item) {
|
||||
settings.setAppCachePath(item.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {}
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
getPathObservable("geolocation")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.main())
|
||||
.subscribe(new OnSubscribe<File>() {
|
||||
@Override
|
||||
public void onNext(File item) {
|
||||
settings.setAppCachePath(item.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {}
|
||||
});
|
||||
|
||||
getPathObservable("geolocation")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.main())
|
||||
.subscribe(new OnSubscribe<File>() {
|
||||
@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<File>() {
|
||||
@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<File>() {
|
||||
@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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user