- // Filter the colors if `darkTheme` is `true`.
- if (MainWebViewActivity.darkTheme) {
- // Initialize `darkPaint`.
- Paint darkPaint = new Paint();
-
- // Setup a float array that inverts and tempers the colors (no hard whites or blacks).
- float[] darkFilterFloatArray = {
- -.8f, 0, 0, 0, 255, // Red.
- 0, -.8f, 0, 0, 255, // Green.
- 0, 0, -.8f, 0, 255, // Blue.
- 0, 0, 0, .8f, 0 // Alpha.
- };
-
- // Set `darkPaint` to use `darkFilterFloatArray`.
- darkPaint.setColorFilter(new ColorMatrixColorFilter(darkFilterFloatArray));
-
- // Apply `darkPaint` to `tabWebView`.
- tabWebView.setLayerType(View.LAYER_TYPE_HARDWARE, darkPaint);
- } else {
- // Reset `tabWebView` to use the normal colors.
- tabWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- }
-
- switch (tabNumber) {
- case 1:
- tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/about_permissions.html");
- break;
+ // Load the tabs according to the theme.
+ if (MainWebViewActivity.darkTheme) { // The dark theme is applied.
+ // Set the background color. We have to use the deprecated `.getColor()` until API >= 23.
+ //noinspection deprecation
+ tabWebView.setBackgroundColor(getResources().getColor(R.color.gray_850));