package com.ceco.gm2.gravitybox;

import android.content.res.XModuleResources;
import android.content.res.XResources;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;

public class SystemWideResources {

    public static void initResources(final XSharedPreferences prefs) {
        try {
            XModuleResources modRes = XModuleResources.createInstance(GravityBox.MODULE_PATH, null);

            XResources.setSystemWideReplacement("android", "bool", "config_animateScreenLights", true);

            boolean holoBgDither = prefs.getBoolean(GravityBoxSettings.PREF_KEY_HOLO_BG_DITHER, false);
            if (prefs.getBoolean(GravityBoxSettings.PREF_KEY_HOLO_BG_SOLID_BLACK, false)) {
                XResources.setSystemWideReplacement(
                    "android", "drawable", "background_holo_dark", modRes.fwd(R.drawable.background_holo_dark_solid));
            } else if (holoBgDither) {
                XResources.setSystemWideReplacement(
                        "android", "drawable", "background_holo_dark", modRes.fwd(R.drawable.background_holo_dark));
            }
            if (holoBgDither) {
                XResources.setSystemWideReplacement(
                        "android", "drawable", "background_holo_light", modRes.fwd(R.drawable.background_holo_light));
            }
        } catch (Throwable t) {
            XposedBridge.log(t);
        }
    }

}

@@ -111,24 +111,50 @@
 Resources;%0D%0A
+import android.os.Build;%0D%0A
 import de.ro
@@ -464,24 +464,75 @@
 , null);%0D%0A%0D%0A
+            if (Build.VERSION.SDK_INT %3E 16) %7B%0D%0A    
             
@@ -623,16 +623,31 @@
  true);%0D
+%0A            %7D%0D
 %0A%0D%0A     

Enable animateScreenLights only for devices running 4.2+ animateScreenLights is needed for CRT effect which is not currently available for 4.1 devices, anyway... This fixes some weird display on/off issues on these devices.