@@ -56,8 +56,6 @@
|
||||
<!--
|
||||
For these schemes where any of these particular MIME types
|
||||
have been supplied, we are a good candidate.
|
||||
|
||||
|
||||
-->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
@@ -107,61 +105,6 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.GeneralSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_general"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GENERAL_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.DisplaySettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_display"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.DISPLAY_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.PrivacySettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_privacy"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PRIVACY_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AdvancedSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_advanced"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ADVANCED_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AboutSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/settings_about"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ABOUT_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.IncognitoActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
@@ -176,28 +119,6 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.LicenseActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/licenses"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.LICENSE" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.BookmarkActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/bookmark_settings"
|
||||
android:theme="@style/Theme.SettingsTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOKMARK" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.ReadingActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class AboutSettingsActivity extends ThemableSettingsActivity implements OnClickListener {
|
||||
|
||||
private int mEasterEggCounter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.about_settings);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
String code = "1.0";
|
||||
try {
|
||||
PackageInfo p = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
code = p.versionName;
|
||||
} catch (NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
TextView versionCode = (TextView) findViewById(R.id.versionCode);
|
||||
versionCode.setText(code);
|
||||
|
||||
RelativeLayout licenses = (RelativeLayout) findViewById(R.id.layoutLicense);
|
||||
RelativeLayout source = (RelativeLayout) findViewById(R.id.layoutSource);
|
||||
RelativeLayout version = (RelativeLayout) findViewById(R.id.layoutVersion);
|
||||
licenses.setOnClickListener(this);
|
||||
source.setOnClickListener(this);
|
||||
version.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.layoutLicense:
|
||||
// NOTE: In order to comply legally with open source licenses,
|
||||
// it is advised that you leave this code so that the License
|
||||
// Activity may be viewed by the user.
|
||||
startActivity(new Intent(this, LicenseActivity.class));
|
||||
break;
|
||||
case R.id.layoutSource:
|
||||
startActivity(new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse("http://twitter.com/RestainoAnthony"), this, MainActivity.class));
|
||||
finish();
|
||||
break;
|
||||
case R.id.layoutVersion:
|
||||
mEasterEggCounter++;
|
||||
if (mEasterEggCounter == 10) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse("http://imgs.xkcd.com/comics/compiling.png"), this,
|
||||
MainActivity.class));
|
||||
finish();
|
||||
mEasterEggCounter = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class AdvancedSettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
private CheckBox cbAllowPopups, cbAllowCookies, cbAllowIncognitoCookies, cbRestoreTabs;
|
||||
private Context mContext;
|
||||
private TextView mRenderText;
|
||||
private TextView mUrlText;
|
||||
private CharSequence[] mUrlOptions;
|
||||
private PreferenceManager mPreferences;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.advanced_settings);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mContext = this;
|
||||
initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
RelativeLayout rAllowPopups, rAllowCookies, rAllowIncognitoCookies, rRestoreTabs;
|
||||
LinearLayout lRenderPicker, lUrlContent;
|
||||
|
||||
rAllowPopups = (RelativeLayout) findViewById(R.id.rAllowPopups);
|
||||
rAllowCookies = (RelativeLayout) findViewById(R.id.rAllowCookies);
|
||||
rAllowIncognitoCookies = (RelativeLayout) findViewById(R.id.rAllowIncognitoCookies);
|
||||
rRestoreTabs = (RelativeLayout) findViewById(R.id.rRestoreTabs);
|
||||
lRenderPicker = (LinearLayout) findViewById(R.id.layoutRendering);
|
||||
lUrlContent = (LinearLayout) findViewById(R.id.rUrlBarContents);
|
||||
|
||||
cbAllowPopups = (CheckBox) findViewById(R.id.cbAllowPopups);
|
||||
cbAllowCookies = (CheckBox) findViewById(R.id.cbAllowCookies);
|
||||
cbAllowIncognitoCookies = (CheckBox) findViewById(R.id.cbAllowIncognitoCookies);
|
||||
cbRestoreTabs = (CheckBox) findViewById(R.id.cbRestoreTabs);
|
||||
|
||||
cbAllowPopups.setChecked(mPreferences.getPopupsEnabled());
|
||||
cbAllowCookies.setChecked(mPreferences.getCookiesEnabled());
|
||||
cbAllowIncognitoCookies.setChecked(mPreferences.getIncognitoCookiesEnabled());
|
||||
cbRestoreTabs.setChecked(mPreferences.getRestoreLostTabsEnabled());
|
||||
|
||||
mRenderText = (TextView) findViewById(R.id.renderText);
|
||||
mUrlText = (TextView) findViewById(R.id.urlText);
|
||||
|
||||
switch (mPreferences.getRenderingMode()) {
|
||||
case 0:
|
||||
mRenderText.setText(mContext.getString(R.string.name_normal));
|
||||
break;
|
||||
case 1:
|
||||
mRenderText.setText(mContext.getString(R.string.name_inverted));
|
||||
break;
|
||||
case 2:
|
||||
mRenderText.setText(mContext.getString(R.string.name_grayscale));
|
||||
break;
|
||||
case 3:
|
||||
mRenderText.setText(mContext.getString(R.string.name_inverted_grayscale));
|
||||
break;
|
||||
}
|
||||
|
||||
mUrlOptions = this.getResources().getStringArray(R.array.url_content_array);
|
||||
int option = mPreferences.getUrlBoxContentChoice();
|
||||
mUrlText.setText(mUrlOptions[option]);
|
||||
|
||||
LayoutClickListener listener = new LayoutClickListener();
|
||||
CheckListener cListener = new CheckListener();
|
||||
|
||||
rAllowPopups.setOnClickListener(listener);
|
||||
rAllowCookies.setOnClickListener(listener);
|
||||
rAllowIncognitoCookies.setOnClickListener(listener);
|
||||
rRestoreTabs.setOnClickListener(listener);
|
||||
lRenderPicker.setOnClickListener(listener);
|
||||
lUrlContent.setOnClickListener(listener);
|
||||
|
||||
cbAllowPopups.setOnCheckedChangeListener(cListener);
|
||||
cbAllowCookies.setOnCheckedChangeListener(cListener);
|
||||
cbAllowIncognitoCookies.setOnCheckedChangeListener(cListener);
|
||||
cbRestoreTabs.setOnCheckedChangeListener(cListener);
|
||||
|
||||
}
|
||||
|
||||
private class LayoutClickListener implements OnClickListener {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.rAllowPopups:
|
||||
cbAllowPopups.setChecked(!cbAllowPopups.isChecked());
|
||||
break;
|
||||
case R.id.rAllowIncognitoCookies:
|
||||
cbAllowIncognitoCookies.setChecked(!cbAllowIncognitoCookies.isChecked());
|
||||
break;
|
||||
case R.id.rAllowCookies:
|
||||
cbAllowCookies.setChecked(!cbAllowCookies.isChecked());
|
||||
break;
|
||||
case R.id.rRestoreTabs:
|
||||
cbRestoreTabs.setChecked(!cbRestoreTabs.isChecked());
|
||||
break;
|
||||
case R.id.layoutRendering:
|
||||
renderPicker();
|
||||
break;
|
||||
case R.id.rUrlBarContents:
|
||||
urlBoxPicker();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class CheckListener implements OnCheckedChangeListener {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
switch (buttonView.getId()) {
|
||||
case R.id.cbAllowPopups:
|
||||
mPreferences.setPopupsEnabled(isChecked);
|
||||
break;
|
||||
case R.id.cbAllowCookies:
|
||||
mPreferences.setCookiesEnabled(isChecked);
|
||||
break;
|
||||
case R.id.cbAllowIncognitoCookies:
|
||||
mPreferences.setIncognitoCookiesEnabled(isChecked);
|
||||
break;
|
||||
case R.id.cbRestoreTabs:
|
||||
mPreferences.setRestoreLostTabsEnabled(isChecked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void renderPicker() {
|
||||
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||
picker.setTitle(getResources().getString(R.string.rendering_mode));
|
||||
CharSequence[] chars = { mContext.getString(R.string.name_normal),
|
||||
mContext.getString(R.string.name_inverted),
|
||||
mContext.getString(R.string.name_grayscale),
|
||||
mContext.getString(R.string.name_inverted_grayscale) };
|
||||
|
||||
int n = mPreferences.getRenderingMode();
|
||||
|
||||
picker.setSingleChoiceItems(chars, n, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setRenderingMode(which);
|
||||
switch (which) {
|
||||
case 0:
|
||||
mRenderText.setText(mContext.getString(R.string.name_normal));
|
||||
break;
|
||||
case 1:
|
||||
mRenderText.setText(mContext.getString(R.string.name_inverted));
|
||||
break;
|
||||
case 2:
|
||||
mRenderText.setText(mContext.getString(R.string.name_grayscale));
|
||||
break;
|
||||
case 3:
|
||||
mRenderText.setText(mContext.getString(R.string.name_inverted_grayscale));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
private void urlBoxPicker() {
|
||||
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||
picker.setTitle(getResources().getString(R.string.url_contents));
|
||||
|
||||
int n = mPreferences.getUrlBoxContentChoice();
|
||||
|
||||
picker.setSingleChoiceItems(mUrlOptions, n, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setUrlBoxContentChoice(which);
|
||||
if (which < mUrlOptions.length) {
|
||||
mUrlText.setText(mUrlOptions[which]);
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||
* to be used with AppCompat.
|
||||
* <p/>
|
||||
* This technique can be used with an {@link android.app.Activity} class, not just
|
||||
* {@link android.preference.PreferenceActivity}.
|
||||
*/
|
||||
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
|
||||
private AppCompatDelegate mDelegate;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
getDelegate().onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public ActionBar getSupportActionBar() {
|
||||
return getDelegate().getSupportActionBar();
|
||||
}
|
||||
|
||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
||||
getDelegate().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MenuInflater getMenuInflater() {
|
||||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
getDelegate().setContentView(layoutResID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view) {
|
||||
getDelegate().setContentView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().setContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().addContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTitleChanged(CharSequence title, int color) {
|
||||
super.onTitleChanged(title, color);
|
||||
getDelegate().setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
getDelegate().onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getDelegate().onDestroy();
|
||||
}
|
||||
|
||||
public void invalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
private AppCompatDelegate getDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = AppCompatDelegate.create(this, null);
|
||||
}
|
||||
return mDelegate;
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.database.BookmarkManager;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class BookmarkActivity extends ThemableSettingsActivity implements OnClickListener {
|
||||
|
||||
private BookmarkManager mBookmarkManager;
|
||||
private File[] mFileList;
|
||||
private String[] mFileNameList;
|
||||
private static final File mPath = new File(Environment.getExternalStorageDirectory().toString());
|
||||
private static final int DIALOG_LOAD_FILE = 1000;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.bookmark_settings);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
LinearLayout exportBackup = (LinearLayout) findViewById(R.id.exportBackup);
|
||||
LinearLayout importBackup = (LinearLayout) findViewById(R.id.importBackup);
|
||||
LinearLayout importFromBrowser = (LinearLayout) findViewById(R.id.importFromBrowser);
|
||||
|
||||
TextView importBookmarks = (TextView) findViewById(R.id.isImportBrowserAvailable);
|
||||
|
||||
mBookmarkManager = BookmarkManager.getInstance(getApplicationContext());
|
||||
PreferenceManager mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
boolean systemBrowser = mPreferences.getSystemBrowserPresent();
|
||||
|
||||
exportBackup.setOnClickListener(this);
|
||||
importBackup.setOnClickListener(this);
|
||||
importFromBrowser.setOnClickListener(this);
|
||||
|
||||
if (systemBrowser) {
|
||||
importBookmarks.setText(getResources().getString(R.string.stock_browser_available));
|
||||
} else {
|
||||
importBookmarks.setText(getResources().getString(R.string.stock_browser_unavailable));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.importBackup:
|
||||
loadFileList(null);
|
||||
onCreateDialog(DIALOG_LOAD_FILE);
|
||||
break;
|
||||
case R.id.importFromBrowser:
|
||||
mBookmarkManager.importBookmarksFromBrowser(BookmarkActivity.this);
|
||||
break;
|
||||
case R.id.exportBackup:
|
||||
mBookmarkManager.exportBookmarks();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void loadFileList(File path) {
|
||||
File file;
|
||||
if (path != null) {
|
||||
file = path;
|
||||
} else {
|
||||
file = mPath;
|
||||
}
|
||||
try {
|
||||
file.mkdirs();
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (file.exists()) {
|
||||
mFileList = file.listFiles();
|
||||
} else {
|
||||
mFileList = new File[0];
|
||||
}
|
||||
|
||||
Arrays.sort(mFileList, new SortName());
|
||||
|
||||
if (mFileList == null) {
|
||||
mFileNameList = new String[0];
|
||||
mFileList = new File[0];
|
||||
} else {
|
||||
mFileNameList = new String[mFileList.length];
|
||||
}
|
||||
for (int n = 0; n < mFileList.length; n++) {
|
||||
mFileNameList[n] = mFileList[n].getName();
|
||||
}
|
||||
}
|
||||
|
||||
private class SortName implements Comparator<File> {
|
||||
|
||||
@Override
|
||||
public int compare(File a, File b) {
|
||||
if (a.isDirectory() && b.isDirectory())
|
||||
return a.getName().compareTo(b.getName());
|
||||
|
||||
if (a.isDirectory())
|
||||
return -1;
|
||||
|
||||
if (b.isDirectory())
|
||||
return 1;
|
||||
|
||||
if (a.isFile() && b.isFile())
|
||||
return a.getName().compareTo(b.getName());
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
Dialog dialog;
|
||||
final AlertDialog.Builder builder = new Builder(this);
|
||||
|
||||
switch (id) {
|
||||
case DIALOG_LOAD_FILE:
|
||||
builder.setTitle(R.string.title_chooser);
|
||||
if (mFileList == null) {
|
||||
dialog = builder.create();
|
||||
return dialog;
|
||||
}
|
||||
builder.setItems(mFileNameList, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (mFileList[which].isDirectory()) {
|
||||
loadFileList(mFileList[which]);
|
||||
builder.setItems(mFileNameList, this);
|
||||
builder.show();
|
||||
} else {
|
||||
mBookmarkManager.importBookmarksFromFile(mFileList[which], BookmarkActivity.this);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
break;
|
||||
}
|
||||
dialog = builder.show();
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class DisplaySettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
// mPreferences variables
|
||||
private PreferenceManager mPreferences;
|
||||
private CheckBox cbHideStatusBar, cbFullScreen, cbWideViewPort, cbOverView, cbTextReflow;
|
||||
private String[] mThemeOptions;
|
||||
private TextView mThemeText;
|
||||
private int mCurrentTheme;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.display_settings);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
mThemeOptions = this.getResources().getStringArray(R.array.themes);
|
||||
initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
||||
RelativeLayout rHideStatusBar, rFullScreen, rWideViewPort, rOverView, rTextReflow, rTextSize, rDarkTheme;
|
||||
LayoutClickListener clickListener = new LayoutClickListener();
|
||||
CheckBoxToggleListener toggleListener = new CheckBoxToggleListener();
|
||||
|
||||
rHideStatusBar = (RelativeLayout) findViewById(R.id.rHideStatusBar);
|
||||
rFullScreen = (RelativeLayout) findViewById(R.id.rFullScreen);
|
||||
rWideViewPort = (RelativeLayout) findViewById(R.id.rWideViewPort);
|
||||
rOverView = (RelativeLayout) findViewById(R.id.rOverView);
|
||||
rTextReflow = (RelativeLayout) findViewById(R.id.rTextReflow);
|
||||
rTextSize = (RelativeLayout) findViewById(R.id.rTextSize);
|
||||
rDarkTheme = (RelativeLayout) findViewById(R.id.rTheme);
|
||||
|
||||
rHideStatusBar.setOnClickListener(clickListener);
|
||||
rFullScreen.setOnClickListener(clickListener);
|
||||
rWideViewPort.setOnClickListener(clickListener);
|
||||
rOverView.setOnClickListener(clickListener);
|
||||
rTextReflow.setOnClickListener(clickListener);
|
||||
rTextSize.setOnClickListener(clickListener);
|
||||
rDarkTheme.setOnClickListener(clickListener);
|
||||
|
||||
mThemeText = (TextView) findViewById(R.id.textViewTheme);
|
||||
|
||||
mCurrentTheme = mPreferences.getUseTheme();
|
||||
mThemeText.setText(mThemeOptions[mPreferences.getUseTheme()]);
|
||||
|
||||
cbHideStatusBar = (CheckBox) findViewById(R.id.cbHideStatusBar);
|
||||
cbFullScreen = (CheckBox) findViewById(R.id.cbFullScreen);
|
||||
cbWideViewPort = (CheckBox) findViewById(R.id.cbWideViewPort);
|
||||
cbOverView = (CheckBox) findViewById(R.id.cbOverView);
|
||||
cbTextReflow = (CheckBox) findViewById(R.id.cbTextReflow);
|
||||
|
||||
cbHideStatusBar.setChecked(mPreferences.getHideStatusBarEnabled());
|
||||
cbFullScreen.setChecked(mPreferences.getFullScreenEnabled());
|
||||
cbWideViewPort.setChecked(mPreferences.getUseWideViewportEnabled());
|
||||
cbOverView.setChecked(mPreferences.getOverviewModeEnabled());
|
||||
cbTextReflow.setChecked(mPreferences.getTextReflowEnabled());
|
||||
|
||||
cbHideStatusBar.setOnCheckedChangeListener(toggleListener);
|
||||
cbFullScreen.setOnCheckedChangeListener(toggleListener);
|
||||
cbWideViewPort.setOnCheckedChangeListener(toggleListener);
|
||||
cbOverView.setOnCheckedChangeListener(toggleListener);
|
||||
cbTextReflow.setOnCheckedChangeListener(toggleListener);
|
||||
}
|
||||
|
||||
private class LayoutClickListener implements OnClickListener {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.rHideStatusBar:
|
||||
cbHideStatusBar.setChecked(!cbHideStatusBar.isChecked());
|
||||
break;
|
||||
case R.id.rFullScreen:
|
||||
cbFullScreen.setChecked(!cbFullScreen.isChecked());
|
||||
break;
|
||||
case R.id.rWideViewPort:
|
||||
cbWideViewPort.setChecked(!cbWideViewPort.isChecked());
|
||||
break;
|
||||
case R.id.rOverView:
|
||||
cbOverView.setChecked(!cbOverView.isChecked());
|
||||
break;
|
||||
case R.id.rTextReflow:
|
||||
cbTextReflow.setChecked(!cbTextReflow.isChecked());
|
||||
break;
|
||||
case R.id.rTextSize:
|
||||
textSizePicker();
|
||||
break;
|
||||
case R.id.rTheme:
|
||||
themePicker();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class CheckBoxToggleListener implements OnCheckedChangeListener {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
switch (buttonView.getId()) {
|
||||
case R.id.cbHideStatusBar:
|
||||
mPreferences.setHideStatusBarEnabled(isChecked);
|
||||
break;
|
||||
case R.id.cbFullScreen:
|
||||
mPreferences.setFullScreenEnabled(isChecked);
|
||||
break;
|
||||
case R.id.cbWideViewPort:
|
||||
mPreferences.setUseWideViewportEnabled(isChecked);
|
||||
break;
|
||||
case R.id.cbOverView:
|
||||
mPreferences.setOverviewModeEnabled(isChecked);
|
||||
break;
|
||||
case R.id.cbTextReflow:
|
||||
mPreferences.setTextReflowEnabled(isChecked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void textSizePicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(DisplaySettingsActivity.this);
|
||||
picker.setTitle(getResources().getString(R.string.title_text_size));
|
||||
|
||||
int n = mPreferences.getTextSize();
|
||||
|
||||
picker.setSingleChoiceItems(R.array.text_size, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setTextSize(which + 1);
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
private void themePicker() {
|
||||
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(DisplaySettingsActivity.this);
|
||||
picker.setTitle(getResources().getString(R.string.url_contents));
|
||||
|
||||
int n = mPreferences.getUseTheme();
|
||||
picker.setSingleChoiceItems(mThemeOptions, n, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setUseTheme(which);
|
||||
if (which < mThemeOptions.length) {
|
||||
mThemeText.setText(mThemeOptions[which]);
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (mCurrentTheme != mPreferences.getUseTheme()) {
|
||||
restart();
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
if (mCurrentTheme != mPreferences.getUseTheme()) {
|
||||
restart();
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
}
|
||||
@@ -1,536 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class GeneralSettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
// mPreferences variables
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
private PreferenceManager mPreferences;
|
||||
private int mAgentChoice;
|
||||
private String mHomepage;
|
||||
private TextView mAgentTextView;
|
||||
private TextView mDownloadTextView;
|
||||
private String mDownloadLocation;
|
||||
private TextView mHomepageText;
|
||||
private TextView mSearchText;
|
||||
private CheckBox cbSearchSuggestions;
|
||||
private Activity mActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.general_settings);
|
||||
|
||||
// set up ActionBar
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
mActivity = this;
|
||||
initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
||||
mSearchText = (TextView) findViewById(R.id.searchText);
|
||||
|
||||
switch (mPreferences.getSearchChoice()) {
|
||||
case 0:
|
||||
mSearchText.setText(getResources().getString(R.string.custom_url));
|
||||
break;
|
||||
case 1:
|
||||
mSearchText.setText("Google");
|
||||
break;
|
||||
case 2:
|
||||
mSearchText.setText("Ask");
|
||||
break;
|
||||
case 3:
|
||||
mSearchText.setText("Bing");
|
||||
break;
|
||||
case 4:
|
||||
mSearchText.setText("Yahoo");
|
||||
break;
|
||||
case 5:
|
||||
mSearchText.setText("StartPage");
|
||||
break;
|
||||
case 6:
|
||||
mSearchText.setText("StartPage (Mobile)");
|
||||
break;
|
||||
case 7:
|
||||
mSearchText.setText("DuckDuckGo");
|
||||
break;
|
||||
case 8:
|
||||
mSearchText.setText("DuckDuckGo Lite");
|
||||
break;
|
||||
case 9:
|
||||
mSearchText.setText("Baidu");
|
||||
break;
|
||||
case 10:
|
||||
mSearchText.setText("Yandex");
|
||||
}
|
||||
|
||||
mAgentTextView = (TextView) findViewById(R.id.agentText);
|
||||
mHomepageText = (TextView) findViewById(R.id.homepageText);
|
||||
mDownloadTextView = (TextView) findViewById(R.id.downloadText);
|
||||
mAgentChoice = mPreferences.getUserAgentChoice();
|
||||
mHomepage = mPreferences.getHomepage();
|
||||
mDownloadLocation = mPreferences.getDownloadDirectory();
|
||||
|
||||
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' + mDownloadLocation);
|
||||
|
||||
if (mHomepage.contains("about:home")) {
|
||||
mHomepageText.setText(getResources().getString(R.string.action_homepage));
|
||||
} else if (mHomepage.contains("about:blank")) {
|
||||
mHomepageText.setText(getResources().getString(R.string.action_blank));
|
||||
} else if (mHomepage.contains("about:bookmarks")) {
|
||||
mHomepageText.setText(getResources().getString(R.string.action_bookmarks));
|
||||
} else {
|
||||
mHomepageText.setText(mHomepage);
|
||||
}
|
||||
|
||||
switch (mAgentChoice) {
|
||||
case 1:
|
||||
mAgentTextView.setText(getResources().getString(R.string.agent_default));
|
||||
break;
|
||||
case 2:
|
||||
mAgentTextView.setText(getResources().getString(R.string.agent_desktop));
|
||||
break;
|
||||
case 3:
|
||||
mAgentTextView.setText(getResources().getString(R.string.agent_mobile));
|
||||
break;
|
||||
case 4:
|
||||
mAgentTextView.setText(getResources().getString(R.string.agent_custom));
|
||||
}
|
||||
|
||||
RelativeLayout rSearchSuggestions;
|
||||
rSearchSuggestions = (RelativeLayout) findViewById(R.id.rGoogleSuggestions);
|
||||
|
||||
cbSearchSuggestions = (CheckBox) findViewById(R.id.cbGoogleSuggestions);
|
||||
|
||||
cbSearchSuggestions.setChecked(mPreferences.getGoogleSearchSuggestionsEnabled());
|
||||
|
||||
RelativeLayout agent = (RelativeLayout) findViewById(R.id.layoutUserAgent);
|
||||
RelativeLayout download = (RelativeLayout) findViewById(R.id.layoutDownload);
|
||||
RelativeLayout homepage = (RelativeLayout) findViewById(R.id.layoutHomepage);
|
||||
|
||||
agent(agent);
|
||||
download(download);
|
||||
homepage(homepage);
|
||||
search();
|
||||
|
||||
rSearchSuggestions(rSearchSuggestions);
|
||||
cbSearchSuggestions(cbSearchSuggestions);
|
||||
}
|
||||
|
||||
public void search() {
|
||||
RelativeLayout search = (RelativeLayout) findViewById(R.id.layoutSearch);
|
||||
search.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.title_search_engine));
|
||||
CharSequence[] chars = { getResources().getString(R.string.custom_url), "Google",
|
||||
"Ask", "Bing", "Yahoo", "StartPage", "StartPage (Mobile)",
|
||||
"DuckDuckGo (Privacy)", "DuckDuckGo Lite (Privacy)", "Baidu (Chinese)",
|
||||
"Yandex (Russian)" };
|
||||
|
||||
int n = mPreferences.getSearchChoice();
|
||||
|
||||
picker.setSingleChoiceItems(chars, n, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setSearchChoice(which);
|
||||
switch (which) {
|
||||
case 0:
|
||||
searchUrlPicker();
|
||||
break;
|
||||
case 1:
|
||||
mSearchText.setText("Google");
|
||||
break;
|
||||
case 2:
|
||||
mSearchText.setText("Ask");
|
||||
break;
|
||||
case 3:
|
||||
mSearchText.setText("Bing");
|
||||
break;
|
||||
case 4:
|
||||
mSearchText.setText("Yahoo");
|
||||
break;
|
||||
case 5:
|
||||
mSearchText.setText("StartPage");
|
||||
break;
|
||||
case 6:
|
||||
mSearchText.setText("StartPage (Mobile)");
|
||||
break;
|
||||
case 7:
|
||||
mSearchText.setText("DuckDuckGo");
|
||||
break;
|
||||
case 8:
|
||||
mSearchText.setText("DuckDuckGo Lite");
|
||||
break;
|
||||
case 9:
|
||||
mSearchText.setText("Baidu");
|
||||
break;
|
||||
case 10:
|
||||
mSearchText.setText("Yandex");
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void searchUrlPicker() {
|
||||
final AlertDialog.Builder urlPicker = new AlertDialog.Builder(this);
|
||||
|
||||
urlPicker.setTitle(getResources().getString(R.string.custom_url));
|
||||
final EditText getSearchUrl = new EditText(this);
|
||||
|
||||
String mSearchUrl = mPreferences.getSearchUrl();
|
||||
getSearchUrl.setText(mSearchUrl);
|
||||
urlPicker.setView(getSearchUrl);
|
||||
urlPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getSearchUrl.getText().toString();
|
||||
mPreferences.setSearchUrl(text);
|
||||
mSearchText.setText(getResources().getString(R.string.custom_url) + ": "
|
||||
+ text);
|
||||
}
|
||||
});
|
||||
urlPicker.show();
|
||||
}
|
||||
|
||||
public void agent(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder agentPicker = new AlertDialog.Builder(mActivity);
|
||||
agentPicker.setTitle(getResources().getString(R.string.title_user_agent));
|
||||
mAgentChoice = mPreferences.getUserAgentChoice();
|
||||
agentPicker.setSingleChoiceItems(R.array.user_agent, mAgentChoice - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setUserAgentChoice(which + 1);
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
mAgentTextView.setText(getResources().getString(
|
||||
R.string.agent_default));
|
||||
break;
|
||||
case 2:
|
||||
mAgentTextView.setText(getResources().getString(
|
||||
R.string.agent_desktop));
|
||||
break;
|
||||
case 3:
|
||||
mAgentTextView.setText(getResources().getString(
|
||||
R.string.agent_mobile));
|
||||
break;
|
||||
case 4:
|
||||
mAgentTextView.setText(getResources().getString(
|
||||
R.string.agent_custom));
|
||||
agentPicker();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
agentPicker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
agentPicker.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.i("Cancelled", "");
|
||||
}
|
||||
});
|
||||
agentPicker.show();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void agentPicker() {
|
||||
final AlertDialog.Builder agentStringPicker = new AlertDialog.Builder(mActivity);
|
||||
|
||||
agentStringPicker.setTitle(getResources().getString(R.string.title_user_agent));
|
||||
final EditText getAgent = new EditText(this);
|
||||
agentStringPicker.setView(getAgent);
|
||||
agentStringPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getAgent.getText().toString();
|
||||
mPreferences.setUserAgentString(text);
|
||||
mAgentTextView.setText(getResources().getString(R.string.agent_custom));
|
||||
}
|
||||
});
|
||||
agentStringPicker.show();
|
||||
}
|
||||
|
||||
public void download(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.title_download_location));
|
||||
mDownloadLocation = mPreferences.getDownloadDirectory();
|
||||
int n;
|
||||
if (mDownloadLocation.contains(Environment.DIRECTORY_DOWNLOADS)) {
|
||||
n = 1;
|
||||
} else {
|
||||
n = 2;
|
||||
}
|
||||
|
||||
picker.setSingleChoiceItems(R.array.download_folder, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
mPreferences
|
||||
.setDownloadDirectory(Environment.DIRECTORY_DOWNLOADS);
|
||||
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/'
|
||||
+ Environment.DIRECTORY_DOWNLOADS);
|
||||
break;
|
||||
case 2:
|
||||
downPicker();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void homePicker() {
|
||||
final AlertDialog.Builder homePicker = new AlertDialog.Builder(mActivity);
|
||||
homePicker.setTitle(getResources().getString(R.string.title_custom_homepage));
|
||||
final EditText getHome = new EditText(this);
|
||||
mHomepage = mPreferences.getHomepage();
|
||||
if (!mHomepage.startsWith("about:")) {
|
||||
getHome.setText(mHomepage);
|
||||
} else {
|
||||
getHome.setText("http://www.google.com");
|
||||
}
|
||||
homePicker.setView(getHome);
|
||||
homePicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getHome.getText().toString();
|
||||
mPreferences.setHomepage(text);
|
||||
mHomepageText.setText(text);
|
||||
}
|
||||
});
|
||||
homePicker.show();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void downPicker() {
|
||||
final AlertDialog.Builder downLocationPicker = new AlertDialog.Builder(mActivity);
|
||||
LinearLayout layout = new LinearLayout(this);
|
||||
downLocationPicker.setTitle(getResources().getString(R.string.title_download_location));
|
||||
final EditText getDownload = new EditText(this);
|
||||
getDownload.setBackgroundResource(0);
|
||||
mDownloadLocation = mPreferences.getDownloadDirectory();
|
||||
int padding = Utils.convertDpToPixels(10);
|
||||
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
|
||||
|
||||
getDownload.setLayoutParams(lparams);
|
||||
getDownload.setTextColor(Color.DKGRAY);
|
||||
getDownload.setText(mDownloadLocation);
|
||||
getDownload.setPadding(0, padding, padding, padding);
|
||||
|
||||
TextView v = new TextView(this);
|
||||
v.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
||||
v.setTextColor(Color.DKGRAY);
|
||||
v.setText(Constants.EXTERNAL_STORAGE + '/');
|
||||
v.setPadding(padding, padding, 0, padding);
|
||||
layout.addView(v);
|
||||
layout.addView(getDownload);
|
||||
if (API < 16) {
|
||||
layout.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.edit_text));
|
||||
} else {
|
||||
layout.setBackground(getResources().getDrawable(android.R.drawable.edit_text));
|
||||
}
|
||||
downLocationPicker.setView(layout);
|
||||
downLocationPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getDownload.getText().toString();
|
||||
mPreferences.setDownloadDirectory(text);
|
||||
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' + text);
|
||||
}
|
||||
});
|
||||
downLocationPicker.show();
|
||||
}
|
||||
|
||||
public void homepage(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.home));
|
||||
mHomepage = mPreferences.getHomepage();
|
||||
int n;
|
||||
if (mHomepage.contains("about:home")) {
|
||||
n = 1;
|
||||
} else if (mHomepage.contains("about:blank")) {
|
||||
n = 2;
|
||||
} else if (mHomepage.contains("about:bookmarks")) {
|
||||
n = 3;
|
||||
} else {
|
||||
n = 4;
|
||||
}
|
||||
|
||||
picker.setSingleChoiceItems(R.array.homepage, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
mPreferences.setHomepage("about:home");
|
||||
mHomepageText.setText(getResources().getString(
|
||||
R.string.action_homepage));
|
||||
break;
|
||||
case 2:
|
||||
mPreferences.setHomepage("about:blank");
|
||||
mHomepageText.setText(getResources().getString(
|
||||
R.string.action_blank));
|
||||
break;
|
||||
case 3:
|
||||
mPreferences.setHomepage("about:bookmarks");
|
||||
mHomepageText.setText(getResources().getString(
|
||||
R.string.action_bookmarks));
|
||||
|
||||
break;
|
||||
case 4:
|
||||
homePicker();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void cbSearchSuggestions(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setGoogleSearchSuggestionsEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rSearchSuggestions(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
cbSearchSuggestions.setChecked(!cbSearchSuggestions.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
/*
|
||||
*NOTE: This activity must not be removed in order to comply with the Mozilla Public License v. 2.0
|
||||
*under which this code is licensed. Unless you plan on providing other attribution in the app to
|
||||
*the original source in another visible way, it is advised against the removal of this Activity.
|
||||
*/
|
||||
public class LicenseActivity extends ThemableSettingsActivity implements View.OnClickListener {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.license_activity);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
findViewById(R.id.browserLicense).setOnClickListener(this);
|
||||
findViewById(R.id.licenseAOSP).setOnClickListener(this);
|
||||
findViewById(R.id.licenseHosts).setOnClickListener(this);
|
||||
findViewById(R.id.licenseOrbot).setOnClickListener(this);
|
||||
findViewById(R.id.licenseSnactory).setOnClickListener(this);
|
||||
findViewById(R.id.licenseJsoup).setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.browserLicense:
|
||||
actionView("http://www.mozilla.org/MPL/2.0/");
|
||||
break;
|
||||
case R.id.licenseAOSP:
|
||||
actionView("http://www.apache.org/licenses/LICENSE-2.0");
|
||||
break;
|
||||
case R.id.licenseHosts:
|
||||
actionView("http://hosts-file.net/");
|
||||
break;
|
||||
case R.id.licenseOrbot:
|
||||
actionView("http://www.gnu.org/licenses/lgpl.html");
|
||||
break;
|
||||
case R.id.licenseSnactory:
|
||||
actionView("http://www.apache.org/licenses/LICENSE-2.0");
|
||||
break;
|
||||
case R.id.licenseJsoup:
|
||||
actionView("http://jsoup.org/license");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void actionView(String url) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url), this, MainActivity.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -1,449 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Browser;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.webkit.*;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.database.HistoryDatabase;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class PrivacySettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
// mPreferences variables
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
private PreferenceManager mPreferences;
|
||||
private CheckBox cbLocation, cbSavePasswords, cbClearCacheExit, cbClearHistoryExit,
|
||||
cbClearCookiesExit, cbThirdParty;
|
||||
private Context mContext;
|
||||
private boolean mSystemBrowser;
|
||||
private Handler messageHandler;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.privacy_settings);
|
||||
|
||||
// set up ActionBar
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
mSystemBrowser = mPreferences.getSystemBrowserPresent();
|
||||
mContext = this;
|
||||
initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
||||
RelativeLayout rLocation, rSavePasswords, rClearCacheExit, rClearHistoryExit, rClearCookiesExit, rClearCache, rClearHistory, rClearCookies, rThirdParty;
|
||||
|
||||
rLocation = (RelativeLayout) findViewById(R.id.rLocation);
|
||||
rSavePasswords = (RelativeLayout) findViewById(R.id.rSavePasswords);
|
||||
rClearCacheExit = (RelativeLayout) findViewById(R.id.rClearCacheExit);
|
||||
rClearHistoryExit = (RelativeLayout) findViewById(R.id.rClearHistoryExit);
|
||||
rClearCookiesExit = (RelativeLayout) findViewById(R.id.rClearCookiesExit);
|
||||
rClearCache = (RelativeLayout) findViewById(R.id.rClearCache);
|
||||
rClearHistory = (RelativeLayout) findViewById(R.id.rClearHistory);
|
||||
rClearCookies = (RelativeLayout) findViewById(R.id.rClearCookies);
|
||||
rThirdParty = (RelativeLayout) findViewById(R.id.rThirdParty);
|
||||
|
||||
cbLocation = (CheckBox) findViewById(R.id.cbLocation);
|
||||
cbSavePasswords = (CheckBox) findViewById(R.id.cbSavePasswords);
|
||||
cbClearCacheExit = (CheckBox) findViewById(R.id.cbClearCacheExit);
|
||||
cbClearHistoryExit = (CheckBox) findViewById(R.id.cbClearHistoryExit);
|
||||
cbClearCookiesExit = (CheckBox) findViewById(R.id.cbClearCookiesExit);
|
||||
cbThirdParty = (CheckBox) findViewById(R.id.cbThirdParty);
|
||||
|
||||
cbLocation.setChecked(mPreferences.getLocationEnabled());
|
||||
cbSavePasswords.setChecked(mPreferences.getSavePasswordsEnabled());
|
||||
cbClearCacheExit.setChecked(mPreferences.getClearCacheExit());
|
||||
cbClearHistoryExit.setChecked(mPreferences.getClearHistoryExitEnabled());
|
||||
cbClearCookiesExit.setChecked(mPreferences.getClearCookiesExitEnabled());
|
||||
cbThirdParty.setChecked(mPreferences.getBlockThirdPartyCookiesEnabled());
|
||||
|
||||
cbThirdParty.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
|
||||
|
||||
rLocation(rLocation);
|
||||
rSavePasswords(rSavePasswords);
|
||||
rClearCacheExit(rClearCacheExit);
|
||||
rClearHistoryExit(rClearHistoryExit);
|
||||
rClearCookiesExit(rClearCookiesExit);
|
||||
rClearCache(rClearCache);
|
||||
rClearHistory(rClearHistory);
|
||||
rClearCookies(rClearCookies);
|
||||
rThirdParty(rThirdParty);
|
||||
cbLocation(cbLocation);
|
||||
cbSavePasswords(cbSavePasswords);
|
||||
cbClearCacheExit(cbClearCacheExit);
|
||||
cbClearHistoryExit(cbClearHistoryExit);
|
||||
cbClearCookiesExit(cbClearCookiesExit);
|
||||
cbThirdParty(cbThirdParty);
|
||||
|
||||
TextView syncHistory = (TextView) findViewById(R.id.isBrowserAvailable);
|
||||
|
||||
RelativeLayout layoutSyncHistory = (RelativeLayout) findViewById(R.id.rBrowserHistory);
|
||||
final CheckBox cbSyncHistory = (CheckBox) findViewById(R.id.cbBrowserHistory);
|
||||
layoutSyncHistory.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
cbSyncHistory.setChecked(!cbSyncHistory.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
cbSyncHistory.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setSyncHistoryEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (!mSystemBrowser) {
|
||||
cbSyncHistory.setChecked(false);
|
||||
cbSyncHistory.setEnabled(false);
|
||||
syncHistory.setText(getResources().getString(R.string.stock_browser_unavailable));
|
||||
} else {
|
||||
cbSyncHistory.setEnabled(true);
|
||||
cbSyncHistory.setChecked(mPreferences.getSyncHistoryEnabled());
|
||||
syncHistory.setText(getResources().getString(R.string.stock_browser_available));
|
||||
}
|
||||
|
||||
messageHandler = new MessageHandler(mContext);
|
||||
}
|
||||
|
||||
private static class MessageHandler extends Handler {
|
||||
|
||||
final Context mHandlerContext;
|
||||
|
||||
public MessageHandler(Context context) {
|
||||
this.mHandlerContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
Utils.showToast(mHandlerContext,
|
||||
mHandlerContext.getResources()
|
||||
.getString(R.string.message_clear_history));
|
||||
break;
|
||||
case 2:
|
||||
Utils.showToast(
|
||||
mHandlerContext,
|
||||
mHandlerContext.getResources().getString(
|
||||
R.string.message_cookies_cleared));
|
||||
break;
|
||||
}
|
||||
super.handleMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private void cbLocation(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setLocationEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void cbSavePasswords(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setSavePasswordsEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void cbClearCacheExit(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setClearCacheExit(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void cbClearHistoryExit(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setClearHistoryExitEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void cbThirdParty(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setBlockThirdPartyCookiesEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void cbClearCookiesExit(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setClearCookiesExitEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rLocation(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cbLocation.setChecked(!cbLocation.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rSavePasswords(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cbSavePasswords.setChecked(!cbSavePasswords.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rClearCacheExit(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cbClearCacheExit.setChecked(!cbClearCacheExit.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rThirdParty(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
cbThirdParty.setChecked(!cbThirdParty.isChecked());
|
||||
} else {
|
||||
Utils.showToast(mContext, mContext.getString(R.string.available_lollipop));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rClearHistoryExit(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cbClearHistoryExit.setChecked(!cbClearHistoryExit.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rClearCookiesExit(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cbClearCookiesExit.setChecked(!cbClearCookiesExit.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rClearHistory(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(PrivacySettingsActivity.this); // dialog
|
||||
builder.setTitle(getResources().getString(R.string.title_clear_history));
|
||||
builder.setMessage(getResources().getString(R.string.dialog_history))
|
||||
.setPositiveButton(getResources().getString(R.string.action_yes),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
Thread clear = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
clearHistory();
|
||||
}
|
||||
|
||||
});
|
||||
clear.start();
|
||||
}
|
||||
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_no),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}).show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rClearCookies(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(PrivacySettingsActivity.this); // dialog
|
||||
builder.setTitle(getResources().getString(R.string.title_clear_cookies));
|
||||
builder.setMessage(getResources().getString(R.string.dialog_cookies))
|
||||
.setPositiveButton(getResources().getString(R.string.action_yes),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
Thread clear = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
clearCookies();
|
||||
}
|
||||
|
||||
});
|
||||
clear.start();
|
||||
}
|
||||
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_no),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
|
||||
}
|
||||
|
||||
}).show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void rClearCache(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
clearCache();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void clearCache() {
|
||||
WebView webView = new WebView(this);
|
||||
webView.clearCache(true);
|
||||
webView.destroy();
|
||||
Utils.showToast(mContext, getResources().getString(R.string.message_cache_cleared));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void clearHistory() {
|
||||
deleteDatabase(HistoryDatabase.DATABASE_NAME);
|
||||
WebViewDatabase m = WebViewDatabase.getInstance(this);
|
||||
m.clearFormData();
|
||||
m.clearHttpAuthUsernamePassword();
|
||||
if (API < 18) {
|
||||
m.clearUsernamePassword();
|
||||
WebIconDatabase.getInstance().removeAllIcons();
|
||||
}
|
||||
if (mSystemBrowser) {
|
||||
try {
|
||||
Browser.clearHistory(getContentResolver());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
Utils.trimCache(this);
|
||||
messageHandler.sendEmptyMessage(1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void clearCookies() {
|
||||
// TODO Break out web storage deletion into its own option/action
|
||||
// TODO clear web storage for all sites that are visited in Incognito mode
|
||||
WebStorage storage = WebStorage.getInstance();
|
||||
storage.deleteAllData();
|
||||
CookieManager c = CookieManager.getInstance();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
c.removeAllCookies(null);
|
||||
} else {
|
||||
CookieSyncManager.createInstance(this);
|
||||
c.removeAllCookie();
|
||||
}
|
||||
messageHandler.sendEmptyMessage(2);
|
||||
}
|
||||
}
|
||||
@@ -3,51 +3,52 @@
|
||||
*/
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.ProxyUtils;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class SettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
private PreferenceManager mPreferences;
|
||||
private Context mContext;
|
||||
private Activity mActivity;
|
||||
private CharSequence[] mProxyChoices;
|
||||
private TextView mProxyChoiceName;
|
||||
private static List<String> fragments = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.settings);
|
||||
mContext = this;
|
||||
mActivity = this;
|
||||
init();
|
||||
// this is a workaround for the Toolbar in PreferenceActitivty
|
||||
ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
|
||||
LinearLayout content = (LinearLayout) root.getChildAt(0);
|
||||
LinearLayout toolbarContainer = (LinearLayout) View.inflate(this, R.layout.toolbar_settings, null);
|
||||
|
||||
root.removeAllViews();
|
||||
toolbarContainer.addView(content);
|
||||
root.addView(toolbarContainer);
|
||||
|
||||
// now we can set the Toolbar using AppCompatPreferenceActivity
|
||||
Toolbar toolbar = (Toolbar) toolbarContainer.findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBuildHeaders(List<Header> target) {
|
||||
loadHeadersFromResource(R.xml.preferences_headers, target);
|
||||
fragments.clear();
|
||||
for (Header header : target) {
|
||||
fragments.add(header.fragment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidFragment(String fragmentName) {
|
||||
return fragments.contains(fragmentName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,389 +56,4 @@ public class SettingsActivity extends ThemableSettingsActivity {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void init() {
|
||||
// set up ActionBar
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
// mPreferences storage
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
// initialize UI
|
||||
RelativeLayout layoutFlash = (RelativeLayout) findViewById(R.id.layoutFlash);
|
||||
RelativeLayout layoutBlockAds = (RelativeLayout) findViewById(R.id.layoutAdBlock);
|
||||
layoutBlockAds.setEnabled(Constants.FULL_VERSION);
|
||||
RelativeLayout layoutImages = (RelativeLayout) findViewById(R.id.layoutImages);
|
||||
RelativeLayout layoutEnableJS = (RelativeLayout) findViewById(R.id.layoutEnableJS);
|
||||
LinearLayout layoutProxyChoice = (LinearLayout) findViewById(R.id.layoutProxyChoice);
|
||||
RelativeLayout layoutColor = (RelativeLayout) findViewById(R.id.layoutColorMode);
|
||||
RelativeLayout layoutBookmarks = (RelativeLayout) findViewById(R.id.layoutBookmarks);
|
||||
|
||||
layoutBookmarks.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, BookmarkActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (API >= 19) {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
int flashNum = mPreferences.getFlashSupport();
|
||||
boolean imagesBool = mPreferences.getBlockImagesEnabled();
|
||||
boolean enableJSBool = mPreferences.getJavaScriptEnabled();
|
||||
|
||||
mProxyChoiceName = (TextView) findViewById(R.id.proxyChoiceName);
|
||||
mProxyChoices = this.getResources().getStringArray(R.array.proxy_choices_array);
|
||||
int choice = mPreferences.getProxyChoice();
|
||||
if (choice == Constants.PROXY_MANUAL)
|
||||
mProxyChoiceName.setText(mPreferences.getProxyHost() + ":" + mPreferences.getProxyPort());
|
||||
else
|
||||
mProxyChoiceName.setText(mProxyChoices[choice]);
|
||||
|
||||
CheckBox flash = (CheckBox) findViewById(R.id.cbFlash);
|
||||
CheckBox adblock = (CheckBox) findViewById(R.id.cbAdblock);
|
||||
adblock.setEnabled(Constants.FULL_VERSION);
|
||||
CheckBox images = (CheckBox) findViewById(R.id.cbImageBlock);
|
||||
CheckBox enablejs = (CheckBox) findViewById(R.id.cbJavascript);
|
||||
CheckBox color = (CheckBox) findViewById(R.id.cbColorMode);
|
||||
|
||||
images.setChecked(imagesBool);
|
||||
enablejs.setChecked(enableJSBool);
|
||||
if (flashNum > 0) {
|
||||
flash.setChecked(true);
|
||||
} else {
|
||||
flash.setChecked(false);
|
||||
}
|
||||
adblock.setChecked(mPreferences.getAdBlockEnabled());
|
||||
color.setChecked(mPreferences.getColorModeEnabled());
|
||||
|
||||
initCheckBox(flash, adblock, images, enablejs, color);
|
||||
clickListenerForCheckBoxes(layoutFlash, layoutBlockAds, layoutImages, layoutEnableJS,
|
||||
layoutProxyChoice, layoutColor, flash, adblock, images, enablejs, color);
|
||||
|
||||
RelativeLayout general = (RelativeLayout) findViewById(R.id.layoutGeneral);
|
||||
RelativeLayout display = (RelativeLayout) findViewById(R.id.layoutDisplay);
|
||||
RelativeLayout privacy = (RelativeLayout) findViewById(R.id.layoutPrivacy);
|
||||
RelativeLayout advanced = (RelativeLayout) findViewById(R.id.layoutAdvanced);
|
||||
RelativeLayout about = (RelativeLayout) findViewById(R.id.layoutAbout);
|
||||
|
||||
general(general);
|
||||
display(display);
|
||||
privacy(privacy);
|
||||
advanced(advanced);
|
||||
about(about);
|
||||
}
|
||||
|
||||
public void clickListenerForCheckBoxes(RelativeLayout layoutFlash,
|
||||
RelativeLayout layoutBlockAds, RelativeLayout layoutImages,
|
||||
RelativeLayout layoutEnableJS, LinearLayout layoutProxyChoice, RelativeLayout layoutColor,
|
||||
final CheckBox flash, final CheckBox adblock, final CheckBox images,
|
||||
final CheckBox enablejs, final CheckBox color) {
|
||||
layoutFlash.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (API < 19) {
|
||||
flash.setChecked(!flash.isChecked());
|
||||
} else {
|
||||
Utils.createInformativeDialog(mContext,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_dead));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
layoutBlockAds.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
adblock.setChecked(!adblock.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
layoutImages.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
images.setChecked(!images.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
layoutEnableJS.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
enablejs.setChecked(!enablejs.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
if (Constants.FULL_VERSION == false) {
|
||||
layoutProxyChoice.setEnabled(false);
|
||||
}
|
||||
layoutProxyChoice.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
proxyChoicePicker();
|
||||
}
|
||||
});
|
||||
layoutColor.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
color.setChecked(!color.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void initCheckBox(CheckBox flash, CheckBox adblock, CheckBox images, CheckBox enablejs,
|
||||
CheckBox color) {
|
||||
flash.setEnabled(API < 19);
|
||||
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
getFlashChoice();
|
||||
} else {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
|
||||
boolean flashInstalled = false;
|
||||
try {
|
||||
PackageManager pm = getPackageManager();
|
||||
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
|
||||
if (ai != null) {
|
||||
flashInstalled = true;
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
flashInstalled = false;
|
||||
}
|
||||
if (!flashInstalled && isChecked) {
|
||||
Utils.createInformativeDialog(SettingsActivity.this,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_not_installed));
|
||||
buttonView.setChecked(false);
|
||||
mPreferences.setFlashSupport(0);
|
||||
|
||||
} else if ((API >= 17) && isChecked) {
|
||||
Utils.createInformativeDialog(SettingsActivity.this,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_unsupported));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
adblock.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setAdBlockEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
images.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setBlockImagesEnabled(isChecked);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
enablejs.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setJavaScriptEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
color.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setColorModeEnabled(isChecked);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void getFlashChoice() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mContext.getResources().getString(R.string.title_flash));
|
||||
builder.setMessage(getResources().getString(R.string.flash))
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(getResources().getString(R.string.action_manual),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
mPreferences.setFlashSupport(1);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_auto),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setFlashSupport(2);
|
||||
}
|
||||
}).setOnCancelListener(new OnCancelListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
private void proxyChoicePicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||
picker.setTitle(getResources().getString(R.string.http_proxy));
|
||||
picker.setSingleChoiceItems(mProxyChoices, mPreferences.getProxyChoice(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setProxyChoice(which);
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
private void setProxyChoice(int choice) {
|
||||
ProxyUtils utils = ProxyUtils.getInstance(this);
|
||||
switch (choice) {
|
||||
case Constants.PROXY_ORBOT:
|
||||
choice = utils.setProxyChoice(choice, this);
|
||||
break;
|
||||
case Constants.PROXY_I2P:
|
||||
choice = utils.setProxyChoice(choice, this);
|
||||
break;
|
||||
case Constants.PROXY_MANUAL:
|
||||
manualProxyPicker();
|
||||
break;
|
||||
}
|
||||
|
||||
mPreferences.setProxyChoice(choice);
|
||||
if (choice < mProxyChoices.length)
|
||||
mProxyChoiceName.setText(mProxyChoices[choice]);
|
||||
}
|
||||
|
||||
public void manualProxyPicker() {
|
||||
View v = getLayoutInflater().inflate(R.layout.picker_manual_proxy, null);
|
||||
final EditText eProxyHost = (EditText) v.findViewById(R.id.proxyHost);
|
||||
final EditText eProxyPort = (EditText) v.findViewById(R.id.proxyPort);
|
||||
eProxyHost.setText(mPreferences.getProxyHost());
|
||||
eProxyPort.setText(Integer.toString(mPreferences.getProxyPort()));
|
||||
|
||||
new AlertDialog.Builder(mActivity)
|
||||
.setTitle(R.string.manual_proxy)
|
||||
.setView(v)
|
||||
.setPositiveButton(R.string.action_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
String proxyHost = eProxyHost.getText().toString();
|
||||
int proxyPort = Integer.parseInt(eProxyPort.getText().toString());
|
||||
mPreferences.setProxyHost(proxyHost);
|
||||
mPreferences.setProxyPort(proxyPort);
|
||||
mProxyChoiceName.setText(proxyHost + ":" + proxyPort);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
public void agentPicker() {
|
||||
final AlertDialog.Builder agentStringPicker = new AlertDialog.Builder(mActivity);
|
||||
|
||||
agentStringPicker.setTitle(getResources().getString(R.string.title_user_agent));
|
||||
final EditText getAgent = new EditText(this);
|
||||
getAgent.append(mPreferences.getUserAgentString(""));
|
||||
agentStringPicker.setView(getAgent);
|
||||
agentStringPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getAgent.getText().toString();
|
||||
mPreferences.setUserAgentString(text);
|
||||
getAgent.setText(getResources().getString(R.string.agent_custom));
|
||||
}
|
||||
});
|
||||
agentStringPicker.show();
|
||||
}
|
||||
|
||||
public void general(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, GeneralSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void display(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, DisplaySettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void privacy(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, PrivacySettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void advanced(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, AdvancedSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void about(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, AboutSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,11 @@ package acr.browser.lightning.activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public abstract class ThemableSettingsActivity extends AppCompatActivity {
|
||||
public abstract class ThemableSettingsActivity extends AppCompatPreferenceActivity {
|
||||
|
||||
private int mTheme;
|
||||
|
||||
@@ -34,7 +33,7 @@ public abstract class ThemableSettingsActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void restart() {
|
||||
public void restart() {
|
||||
final Bundle outState = new Bundle();
|
||||
onSaveInstanceState(outState);
|
||||
final Intent intent = new Intent(this, getClass());
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
public class AboutSettingsFragment extends PreferenceFragment {
|
||||
|
||||
private Activity mActivity;
|
||||
|
||||
private static final String SETTINGS_VERSION = "pref_version";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preference_about);
|
||||
|
||||
mActivity = getActivity();
|
||||
|
||||
Preference version = findPreference(SETTINGS_VERSION);
|
||||
version.setSummary(getVersion());
|
||||
}
|
||||
|
||||
private String getVersion() {
|
||||
try {
|
||||
PackageInfo p = mActivity.getPackageManager().getPackageInfo(mActivity.getPackageName(), 0);
|
||||
return p.versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return "1.0";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public class AdvancedSettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String SETTINGS_NEWWINDOW = "allow_new_window";
|
||||
private static final String SETTINGS_ENABLECOOKIES = "allow_cookies";
|
||||
private static final String SETTINGS_COOKIESINKOGNITO = "incognito_cookies";
|
||||
private static final String SETTINGS_RESTORETABS = "restore_tabs";
|
||||
private static final String SETTINGS_RENDERINGMODE = "rendering_mode";
|
||||
private static final String SETTINGS_URLCONTENT = "url_contents";
|
||||
|
||||
private Activity mActivity;
|
||||
private PreferenceManager mPreferences;
|
||||
private CheckBoxPreference cbAllowPopups, cbenablecookies, cbcookiesInkognito, cbrestoreTabs;
|
||||
private Preference renderingmode, urlcontent;
|
||||
private CharSequence[] mUrlOptions;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preference_advanced);
|
||||
|
||||
mActivity = getActivity();
|
||||
|
||||
initPrefs();
|
||||
}
|
||||
|
||||
private void initPrefs() {
|
||||
// mPreferences storage
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
renderingmode = findPreference(SETTINGS_RENDERINGMODE);
|
||||
urlcontent = findPreference(SETTINGS_URLCONTENT);
|
||||
cbAllowPopups = (CheckBoxPreference) findPreference(SETTINGS_NEWWINDOW);
|
||||
cbenablecookies = (CheckBoxPreference) findPreference(SETTINGS_ENABLECOOKIES);
|
||||
cbcookiesInkognito = (CheckBoxPreference) findPreference(SETTINGS_COOKIESINKOGNITO);
|
||||
cbrestoreTabs = (CheckBoxPreference) findPreference(SETTINGS_RESTORETABS);
|
||||
|
||||
renderingmode.setOnPreferenceClickListener(this);
|
||||
urlcontent.setOnPreferenceClickListener(this);
|
||||
cbAllowPopups.setOnPreferenceChangeListener(this);
|
||||
cbenablecookies.setOnPreferenceChangeListener(this);
|
||||
cbcookiesInkognito.setOnPreferenceChangeListener(this);
|
||||
cbrestoreTabs.setOnPreferenceChangeListener(this);
|
||||
|
||||
switch (mPreferences.getRenderingMode()) {
|
||||
case 0:
|
||||
renderingmode.setSummary(getString(R.string.name_normal));
|
||||
break;
|
||||
case 1:
|
||||
renderingmode.setSummary(getString(R.string.name_inverted));
|
||||
break;
|
||||
case 2:
|
||||
renderingmode.setSummary(getString(R.string.name_grayscale));
|
||||
break;
|
||||
case 3:
|
||||
renderingmode.setSummary(getString(R.string.name_inverted_grayscale));
|
||||
break;
|
||||
}
|
||||
|
||||
mUrlOptions = getResources().getStringArray(R.array.url_content_array);
|
||||
int option = mPreferences.getUrlBoxContentChoice();
|
||||
urlcontent.setSummary(mUrlOptions[option]);
|
||||
|
||||
cbAllowPopups.setChecked(mPreferences.getPopupsEnabled());
|
||||
cbenablecookies.setChecked(mPreferences.getCookiesEnabled());
|
||||
cbcookiesInkognito.setChecked(mPreferences.getIncognitoCookiesEnabled());
|
||||
cbrestoreTabs.setChecked(mPreferences.getRestoreLostTabsEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_RENDERINGMODE:
|
||||
renderPicker();
|
||||
return true;
|
||||
case SETTINGS_URLCONTENT:
|
||||
urlBoxPicker();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
// switch preferences
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_NEWWINDOW:
|
||||
mPreferences.setPopupsEnabled((Boolean) newValue);
|
||||
cbAllowPopups.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_ENABLECOOKIES:
|
||||
mPreferences.setCookiesEnabled((Boolean) newValue);
|
||||
cbenablecookies.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_COOKIESINKOGNITO:
|
||||
mPreferences.setIncognitoCookiesEnabled((Boolean) newValue);
|
||||
cbcookiesInkognito.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_RESTORETABS:
|
||||
mPreferences.setRestoreLostTabsEnabled((Boolean) newValue);
|
||||
cbrestoreTabs.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.rendering_mode));
|
||||
CharSequence[] chars = {mActivity.getString(R.string.name_normal),
|
||||
mActivity.getString(R.string.name_inverted),
|
||||
mActivity.getString(R.string.name_grayscale),
|
||||
mActivity.getString(R.string.name_inverted_grayscale)};
|
||||
|
||||
int n = mPreferences.getRenderingMode();
|
||||
|
||||
picker.setSingleChoiceItems(chars, n, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setRenderingMode(which);
|
||||
switch (which) {
|
||||
case 0:
|
||||
renderingmode.setSummary(getString(R.string.name_normal));
|
||||
break;
|
||||
case 1:
|
||||
renderingmode.setSummary(getString(R.string.name_inverted));
|
||||
break;
|
||||
case 2:
|
||||
renderingmode.setSummary(getString(R.string.name_grayscale));
|
||||
break;
|
||||
case 3:
|
||||
renderingmode.setSummary(getString(R.string.name_inverted_grayscale));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
private void urlBoxPicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.url_contents));
|
||||
|
||||
int n = mPreferences.getUrlBoxContentChoice();
|
||||
|
||||
picker.setSingleChoiceItems(mUrlOptions, n, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setUrlBoxContentChoice(which);
|
||||
if (which < mUrlOptions.length) {
|
||||
urlcontent.setSummary(mUrlOptions[which]);
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.database.BookmarkManager;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public class BookmarkSettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener {
|
||||
|
||||
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 PreferenceManager mPreferences;
|
||||
private BookmarkManager mBookmarkManager;
|
||||
private File[] mFileList;
|
||||
private String[] mFileNameList;
|
||||
private static final File mPath = new File(Environment.getExternalStorageDirectory().toString());
|
||||
private static final int DIALOG_LOAD_FILE = 1000;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preference_bookmarks);
|
||||
|
||||
mActivity = getActivity();
|
||||
|
||||
mBookmarkManager = BookmarkManager.getInstance(mActivity);
|
||||
|
||||
initPrefs();
|
||||
}
|
||||
|
||||
private void initPrefs() {
|
||||
// mPreferences storage
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
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
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_EXPORT:
|
||||
mBookmarkManager.exportBookmarks();
|
||||
return true;
|
||||
case SETTINGS_IMPORT:
|
||||
loadFileList(null);
|
||||
onCreateDialog(DIALOG_LOAD_FILE);
|
||||
return true;
|
||||
case SETTINGS_BROWSER_IMPORT:
|
||||
mBookmarkManager.importBookmarksFromBrowser(mActivity);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void loadFileList(File path) {
|
||||
File file;
|
||||
if (path != null) {
|
||||
file = path;
|
||||
} else {
|
||||
file = mPath;
|
||||
}
|
||||
try {
|
||||
file.mkdirs();
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (file.exists()) {
|
||||
mFileList = file.listFiles();
|
||||
} else {
|
||||
mFileList = new File[0];
|
||||
}
|
||||
|
||||
Arrays.sort(mFileList, new SortName());
|
||||
|
||||
if (mFileList == null) {
|
||||
mFileNameList = new String[0];
|
||||
mFileList = new File[0];
|
||||
} else {
|
||||
mFileNameList = new String[mFileList.length];
|
||||
}
|
||||
for (int n = 0; n < mFileList.length; n++) {
|
||||
mFileNameList[n] = mFileList[n].getName();
|
||||
}
|
||||
}
|
||||
|
||||
private class SortName implements Comparator<File> {
|
||||
|
||||
@Override
|
||||
public int compare(File a, File b) {
|
||||
if (a.isDirectory() && b.isDirectory())
|
||||
return a.getName().compareTo(b.getName());
|
||||
|
||||
if (a.isDirectory())
|
||||
return -1;
|
||||
|
||||
if (b.isDirectory())
|
||||
return 1;
|
||||
|
||||
if (a.isFile() && b.isFile())
|
||||
return a.getName().compareTo(b.getName());
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
Dialog dialog;
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
|
||||
switch (id) {
|
||||
case DIALOG_LOAD_FILE:
|
||||
builder.setTitle(R.string.title_chooser);
|
||||
if (mFileList == null) {
|
||||
dialog = builder.create();
|
||||
return dialog;
|
||||
}
|
||||
builder.setItems(mFileNameList, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (mFileList[which].isDirectory()) {
|
||||
loadFileList(mFileList[which]);
|
||||
builder.setItems(mFileNameList, this);
|
||||
builder.show();
|
||||
} else {
|
||||
mBookmarkManager.importBookmarksFromFile(mFileList[which], mActivity);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
break;
|
||||
}
|
||||
dialog = builder.show();
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.activity.SettingsActivity;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public class DisplaySettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String SETTINGS_HIDESTATUSBAR = "fullScreenOption";
|
||||
private static final String SETTINGS_FULLSCREEN = "fullscreen";
|
||||
private static final String SETTINGS_VIEWPORT = "wideViewPort";
|
||||
private static final String SETTINGS_OVERVIEWMODE = "overViewMode";
|
||||
private static final String SETTINGS_REFLOW = "text_reflow";
|
||||
private static final String SETTINGS_THEME = "app_theme";
|
||||
private static final String SETTINGS_TEXTSIZE = "text_size";
|
||||
|
||||
private Activity mActivity;
|
||||
private PreferenceManager mPreferences;
|
||||
private CheckBoxPreference cbstatus, cbfullscreen, cbviewport, cboverview, cbreflow;
|
||||
private Preference theme, textsize;
|
||||
private String[] mThemeOptions;
|
||||
private int mCurrentTheme;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preference_display);
|
||||
|
||||
mActivity = getActivity();
|
||||
|
||||
initPrefs();
|
||||
}
|
||||
|
||||
private void initPrefs() {
|
||||
// mPreferences storage
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
mThemeOptions = this.getResources().getStringArray(R.array.themes);
|
||||
mCurrentTheme = mPreferences.getUseTheme();
|
||||
|
||||
theme = findPreference(SETTINGS_THEME);
|
||||
textsize = findPreference(SETTINGS_TEXTSIZE);
|
||||
cbstatus = (CheckBoxPreference) findPreference(SETTINGS_HIDESTATUSBAR);
|
||||
cbfullscreen = (CheckBoxPreference) findPreference(SETTINGS_FULLSCREEN);
|
||||
cbviewport = (CheckBoxPreference) findPreference(SETTINGS_VIEWPORT);
|
||||
cboverview = (CheckBoxPreference) findPreference(SETTINGS_OVERVIEWMODE);
|
||||
cbreflow = (CheckBoxPreference) findPreference(SETTINGS_REFLOW);
|
||||
|
||||
theme.setOnPreferenceClickListener(this);
|
||||
textsize.setOnPreferenceClickListener(this);
|
||||
cbstatus.setOnPreferenceChangeListener(this);
|
||||
cbfullscreen.setOnPreferenceChangeListener(this);
|
||||
cbviewport.setOnPreferenceChangeListener(this);
|
||||
cboverview.setOnPreferenceChangeListener(this);
|
||||
cbreflow.setOnPreferenceChangeListener(this);
|
||||
|
||||
cbstatus.setChecked(mPreferences.getHideStatusBarEnabled());
|
||||
cbfullscreen.setChecked(mPreferences.getFullScreenEnabled());
|
||||
cbviewport.setChecked(mPreferences.getUseWideViewportEnabled());
|
||||
cboverview.setChecked(mPreferences.getOverviewModeEnabled());
|
||||
cbreflow.setChecked(mPreferences.getTextReflowEnabled());
|
||||
|
||||
theme.setSummary(mThemeOptions[mPreferences.getUseTheme()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_THEME:
|
||||
themePicker();
|
||||
return true;
|
||||
case SETTINGS_TEXTSIZE:
|
||||
textSizePicker();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
// switch preferences
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_HIDESTATUSBAR:
|
||||
mPreferences.setHideStatusBarEnabled((Boolean) newValue);
|
||||
cbstatus.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_FULLSCREEN:
|
||||
mPreferences.setFullScreenEnabled((Boolean) newValue);
|
||||
cbfullscreen.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_VIEWPORT:
|
||||
mPreferences.setUseWideViewportEnabled((Boolean) newValue);
|
||||
cbviewport.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_OVERVIEWMODE:
|
||||
mPreferences.setOverviewModeEnabled((Boolean) newValue);
|
||||
cboverview.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_REFLOW:
|
||||
mPreferences.setTextReflowEnabled((Boolean) newValue);
|
||||
cbreflow.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void textSizePicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.title_text_size));
|
||||
|
||||
int n = mPreferences.getTextSize();
|
||||
|
||||
picker.setSingleChoiceItems(R.array.text_size, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setTextSize(which + 1);
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
private void themePicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.url_contents));
|
||||
|
||||
int n = mPreferences.getUseTheme();
|
||||
picker.setSingleChoiceItems(mThemeOptions, n, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setUseTheme(which);
|
||||
if (which < mThemeOptions.length) {
|
||||
theme.setSummary(mThemeOptions[which]);
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (mCurrentTheme != mPreferences.getUseTheme()) {
|
||||
((SettingsActivity) getActivity()).restart();
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
if (mCurrentTheme != mPreferences.getUseTheme()) {
|
||||
((SettingsActivity) getActivity()).restart();
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,592 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.ProxyUtils;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class GeneralSettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String SETTINGS_PROXY = "proxy";
|
||||
private static final String SETTINGS_FLASH = "cb_flash";
|
||||
private static final String SETTINGS_ADS = "cb_ads";
|
||||
private static final String SETTINGS_IMAGES = "cb_images";
|
||||
private static final String SETTINGS_JAVASCRIPT = "cb_javascript";
|
||||
private static final String SETTINGS_COLORMODE = "cb_colormode";
|
||||
private static final String SETTINGS_USERAGENT = "agent";
|
||||
private static final String SETTINGS_DOWNLOAD = "download";
|
||||
private static final String SETTINGS_HOME = "home";
|
||||
private static final String SETTINGS_SEARCHENGINE = "search";
|
||||
private static final String SETTINGS_GOOGLESUGGESTIONS = "google_suggestions";
|
||||
|
||||
private Activity mActivity;
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
private PreferenceManager mPreferences;
|
||||
private CharSequence[] mProxyChoices;
|
||||
private Preference proxy, useragent, downloadloc, home, searchengine;
|
||||
private String mDownloadLocation;
|
||||
private int mAgentChoice;
|
||||
private String mHomepage;
|
||||
private CheckBoxPreference cbFlash, cbAds, cbImages, cbJsScript, cbColorMode, cbgooglesuggest;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preference_general);
|
||||
|
||||
mActivity = getActivity();
|
||||
|
||||
initPrefs();
|
||||
}
|
||||
|
||||
private void initPrefs() {
|
||||
// mPreferences storage
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
proxy = findPreference(SETTINGS_PROXY);
|
||||
useragent = findPreference(SETTINGS_USERAGENT);
|
||||
downloadloc = findPreference(SETTINGS_DOWNLOAD);
|
||||
home = findPreference(SETTINGS_HOME);
|
||||
searchengine = findPreference(SETTINGS_SEARCHENGINE);
|
||||
cbFlash = (CheckBoxPreference) findPreference(SETTINGS_FLASH);
|
||||
cbAds = (CheckBoxPreference) findPreference(SETTINGS_ADS);
|
||||
cbImages = (CheckBoxPreference) findPreference(SETTINGS_IMAGES);
|
||||
cbJsScript = (CheckBoxPreference) findPreference(SETTINGS_JAVASCRIPT);
|
||||
cbColorMode = (CheckBoxPreference) findPreference(SETTINGS_COLORMODE);
|
||||
cbgooglesuggest = (CheckBoxPreference) findPreference(SETTINGS_GOOGLESUGGESTIONS);
|
||||
|
||||
proxy.setOnPreferenceClickListener(this);
|
||||
useragent.setOnPreferenceClickListener(this);
|
||||
downloadloc.setOnPreferenceClickListener(this);
|
||||
home.setOnPreferenceClickListener(this);
|
||||
searchengine.setOnPreferenceClickListener(this);
|
||||
cbFlash.setOnPreferenceChangeListener(this);
|
||||
cbAds.setOnPreferenceChangeListener(this);
|
||||
cbImages.setOnPreferenceChangeListener(this);
|
||||
cbJsScript.setOnPreferenceChangeListener(this);
|
||||
cbColorMode.setOnPreferenceChangeListener(this);
|
||||
cbgooglesuggest.setOnPreferenceChangeListener(this);
|
||||
|
||||
mAgentChoice = mPreferences.getUserAgentChoice();
|
||||
mHomepage = mPreferences.getHomepage();
|
||||
mDownloadLocation = mPreferences.getDownloadDirectory();
|
||||
mProxyChoices = getResources().getStringArray(R.array.proxy_choices_array);
|
||||
|
||||
int choice = mPreferences.getProxyChoice();
|
||||
if (choice == Constants.PROXY_MANUAL) {
|
||||
proxy.setSummary(mPreferences.getProxyHost() + ":" + mPreferences.getProxyPort());
|
||||
} else {
|
||||
proxy.setSummary(mProxyChoices[choice]);
|
||||
}
|
||||
|
||||
if (API >= 19) {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
|
||||
setSearchEngineSummary(mPreferences.getSearchChoice());
|
||||
|
||||
downloadloc.setSummary(Constants.EXTERNAL_STORAGE + '/' + mDownloadLocation);
|
||||
|
||||
if (mHomepage.contains("about:home")) {
|
||||
home.setSummary(getResources().getString(R.string.action_homepage));
|
||||
} else if (mHomepage.contains("about:blank")) {
|
||||
home.setSummary(getResources().getString(R.string.action_blank));
|
||||
} else if (mHomepage.contains("about:bookmarks")) {
|
||||
home.setSummary(getResources().getString(R.string.action_bookmarks));
|
||||
} else {
|
||||
home.setSummary(mHomepage);
|
||||
}
|
||||
|
||||
switch (mAgentChoice) {
|
||||
case 1:
|
||||
useragent.setSummary(getResources().getString(R.string.agent_default));
|
||||
break;
|
||||
case 2:
|
||||
useragent.setSummary(getResources().getString(R.string.agent_desktop));
|
||||
break;
|
||||
case 3:
|
||||
useragent.setSummary(getResources().getString(R.string.agent_mobile));
|
||||
break;
|
||||
case 4:
|
||||
useragent.setSummary(getResources().getString(R.string.agent_custom));
|
||||
}
|
||||
|
||||
int flashNum = mPreferences.getFlashSupport();
|
||||
boolean imagesBool = mPreferences.getBlockImagesEnabled();
|
||||
boolean enableJSBool = mPreferences.getJavaScriptEnabled();
|
||||
|
||||
proxy.setEnabled(Constants.FULL_VERSION);
|
||||
cbAds.setEnabled(Constants.FULL_VERSION);
|
||||
cbFlash.setEnabled(API < 19);
|
||||
|
||||
cbImages.setChecked(imagesBool);
|
||||
cbJsScript.setChecked(enableJSBool);
|
||||
cbFlash.setChecked(flashNum > 0);
|
||||
cbAds.setChecked(Constants.FULL_VERSION && mPreferences.getAdBlockEnabled());
|
||||
cbColorMode.setChecked(mPreferences.getColorModeEnabled());
|
||||
cbgooglesuggest.setChecked(mPreferences.getGoogleSearchSuggestionsEnabled());
|
||||
}
|
||||
|
||||
public void searchUrlPicker() {
|
||||
final AlertDialog.Builder urlPicker = new AlertDialog.Builder(mActivity);
|
||||
urlPicker.setTitle(getResources().getString(R.string.custom_url));
|
||||
final EditText getSearchUrl = new EditText(mActivity);
|
||||
String mSearchUrl = mPreferences.getSearchUrl();
|
||||
getSearchUrl.setText(mSearchUrl);
|
||||
urlPicker.setView(getSearchUrl);
|
||||
urlPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getSearchUrl.getText().toString();
|
||||
mPreferences.setSearchUrl(text);
|
||||
searchengine.setSummary(getResources().getString(R.string.custom_url) + ": "
|
||||
+ text);
|
||||
}
|
||||
});
|
||||
urlPicker.show();
|
||||
}
|
||||
|
||||
private void getFlashChoice() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mActivity.getResources().getString(R.string.title_flash));
|
||||
builder.setMessage(getResources().getString(R.string.flash))
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(getResources().getString(R.string.action_manual),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
mPreferences.setFlashSupport(1);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_auto),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setFlashSupport(2);
|
||||
}
|
||||
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
private void proxyChoicePicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.http_proxy));
|
||||
picker.setSingleChoiceItems(mProxyChoices, mPreferences.getProxyChoice(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setProxyChoice(which);
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
private void setProxyChoice(int choice) {
|
||||
ProxyUtils utils = ProxyUtils.getInstance(mActivity);
|
||||
switch (choice) {
|
||||
case Constants.PROXY_ORBOT:
|
||||
choice = utils.setProxyChoice(choice, mActivity);
|
||||
break;
|
||||
case Constants.PROXY_I2P:
|
||||
choice = utils.setProxyChoice(choice, mActivity);
|
||||
break;
|
||||
case Constants.PROXY_MANUAL:
|
||||
manualProxyPicker();
|
||||
break;
|
||||
}
|
||||
|
||||
mPreferences.setProxyChoice(choice);
|
||||
if (choice < mProxyChoices.length)
|
||||
proxy.setSummary(mProxyChoices[choice]);
|
||||
}
|
||||
|
||||
public void manualProxyPicker() {
|
||||
View v = mActivity.getLayoutInflater().inflate(R.layout.picker_manual_proxy, null);
|
||||
final EditText eProxyHost = (EditText) v.findViewById(R.id.proxyHost);
|
||||
final EditText eProxyPort = (EditText) v.findViewById(R.id.proxyPort);
|
||||
eProxyHost.setText(mPreferences.getProxyHost());
|
||||
eProxyPort.setText(Integer.toString(mPreferences.getProxyPort()));
|
||||
|
||||
new AlertDialog.Builder(mActivity)
|
||||
.setTitle(R.string.manual_proxy)
|
||||
.setView(v)
|
||||
.setPositiveButton(R.string.action_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
String proxyHost = eProxyHost.getText().toString();
|
||||
int proxyPort = Integer.parseInt(eProxyPort.getText().toString());
|
||||
mPreferences.setProxyHost(proxyHost);
|
||||
mPreferences.setProxyPort(proxyPort);
|
||||
proxy.setSummary(proxyHost + ":" + proxyPort);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
public void searchDialog() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.title_search_engine));
|
||||
CharSequence[] chars = {getResources().getString(R.string.custom_url), "Google",
|
||||
"Ask", "Bing", "Yahoo", "StartPage", "StartPage (Mobile)",
|
||||
"DuckDuckGo (Privacy)", "DuckDuckGo Lite (Privacy)", "Baidu (Chinese)",
|
||||
"Yandex (Russian)"};
|
||||
|
||||
int n = mPreferences.getSearchChoice();
|
||||
|
||||
picker.setSingleChoiceItems(chars, n, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setSearchChoice(which);
|
||||
setSearchEngineSummary(which);
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
public void homepageDialog() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.home));
|
||||
mHomepage = mPreferences.getHomepage();
|
||||
int n;
|
||||
if (mHomepage.contains("about:home")) {
|
||||
n = 1;
|
||||
} else if (mHomepage.contains("about:blank")) {
|
||||
n = 2;
|
||||
} else if (mHomepage.contains("about:bookmarks")) {
|
||||
n = 3;
|
||||
} else {
|
||||
n = 4;
|
||||
}
|
||||
|
||||
picker.setSingleChoiceItems(R.array.homepage, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
mPreferences.setHomepage("about:home");
|
||||
home.setSummary(getResources().getString(R.string.action_homepage));
|
||||
break;
|
||||
case 2:
|
||||
mPreferences.setHomepage("about:blank");
|
||||
home.setSummary(getResources().getString(R.string.action_blank));
|
||||
break;
|
||||
case 3:
|
||||
mPreferences.setHomepage("about:bookmarks");
|
||||
home.setSummary(getResources().getString(R.string.action_bookmarks));
|
||||
break;
|
||||
case 4:
|
||||
homePicker();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
public void homePicker() {
|
||||
final AlertDialog.Builder homePicker = new AlertDialog.Builder(mActivity);
|
||||
homePicker.setTitle(getResources().getString(R.string.title_custom_homepage));
|
||||
final EditText getHome = new EditText(mActivity);
|
||||
mHomepage = mPreferences.getHomepage();
|
||||
if (!mHomepage.startsWith("about:")) {
|
||||
getHome.setText(mHomepage);
|
||||
} else {
|
||||
getHome.setText("http://www.google.com");
|
||||
}
|
||||
homePicker.setView(getHome);
|
||||
homePicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getHome.getText().toString();
|
||||
mPreferences.setHomepage(text);
|
||||
home.setSummary(text);
|
||||
}
|
||||
});
|
||||
homePicker.show();
|
||||
}
|
||||
|
||||
public void downloadLocDialog() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(getResources().getString(R.string.title_download_location));
|
||||
mDownloadLocation = mPreferences.getDownloadDirectory();
|
||||
int n;
|
||||
if (mDownloadLocation.contains(Environment.DIRECTORY_DOWNLOADS)) {
|
||||
n = 1;
|
||||
} else {
|
||||
n = 2;
|
||||
}
|
||||
|
||||
picker.setSingleChoiceItems(R.array.download_folder, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
mPreferences.setDownloadDirectory(Environment.DIRECTORY_DOWNLOADS);
|
||||
downloadloc.setSummary(Constants.EXTERNAL_STORAGE + '/'
|
||||
+ Environment.DIRECTORY_DOWNLOADS);
|
||||
break;
|
||||
case 2:
|
||||
downPicker();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
public void agentDialog() {
|
||||
AlertDialog.Builder agentPicker = new AlertDialog.Builder(mActivity);
|
||||
agentPicker.setTitle(getResources().getString(R.string.title_user_agent));
|
||||
mAgentChoice = mPreferences.getUserAgentChoice();
|
||||
agentPicker.setSingleChoiceItems(R.array.user_agent, mAgentChoice - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setUserAgentChoice(which + 1);
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
useragent.setSummary(getResources().getString(R.string.agent_default));
|
||||
break;
|
||||
case 2:
|
||||
useragent.setSummary(getResources().getString(R.string.agent_desktop));
|
||||
break;
|
||||
case 3:
|
||||
useragent.setSummary(getResources().getString(R.string.agent_mobile));
|
||||
break;
|
||||
case 4:
|
||||
useragent.setSummary(getResources().getString(R.string.agent_custom));
|
||||
agentPicker();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
agentPicker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
agentPicker.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
Log.i("Cancelled", "");
|
||||
}
|
||||
});
|
||||
agentPicker.show();
|
||||
}
|
||||
|
||||
public void agentPicker() {
|
||||
final AlertDialog.Builder agentStringPicker = new AlertDialog.Builder(mActivity);
|
||||
agentStringPicker.setTitle(getResources().getString(R.string.title_user_agent));
|
||||
final EditText getAgent = new EditText(mActivity);
|
||||
agentStringPicker.setView(getAgent);
|
||||
agentStringPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getAgent.getText().toString();
|
||||
mPreferences.setUserAgentString(text);
|
||||
useragent.setSummary(getResources().getString(R.string.agent_custom));
|
||||
}
|
||||
});
|
||||
agentStringPicker.show();
|
||||
}
|
||||
|
||||
public void downPicker() {
|
||||
final AlertDialog.Builder downLocationPicker = new AlertDialog.Builder(mActivity);
|
||||
LinearLayout layout = new LinearLayout(mActivity);
|
||||
downLocationPicker.setTitle(getResources().getString(R.string.title_download_location));
|
||||
final EditText getDownload = new EditText(mActivity);
|
||||
getDownload.setText(mPreferences.getDownloadDirectory());
|
||||
|
||||
int padding = Utils.convertDpToPixels(10);
|
||||
|
||||
TextView v = new TextView(mActivity);
|
||||
v.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
||||
v.setTextColor(Color.DKGRAY);
|
||||
v.setText(Constants.EXTERNAL_STORAGE + '/');
|
||||
v.setPadding(padding, padding, 0, padding);
|
||||
layout.addView(v);
|
||||
layout.addView(getDownload);
|
||||
if (API < 16) {
|
||||
layout.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.edit_text));
|
||||
} else {
|
||||
layout.setBackground(getResources().getDrawable(android.R.drawable.edit_text));
|
||||
}
|
||||
downLocationPicker.setView(layout);
|
||||
downLocationPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getDownload.getText().toString();
|
||||
mPreferences.setDownloadDirectory(text);
|
||||
downloadloc.setSummary(Constants.EXTERNAL_STORAGE + '/' + text);
|
||||
}
|
||||
});
|
||||
downLocationPicker.show();
|
||||
}
|
||||
|
||||
private void setSearchEngineSummary(int which) {
|
||||
switch (which) {
|
||||
case 0:
|
||||
searchUrlPicker();
|
||||
break;
|
||||
case 1:
|
||||
searchengine.setSummary("Google");
|
||||
break;
|
||||
case 2:
|
||||
searchengine.setSummary("Ask");
|
||||
break;
|
||||
case 3:
|
||||
searchengine.setSummary("Bing");
|
||||
break;
|
||||
case 4:
|
||||
searchengine.setSummary("Yahoo");
|
||||
break;
|
||||
case 5:
|
||||
searchengine.setSummary("StartPage");
|
||||
break;
|
||||
case 6:
|
||||
searchengine.setSummary("StartPage (Mobile)");
|
||||
break;
|
||||
case 7:
|
||||
searchengine.setSummary("DuckDuckGo");
|
||||
break;
|
||||
case 8:
|
||||
searchengine.setSummary("DuckDuckGo Lite");
|
||||
break;
|
||||
case 9:
|
||||
searchengine.setSummary("Baidu");
|
||||
break;
|
||||
case 10:
|
||||
searchengine.setSummary("Yandex");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_PROXY:
|
||||
proxyChoicePicker();
|
||||
return true;
|
||||
case SETTINGS_USERAGENT:
|
||||
agentDialog();
|
||||
return true;
|
||||
case SETTINGS_DOWNLOAD:
|
||||
downloadLocDialog();
|
||||
return true;
|
||||
case SETTINGS_HOME:
|
||||
homepageDialog();
|
||||
return true;
|
||||
case SETTINGS_SEARCHENGINE:
|
||||
searchDialog();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
// switch preferences
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_FLASH:
|
||||
if (cbFlash.isChecked()) {
|
||||
getFlashChoice();
|
||||
} else {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
if (!Utils.isFlashInstalled(mActivity) && cbFlash.isChecked()) {
|
||||
Utils.createInformativeDialog(mActivity,
|
||||
mActivity.getResources().getString(R.string.title_warning),
|
||||
mActivity.getResources().getString(R.string.dialog_adobe_not_installed));
|
||||
cbFlash.setEnabled(false);
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
cbFlash.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_ADS:
|
||||
mPreferences.setAdBlockEnabled((Boolean) newValue);
|
||||
cbAds.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_IMAGES:
|
||||
mPreferences.setBlockImagesEnabled((Boolean) newValue);
|
||||
cbImages.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_JAVASCRIPT:
|
||||
mPreferences.setJavaScriptEnabled((Boolean) newValue);
|
||||
cbJsScript.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_COLORMODE:
|
||||
mPreferences.setColorModeEnabled((Boolean) newValue);
|
||||
cbColorMode.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_GOOGLESUGGESTIONS:
|
||||
mPreferences.setGoogleSearchSuggestionsEnabled((Boolean) newValue);
|
||||
cbgooglesuggest.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Copyright 2014 A.C.R. Development
|
||||
*/
|
||||
package acr.browser.lightning.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.provider.Browser;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
import android.webkit.WebIconDatabase;
|
||||
import android.webkit.WebStorage;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewDatabase;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.database.HistoryDatabase;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class PrivacySettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String SETTINGS_LOCATION = "location";
|
||||
private static final String SETTINGS_THIRDPCOOKIES = "third_party";
|
||||
private static final String SETTINGS_SAVEPASSWORD = "password";
|
||||
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 int API = android.os.Build.VERSION.SDK_INT;
|
||||
private Activity mActivity;
|
||||
private PreferenceManager mPreferences;
|
||||
private CheckBoxPreference cblocation, cb3cookies, cbsavepasswords, cbcacheexit, cbhistoryexit,
|
||||
cbcookiesexit, cbsynchistory;
|
||||
private Preference clearcache, clearhistory, clearcookies;
|
||||
private boolean mSystemBrowser;
|
||||
private Handler messageHandler;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preference_privacy);
|
||||
|
||||
mActivity = getActivity();
|
||||
|
||||
initPrefs();
|
||||
}
|
||||
|
||||
private void initPrefs() {
|
||||
// mPreferences storage
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
mSystemBrowser = mPreferences.getSystemBrowserPresent();
|
||||
|
||||
clearcache = findPreference(SETTINGS_CLEARCACHE);
|
||||
clearhistory = findPreference(SETTINGS_CLEARHISTORY);
|
||||
clearcookies = findPreference(SETTINGS_CLEARCOOKIES);
|
||||
cblocation = (CheckBoxPreference) findPreference(SETTINGS_LOCATION);
|
||||
cb3cookies = (CheckBoxPreference) findPreference(SETTINGS_THIRDPCOOKIES);
|
||||
cbsavepasswords = (CheckBoxPreference) findPreference(SETTINGS_SAVEPASSWORD);
|
||||
cbcacheexit = (CheckBoxPreference) findPreference(SETTINGS_CACHEEXIT);
|
||||
cbhistoryexit = (CheckBoxPreference) findPreference(SETTINGS_HISTORYEXIT);
|
||||
cbcookiesexit = (CheckBoxPreference) findPreference(SETTINGS_COOKIEEXIT);
|
||||
cbsynchistory = (CheckBoxPreference) findPreference(SETTINGS_SYNCHISTORY);
|
||||
|
||||
clearcache.setOnPreferenceClickListener(this);
|
||||
clearhistory.setOnPreferenceClickListener(this);
|
||||
clearcookies.setOnPreferenceClickListener(this);
|
||||
cblocation.setOnPreferenceChangeListener(this);
|
||||
cb3cookies.setOnPreferenceChangeListener(this);
|
||||
cbsavepasswords.setOnPreferenceChangeListener(this);
|
||||
cbcacheexit.setOnPreferenceChangeListener(this);
|
||||
cbhistoryexit.setOnPreferenceChangeListener(this);
|
||||
cbcookiesexit.setOnPreferenceChangeListener(this);
|
||||
cbsynchistory.setOnPreferenceChangeListener(this);
|
||||
|
||||
cblocation.setChecked(mPreferences.getLocationEnabled());
|
||||
cbsavepasswords.setChecked(mPreferences.getSavePasswordsEnabled());
|
||||
cbcacheexit.setChecked(mPreferences.getClearCacheExit());
|
||||
cbhistoryexit.setChecked(mPreferences.getClearHistoryExitEnabled());
|
||||
cbcookiesexit.setChecked(mPreferences.getClearCookiesExitEnabled());
|
||||
cb3cookies.setChecked(mPreferences.getBlockThirdPartyCookiesEnabled());
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
private static class MessageHandler extends Handler {
|
||||
|
||||
final Context mHandlerContext;
|
||||
|
||||
public MessageHandler(Context context) {
|
||||
this.mHandlerContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
Utils.showToast(mHandlerContext, mHandlerContext.getResources()
|
||||
.getString(R.string.message_clear_history));
|
||||
break;
|
||||
case 2:
|
||||
Utils.showToast(mHandlerContext, mHandlerContext.getResources().getString(
|
||||
R.string.message_cookies_cleared));
|
||||
break;
|
||||
}
|
||||
super.handleMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_CLEARCACHE:
|
||||
clearCache();
|
||||
return true;
|
||||
case SETTINGS_CLEARHISTORY:
|
||||
clearHistoryDialog();
|
||||
return true;
|
||||
case SETTINGS_CLEARCOOKIES:
|
||||
clearCookiesDialog();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void clearHistoryDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(getResources().getString(R.string.title_clear_history));
|
||||
builder.setMessage(getResources().getString(R.string.dialog_history))
|
||||
.setPositiveButton(getResources().getString(R.string.action_yes),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
Thread clear = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clearHistory();
|
||||
}
|
||||
});
|
||||
clear.start();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_no),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
private void clearCookiesDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(getResources().getString(R.string.title_clear_cookies));
|
||||
builder.setMessage(getResources().getString(R.string.dialog_cookies))
|
||||
.setPositiveButton(getResources().getString(R.string.action_yes),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
Thread clear = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clearCookies();
|
||||
}
|
||||
});
|
||||
clear.start();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_no),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
private void clearCache() {
|
||||
WebView webView = new WebView(mActivity);
|
||||
webView.clearCache(true);
|
||||
webView.destroy();
|
||||
Utils.showToast(mActivity, getResources().getString(R.string.message_cache_cleared));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void clearHistory() {
|
||||
mActivity.deleteDatabase(HistoryDatabase.DATABASE_NAME);
|
||||
WebViewDatabase m = WebViewDatabase.getInstance(mActivity);
|
||||
m.clearFormData();
|
||||
m.clearHttpAuthUsernamePassword();
|
||||
if (API < 18) {
|
||||
m.clearUsernamePassword();
|
||||
WebIconDatabase.getInstance().removeAllIcons();
|
||||
}
|
||||
if (mSystemBrowser) {
|
||||
try {
|
||||
Browser.clearHistory(mActivity.getContentResolver());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
Utils.trimCache(mActivity);
|
||||
messageHandler.sendEmptyMessage(1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void clearCookies() {
|
||||
// TODO Break out web storage deletion into its own option/action
|
||||
// TODO clear web storage for all sites that are visited in Incognito mode
|
||||
WebStorage storage = WebStorage.getInstance();
|
||||
storage.deleteAllData();
|
||||
CookieManager c = CookieManager.getInstance();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
c.removeAllCookies(null);
|
||||
} else {
|
||||
CookieSyncManager.createInstance(mActivity);
|
||||
c.removeAllCookie();
|
||||
}
|
||||
messageHandler.sendEmptyMessage(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
// switch preferences
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_LOCATION:
|
||||
mPreferences.setLocationEnabled((Boolean) newValue);
|
||||
cblocation.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_THIRDPCOOKIES:
|
||||
mPreferences.setBlockThirdPartyCookiesEnabled((Boolean) newValue);
|
||||
cb3cookies.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_SAVEPASSWORD:
|
||||
mPreferences.setSavePasswordsEnabled((Boolean) newValue);
|
||||
cbsavepasswords.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_CACHEEXIT:
|
||||
mPreferences.setClearCacheExit((Boolean) newValue);
|
||||
cbcacheexit.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_HISTORYEXIT:
|
||||
mPreferences.setClearHistoryExitEnabled((Boolean) newValue);
|
||||
cbhistoryexit.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_COOKIEEXIT:
|
||||
mPreferences.setClearCookiesExitEnabled((Boolean) newValue);
|
||||
cbcookiesexit.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
case SETTINGS_SYNCHISTORY:
|
||||
mPreferences.setSyncHistoryEnabled((Boolean) newValue);
|
||||
cbsynchistory.setChecked((Boolean) newValue);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
@@ -20,17 +22,15 @@ import android.util.Log;
|
||||
import android.webkit.URLUtil;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.database.HistoryItem;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.download.DownloadHandler;
|
||||
|
||||
public final class Utils {
|
||||
@@ -63,11 +63,11 @@ public final class Utils {
|
||||
builder.setMessage(message)
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(context.getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
}
|
||||
});
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
@@ -114,26 +114,6 @@ public final class Utils {
|
||||
return url.substring(0, index + 2);
|
||||
}
|
||||
|
||||
public static List<HistoryItem> getOldBookmarks(Context context) {
|
||||
List<HistoryItem> bookmarks = new ArrayList<>();
|
||||
File bookUrl = new File(context.getFilesDir(), "bookurl");
|
||||
File book = new File(context.getFilesDir(), "bookmarks");
|
||||
try {
|
||||
BufferedReader readUrl = new BufferedReader(new FileReader(bookUrl));
|
||||
BufferedReader readBook = new BufferedReader(new FileReader(book));
|
||||
String u, t;
|
||||
while ((u = readUrl.readLine()) != null && (t = readBook.readLine()) != null) {
|
||||
HistoryItem map = new HistoryItem(u, t, R.drawable.ic_bookmark);
|
||||
bookmarks.add(map);
|
||||
}
|
||||
readBook.close();
|
||||
readUrl.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return bookmarks;
|
||||
}
|
||||
|
||||
public static String[] getArray(String input) {
|
||||
return input.split(Constants.SEPARATOR);
|
||||
}
|
||||
@@ -227,6 +207,19 @@ public final class Utils {
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean isFlashInstalled(Context context) {
|
||||
try {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
|
||||
if (ai != null) {
|
||||
return true;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Bitmap getWebpageBitmap(Resources resources, boolean dark) {
|
||||
if (dark) {
|
||||
if (mWebIconDark == null) {
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutSource"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/action_follow_me"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/isImportAvailable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/url_twitter"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutLicense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/licenses"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutVersion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/version"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/versionCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,267 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rAllowPopups"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/window"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/recommended"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbAllowPopups"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rAllowCookies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/cookies"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/recommended"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbAllowCookies"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rAllowIncognitoCookies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/incognito_cookies"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbAllowIncognitoCookies"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rRestoreTabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/restore"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbRestoreTabs"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutRendering"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/rendering_mode"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/renderText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rUrlBarContents"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/url_contents"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/urlText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/exportBackup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/export_bookmarks"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/importBackup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/import_backup"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/importFromBrowser"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/importbookmarks"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/isImportBrowserAvailable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/recommended"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,301 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rHideStatusBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/fullScreenOption"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbHideStatusBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rFullScreen"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/fullscreen"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbFullScreen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rTheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/theme"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewTheme"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="CURRENT THEME"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rWideViewPort"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/wideViewPort"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/recommended"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbWideViewPort"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rOverView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/overViewMode"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/recommended"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbOverView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rTextReflow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/reflow"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbTextReflow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rTextSize"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/size"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,238 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutUserAgent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/agent"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/agentText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutDownload"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/download"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/downloadText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutHomepage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/home"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/homepageText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/search"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/searchText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rGoogleSuggestions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/google_suggestions"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/powered_by_google"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbGoogleSuggestions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,200 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/browserLicense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/app_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/mpl_license"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/licenseAOSP"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/android_open_source_project"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/apache"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/licenseHosts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/hphosts_ad_server_list"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/freeware"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/licenseOrbot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/library_netcipher"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/license_gnu"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/licenseSnactory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/snacktory"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/apache"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/licenseJsoup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/jsoup"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/mit_license"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,378 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rLocation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/location"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbLocation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rThirdParty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/third_party"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbThirdParty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rSavePasswords"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/password"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/recommended"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSavePasswords"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rClearCacheExit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/cache"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbClearCacheExit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rClearHistoryExit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/clear_history_exit"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbClearHistoryExit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rClearCookiesExit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/clear_cookies_exit"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbClearCookiesExit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rBrowserHistory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="30dp"
|
||||
android:text="@string/sync_history"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/isBrowserAvailable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbBrowserHistory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rClearCache"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/clear_cache"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rClearHistory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/history"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rClearCookies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/clear_cookies"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,411 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutFlash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="60dp"
|
||||
android:text="@string/flash"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbFlash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutAdBlock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="60dp"
|
||||
android:text="@string/block_ads"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbAdblock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutImages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="60dp"
|
||||
android:text="@string/block"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbImageBlock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutEnableJS"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="60dp"
|
||||
android:text="@string/java"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbJavascript"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutColorMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="60dp"
|
||||
android:text="@string/color_mode"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbColorMode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutProxyChoice"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/http_proxy"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/proxyChoiceName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light"
|
||||
tools:text="Disabled" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutGeneral"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/settings_general"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutBookmarks"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/bookmark_settings"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutDisplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/settings_display"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutPrivacy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/settings_privacy"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutAdvanced"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/settings_advanced"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutAbout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/settings_about"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/isImportAvailable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/settings_about_explain"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,11 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?toolbarSettingsBackground"
|
||||
android:elevation="2dp"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
custom:contentInsetEnd="0dp"
|
||||
custom:contentInsetStart="0dp" />
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?toolbarSettingsBackground"
|
||||
android:elevation="2dp"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
custom:contentInsetEnd="0dp"
|
||||
custom:contentInsetStart="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_about">
|
||||
<Preference
|
||||
android:title="@string/action_follow_me"
|
||||
android:summary="@string/url_twitter">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="http://twitter.com/RestainoAnthony" />
|
||||
</Preference>
|
||||
<Preference
|
||||
android:title="@string/version"
|
||||
android:key="pref_version" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/licenses">
|
||||
<Preference
|
||||
android:title="@string/app_name"
|
||||
android:summary="@string/mpl_license">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="http://www.mozilla.org/MPL/2.0/" />
|
||||
</Preference>
|
||||
<Preference
|
||||
android:title="@string/android_open_source_project"
|
||||
android:summary="@string/apache">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="http://www.apache.org/licenses/LICENSE-2.0" />
|
||||
</Preference>
|
||||
<Preference
|
||||
android:title="@string/hphosts_ad_server_list"
|
||||
android:summary="@string/freeware">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="http://hosts-file.net/" />
|
||||
</Preference>
|
||||
<Preference
|
||||
android:title="@string/library_netcipher"
|
||||
android:summary="@string/license_gnu">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="http://www.gnu.org/licenses/lgpl.html" />
|
||||
</Preference>
|
||||
<Preference
|
||||
android:title="@string/snacktory"
|
||||
android:summary="@string/apache">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="http://www.apache.org/licenses/LICENSE-2.0" />
|
||||
</Preference>
|
||||
<Preference
|
||||
android:title="@string/jsoup"
|
||||
android:summary="@string/mit_license">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="http://jsoup.org/license" />
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_advanced">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="allow_new_window"
|
||||
android:title="@string/window"
|
||||
android:summary="@string/recommended" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="allow_cookies"
|
||||
android:title="@string/cookies"
|
||||
android:summary="@string/recommended" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="incognito_cookies"
|
||||
android:title="@string/incognito_cookies" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="restore_tabs"
|
||||
android:title="@string/restore" />
|
||||
<Preference
|
||||
android:key="rendering_mode"
|
||||
android:title="@string/rendering_mode" />
|
||||
<Preference
|
||||
android:key="url_contents"
|
||||
android:title="@string/url_contents" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/bookmark_settings">
|
||||
<Preference
|
||||
android:key="export_bookmark"
|
||||
android:title="@string/export_bookmarks" />
|
||||
<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>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_display">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="fullScreenOption"
|
||||
android:title="@string/fullScreenOption" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="fullscreen"
|
||||
android:title="@string/fullscreen" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="wideViewPort"
|
||||
android:title="@string/wideViewPort"
|
||||
android:summary="@string/recommended" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="overViewMode"
|
||||
android:title="@string/overViewMode"
|
||||
android:summary="@string/recommended" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="text_reflow"
|
||||
android:title="@string/reflow" />
|
||||
<Preference
|
||||
android:key="app_theme"
|
||||
android:title="@string/theme" />
|
||||
<Preference
|
||||
android:key="text_size"
|
||||
android:title="@string/title_text_size" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_general">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="cb_flash"
|
||||
android:title="@string/flash" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="cb_ads"
|
||||
android:title="@string/block_ads" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="cb_images"
|
||||
android:title="@string/block" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="cb_javascript"
|
||||
android:title="@string/java" />
|
||||
<Preference
|
||||
android:key="proxy"
|
||||
android:title="@string/http_proxy" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="cb_colormode"
|
||||
android:title="@string/color_mode" />
|
||||
<Preference
|
||||
android:key="agent"
|
||||
android:title="@string/agent" />
|
||||
<Preference
|
||||
android:key="download"
|
||||
android:title="@string/download" />
|
||||
<Preference
|
||||
android:key="home"
|
||||
android:title="@string/home" />
|
||||
<Preference
|
||||
android:key="search"
|
||||
android:title="@string/search" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="google_suggestions"
|
||||
android:title="@string/google_suggestions"
|
||||
android:summary="@string/powered_by_google" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_privacy">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="location"
|
||||
android:title="@string/location" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="third_party"
|
||||
android:title="@string/third_party" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="password"
|
||||
android:title="@string/password"
|
||||
android:summary="@string/recommended" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="clear_cache_exit"
|
||||
android:title="@string/cache" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="clear_history_exit"
|
||||
android:title="@string/clear_history_exit" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="clear_cookies_exit"
|
||||
android:title="@string/clear_cookies_exit" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="sync_history"
|
||||
android:title="@string/sync_history" />
|
||||
<Preference
|
||||
android:key="clear_cache"
|
||||
android:title="@string/clear_cache" />
|
||||
<Preference
|
||||
android:key="clear_history"
|
||||
android:title="@string/title_clear_history" />
|
||||
<Preference
|
||||
android:key="clear_cookies"
|
||||
android:title="@string/clear_cookies" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<header
|
||||
android:fragment="acr.browser.lightning.fragment.GeneralSettingsFragment"
|
||||
android:title="@string/settings_general" />
|
||||
<header
|
||||
android:fragment="acr.browser.lightning.fragment.BookmarkSettingsFragment"
|
||||
android:title="@string/bookmark_settings" />
|
||||
<header
|
||||
android:fragment="acr.browser.lightning.fragment.DisplaySettingsFragment"
|
||||
android:title="@string/settings_display" />
|
||||
<header
|
||||
android:fragment="acr.browser.lightning.fragment.PrivacySettingsFragment"
|
||||
android:title="@string/settings_privacy" />
|
||||
<header
|
||||
android:fragment="acr.browser.lightning.fragment.AdvancedSettingsFragment"
|
||||
android:title="@string/settings_advanced" />
|
||||
<header
|
||||
android:fragment="acr.browser.lightning.fragment.AboutSettingsFragment"
|
||||
android:title="@string/settings_about"
|
||||
android:summary="@string/settings_about_explain" />
|
||||
</preference-headers>
|
||||
Referência em uma Nova Issue
Bloquear um usuário