Browse Source

Merge pull request #369 from rishubil/dev

Add increase contrast filter
master
Anthony Restaino 9 years ago
parent
commit
a1978c73b8
  1. 9
      app/src/main/java/acr/browser/lightning/fragment/AdvancedSettingsFragment.java
  2. 13
      app/src/main/java/acr/browser/lightning/view/LightningView.java
  3. 1
      app/src/main/res/values-ko/strings.xml
  4. 1
      app/src/main/res/values/strings.xml

9
app/src/main/java/acr/browser/lightning/fragment/AdvancedSettingsFragment.java

@ -74,6 +74,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem @@ -74,6 +74,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
case 3:
renderingmode.setSummary(getString(R.string.name_inverted_grayscale));
break;
case 4:
renderingmode.setSummary(getString(R.string.name_increase_contrast));
break;
}
textEncoding.setSummary(mPreferenceManager.getTextEncoding());
@ -136,7 +139,8 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem @@ -136,7 +139,8 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
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)};
mActivity.getString(R.string.name_inverted_grayscale),
mActivity.getString(R.string.name_increase_contrast)};
int n = mPreferenceManager.getRenderingMode();
@ -157,6 +161,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem @@ -157,6 +161,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem
case 3:
renderingmode.setSummary(getString(R.string.name_inverted_grayscale));
break;
case 4:
renderingmode.setSummary(getString(R.string.name_increase_contrast));
break;
}
}
});

13
app/src/main/java/acr/browser/lightning/view/LightningView.java

@ -95,6 +95,12 @@ public class LightningView { @@ -95,6 +95,12 @@ public class LightningView {
0, 0, -1.0f, 0, 255, // blue
0, 0, 0, 1.0f, 0 // alpha
};
private static final float[] mIncreaseContrastColorArray = {
2.0f, 0, 0, 0, -160.f, // red
0, 2.0f, 0, 0, -160.f, // green
0, 0, 2.0f, 0, -160.f, // blue
0, 0, 0, 1.0f, 0 // alpha
};
private final WebViewHandler mWebViewHandler = new WebViewHandler(this);
private final Map<String, String> mRequestHeaders = new ArrayMap<>();
@ -688,6 +694,13 @@ public class LightningView { @@ -688,6 +694,13 @@ public class LightningView {
mInvertPage = true;
break;
case 4:
ColorMatrixColorFilter IncreaseHighContrast = new ColorMatrixColorFilter(
mIncreaseContrastColorArray);
mPaint.setColorFilter(IncreaseHighContrast);
setHardwareRendering();
break;
}
}

1
app/src/main/res/values-ko/strings.xml

@ -135,6 +135,7 @@ @@ -135,6 +135,7 @@
<string name="name_inverted">반전</string>
<string name="name_grayscale">그레이스케일</string>
<string name="name_inverted_grayscale">반전된 그레이스케일</string>
<string name="name_increase_contrast">대비 증가</string>
<string name="name_normal">보통</string>
<string name="sync_history">Google과 기록 동기화</string>
<string name="title_file_chooser">파일 선택기</string>

1
app/src/main/res/values/strings.xml

@ -177,6 +177,7 @@ @@ -177,6 +177,7 @@
<string name="name_inverted">Inverted</string>
<string name="name_grayscale">Grayscale</string>
<string name="name_inverted_grayscale">Inverted Grayscale</string>
<string name="name_increase_contrast">Increase Contrast</string>
<string name="name_normal">Normal</string>
<string name="sync_history">Sync history with Google</string>
<string name="title_file_chooser">File Chooser</string>

Loading…
Cancel
Save