Fixed many code analysis warnings
This commit is contained in:
parent
d5e1e06d84
commit
f3b0e46801
@ -21,10 +21,10 @@ import info.guardianproject.netcipher.web.WebkitProxy;
|
|||||||
*/
|
*/
|
||||||
public class ProxyUtils {
|
public class ProxyUtils {
|
||||||
// Helper
|
// Helper
|
||||||
private static I2PAndroidHelper mI2PHelper;
|
private I2PAndroidHelper mI2PHelper;
|
||||||
private static boolean mI2PHelperBound;
|
private static boolean mI2PHelperBound;
|
||||||
private static boolean mI2PProxyInitialized;
|
private static boolean mI2PProxyInitialized;
|
||||||
private static PreferenceManager mPreferences;
|
private PreferenceManager mPreferences;
|
||||||
private static ProxyUtils mInstance;
|
private static ProxyUtils mInstance;
|
||||||
|
|
||||||
private ProxyUtils(Context context) {
|
private ProxyUtils(Context context) {
|
||||||
|
@ -980,8 +980,10 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
mIsNewIntent = false;
|
if (mCurrentView != mWebViewList.get(position)) {
|
||||||
showTab(mWebViewList.get(position));
|
mIsNewIntent = false;
|
||||||
|
showTab(mWebViewList.get(position));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2113,7 +2115,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
|
|
||||||
private void buildBookmarkPage(final String folder, final List<HistoryItem> list) {
|
private void buildBookmarkPage(final String folder, final List<HistoryItem> list) {
|
||||||
File bookmarkWebPage;
|
File bookmarkWebPage;
|
||||||
if (folder == null || folder.length() == 0) {
|
if (folder == null || folder.isEmpty()) {
|
||||||
bookmarkWebPage = new File(mActivity.getFilesDir(), BookmarkPage.FILENAME);
|
bookmarkWebPage = new File(mActivity.getFilesDir(), BookmarkPage.FILENAME);
|
||||||
} else {
|
} else {
|
||||||
bookmarkWebPage = new File(mActivity.getFilesDir(), folder + '-' + BookmarkPage.FILENAME);
|
bookmarkWebPage = new File(mActivity.getFilesDir(), folder + '-' + BookmarkPage.FILENAME);
|
||||||
|
@ -89,7 +89,7 @@ public class ReadingActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getTextSize(int size) {
|
private static float getTextSize(int size) {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 0:
|
case 0:
|
||||||
return XSMALL;
|
return XSMALL;
|
||||||
|
@ -36,8 +36,7 @@ public class HistoryPage {
|
|||||||
private static final String END = "</div></body></html>";
|
private static final String END = "</div></body></html>";
|
||||||
|
|
||||||
public static String getHistoryPage(Context context) {
|
public static String getHistoryPage(Context context) {
|
||||||
StringBuilder historyBuilder = new StringBuilder();
|
StringBuilder historyBuilder = new StringBuilder(HistoryPage.HEADING);
|
||||||
historyBuilder.append(HistoryPage.HEADING);
|
|
||||||
List<HistoryItem> historyList = getWebHistory(context);
|
List<HistoryItem> historyList = getWebHistory(context);
|
||||||
Iterator<HistoryItem> it = historyList.iterator();
|
Iterator<HistoryItem> it = historyList.iterator();
|
||||||
HistoryItem helper;
|
HistoryItem helper;
|
||||||
|
@ -38,9 +38,9 @@ public class BookmarkManager {
|
|||||||
private static final String FOLDER = "folder";
|
private static final String FOLDER = "folder";
|
||||||
private static final String ORDER = "order";
|
private static final String ORDER = "order";
|
||||||
private static final String FILE_BOOKMARKS = "bookmarks.dat";
|
private static final String FILE_BOOKMARKS = "bookmarks.dat";
|
||||||
private static Set<String> mBookmarkSearchSet = new HashSet<>();
|
private Set<String> mBookmarkSearchSet = new HashSet<>();
|
||||||
private static final List<HistoryItem> mBookmarkList = new ArrayList<>();
|
private final List<HistoryItem> mBookmarkList = new ArrayList<>();
|
||||||
private static String mCurrentFolder = "";
|
private String mCurrentFolder = "";
|
||||||
private static BookmarkManager mInstance;
|
private static BookmarkManager mInstance;
|
||||||
|
|
||||||
public static BookmarkManager getInstance(Context context) {
|
public static BookmarkManager getInstance(Context context) {
|
||||||
@ -145,7 +145,7 @@ public class BookmarkManager {
|
|||||||
* @param newName the new name of the folder
|
* @param newName the new name of the folder
|
||||||
*/
|
*/
|
||||||
public synchronized void renameFolder(@NonNull String oldName, @NonNull String newName) {
|
public synchronized void renameFolder(@NonNull String oldName, @NonNull String newName) {
|
||||||
if (newName.length() == 0) {
|
if (newName.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int n = 0; n < mBookmarkList.size(); n++) {
|
for (int n = 0; n < mBookmarkList.size(); n++) {
|
||||||
@ -194,11 +194,11 @@ public class BookmarkManager {
|
|||||||
mBookmarkSearchSet.remove(oldItem.getUrl());
|
mBookmarkSearchSet.remove(oldItem.getUrl());
|
||||||
mBookmarkSearchSet.add(newItem.getUrl());
|
mBookmarkSearchSet.add(newItem.getUrl());
|
||||||
}
|
}
|
||||||
if (newItem.getUrl().length() == 0) {
|
if (newItem.getUrl().isEmpty()) {
|
||||||
deleteBookmark(oldItem);
|
deleteBookmark(oldItem);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (newItem.getTitle().length() == 0) {
|
if (newItem.getTitle().isEmpty()) {
|
||||||
newItem.setTitle(mContext.getString(R.string.untitled));
|
newItem.setTitle(mContext.getString(R.string.untitled));
|
||||||
}
|
}
|
||||||
overwriteBookmarks(mBookmarkList);
|
overwriteBookmarks(mBookmarkList);
|
||||||
@ -289,7 +289,7 @@ public class BookmarkManager {
|
|||||||
*/
|
*/
|
||||||
public synchronized List<HistoryItem> getBookmarksFromFolder(String folder, boolean sort) {
|
public synchronized List<HistoryItem> getBookmarksFromFolder(String folder, boolean sort) {
|
||||||
List<HistoryItem> bookmarks = new ArrayList<>();
|
List<HistoryItem> bookmarks = new ArrayList<>();
|
||||||
if (folder == null || folder.length() == 0) {
|
if (folder == null || folder.isEmpty()) {
|
||||||
bookmarks.addAll(getFolders(sort));
|
bookmarks.addAll(getFolders(sort));
|
||||||
folder = "";
|
folder = "";
|
||||||
}
|
}
|
||||||
@ -310,7 +310,7 @@ public class BookmarkManager {
|
|||||||
* @return returns true if you are in the root folder
|
* @return returns true if you are in the root folder
|
||||||
*/
|
*/
|
||||||
public boolean isRootFolder() {
|
public boolean isRootFolder() {
|
||||||
return mCurrentFolder.length() == 0;
|
return mCurrentFolder.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -318,7 +318,7 @@ public class BookmarkManager {
|
|||||||
*
|
*
|
||||||
* @return a sorted map of all bookmarks, useful for seeing if a bookmark exists
|
* @return a sorted map of all bookmarks, useful for seeing if a bookmark exists
|
||||||
*/
|
*/
|
||||||
private static Set<String> getBookmarkUrls(List<HistoryItem> list) {
|
private Set<String> getBookmarkUrls(List<HistoryItem> list) {
|
||||||
Set<String> set = new HashSet<>();
|
Set<String> set = new HashSet<>();
|
||||||
for (int n = 0; n < list.size(); n++) {
|
for (int n = 0; n < list.size(); n++) {
|
||||||
if (!mBookmarkList.get(n).isFolder())
|
if (!mBookmarkList.get(n).isFolder())
|
||||||
|
@ -50,9 +50,9 @@ public class HistoryDatabase extends SQLiteOpenHelper {
|
|||||||
// Creating Tables
|
// Creating Tables
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(SQLiteDatabase db) {
|
public void onCreate(SQLiteDatabase db) {
|
||||||
String CREATE_HISTORY_TABLE = "CREATE TABLE " + TABLE_HISTORY + "(" + KEY_ID
|
String CREATE_HISTORY_TABLE = "CREATE TABLE " + TABLE_HISTORY + '(' + KEY_ID
|
||||||
+ " INTEGER PRIMARY KEY," + KEY_URL + " TEXT," + KEY_TITLE + " TEXT,"
|
+ " INTEGER PRIMARY KEY," + KEY_URL + " TEXT," + KEY_TITLE + " TEXT,"
|
||||||
+ KEY_TIME_VISITED + " INTEGER" + ")";
|
+ KEY_TIME_VISITED + " INTEGER" + ')';
|
||||||
db.execSQL(CREATE_HISTORY_TABLE);
|
db.execSQL(CREATE_HISTORY_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class FetchUrlMimeType extends Thread {
|
|||||||
try {
|
try {
|
||||||
URL url = new URL(mUri);
|
URL url = new URL(mUri);
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
connection = (HttpURLConnection) url.openConnection();
|
||||||
if (mCookies != null && mCookies.length() > 0) {
|
if (mCookies != null && !mCookies.isEmpty()) {
|
||||||
connection.addRequestProperty("Cookie", mCookies);
|
connection.addRequestProperty("Cookie", mCookies);
|
||||||
connection.setRequestProperty("User-Agent", mUserAgent);
|
connection.setRequestProperty("User-Agent", mUserAgent);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ public class GeneralSettingsFragment extends PreferenceFragment implements Prefe
|
|||||||
|
|
||||||
int choice = mPreferences.getProxyChoice();
|
int choice = mPreferences.getProxyChoice();
|
||||||
if (choice == Constants.PROXY_MANUAL) {
|
if (choice == Constants.PROXY_MANUAL) {
|
||||||
proxy.setSummary(mPreferences.getProxyHost() + ":" + mPreferences.getProxyPort());
|
proxy.setSummary(mPreferences.getProxyHost() + ':' + mPreferences.getProxyPort());
|
||||||
} else {
|
} else {
|
||||||
proxy.setSummary(mProxyChoices[choice]);
|
proxy.setSummary(mProxyChoices[choice]);
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ public class GeneralSettingsFragment extends PreferenceFragment implements Prefe
|
|||||||
}
|
}
|
||||||
mPreferences.setProxyHost(proxyHost);
|
mPreferences.setProxyHost(proxyHost);
|
||||||
mPreferences.setProxyPort(proxyPort);
|
mPreferences.setProxyPort(proxyPort);
|
||||||
proxy.setSummary(proxyHost + ":" + proxyPort);
|
proxy.setSummary(proxyHost + ':' + proxyPort);
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
@ -385,12 +385,12 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
|
|||||||
return cacheFile;
|
return cacheFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNetworkConnected(Context context) {
|
private static boolean isNetworkConnected(Context context) {
|
||||||
NetworkInfo networkInfo = getActiveNetworkInfo(context);
|
NetworkInfo networkInfo = getActiveNetworkInfo(context);
|
||||||
return networkInfo != null && networkInfo.isConnected();
|
return networkInfo != null && networkInfo.isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private NetworkInfo getActiveNetworkInfo(Context context) {
|
private static NetworkInfo getActiveNetworkInfo(Context context) {
|
||||||
ConnectivityManager connectivity = (ConnectivityManager) context
|
ConnectivityManager connectivity = (ConnectivityManager) context
|
||||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
if (connectivity == null) {
|
if (connectivity == null) {
|
||||||
|
@ -60,7 +60,7 @@ public class PreferenceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static PreferenceManager mInstance;
|
private static PreferenceManager mInstance;
|
||||||
private static SharedPreferences mPrefs;
|
private SharedPreferences mPrefs;
|
||||||
|
|
||||||
private static final String PREFERENCES = "settings";
|
private static final String PREFERENCES = "settings";
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class ArticleTextExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArticleTextExtractor addUnlikely(String unlikelyMatches) {
|
public ArticleTextExtractor addUnlikely(String unlikelyMatches) {
|
||||||
return setUnlikely(unlikelyStr + "|" + unlikelyMatches);
|
return setUnlikely(unlikelyStr + '|' + unlikelyMatches);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticleTextExtractor setPositive(String positiveStr) {
|
public ArticleTextExtractor setPositive(String positiveStr) {
|
||||||
@ -76,7 +76,7 @@ public class ArticleTextExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArticleTextExtractor addPositive(String pos) {
|
public ArticleTextExtractor addPositive(String pos) {
|
||||||
return setPositive(positiveStr + "|" + pos);
|
return setPositive(positiveStr + '|' + pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticleTextExtractor setNegative(String negativeStr) {
|
public ArticleTextExtractor setNegative(String negativeStr) {
|
||||||
@ -86,7 +86,7 @@ public class ArticleTextExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArticleTextExtractor addNegative(String neg) {
|
public ArticleTextExtractor addNegative(String neg) {
|
||||||
setNegative(negativeStr + "|" + neg);
|
setNegative(negativeStr + '|' + neg);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,7 +590,7 @@ public class ArticleTextExtractor {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (counter > 0)
|
if (counter > 0)
|
||||||
res.append("|");
|
res.append('|');
|
||||||
|
|
||||||
res.append(part);
|
res.append(part);
|
||||||
counter++;
|
counter++;
|
||||||
|
@ -71,7 +71,7 @@ public class Converter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// http1.1 says ISO-8859-1 is the default charset
|
// http1.1 says ISO-8859-1 is the default charset
|
||||||
if (charset.length() == 0)
|
if (charset.isEmpty())
|
||||||
charset = ISO;
|
charset = ISO;
|
||||||
|
|
||||||
return charset;
|
return charset;
|
||||||
@ -133,7 +133,7 @@ public class Converter {
|
|||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
Log.d(Constants.TAG,
|
Log.d(Constants.TAG,
|
||||||
"Using default encoding:" + UTF8 + " problem:" + e.getMessage()
|
"Using default encoding:" + UTF8 + " problem:" + e.getMessage()
|
||||||
+ " encoding:" + encoding + " " + url);
|
+ " encoding:" + encoding + ' ' + url);
|
||||||
encoding = UTF8;
|
encoding = UTF8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ public class Converter {
|
|||||||
return tmpEnc;
|
return tmpEnc;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Log.e(Constants.TAG, "Couldn't reset stream to re-read with new encoding "
|
Log.e(Constants.TAG, "Couldn't reset stream to re-read with new encoding "
|
||||||
+ tmpEnc + " " + ex.toString());
|
+ tmpEnc + ' ' + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class HtmlFetcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String referrer = "https://github.com/karussell/snacktory";
|
private String referrer = "https://github.com/karussell/snacktory";
|
||||||
private String userAgent = "Mozilla/5.0 (compatible; Snacktory; +" + referrer + ")";
|
private String userAgent = "Mozilla/5.0 (compatible; Snacktory; +" + referrer + ')';
|
||||||
private String cacheControl = "max-age=0";
|
private String cacheControl = "max-age=0";
|
||||||
private String language = "en-us";
|
private String language = "en-us";
|
||||||
private String accept = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
|
private String accept = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
|
||||||
@ -308,9 +308,9 @@ public class HtmlFetcher {
|
|||||||
hConn.setInstanceFollowRedirects(true);
|
hConn.setInstanceFollowRedirects(true);
|
||||||
String encoding = hConn.getContentEncoding();
|
String encoding = hConn.getContentEncoding();
|
||||||
InputStream is;
|
InputStream is;
|
||||||
if (encoding != null && encoding.equalsIgnoreCase("gzip")) {
|
if ("gzip".equalsIgnoreCase(encoding)) {
|
||||||
is = new GZIPInputStream(hConn.getInputStream());
|
is = new GZIPInputStream(hConn.getInputStream());
|
||||||
} else if (encoding != null && encoding.equalsIgnoreCase("deflate")) {
|
} else if ("deflate".equalsIgnoreCase(encoding)) {
|
||||||
is = new InflaterInputStream(hConn.getInputStream(), new Inflater(true));
|
is = new InflaterInputStream(hConn.getInputStream(), new Inflater(true));
|
||||||
} else {
|
} else {
|
||||||
is = hConn.getInputStream();
|
is = hConn.getInputStream();
|
||||||
|
@ -138,9 +138,9 @@ public class OutputFormatter {
|
|||||||
} else if (child instanceof Element) {
|
} else if (child instanceof Element) {
|
||||||
Element element = (Element) child;
|
Element element = (Element) child;
|
||||||
if (accum.length() > 0 && element.isBlock() && !lastCharIsWhitespace(accum))
|
if (accum.length() > 0 && element.isBlock() && !lastCharIsWhitespace(accum))
|
||||||
accum.append(" ");
|
accum.append(' ');
|
||||||
else if (element.tagName().equals("br"))
|
else if (element.tagName().equals("br"))
|
||||||
accum.append(" ");
|
accum.append(' ');
|
||||||
appendTextSkipHidden(element, accum);
|
appendTextSkipHidden(element, accum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,6 +166,6 @@ public class OutputFormatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public OutputFormatter appendUnlikelyPattern(String str) {
|
public OutputFormatter appendUnlikelyPattern(String str) {
|
||||||
return setUnlikelyPattern(unlikelyPattern.toString() + "|" + str);
|
return setUnlikelyPattern(unlikelyPattern.toString() + '|' + str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,12 +328,12 @@ public class SHelper {
|
|||||||
sb.append(' ');
|
sb.append(' ');
|
||||||
}
|
}
|
||||||
sb.append(root.tagName());
|
sb.append(root.tagName());
|
||||||
sb.append(":");
|
sb.append(':');
|
||||||
sb.append(root.ownText());
|
sb.append(root.ownText());
|
||||||
sb.append("\n");
|
sb.append('\n');
|
||||||
for (Element el : root.children()) {
|
for (Element el : root.children()) {
|
||||||
sb.append(printNode(el, indentation + 1));
|
sb.append(printNode(el, indentation + 1));
|
||||||
sb.append("\n");
|
sb.append('\n');
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
@ -392,8 +392,7 @@ public class SHelper {
|
|||||||
if (year < 0)
|
if (year < 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder(year);
|
||||||
str.append(year);
|
|
||||||
if (month < 1)
|
if (month < 1)
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class AdBlock {
|
|||||||
private static final String TAB = "\t";
|
private static final String TAB = "\t";
|
||||||
private static final String SPACE = " ";
|
private static final String SPACE = " ";
|
||||||
private static final String EMPTY = "";
|
private static final String EMPTY = "";
|
||||||
private static final Set<String> mBlockedDomainsList = new HashSet<>();
|
private final Set<String> mBlockedDomainsList = new HashSet<>();
|
||||||
private boolean mBlockAds;
|
private boolean mBlockAds;
|
||||||
private static final Locale mLocale = Locale.getDefault();
|
private static final Locale mLocale = Locale.getDefault();
|
||||||
private static AdBlock mInstance;
|
private static AdBlock mInstance;
|
||||||
|
@ -23,10 +23,10 @@ public class IntentUtils {
|
|||||||
|
|
||||||
private static final Pattern ACCEPTED_URI_SCHEMA = Pattern.compile("(?i)"
|
private static final Pattern ACCEPTED_URI_SCHEMA = Pattern.compile("(?i)"
|
||||||
+ // switch on case insensitive matching
|
+ // switch on case insensitive matching
|
||||||
"("
|
'('
|
||||||
+ // begin group for schema
|
+ // begin group for schema
|
||||||
"(?:http|https|file):\\/\\/" + "|(?:inline|data|about|javascript):" + "|(?:.*:.*@)"
|
"(?:http|https|file):\\/\\/" + "|(?:inline|data|about|javascript):" + "|(?:.*:.*@)"
|
||||||
+ ")" + "(.*)");
|
+ ')' + "(.*)");
|
||||||
|
|
||||||
public IntentUtils(BrowserController controller) {
|
public IntentUtils(BrowserController controller) {
|
||||||
mActivity = controller.getActivity();
|
mActivity = controller.getActivity();
|
||||||
|
@ -218,7 +218,7 @@ public final class Utils {
|
|||||||
public static File createImageFile() throws IOException {
|
public static File createImageFile() throws IOException {
|
||||||
// Create an image file name
|
// Create an image file name
|
||||||
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
||||||
String imageFileName = "JPEG_" + timeStamp + "_";
|
String imageFileName = "JPEG_" + timeStamp + '_';
|
||||||
File storageDir = Environment
|
File storageDir = Environment
|
||||||
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
||||||
return File.createTempFile(imageFileName, /* prefix */
|
return File.createTempFile(imageFileName, /* prefix */
|
||||||
|
@ -69,14 +69,14 @@ public class LightningView {
|
|||||||
|
|
||||||
private final Title mTitle;
|
private final Title mTitle;
|
||||||
private WebView mWebView;
|
private WebView mWebView;
|
||||||
private boolean mIsIncognitoTab;
|
private final boolean mIsIncognitoTab;
|
||||||
private BrowserController mBrowserController;
|
private BrowserController mBrowserController;
|
||||||
private GestureDetector mGestureDetector;
|
private GestureDetector mGestureDetector;
|
||||||
private final Activity mActivity;
|
private final Activity mActivity;
|
||||||
private static String mHomepage;
|
private static String mHomepage;
|
||||||
private static String mDefaultUserAgent;
|
private static String mDefaultUserAgent;
|
||||||
// TODO fix so that mWebpageBitmap can be static - static changes the icon when switching from light to dark and then back to light
|
// TODO fix so that mWebpageBitmap can be static - static changes the icon when switching from light to dark and then back to light
|
||||||
private Bitmap mWebpageBitmap;
|
private final Bitmap mWebpageBitmap;
|
||||||
private static PreferenceManager mPreferences;
|
private static PreferenceManager mPreferences;
|
||||||
private final AdBlock mAdBlock;
|
private final AdBlock mAdBlock;
|
||||||
private IntentUtils mIntentUtils;
|
private IntentUtils mIntentUtils;
|
||||||
@ -163,8 +163,7 @@ public class LightningView {
|
|||||||
* @return the URL to load
|
* @return the URL to load
|
||||||
*/
|
*/
|
||||||
private String getHomepage() {
|
private String getHomepage() {
|
||||||
StringBuilder homepageBuilder = new StringBuilder();
|
StringBuilder homepageBuilder = new StringBuilder(StartPage.HEAD);
|
||||||
homepageBuilder.append(StartPage.HEAD);
|
|
||||||
String icon;
|
String icon;
|
||||||
String searchUrl;
|
String searchUrl;
|
||||||
switch (mPreferences.getSearchChoice()) {
|
switch (mPreferences.getSearchChoice()) {
|
||||||
@ -440,7 +439,7 @@ public class LightningView {
|
|||||||
WebSettings settings = mWebView.getSettings();
|
WebSettings settings = mWebView.getSettings();
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case 1:
|
case 1:
|
||||||
if (API > 16) {
|
if (API >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
settings.setUserAgentString(WebSettings.getDefaultUserAgent(context));
|
settings.setUserAgentString(WebSettings.getDefaultUserAgent(context));
|
||||||
} else {
|
} else {
|
||||||
settings.setUserAgentString(mDefaultUserAgent);
|
settings.setUserAgentString(mDefaultUserAgent);
|
||||||
@ -612,7 +611,7 @@ public class LightningView {
|
|||||||
|
|
||||||
public synchronized void find(String text) {
|
public synchronized void find(String text) {
|
||||||
if (mWebView != null) {
|
if (mWebView != null) {
|
||||||
if (API > 16) {
|
if (API >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
mWebView.findAllAsync(text);
|
mWebView.findAllAsync(text);
|
||||||
} else {
|
} else {
|
||||||
mWebView.findAll(text);
|
mWebView.findAll(text);
|
||||||
|
@ -31,6 +31,6 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:text="Loading..." android:textSize="14sp"
|
android:text="@string/loading" android:textSize="14sp"
|
||||||
android:textColor="?android:attr/textColorPrimary" />
|
android:textColor="?android:attr/textColorPrimary" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user