diff --git a/res/layout/settings.xml b/res/layout/settings.xml
index 6dbe040..5edcd43 100644
--- a/res/layout/settings.xml
+++ b/res/layout/settings.xml
@@ -1,508 +1,540 @@
+
-
+ android:layout_height="wrap_content"
+ android:orientation="vertical" >
-
+ android:background="?android:attr/listChoiceBackgroundIndicator"
+ android:minHeight="60dp"
+ android:paddingBottom="10dp"
+ android:paddingRight="10dp"
+ android:paddingTop="10dp" >
+
+
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true" >
+
+
-
+
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true" >
+
+
-
+
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:orientation="vertical" >
-
-
-
+ android:paddingLeft="10dp"
+ android:text="Small Text"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/light" />
+
+
-
+
-
+
+
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:orientation="vertical" >
-
-
-
+ android:paddingLeft="10dp"
+ android:text="Small Text"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/light" />
+
+
-
+
-
+
+
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:orientation="vertical" >
-
-
-
+ android:paddingLeft="10dp"
+ android:text="Small Text"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/light" />
+
+
-
+
-
+
+
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:orientation="vertical" >
-
-
-
-
-
-
-
-
-
-
-
+ android:paddingLeft="10dp"
+ android:text="@string/search"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
-
-
-
-
-
-
-
+ android:paddingLeft="10dp"
+ android:text="Small Text"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/light" />
+
+
-
+
-
+
+
+ android:paddingLeft="10dp"
+ android:text="@string/rendering_mode"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
-
-
-
-
-
-
-
+
+
-
+
-
+
+
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:paddingLeft="10dp"
+ android:text="@string/advanced"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
-
-
-
-
-
-
-
+
-
+
-
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:orientation="vertical" >
-
-
-
-
-
-
-
-
-
-
-
-
+ android:paddingLeft="10dp"
+ android:text="@string/url_twitter"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/light" />
+
+
-
+
-
+
+
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:orientation="vertical" >
-
-
-
+ android:paddingLeft="10dp"
+ android:text="@string/licenses"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+
+
-
-
+
-
-
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:orientation="vertical" >
-
-
-
-
-
-
-
+ android:paddingLeft="10dp"
+ android:text="@string/version"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f8e7923..bb95ff1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -172,4 +172,10 @@
Freeware
Android Open Source Project
hpHosts Ad Server List
+ Reopened old tab
+ Rendering Mode
+ Inverted
+ Grayscale
+ Inverted Grayscale
+ Normal
diff --git a/src/acr/browser/lightning/LightningView.java b/src/acr/browser/lightning/LightningView.java
index 27f03cf..ec63272 100644
--- a/src/acr/browser/lightning/LightningView.java
+++ b/src/acr/browser/lightning/LightningView.java
@@ -266,6 +266,9 @@ public class LightningView {
} else if (mSettings == null) {
return;
}
+
+ setColorMode(mPreferences.getInt(PreferenceConstants.RENDERING_MODE, 0));
+
mSettings.setGeolocationEnabled(mPreferences
.getBoolean(PreferenceConstants.LOCATION, false));
if (API < 19) {
@@ -355,7 +358,6 @@ public class LightningView {
@SuppressWarnings("deprecation")
@SuppressLint({ "SetJavaScriptEnabled", "NewApi" })
public void initializeSettings(WebSettings settings, Context context) {
- this.setNormalRendering();
if (API < 18) {
settings.setAppCacheMaxSize(Long.MAX_VALUE);
}
@@ -432,7 +434,7 @@ public class LightningView {
public void setNormalRendering() {
mWebView.setLayerType(View.LAYER_TYPE_NONE, mPaint);
}
-
+
public void setSoftwareRendering() {
mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, mPaint);
}
@@ -441,18 +443,33 @@ public class LightningView {
switch (mode) {
case 0:
mPaint.setColorFilter(null);
+ setNormalRendering();
break;
case 1:
ColorMatrixColorFilter filterInvert = new ColorMatrixColorFilter(
mNegativeColorArray);
mPaint.setColorFilter(filterInvert);
+ setHardwareRendering();
break;
case 2:
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter filterGray = new ColorMatrixColorFilter(cm);
mPaint.setColorFilter(filterGray);
+ setHardwareRendering();
break;
+ case 3:
+ ColorMatrix matrix = new ColorMatrix();
+ matrix.set(mNegativeColorArray);
+ ColorMatrix matrixGray = new ColorMatrix();
+ matrixGray.setSaturation(0);
+ ColorMatrix concat = new ColorMatrix();
+ concat.setConcat(matrix, matrixGray);
+ ColorMatrixColorFilter filterInvertGray = new ColorMatrixColorFilter(concat);
+ mPaint.setColorFilter(filterInvertGray);
+ setHardwareRendering();
+ break;
+
}
}
diff --git a/src/acr/browser/lightning/SettingsActivity.java b/src/acr/browser/lightning/SettingsActivity.java
index 36bed09..966c5c0 100644
--- a/src/acr/browser/lightning/SettingsActivity.java
+++ b/src/acr/browser/lightning/SettingsActivity.java
@@ -33,29 +33,18 @@ import info.guardianproject.onionkit.ui.OrbotHelper;
public class SettingsActivity extends Activity {
private static int API = android.os.Build.VERSION.SDK_INT;
-
private SharedPreferences.Editor mEditPrefs;
-
private int mAgentChoice;
-
private String mHomepage;
-
private TextView mAgentTextView;
-
private TextView mDownloadTextView;
-
private int mEasterEggCounter;
-
private String mDownloadLocation;
-
private TextView mHomepageText;
-
private SharedPreferences mPreferences;
-
private TextView mSearchText;
-
+ private TextView mRenderText;
private Context mContext;
-
private Activity mActivity;
@Override
@@ -98,6 +87,7 @@ public class SettingsActivity extends Activity {
RelativeLayout layoutOrbot = (RelativeLayout) findViewById(R.id.layoutUseOrbot);
mSearchText = (TextView) findViewById(R.id.searchText);
+ mRenderText = (TextView) findViewById(R.id.renderText);
switch (mPreferences.getInt(PreferenceConstants.SEARCH, 1)) {
case 0:
@@ -134,6 +124,21 @@ public class SettingsActivity extends Activity {
mSearchText.setText("Yandex");
}
+ switch (mPreferences.getInt(PreferenceConstants.RENDERING_MODE, 0)) {
+ 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;
+ }
+
mAgentTextView = (TextView) findViewById(R.id.agentText);
mHomepageText = (TextView) findViewById(R.id.homepageText);
mDownloadTextView = (TextView) findViewById(R.id.downloadText);
@@ -244,6 +249,7 @@ public class SettingsActivity extends Activity {
advanced(advanced);
source(source);
search();
+ renderPicker();
easterEgg();
}
@@ -318,6 +324,57 @@ public class SettingsActivity extends Activity {
});
}
+ public void renderPicker() {
+ LinearLayout layout = (LinearLayout) findViewById(R.id.layoutRendering);
+ layout.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
+ 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.getInt(PreferenceConstants.RENDERING_MODE, 0);
+
+ picker.setSingleChoiceItems(chars, n, new DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ mEditPrefs.putInt(PreferenceConstants.RENDERING_MODE, which).apply();
+ 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();
+ }
+
+ });
+ }
+
public void searchUrlPicker() {
final AlertDialog.Builder urlPicker = new AlertDialog.Builder(this);