This commit is contained in:
Moez Bhatti
2015-12-06 22:36:56 -05:00
parent 9ac185998e
commit 20dadedd83
@@ -285,9 +285,7 @@ public class ThemeManager {
if (startColor != endColor) { if (startColor != endColor) {
ValueAnimator backgroundAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), startColor, endColor); ValueAnimator backgroundAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), startColor, endColor);
backgroundAnimation.setDuration(TRANSITION_LENGTH); backgroundAnimation.setDuration(TRANSITION_LENGTH);
backgroundAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { backgroundAnimation.addUpdateListener(animation -> {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int color = (Integer) animation.getAnimatedValue(); int color = (Integer) animation.getAnimatedValue();
if (fragment != null) { if (fragment != null) {
fragment.setBackgroundColor(color); fragment.setBackgroundColor(color);
@@ -295,7 +293,6 @@ public class ThemeManager {
background.setBackgroundColor(color); background.setBackgroundColor(color);
menu.setBackgroundColor(color); menu.setBackgroundColor(color);
content.setBackgroundColor(color); content.setBackgroundColor(color);
}
}); });
backgroundAnimation.addListener(new AnimatorListenerAdapter() { backgroundAnimation.addListener(new AnimatorListenerAdapter() {
@Override @Override
@@ -384,9 +381,7 @@ public class ThemeManager {
.setTitle(R.string.update_icon_title) .setTitle(R.string.update_icon_title)
.setMessage(R.string.update_icon_message) .setMessage(R.string.update_icon_message)
.setButtonBarOrientation(LinearLayout.VERTICAL) .setButtonBarOrientation(LinearLayout.VERTICAL)
.setPositiveButton(R.string.okay, new View.OnClickListener() { .setPositiveButton(R.string.okay, v -> {
@Override
public void onClick(View v) {
PackageManager packageManager = context.getPackageManager(); PackageManager packageManager = context.getPackageManager();
String[] colors = { String[] colors = {
@@ -428,7 +423,6 @@ public class ThemeManager {
Intent intent = new Intent(IconColorReceiver.ACTION_ICON_COLOR_CHANGED); Intent intent = new Intent(IconColorReceiver.ACTION_ICON_COLOR_CHANGED);
intent.putExtra(IconColorReceiver.EXTRA_COMPONENT_NAME, enabledComponent); intent.putExtra(IconColorReceiver.EXTRA_COMPONENT_NAME, enabledComponent);
context.sendBroadcast(intent); context.sendBroadcast(intent);
}
}) })
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show(); .show();
@@ -530,12 +524,9 @@ public class ThemeManager {
ColorPickerPalette palette = new ColorPickerPalette(context); ColorPickerPalette palette = new ColorPickerPalette(context);
palette.setGravity(Gravity.CENTER); palette.setGravity(Gravity.CENTER);
palette.init(19, 4, new ColorPickerSwatch.OnColorSelectedListener() { palette.init(19, 4, color -> {
@Override
public void onColorSelected(int color) {
showColourPickerDialog(context, color); showColourPickerDialog(context, color);
dialog.dismiss(); dialog.dismiss();
}
}); });
palette.drawPalette(PALETTE, getSwatchColour(sColor)); palette.drawPalette(PALETTE, getSwatchColour(sColor));
@@ -553,12 +544,9 @@ public class ThemeManager {
ColorPickerPalette palette = new ColorPickerPalette(context); ColorPickerPalette palette = new ColorPickerPalette(context);
palette.setGravity(Gravity.CENTER); palette.setGravity(Gravity.CENTER);
palette.init(getSwatch(swatchColour).length, 4, new ColorPickerSwatch.OnColorSelectedListener() { palette.init(getSwatch(swatchColour).length, 4, color -> {
@Override
public void onColorSelected(int color) {
setColour(color); setColour(color);
dialog.dismiss(); dialog.dismiss();
}
}); });
palette.drawPalette(getSwatch(swatchColour), sColor); palette.drawPalette(getSwatch(swatchColour), sColor);
@@ -578,12 +566,7 @@ public class ThemeManager {
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.setDuration(TRANSITION_LENGTH); colorAnimation.setDuration(TRANSITION_LENGTH);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { colorAnimation.addUpdateListener(animation -> mWindow.setStatusBarColor((Integer) animation.getAnimatedValue()));
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mWindow.setStatusBarColor((Integer) animation.getAnimatedValue());
}
});
colorAnimation.start(); colorAnimation.start();
} }
} }
@@ -624,20 +607,17 @@ public class ThemeManager {
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colourFrom, color); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colourFrom, color);
colorAnimation.setDuration(TRANSITION_LENGTH); colorAnimation.setDuration(TRANSITION_LENGTH);
colorAnimation.setInterpolator(new DecelerateInterpolator()); colorAnimation.setInterpolator(new DecelerateInterpolator());
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { colorAnimation.addUpdateListener(animation -> {
@Override int color1 = (Integer) animation.getAnimatedValue();
public void onAnimationUpdate(ValueAnimator animation) {
int color = (Integer) animation.getAnimatedValue();
if (mActivity != null) { if (mActivity != null) {
if (mActivity.getSupportActionBar() != null) { if (mActivity.getSupportActionBar() != null) {
mActivity.getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color)); mActivity.getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color1));
} }
} }
if (status_tint) { if (status_tint) {
mWindow.setStatusBarColor(color); mWindow.setStatusBarColor(color1);
}
} }
}); });
colorAnimation.addListener(new AnimatorListenerAdapter() { colorAnimation.addListener(new AnimatorListenerAdapter() {
@@ -658,13 +638,10 @@ public class ThemeManager {
ValueAnimator titleColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), title.getCurrentTextColor(), ThemeManager.sTextOnColorPrimary); ValueAnimator titleColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), title.getCurrentTextColor(), ThemeManager.sTextOnColorPrimary);
titleColorAnimation.setDuration(TRANSITION_LENGTH); titleColorAnimation.setDuration(TRANSITION_LENGTH);
titleColorAnimation.setInterpolator(new DecelerateInterpolator()); titleColorAnimation.setInterpolator(new DecelerateInterpolator());
titleColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { titleColorAnimation.addUpdateListener(animation -> {
@Override int color1 = (Integer) animation.getAnimatedValue();
public void onAnimationUpdate(ValueAnimator animation) { title.setTextColor(color1);
int color = (Integer) animation.getAnimatedValue(); mActivity.colorMenuIcons(mActivity.getMenu(), color1);
title.setTextColor(color);
mActivity.colorMenuIcons(mActivity.getMenu(), color);
}
}); });
titleColorAnimation.start(); titleColorAnimation.start();
} }