private void setKitKatBatteryColor(int iconColor) { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) return; if (mKitKatBatteryView == null) return; boolean debug = mSettingsHelper.isDebugMode(); try { final int[] colors = (int[]) XposedHelpers.getObjectField(mKitKatBatteryView, "mColors"); colors[colors.length - 1] = iconColor; XposedHelpers.setObjectField(mKitKatBatteryView, "mColors", colors); } catch (NoSuchFieldError e) { if (debug) e.printStackTrace(); } try { final Paint framePaint = (Paint) XposedHelpers.getObjectField(mKitKatBatteryView, "mFramePaint"); framePaint.setColor(iconColor); framePaint.setAlpha(100); } catch (NoSuchFieldError e) { if (debug) e.printStackTrace(); } try { final Paint boltPaint = (Paint) XposedHelpers.getObjectField(mKitKatBatteryView, "mBoltPaint"); boltPaint.setColor(Utils.getIconColorForColor(iconColor, Color.BLACK, Color.WHITE, 0.7f)); boltPaint.setAlpha(100); } catch (NoSuchFieldError e) { if (debug) e.printStackTrace(); } try { XposedHelpers.setIntField(mKitKatBatteryView, "mChargeColor", iconColor); } catch (NoSuchFieldError e) { /* Beanstalk, not sure why the ROM changed this */ try { XposedHelpers.setIntField(mKitKatBatteryView, "mBatteryColor", iconColor); } catch (NoSuchFieldError e1) { } if (debug) e.printStackTrace(); } mKitKatBatteryView.invalidate(); }
public void log(String text) { if (mSettingsHelper.isDebugMode()) XposedBridge.log("TintedStatusBar: " + text); }