public void setStatusBarIconsTint(int iconTint) { if (mSettingsHelper.shouldLinkStatusBarAndNavBar() && !mKeyboardUp) { mNavigationBarIconTint = iconTint; setNavigationBarIconTint(iconTint, true); } if (mSettingsHelper.shouldForceWhiteTintWithOverlay()) { iconTint = Color.parseColor("#ccffffff"); } mColorForStatusIcons = iconTint; try { if (mSystemIconViews != null) { for (ImageView view : mSystemIconViews) { if (view != null) { view.setColorFilter(iconTint, mSettingsHelper.getSystemIconCfType()); } else { mSystemIconViews.remove(view); } } } if (mNotificationIconViews != null) { for (ImageView view : mNotificationIconViews) { if (view != null) { view.setColorFilter(iconTint, mSettingsHelper.getNotificationIconCfType()); } else { mNotificationIconViews.remove(view); } } } if (mTextLabels != null) { for (TextView view : mTextLabels) { if (view != null) { view.setTextColor(iconTint); } else { mTextLabels.remove(view); } } } if (mStatusBarView != null) { Intent intent = new Intent("gravitybox.intent.action.STATUSBAR_COLOR_CHANGED"); intent.putExtra("iconColorEnable", true); intent.putExtra("iconColor", iconTint); mStatusBarView.getContext().sendBroadcast(intent); } } catch (Exception e) { e.printStackTrace(); } setColorForLayout(mStatusIcons, iconTint, mSettingsHelper.getNotificationIconCfType()); setKitKatBatteryColor(iconTint); }
@SuppressLint("NewApi") private void setNavigationBarTint(final int tintColor, boolean force) { if (mNavigationBarView == null) return; if (mSettingsHelper.shouldLinkStatusBarAndNavBar() && !force) { log("Ignoring manual navigation bar color change cause we're linked"); return; } log("Setting navigation bar color to " + tintColor); if (mSettingsHelper.animateStatusBarTintChange()) { if (tintColor != KITKAT_TRANSPARENT_COLOR) { ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), mLastSetNavBarTint, tintColor); colorAnimation.addUpdateListener( new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { mNavigationBarView.setBackgroundColor((Integer) animator.getAnimatedValue()); } }); colorAnimation.start(); } else { mNavigationBarView.setBackgroundColor(KITKAT_TRANSPARENT_COLOR); Utils.setViewBackground( mNavigationBarView, new BarBackgroundDrawable( mStatusBarView.getContext(), mResources, R.drawable.nav_background)); } } else { if (tintColor == KITKAT_TRANSPARENT_COLOR) { mNavigationBarView.setBackgroundColor(KITKAT_TRANSPARENT_COLOR); Utils.setViewBackground( mNavigationBarView, new BarBackgroundDrawable( mNavigationBarView.getContext(), mResources, R.drawable.nav_background)); } else { mNavigationBarView.setBackgroundColor(tintColor); } } if (mNavigationBarView != null && tintColor != KITKAT_TRANSPARENT_COLOR) { Intent intent = new Intent("gravitybox.intent.action.ACTION_NAVBAR_CHANGED"); intent.putExtra("navbarBgColor", tintColor); intent.putExtra("navbarColorEnable", true); mNavigationBarView.getContext().sendBroadcast(intent); } mLastSetNavBarTint = tintColor; }
@SuppressLint("NewApi") public void setStatusBarTint(final int tintColor) { if (mStatusBarView == null) return; log("Setting statusbar color to " + tintColor); if (mSettingsHelper.animateStatusBarTintChange()) { int animateFrom = mLastSetColor == KITKAT_TRANSPARENT_COLOR ? Color.TRANSPARENT : mLastSetColor; int animateTo = tintColor == KITKAT_TRANSPARENT_COLOR ? Color.TRANSPARENT : tintColor; ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), animateFrom, animateTo); colorAnimation.addUpdateListener( new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { mGradientDrawable.setColor((Integer) animator.getAnimatedValue()); } }); Utils.setViewBackground(mStatusBarView, mGradientDrawable); mGradientDrawable.setMode(mSettingsHelper.getOverlayMode()); colorAnimation.start(); } else { mStatusBarView.setAlpha(1f); if (tintColor == KITKAT_TRANSPARENT_COLOR) { Utils.setViewBackground(mStatusBarView, mGradientDrawable); mGradientDrawable.setColor(Color.TRANSPARENT); mGradientDrawable.setMode(mSettingsHelper.getOverlayMode()); } else { Utils.setViewBackground(mStatusBarView, mGradientDrawable); mGradientDrawable.setColor(tintColor); mGradientDrawable.setMode(mSettingsHelper.getOverlayMode()); } } mLastSetColor = tintColor; if (mSettingsHelper.shouldLinkStatusBarAndNavBar() && !mKeyboardUp) { mNavigationBarTint = tintColor; setNavigationBarTint(tintColor, true); } }
private void setNavigationBarIconTint(final int tintColor, boolean force) { if (mNavigationBarView == null) return; if (mSettingsHelper.shouldLinkStatusBarAndNavBar() && !force) { return; } ImageView recentsButton = null; ImageView menuButton = null; ImageView backButton = null; ImageView homeButton = null; /* LG BUTTONS */ ImageView qmemoButton = null; ImageView notificationButton = null; Class<?> NavbarEditor = null; try { NavbarEditor = getObjectField(mNavigationBarView, "mEditBar").getClass(); } catch (NoSuchFieldError e) { } try { recentsButton = (ImageView) XposedHelpers.callMethod(mNavigationBarView, "getRecentsButton"); } catch (NoSuchMethodError e) { try { if (NavbarEditor != null) { recentsButton = (ImageView) mNavigationBarView.findViewWithTag( getStaticObjectField(NavbarEditor, "NAVBAR_RECENT")); } } catch (NoSuchFieldError e1) { e1.printStackTrace(); } } try { menuButton = (ImageView) XposedHelpers.callMethod(mNavigationBarView, "getMenuButton"); } catch (NoSuchMethodError e) { try { if (NavbarEditor != null) { menuButton = (ImageView) mNavigationBarView.findViewWithTag( getStaticObjectField(NavbarEditor, "NAVBAR_ALWAYS_MENU")); } } catch (NoSuchFieldError e1) { e1.printStackTrace(); } } try { backButton = (ImageView) XposedHelpers.callMethod(mNavigationBarView, "getBackButton"); } catch (NoSuchMethodError e) { try { backButton = (ImageView) mNavigationBarView.findViewWithTag( getStaticObjectField(NavbarEditor, "NAVBAR_BACK")); } catch (NoSuchFieldError e1) { e1.printStackTrace(); } } try { homeButton = (ImageView) XposedHelpers.callMethod(mNavigationBarView, "getHomeButton"); } catch (NoSuchMethodError e) { try { homeButton = (ImageView) mNavigationBarView.findViewWithTag( getStaticObjectField(NavbarEditor, "NAVBAR_HOME")); } catch (NoSuchFieldError e1) { e1.printStackTrace(); } } /* LG BUTTONS*/ if (qmemoButtonRESID > 0) qmemoButton = (ImageView) mNavigationBarView.findViewById(qmemoButtonRESID); if (notificationButtonRESID > 0) notificationButton = (ImageView) mNavigationBarView.findViewById(notificationButtonRESID); if (recentsButton != null) recentsButton.setColorFilter(tintColor); if (menuButton != null) menuButton.setColorFilter(tintColor); if (backButton != null) backButton.setColorFilter(tintColor); if (homeButton != null) homeButton.setColorFilter(tintColor); if (qmemoButton != null) qmemoButton.setColorFilter(tintColor); if (notificationButton != null) notificationButton.setColorFilter(tintColor); if (mNavigationBarView != null) { Intent intent = new Intent("gravitybox.intent.action.ACTION_NAVBAR_CHANGED"); intent.putExtra("navbarKeyColor", tintColor); intent.putExtra("navbarColorEnable", true); mNavigationBarView.getContext().sendBroadcast(intent); } }