Browse Source

Add increase contrast filter

master
Nesswit 9 years ago
parent
commit
2e55ceba0c
  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

@ -73,6 +73,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem @@ -73,6 +73,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());
@ -135,7 +138,8 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem @@ -135,7 +138,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();
@ -156,6 +160,9 @@ public class AdvancedSettingsFragment extends LightningPreferenceFragment implem @@ -156,6 +160,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

@ -85,6 +85,12 @@ public class LightningView { @@ -85,6 +85,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<>();
@ -506,6 +512,13 @@ public class LightningView { @@ -506,6 +512,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

@ -175,6 +175,7 @@ @@ -175,6 +175,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