Merge pull request #369 from rishubil/dev

Add increase contrast filter
This commit is contained in:
Anthony Restaino 2016-02-11 21:06:00 -05:00
commit a1978c73b8
4 changed files with 23 additions and 1 deletions

View File

@ -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
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
case 3:
renderingmode.setSummary(getString(R.string.name_inverted_grayscale));
break;
case 4:
renderingmode.setSummary(getString(R.string.name_increase_contrast));
break;
}
}
});

View File

@ -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 {
mInvertPage = true;
break;
case 4:
ColorMatrixColorFilter IncreaseHighContrast = new ColorMatrixColorFilter(
mIncreaseContrastColorArray);
mPaint.setColorFilter(IncreaseHighContrast);
setHardwareRendering();
break;
}
}

View File

@ -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>

View File

@ -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>