First step toward Android M support, compile with sdk 23, fix errors caused by upgrade

removed copy button from search bar and replaced with go action. Had to
remove browser content provider usage as it is not longer included in
the sdk and has been completely removed.
This commit is contained in:
Anthony Restaino 2015-08-22 09:08:39 -04:00
parent 68f5c4fb45
commit 9f2f9d74eb
16 changed files with 155 additions and 317 deletions

View File

@ -3,7 +3,7 @@ sudo: false
android:
components:
- build-tools-22.0.1
- android-22
- android-23
- extra-android-support
- extra-android-m2repository
licenses:

View File

@ -36,7 +36,7 @@
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/lightningPlus/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/lightningPlus/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/lightningPlus/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/lightningPlus/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/lightningPlus/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/assets" type="java-resource" />
@ -49,7 +49,7 @@
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/lightningPlus/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/lightningPlus/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/lightningPlus/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/lightningPlus/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/lightningPlus/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/assets" type="java-resource" />
@ -92,10 +92,10 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/23.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/net.i2p.android/client/0.7/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/org.lucasr.twowayview/twowayview/0.1.4/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
@ -113,16 +113,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform (1)" jdkType="Android SDK" />
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="palette-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="client-0.7" level="project" />
<orderEntry type="library" exported="" name="design-22.2.1" level="project" />
<orderEntry type="library" exported="" name="design-23.0.0" level="project" />
<orderEntry type="library" exported="" name="twowayview-0.1.4" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
<orderEntry type="library" exported="" name="palette-v7-23.0.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.0" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.8.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="module" module-name="libnetcipher" exported="" />
</component>
</module>

View File

