A lot of fixes and small changes

This commit is contained in:
Karim Abou Zeid 2015-05-29 21:24:11 +02:00
commit 865f72e5bb
33 changed files with 360 additions and 479 deletions

View file

@ -36,6 +36,8 @@ public final class PreferenceUtils {
public static final String TRANSPARENT_TOOLBAR = "transparent_toolbar";
public static final String ALBUM_GRID_COLUMNS = "album_grid_columns";
public static final String ALBUM_GRID_COLUMNS_LAND = "album_grid_columns_land";
public static final String OPAQUE_TOOLBAR_NOW_PLAYING = "opaque_toolbar_now_playing";
public static final String FORCE_SQUARE_ALBUM_ART = "force_square_album_art";
private static PreferenceUtils sInstance;
@ -79,7 +81,7 @@ public final class PreferenceUtils {
}
public int getThemeColorAccent() {
return mPreferences.getInt("accent_color", mContext.getResources().getColor(R.color.pink_500));
return mPreferences.getInt("accent_color", mContext.getResources().getColor(R.color.pink_A200));
}
@SuppressLint("CommitPrefEdits")
@ -163,6 +165,14 @@ public final class PreferenceUtils {
return mPreferences.getBoolean(TRANSPARENT_TOOLBAR, false);
}
public final boolean opaqueToolbarNowPlaying() {
return mPreferences.getBoolean(OPAQUE_TOOLBAR_NOW_PLAYING, false);
}
public final boolean forceAlbumArtSquared() {
return mPreferences.getBoolean(FORCE_SQUARE_ALBUM_ART, false);
}
// public final boolean downloadMissingArtistImages() {
// return mPreferences.getBoolean(DOWNLOAD_MISSING_ARTIST_IMAGES, true);
// }

View file

@ -8,6 +8,7 @@ import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.v4.content.ContextCompat;
import android.util.TypedValue;
@ -201,4 +202,8 @@ public class Util {
}
return drawable;
}
public static int getColorWithoutAlpha(@ColorInt int color) {
return color | 0xFF000000;
}
}

View file

@ -13,12 +13,15 @@ import android.widget.CheckBox;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.TextView;
import com.afollestad.materialdialogs.ThemeSingleton;
import com.afollestad.materialdialogs.internal.MDTintHelper;
import java.lang.reflect.Field;
import hugo.weaving.DebugLog;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
@ -84,6 +87,22 @@ public class ViewUtil {
animator.start();
}
@DebugLog
public static void animateTextColor(final TextView v, final int startColor, final int endColor) {
animateTextColor(v, startColor, endColor, DEFAULT_COLOR_ANIMATION_DURATION);
}
public static void animateTextColor(final TextView v, final int startColor, final int endColor, final int duration) {
ObjectAnimator animator = ObjectAnimator.ofObject(v, "textColor",
new ArgbEvaluator(), startColor, endColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
animator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
}
animator.setDuration(duration);
animator.start();
}
public static void setBackgroundAlpha(View view, float alpha, int baseColor) {
int a = Math.min(255, Math.max(0, (int) (alpha * 255))) << 24;
int rgb = 0x00ffffff & baseColor;