@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
@ -43,9 +43,9 @@ android {
}
dependencies {
compile 'com.android.support:palette-v7:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:palette-v7:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'org.jsoup:jsoup:1.8.1'
compile 'org.lucasr.twowayview:twowayview:0.1.4'
// Only Lightning Plus needs the proxy libraries

View File

@ -15,7 +15,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@ -35,7 +34,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Browser;
import android.provider.MediaStore;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
@ -48,9 +46,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
@ -101,12 +97,10 @@ import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -172,7 +166,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
// Primatives
private boolean mFullScreen, mColorMode, mDarkTheme,
mSystemBrowser = false,
mIsNewIntent = false,
mIsFullScreen = false,
mIsImmersive = false,
@ -188,7 +181,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
// Image
private Bitmap mDefaultVideoPoster, mWebpageBitmap, mFolderBitmap;
private final ColorDrawable mBackground = new ColorDrawable();
private Drawable mDeleteIcon, mRefreshIcon, mCopyIcon, mIcon;
private Drawable mDeleteIcon, mRefreshIcon, mSearchIcon, mIcon;
private DrawerArrowDrawable mArrowDrawable;
// Proxy
@ -335,21 +328,20 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
mBackgroundColor = getResources().getColor(R.color.primary_color);
mDeleteIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_delete);
mRefreshIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_refresh);
mCopyIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_copy);
mSearchIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_forward);
int iconBounds = Utils.dpToPx(30);
mDeleteIcon.setBounds(0, 0, iconBounds, iconBounds);
mRefreshIcon.setBounds(0, 0, iconBounds, iconBounds);
mCopyIcon.setBounds(0, 0, iconBounds, iconBounds);
mSearchIcon.setBounds(0, 0, iconBounds, iconBounds);
mIcon = mRefreshIcon;
SearchClass search = new SearchClass();
SearchListenerClass search = new SearchListenerClass();
mSearch.setCompoundDrawables(null, null, mRefreshIcon, null);
mSearch.setOnKeyListener(search.new KeyListener());
mSearch.setOnFocusChangeListener(search.new FocusChangeListener());
mSearch.setOnEditorActionListener(search.new EditorActionListener());
mSearch.setOnTouchListener(search.new TouchListener());
mSearch.setOnKeyListener(search);
mSearch.setOnFocusChangeListener(search);
mSearch.setOnEditorActionListener(search);
mSearch.setOnTouchListener(search);
mSystemBrowser = getSystemBrowser();
new Thread(new Runnable() {
@Override
@ -398,40 +390,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
mProxyUtils.checkForProxy(this);
}
private class SearchClass {
private class SearchListenerClass implements OnKeyListener, OnEditorActionListener, OnFocusChangeListener, OnTouchListener {
public class KeyListener implements OnKeyListener {
@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
switch (arg1) {
case KeyEvent.KEYCODE_ENTER:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
searchTheWeb(mSearch.getText().toString());
if (mCurrentView != null) {
mCurrentView.requestFocus();
}
return true;
default:
break;
}
return false;
}
}
public class EditorActionListener implements OnEditorActionListener {
@Override
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) {
// hide the keyboard and search the web when the enter key
// button is pressed
if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_NEXT
|| actionId == EditorInfo.IME_ACTION_SEND
|| actionId == EditorInfo.IME_ACTION_SEARCH
|| (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) {
switch (arg1) {
case KeyEvent.KEYCODE_ENTER:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
searchTheWeb(mSearch.getText().toString());
@ -439,116 +404,132 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
mCurrentView.requestFocus();
}
return true;
default:
break;
}
return false;
}
@Override
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) {
// hide the keyboard and search the web when the enter key
// button is pressed
if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_NEXT
|| actionId == EditorInfo.IME_ACTION_SEND
|| actionId == EditorInfo.IME_ACTION_SEARCH
|| (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
searchTheWeb(mSearch.getText().toString());
if (mCurrentView != null) {
mCurrentView.requestFocus();
}
return false;
return true;
}
return false;
}
@Override
public void onFocusChange(View v, final boolean hasFocus) {
if (!hasFocus && mCurrentView != null) {
if (mCurrentView.getProgress() < 100) {
setIsLoading();
} else {
setIsFinishedLoading();
}
updateUrl(mCurrentView.getUrl(), true);
} else if (hasFocus) {
String url = mCurrentView.getUrl();
if (url.startsWith(Constants.FILE)) {
mSearch.setText("");
} else {
mSearch.setText(url);
}
((AutoCompleteTextView) v).selectAll(); // Hack to make sure
// the text gets
// selected
mIcon = mSearchIcon;
mSearch.setCompoundDrawables(null, null, mSearchIcon, null);
}
final Animation anim = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (!hasFocus) {
mArrowDrawable.setProgress(1.0f - interpolatedTime);
} else {
mArrowDrawable.setProgress(interpolatedTime);
}
}
@Override
public boolean willChangeBounds() {
return true;
}
};
anim.setDuration(300);
anim.setInterpolator(new DecelerateInterpolator());
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (!hasFocus) {
mArrowDrawable.setProgress(0.0f);
} else {
mArrowDrawable.setProgress(1.0f);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (mArrowDrawable != null) {
mArrowImage.startAnimation(anim);
}
}
}, 100);
if (!hasFocus) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
}
}
public class FocusChangeListener implements OnFocusChangeListener {
@Override
public void onFocusChange(View v, final boolean hasFocus) {
if (!hasFocus && mCurrentView != null) {
if (mCurrentView.getProgress() < 100) {
setIsLoading();
} else {
setIsFinishedLoading();
}
updateUrl(mCurrentView.getUrl(), true);
} else if (hasFocus) {
String url = mCurrentView.getUrl();
if (url.startsWith(Constants.FILE)) {
mSearch.setText("");
} else {
mSearch.setText(url);
}
((AutoCompleteTextView) v).selectAll(); // Hack to make sure
// the text gets
// selected
mIcon = mCopyIcon;
mSearch.setCompoundDrawables(null, null, mCopyIcon, null);
}
final Animation anim = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (!hasFocus) {
mArrowDrawable.setProgress(1.0f - interpolatedTime);
} else {
mArrowDrawable.setProgress(interpolatedTime);
}
}
@Override
public boolean willChangeBounds() {
return true;
}
};
anim.setDuration(300);
anim.setInterpolator(new DecelerateInterpolator());
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (!hasFocus) {
mArrowDrawable.setProgress(0.0f);
} else {
mArrowDrawable.setProgress(1.0f);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (mArrowDrawable != null) {
mArrowImage.startAnimation(anim);
}
}
}, 100);
if (!hasFocus) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
}
}
}
public class TouchListener implements OnTouchListener {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mSearch.getCompoundDrawables()[2] != null) {
boolean tappedX = event.getX() > (mSearch.getWidth()
- mSearch.getPaddingRight() - mIcon.getIntrinsicWidth());
if (tappedX) {
if (event.getAction() == MotionEvent.ACTION_UP) {
if (mSearch.hasFocus()) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", mSearch.getText()
.toString());
clipboard.setPrimaryClip(clip);
Utils.showSnackbar(mActivity, R.string.message_text_copied);
} else {
refreshOrStop();
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mSearch.getCompoundDrawables()[2] != null) {
boolean tappedX = event.getX() > (mSearch.getWidth()
- mSearch.getPaddingRight() - mIcon.getIntrinsicWidth());
if (tappedX) {
if (event.getAction() == MotionEvent.ACTION_UP) {
if (mSearch.hasFocus()) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
searchTheWeb(mSearch.getText().toString());
if (mCurrentView != null) {
mCurrentView.requestFocus();
}
} else {
refreshOrStop();
}
return true;
}
return true;
}
return false;
}
return false;
}
}
@ -1362,7 +1343,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
}
if (mPreferences.getClearHistoryExitEnabled() && !isIncognito()) {
WebUtils.clearHistory(this, mSystemBrowser);
WebUtils.clearHistory(this);
Log.d(Constants.TAG, "History Cleared");
}
@ -1916,13 +1897,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
Runnable update = new Runnable() {
@Override
public void run() {
if (isSystemBrowserAvailable() && mPreferences.getSyncHistoryEnabled()) {
try {
Browser.updateVisitedHistory(getContentResolver(), url, true);
} catch (Exception ignored) {
// ignored
}
}
try {
if (mHistoryDatabase == null) {
mHistoryDatabase = HistoryDatabase.getInstance(mActivity.getApplicationContext());
@ -1942,35 +1916,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
}
}
private boolean isSystemBrowserAvailable() {
return mSystemBrowser;
}
private boolean getSystemBrowser() {
Cursor c = null;
String[] columns = new String[]{"url", "title"};
boolean browserFlag;
try {
Uri bookmarks = Browser.BOOKMARKS_URI;
c = getContentResolver().query(bookmarks, columns, null, null, null);
} catch (Exception e) {
e.printStackTrace();
}
if (c != null) {
Log.d("Browser", "System Browser Available");
browserFlag = true;
} else {
Log.e("Browser", "System Browser Unavailable");
browserFlag = false;
}
if (c != null) {
c.close();
}
mPreferences.setSystemBrowserPresent(browserFlag);
return browserFlag;
}
/**
* method to generate search suggestions for the AutoCompleteTextView from
* previously searched URLs

View File

@ -395,44 +395,6 @@ public class BookmarkManager {
return folders;
}
/**
* This method imports all bookmarks that are included in the device's
* permanent bookmark storage
*/
public synchronized void importBookmarksFromBrowser(Activity activity) throws Exception{
if (PreferenceManager.getInstance().getSystemBrowserPresent()) {
List<HistoryItem> bookmarkList = new ArrayList<>();
String[] columns = new String[]{Browser.BookmarkColumns.TITLE,
Browser.BookmarkColumns.URL};
String selection = Browser.BookmarkColumns.BOOKMARK + " = 1";
Cursor cursor = mContext.getContentResolver().query(Browser.BOOKMARKS_URI, columns,
selection, null, null);
if (cursor == null)
return;
String title, url;
int number = 0;
if (cursor.moveToFirst()) {
do {
title = cursor.getString(0);
url = cursor.getString(1);
if (title.isEmpty()) {
title = Utils.getDomainName(url);
}
number++;
bookmarkList.add(new HistoryItem(url, title));
} while (cursor.moveToNext());
}
cursor.close();
addBookmarkList(bookmarkList);
Utils.showSnackbar(activity, number + " " + mContext.getResources().getString(R.string.message_import));
} else {
Utils.createInformativeDialog(activity, R.string.title_error, R.string.dialog_import_error);
}
}
/**
* This method imports the bookmarks from a backup file that is located on
* external storage

View File

@ -23,7 +23,6 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
private static final String SETTINGS_EXPORT = "export_bookmark";
private static final String SETTINGS_IMPORT = "import_bookmark";
private static final String SETTINGS_BROWSER_IMPORT = "import_browser_bookmark";
private Activity mActivity;
private BookmarkManager mBookmarkManager;
@ -50,17 +49,9 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
Preference exportpref = findPreference(SETTINGS_EXPORT);
Preference importpref = findPreference(SETTINGS_IMPORT);
Preference importBrowserpref = findPreference(SETTINGS_BROWSER_IMPORT);
exportpref.setOnPreferenceClickListener(this);
importpref.setOnPreferenceClickListener(this);
importBrowserpref.setOnPreferenceClickListener(this);
if (mPreferences.getSystemBrowserPresent()) {
importBrowserpref.setSummary(getResources().getString(R.string.stock_browser_available));
} else {
importBrowserpref.setSummary(getResources().getString(R.string.stock_browser_unavailable));
}
}
@Override
@ -73,13 +64,6 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
loadFileList(null);
createDialog();
return true;
case SETTINGS_BROWSER_IMPORT:
try {
mBookmarkManager.importBookmarksFromBrowser(getActivity());
} catch (Exception e) {
e.printStackTrace();
}
return true;
default:
return false;
}

View File

@ -28,19 +28,16 @@ public class PrivacySettingsFragment extends PreferenceFragment implements Prefe
private static final String SETTINGS_CACHEEXIT = "clear_cache_exit";
private static final String SETTINGS_HISTORYEXIT = "clear_history_exit";
private static final String SETTINGS_COOKIEEXIT = "clear_cookies_exit";
private static final String SETTINGS_SYNCHISTORY = "sync_history";
private static final String SETTINGS_CLEARCACHE = "clear_cache";
private static final String SETTINGS_CLEARHISTORY = "clear_history";
private static final String SETTINGS_CLEARCOOKIES = "clear_cookies";
private static final String SETTINGS_CLEARWEBSTORAGE = "clear_webstorage";
private static final String SETTINGS_WEBSTORAGEEXIT = "clear_webstorage_exit";
private static final int API = android.os.Build.VERSION.SDK_INT;
private Activity mActivity;
private PreferenceManager mPreferences;
private CheckBoxPreference cblocation, cb3cookies, cbsavepasswords, cbcacheexit, cbhistoryexit,
cbcookiesexit, cbsynchistory, cbwebstorageexit;
private boolean mSystemBrowser;
cbcookiesexit, cbwebstorageexit;
private Handler messageHandler;
@Override
@ -57,7 +54,6 @@ public class PrivacySettingsFragment extends PreferenceFragment implements Prefe
private void initPrefs() {
// mPreferences storage
mPreferences = PreferenceManager.getInstance();
mSystemBrowser = mPreferences.getSystemBrowserPresent();
Preference clearcache = findPreference(SETTINGS_CLEARCACHE);
Preference clearhistory = findPreference(SETTINGS_CLEARHISTORY);
@ -70,7 +66,6 @@ public class PrivacySettingsFragment extends PreferenceFragment implements Prefe
cbcacheexit = (CheckBoxPreference) findPreference(SETTINGS_CACHEEXIT);
cbhistoryexit = (CheckBoxPreference) findPreference(SETTINGS_HISTORYEXIT);
cbcookiesexit = (CheckBoxPreference) findPreference(SETTINGS_COOKIEEXIT);
cbsynchistory = (CheckBoxPreference) findPreference(SETTINGS_SYNCHISTORY);
cbwebstorageexit = (CheckBoxPreference) findPreference(SETTINGS_WEBSTORAGEEXIT);
clearcache.setOnPreferenceClickListener(this);
@ -84,7 +79,6 @@ public class PrivacySettingsFragment extends PreferenceFragment implements Prefe
cbcacheexit.setOnPreferenceChangeListener(this);
cbhistoryexit.setOnPreferenceChangeListener(this);
cbcookiesexit.setOnPreferenceChangeListener(this);
cbsynchistory.setOnPreferenceChangeListener(this);
cbwebstorageexit.setOnPreferenceChangeListener(this);
cblocation.setChecked(mPreferences.getLocationEnabled());
@ -97,16 +91,6 @@ public class PrivacySettingsFragment extends PreferenceFragment implements Prefe
cb3cookies.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
if (!mSystemBrowser) {
cbsynchistory.setChecked(false);
cbsynchistory.setEnabled(false);
cbsynchistory.setSummary(getResources().getString(R.string.stock_browser_unavailable));
} else {
cbsynchistory.setEnabled(true);
cbsynchistory.setChecked(mPreferences.getSyncHistoryEnabled());
cbsynchistory.setSummary(getResources().getString(R.string.stock_browser_available));
}
messageHandler = new MessageHandler(mActivity);
}
@ -210,7 +194,7 @@ public class PrivacySettingsFragment extends PreferenceFragment implements Prefe
}
private void clearHistory() {
WebUtils.clearHistory(getActivity(), mSystemBrowser);
WebUtils.clearHistory(getActivity());
messageHandler.sendEmptyMessage(1);
}
@ -256,10 +240,6 @@ public class PrivacySettingsFragment extends PreferenceFragment implements Prefe
mPreferences.setClearWebStorageExitEnabled((Boolean) newValue);
cbwebstorageexit.setChecked((Boolean) newValue);
return true;
case SETTINGS_SYNCHISTORY:
mPreferences.setSyncHistoryEnabled((Boolean) newValue);
cbsynchistory.setChecked((Boolean) newValue);
return true;
default:
return false;
}

View File

@ -67,14 +67,14 @@ public class DrawerArrowDrawable extends Drawable {
mPaint.setAntiAlias(true);
mPaint.setColor(typedArray.getColor(R.styleable.DrawerArrowToggle_color, 0));
mSize = typedArray.getDimensionPixelSize(R.styleable.DrawerArrowToggle_drawableSize, 0);
mBarSize = typedArray.getDimension(R.styleable.DrawerArrowToggle_barSize, 0);
mBarSize = typedArray.getDimension(R.styleable.DrawerArrowToggle_barLength, 0);
mTopBottomArrowSize = typedArray.getDimension(
R.styleable.DrawerArrowToggle_topBottomBarArrowSize, 0);
R.styleable.DrawerArrowToggle_arrowHeadLength, 0);
mBarThickness = typedArray.getDimension(R.styleable.DrawerArrowToggle_thickness, 0);
mBarGap = typedArray.getDimension(R.styleable.DrawerArrowToggle_gapBetweenBars, 0);
mSpin = typedArray.getBoolean(R.styleable.DrawerArrowToggle_spinBars, true);
mMiddleArrowSize = typedArray.getDimension(
R.styleable.DrawerArrowToggle_middleBarArrowSize, 0);
R.styleable.DrawerArrowToggle_arrowShaftLength, 0);
typedArray.recycle();
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);

View File

@ -27,7 +27,6 @@ public class PreferenceManager {
public static final String SAVE_PASSWORDS = "passwords";
public static final String SEARCH = "search";
public static final String SEARCH_URL = "searchurl";
public static final String SYSTEM_BROWSER_PRESENT = "SystemBrowser";
public static final String TEXT_REFLOW = "textreflow";
public static final String TEXT_SIZE = "textsize";
public static final String URL_MEMORY = "memory";
@ -39,7 +38,6 @@ public class PreferenceManager {
public static final String CLEAR_COOKIES_EXIT = "clearCookiesExit";
public static final String SAVE_URL = "saveUrl";
public static final String RENDERING_MODE = "renderMode";
public static final String SYNC_HISTORY = "syncHistory";
public static final String BLOCK_THIRD_PARTY = "thirdParty";
public static final String ENABLE_COLOR_MODE = "colorMode";
public static final String URL_BOX_CONTENTS = "urlContent";
@ -211,14 +209,6 @@ public class PreferenceManager {
return mPrefs.getString(Name.SEARCH_URL, Constants.GOOGLE_SEARCH);
}
public boolean getSyncHistoryEnabled() {
return mPrefs.getBoolean(Name.SYNC_HISTORY, true);
}
public boolean getSystemBrowserPresent() {
return mPrefs.getBoolean(Name.SYSTEM_BROWSER_PRESENT, false);
}
public boolean getTextReflowEnabled() {
return mPrefs.getBoolean(Name.TEXT_REFLOW, false);
}
@ -411,14 +401,6 @@ public class PreferenceManager {
putString(Name.SEARCH_URL, url);
}
public void setSyncHistoryEnabled(boolean enable) {
putBoolean(Name.SYNC_HISTORY, enable);
}
public void setSystemBrowserPresent(boolean available) {
putBoolean(Name.SYSTEM_BROWSER_PRESENT, available);
}
public void setTextReflowEnabled(boolean enable) {
putBoolean(Name.TEXT_REFLOW, enable);
}

View File

@ -32,7 +32,7 @@ public class WebUtils {
WebStorage.getInstance().deleteAllData();
}
public static void clearHistory(@NonNull Context context, boolean systemBrowserPresent) {
public static void clearHistory(@NonNull Context context) {
HistoryDatabase.getInstance(context).deleteHistory();
WebViewDatabase m = WebViewDatabase.getInstance(context);
m.clearFormData();
@ -41,13 +41,6 @@ public class WebUtils {
m.clearUsernamePassword();
WebIconDatabase.getInstance().removeAllIcons();
}
if (systemBrowserPresent) {
try {
Browser.clearHistory(context.getContentResolver());
} catch (Exception ignored) {
// ignored
}
}
Utils.trimCache(context);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

View File

@ -8,9 +8,5 @@
<Preference
android:key="import_bookmark"
android:title="@string/import_backup" />
<Preference
android:key="import_browser_bookmark"
android:title="@string/importbookmarks"
android:summary="@string/recommended" />
</PreferenceCategory>
</PreferenceScreen>

View File

@ -31,10 +31,6 @@
android:defaultValue="false"
android:key="clear_webstorage_exit"
android:title="@string/clear_web_storage_exit" />
<CheckBoxPreference
android:defaultValue="false"
android:key="sync_history"
android:title="@string/sync_history" />
<Preference
android:key="clear_cache"
android:title="@string/clear_cache" />

View File

@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:1.3.1'
}
}