diff --git a/app/build.gradle b/app/build.gradle index 944276fd..8ddb3742 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,8 +27,8 @@ android { applicationId "com.kabouzeid.gramophone" minSdkVersion 16 targetSdkVersion 22 - versionCode 28 - versionName "0.9.12b DEV" + versionCode 29 + versionName "0.9.13b DEV" } compileOptions { @@ -55,12 +55,13 @@ dependencies { transitive = true; } - compile 'com.android.support:appcompat-v7:22.1.1@aar' - compile 'com.android.support:recyclerview-v7:22.1.1@aar' - compile 'com.android.support:gridlayout-v7:22.1.1@aar' - compile 'com.android.support:palette-v7:22.1.1@aar' - compile 'com.android.support:support-v13:22.1.1@aar' - compile 'com.android.support:cardview-v7:22.1.1@aar' + compile 'com.android.support:appcompat-v7:22.2.0@aar' + compile 'com.android.support:recyclerview-v7:22.2.0@aar' + compile 'com.android.support:gridlayout-v7:22.2.0@aar' + compile 'com.android.support:palette-v7:22.2.0@aar' + compile 'com.android.support:support-v13:22.2.0@aar' + compile 'com.android.support:cardview-v7:22.2.0@aar' + compile 'com.android.support:design:22.2.0@aar' compile 'com.github.ksoichiro:android-observablescrollview:1.5.1' compile 'asia.ivity.android:drag-sort-listview:1.0' @@ -76,5 +77,4 @@ dependencies { compile 'com.afollestad:material-cab:0.1.2' compile 'com.jpardogo.materialtabstrip:library:1.0.9' compile 'com.readystatesoftware.systembartint:systembartint:1.0.3' - compile 'com.melnykov:floatingactionbutton:1.3.0' } diff --git a/app/src/main/java/com/kabouzeid/gramophone/adapter/AlbumAdapter.java b/app/src/main/java/com/kabouzeid/gramophone/adapter/AlbumAdapter.java index a59c5080..ae37ce30 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/adapter/AlbumAdapter.java +++ b/app/src/main/java/com/kabouzeid/gramophone/adapter/AlbumAdapter.java @@ -204,9 +204,9 @@ public class AlbumAdapter extends AbsMultiSelectAdapter= Build.VERSION_CODES.LOLLIPOP) { - seekBar.setThumbTintList(s1); - seekBar.setProgressTintList(s1); - } else { - seekBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) - seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN); - - } + seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN); } private void setUpProgressSlider() { - setTint(progressSlider, ThemeSingleton.get().positiveColor); progressSlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { @@ -343,10 +335,7 @@ public class MusicControllerActivity extends AbsFabActivity { if (vibrantSwatch != null) { final int swatchRgb = vibrantSwatch.getRgb(); animateColorChange(swatchRgb); - songTitle.setTextColor(vibrantSwatch.getTitleTextColor()); - songArtist.setTextColor(vibrantSwatch.getBodyTextColor()); - currentSongProgress.setTextColor(vibrantSwatch.getTitleTextColor()); - totalSongDuration.setTextColor(vibrantSwatch.getTitleTextColor()); + animateTextColorChange(Util.getColorWithoutAlpha(vibrantSwatch.getTitleTextColor())); notifyTaskColorChange(swatchRgb); } else { resetColors(); @@ -359,16 +348,14 @@ public class MusicControllerActivity extends AbsFabActivity { } private void resetColors() { - final int songTitleTextColor = DialogUtils.resolveColor(this, R.attr.title_text_color); - final int artistNameTextColor = DialogUtils.resolveColor(this, R.attr.caption_text_color); + final int textColor = Util.getColorWithoutAlpha(DialogUtils.resolveColor(this, R.attr.title_text_color)); final int defaultBarColor = DialogUtils.resolveColor(this, R.attr.default_bar_color); animateColorChange(defaultBarColor); + animateTextColorChange(textColor); - songTitle.setTextColor(songTitleTextColor); - songArtist.setTextColor(artistNameTextColor); - currentSongProgress.setTextColor(artistNameTextColor); - totalSongDuration.setTextColor(artistNameTextColor); + currentSongProgress.setTextColor(DialogUtils.resolveColor(MusicControllerActivity.this, R.attr.themed_drawable_color)); + totalSongDuration.setTextColor(DialogUtils.resolveColor(MusicControllerActivity.this, R.attr.themed_drawable_color)); notifyTaskColorChange(defaultBarColor); } @@ -376,20 +363,38 @@ public class MusicControllerActivity extends AbsFabActivity { @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void animateColorChange(final int newColor) { if (lastFooterColor != -1 && lastFooterColor != newColor) { - ViewUtil.animateViewColor(footer, lastFooterColor, newColor, 300); - ViewUtil.animateViewColor(progressContainer, ColorChooserDialog.shiftColorDown(lastFooterColor), ColorChooserDialog.shiftColorDown(newColor), 300); - ViewUtil.animateViewColor(toolbar, lastFooterColor, newColor, 300); + ViewUtil.animateViewColor(footer, lastFooterColor, newColor, COLOR_TRANSITION_TIME); + + if (opaqueToolBar) + ViewUtil.animateViewColor(toolbar, lastFooterColor, newColor, COLOR_TRANSITION_TIME); + else toolbar.setBackgroundColor(Color.TRANSPARENT); } else { footer.setBackgroundColor(newColor); - progressContainer.setBackgroundColor(ColorChooserDialog.shiftColorDown(newColor)); - toolbar.setBackgroundColor(newColor); + + if (opaqueToolBar) toolbar.setBackgroundColor(newColor); + else toolbar.setBackgroundColor(Color.TRANSPARENT); } - setStatusBarColor(newColor); + + setTint(progressSlider, PreferenceUtils.getInstance(this).getThemeColorAccent()); + if (opaqueToolBar) setStatusBarColor(newColor); + else setStatusBarColor(Color.TRANSPARENT); + if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarCurrentPlayingEnabled()) setNavigationBarColor(newColor); lastFooterColor = newColor; } + private void animateTextColorChange(final int newColor) { + if (lastTextColor != -2 && lastTextColor != newColor) { + ViewUtil.animateTextColor(songTitle, lastTextColor, newColor, COLOR_TRANSITION_TIME); + ViewUtil.animateTextColor(songArtist, lastTextColor, newColor, COLOR_TRANSITION_TIME); + } else { + songTitle.setTextColor(newColor); + songArtist.setTextColor(newColor); + } + lastTextColor = newColor; + } + private void getCurrentSong() { song = MusicPlayerRemote.getCurrentSong(); if (song.id == -1) { @@ -457,14 +462,6 @@ public class MusicControllerActivity extends AbsFabActivity { killThreads = true; } - @Override - public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); - if (hasFocus) { - animateActivityOpened(DEFAULT_DELAY); - } - } - @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_music_playing, menu); @@ -511,13 +508,16 @@ public class MusicControllerActivity extends AbsFabActivity { return super.onOptionsItemSelected(item); } - private void animateActivityOpened(int startDelay) { - ViewPropertyAnimator.animate(footer) - .scaleX(1) - .scaleY(1) - .setInterpolator(new DecelerateInterpolator(4)) - .setDuration(DEFAULT_ANIMATION_TIME) - .setStartDelay(startDelay) - .start(); + private void setToolbarOpaque(boolean toolbarOpaque) { + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) findViewById(R.id.album_art_frame).getLayoutParams(); + if (!toolbarOpaque) { + if (Build.VERSION.SDK_INT > 16) { + params.removeRule(RelativeLayout.BELOW); + } else { + params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT); + params.addRule(RelativeLayout.ABOVE, R.id.footer_frame); + } + } else params.addRule(RelativeLayout.BELOW, R.id.toolbar_frame); } } \ No newline at end of file diff --git a/app/src/main/java/com/kabouzeid/gramophone/ui/activities/base/AbsFabActivity.java b/app/src/main/java/com/kabouzeid/gramophone/ui/activities/base/AbsFabActivity.java index fa6f3305..464f305c 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/ui/activities/base/AbsFabActivity.java +++ b/app/src/main/java/com/kabouzeid/gramophone/ui/activities/base/AbsFabActivity.java @@ -3,6 +3,7 @@ package com.kabouzeid.gramophone.ui.activities.base; import android.graphics.Color; import android.graphics.PorterDuff; import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; import android.support.v4.util.Pair; import android.util.Log; import android.view.GestureDetector; @@ -13,14 +14,12 @@ import android.widget.Toast; import com.afollestad.materialdialogs.ThemeSingleton; import com.kabouzeid.gramophone.App; import com.kabouzeid.gramophone.R; -import com.kabouzeid.gramophone.dialogs.ColorChooserDialog; import com.kabouzeid.gramophone.helper.MusicPlayerRemote; import com.kabouzeid.gramophone.misc.SmallOnGestureListener; import com.kabouzeid.gramophone.model.MusicRemoteEvent; import com.kabouzeid.gramophone.model.Song; import com.kabouzeid.gramophone.util.NavigationUtil; import com.kabouzeid.gramophone.views.PlayPauseDrawable; -import com.melnykov.fab.FloatingActionButton; import com.squareup.otto.Subscribe; /** @@ -55,15 +54,10 @@ public abstract class AbsFabActivity extends AbsBaseActivity { getFab().setImageDrawable(playPauseDrawable); final int accentColor = ThemeSingleton.get().positiveColor; + getFab().setRippleColor(accentColor); if (accentColor == Color.WHITE) { - getFab().setColorNormal(accentColor); - getFab().setColorPressed(ColorChooserDialog.shiftColorDown(accentColor)); - getFab().setColorRipple(ColorChooserDialog.shiftColorUp(accentColor)); getFab().getDrawable().setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN); } else { - getFab().setColorNormal(accentColor); - getFab().setColorPressed(ColorChooserDialog.shiftColorUp(accentColor)); - getFab().setColorRipple(ColorChooserDialog.shiftColorDown(accentColor)); getFab().getDrawable().clearColorFilter(); } diff --git a/app/src/main/java/com/kabouzeid/gramophone/ui/activities/tageditor/AbsTagEditorActivity.java b/app/src/main/java/com/kabouzeid/gramophone/ui/activities/tageditor/AbsTagEditorActivity.java index b7963e97..933eb115 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/ui/activities/tageditor/AbsTagEditorActivity.java +++ b/app/src/main/java/com/kabouzeid/gramophone/ui/activities/tageditor/AbsTagEditorActivity.java @@ -10,6 +10,7 @@ import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; import android.support.v7.graphics.Palette; import android.support.v7.widget.Toolbar; import android.util.Log; @@ -19,6 +20,7 @@ import android.view.animation.OvershootInterpolator; import android.widget.ImageView; import com.afollestad.materialdialogs.MaterialDialog; +import com.afollestad.materialdialogs.ThemeSingleton; import com.afollestad.materialdialogs.util.DialogUtils; import com.github.ksoichiro.android.observablescrollview.ObservableScrollView; import com.kabouzeid.gramophone.App; @@ -32,7 +34,6 @@ import com.kabouzeid.gramophone.util.MusicUtil; import com.kabouzeid.gramophone.util.PreferenceUtils; import com.kabouzeid.gramophone.util.Util; import com.kabouzeid.gramophone.util.ViewUtil; -import com.melnykov.fab.FloatingActionButton; import com.nineoldandroids.view.ViewHelper; import com.nineoldandroids.view.ViewPropertyAnimator; import com.nostra13.universalimageloader.core.ImageLoader; @@ -207,6 +208,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity { save(); } }); + fab.setRippleColor(ThemeSingleton.get().positiveColor); } protected abstract void save(); diff --git a/app/src/main/java/com/kabouzeid/gramophone/util/PreferenceUtils.java b/app/src/main/java/com/kabouzeid/gramophone/util/PreferenceUtils.java index b9831097..be0c68e9 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/util/PreferenceUtils.java +++ b/app/src/main/java/com/kabouzeid/gramophone/util/PreferenceUtils.java @@ -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); // } diff --git a/app/src/main/java/com/kabouzeid/gramophone/util/Util.java b/app/src/main/java/com/kabouzeid/gramophone/util/Util.java index 1afe5243..c1b095f9 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/util/Util.java +++ b/app/src/main/java/com/kabouzeid/gramophone/util/Util.java @@ -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; + } } \ No newline at end of file diff --git a/app/src/main/java/com/kabouzeid/gramophone/util/ViewUtil.java b/app/src/main/java/com/kabouzeid/gramophone/util/ViewUtil.java index bca1878c..fc7cd40c 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/util/ViewUtil.java +++ b/app/src/main/java/com/kabouzeid/gramophone/util/ViewUtil.java @@ -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; diff --git a/app/src/main/java/com/kabouzeid/gramophone/views/HeightAndWidthFitSquarePlaceLeftRightImageView.java b/app/src/main/java/com/kabouzeid/gramophone/views/HeightWidthFitSquareImageView.java similarity index 58% rename from app/src/main/java/com/kabouzeid/gramophone/views/HeightAndWidthFitSquarePlaceLeftRightImageView.java rename to app/src/main/java/com/kabouzeid/gramophone/views/HeightWidthFitSquareImageView.java index a2c7157d..93872632 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/views/HeightAndWidthFitSquarePlaceLeftRightImageView.java +++ b/app/src/main/java/com/kabouzeid/gramophone/views/HeightWidthFitSquareImageView.java @@ -7,17 +7,17 @@ import android.widget.ImageView; /** * @author Karim Abou Zeid (kabouzeid) */ -public class HeightAndWidthFitSquarePlaceLeftRightImageView extends ImageView { +public class HeightWidthFitSquareImageView extends ImageView { - public HeightAndWidthFitSquarePlaceLeftRightImageView(Context context) { + public HeightWidthFitSquareImageView(Context context) { super(context); } - public HeightAndWidthFitSquarePlaceLeftRightImageView(Context context, AttributeSet attrs) { + public HeightWidthFitSquareImageView(Context context, AttributeSet attrs) { super(context, attrs); } - public HeightAndWidthFitSquarePlaceLeftRightImageView(Context context, AttributeSet attrs, int defStyle) { + public HeightWidthFitSquareImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } diff --git a/app/src/main/java/com/kabouzeid/gramophone/views/PlayPauseDrawable.java b/app/src/main/java/com/kabouzeid/gramophone/views/PlayPauseDrawable.java index ca507e4c..24740570 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/views/PlayPauseDrawable.java +++ b/app/src/main/java/com/kabouzeid/gramophone/views/PlayPauseDrawable.java @@ -44,8 +44,6 @@ public class PlayPauseDrawable extends Drawable { private float width; private float height; - private final float fallBackWidth; - private final float fallBackHeight; private float progress; private boolean isPlay; @@ -61,8 +59,6 @@ public class PlayPauseDrawable extends Drawable { pauseBarWidth = res.getDimensionPixelSize(R.dimen.pause_bar_width); pauseBarHeight = res.getDimensionPixelSize(R.dimen.pause_bar_height); pauseBarDistance = res.getDimensionPixelSize(R.dimen.pause_bar_distance); - fallBackWidth = res.getDimensionPixelSize(R.dimen.fab_icon_bound_width); - fallBackHeight = res.getDimensionPixelSize(R.dimen.fab_icon_bound_height); } @Override @@ -71,9 +67,6 @@ public class PlayPauseDrawable extends Drawable { if (bounds.width() > 0 && bounds.height() > 0) { width = bounds.width(); height = bounds.height(); - } else { - width = fallBackWidth; - height = fallBackHeight; } } diff --git a/app/src/main/java/com/kabouzeid/gramophone/views/ScrimInsetsFrameLayout.java b/app/src/main/java/com/kabouzeid/gramophone/views/ScrimInsetsFrameLayout.java deleted file mode 100644 index d76318a5..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/views/ScrimInsetsFrameLayout.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.kabouzeid.gramophone.views; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Rect; -import android.graphics.drawable.Drawable; -import android.support.v4.view.ViewCompat; -import android.util.AttributeSet; -import android.widget.FrameLayout; - -import com.kabouzeid.gramophone.R; - -/** - * A layout that draws something in the insets passed to {@link #fitSystemWindows(Rect)}, i.e. the area above UI chrome - * (status and navigation bars, overlay action bars). - */ -public class ScrimInsetsFrameLayout extends FrameLayout { - private Drawable mInsetForeground; - - private Rect mInsets; - private Rect mTempRect = new Rect(); - private OnInsetsCallback mOnInsetsCallback; - - public ScrimInsetsFrameLayout(Context context) { - super(context); - init(context, null, 0); - } - - public ScrimInsetsFrameLayout(Context context, AttributeSet attrs) { - super(context, attrs); - init(context, attrs, 0); - } - - public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - init(context, attrs, defStyle); - } - - private void init(Context context, AttributeSet attrs, int defStyle) { - final TypedArray a = context.obtainStyledAttributes(attrs, - R.styleable.ScrimInsetsView, defStyle, 0); - if (a == null) { - return; - } - mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForeground); - a.recycle(); - - setWillNotDraw(true); - } - - @Override - protected boolean fitSystemWindows(Rect insets) { - mInsets = new Rect(insets); - setWillNotDraw(mInsetForeground == null); - ViewCompat.postInvalidateOnAnimation(this); - if (mOnInsetsCallback != null) { - mOnInsetsCallback.onInsetsChanged(insets); - } - return true; // consume insets - } - - @Override - public void draw(Canvas canvas) { - super.draw(canvas); - - int width = getWidth(); - int height = getHeight(); - if (mInsets != null && mInsetForeground != null) { - int sc = canvas.save(); - canvas.translate(getScrollX(), getScrollY()); - - // Top - mTempRect.set(0, 0, width, mInsets.top); - mInsetForeground.setBounds(mTempRect); - mInsetForeground.draw(canvas); - - // Bottom - mTempRect.set(0, height - mInsets.bottom, width, height); - mInsetForeground.setBounds(mTempRect); - mInsetForeground.draw(canvas); - - // Left - mTempRect.set(0, mInsets.top, mInsets.left, height - mInsets.bottom); - mInsetForeground.setBounds(mTempRect); - mInsetForeground.draw(canvas); - - // Right - mTempRect.set(width - mInsets.right, mInsets.top, width, height - mInsets.bottom); - mInsetForeground.setBounds(mTempRect); - mInsetForeground.draw(canvas); - - canvas.restoreToCount(sc); - } - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - if (mInsetForeground != null) { - mInsetForeground.setCallback(this); - } - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - if (mInsetForeground != null) { - mInsetForeground.setCallback(null); - } - } - - /** - * Allows the calling container to specify a callback for custom processing when insets change (i.e. when - * {@link #fitSystemWindows(Rect)} is called. This is useful for setting padding on UI elements based on - * UI chrome insets (e.g. a Google Map or a ListView). When using with ListView or GridView, remember to set - * clipToPadding to false. - */ - public void setOnInsetsCallback(OnInsetsCallback onInsetsCallback) { - mOnInsetsCallback = onInsetsCallback; - } - - public static interface OnInsetsCallback { - public void onInsetsChanged(Rect insets); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/kabouzeid/gramophone/views/SquareIfPlaceLeftRightImageView.java b/app/src/main/java/com/kabouzeid/gramophone/views/SquareIfPlaceImageView.java similarity index 52% rename from app/src/main/java/com/kabouzeid/gramophone/views/SquareIfPlaceLeftRightImageView.java rename to app/src/main/java/com/kabouzeid/gramophone/views/SquareIfPlaceImageView.java index 85274213..ce034fd8 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/views/SquareIfPlaceLeftRightImageView.java +++ b/app/src/main/java/com/kabouzeid/gramophone/views/SquareIfPlaceImageView.java @@ -8,17 +8,18 @@ import android.widget.ImageView; /** * @author Karim Abou Zeid (kabouzeid) */ -public class SquareIfPlaceLeftRightImageView extends ImageView { +public class SquareIfPlaceImageView extends ImageView { + private boolean forceSquare = false; - public SquareIfPlaceLeftRightImageView(Context context) { + public SquareIfPlaceImageView(Context context) { super(context); } - public SquareIfPlaceLeftRightImageView(Context context, AttributeSet attrs) { + public SquareIfPlaceImageView(Context context, AttributeSet attrs) { super(context, attrs); } - public SquareIfPlaceLeftRightImageView(Context context, AttributeSet attrs, int defStyle) { + public SquareIfPlaceImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @@ -27,9 +28,17 @@ public class SquareIfPlaceLeftRightImageView extends ImageView { final int small = Math.min(widthMeasureSpec, heightMeasureSpec); final int large = Math.max(widthMeasureSpec, heightMeasureSpec); - if (View.MeasureSpec.getSize(large) > View.MeasureSpec.getSize(small) * 1.5) + if (forceSquare) super.onMeasure(small, small); + else if (View.MeasureSpec.getSize(large) > View.MeasureSpec.getSize(small) * 1.5) super.onMeasure(small, small); else super.onMeasure(widthMeasureSpec, heightMeasureSpec); } + public void forceSquare(boolean force) { + if (forceSquare != force) { + forceSquare = force; + invalidate(); + } + } + } diff --git a/app/src/main/res/drawable/slider_thumb.xml b/app/src/main/res/drawable/slider_thumb.xml index a69f10ab..68f40df1 100644 --- a/app/src/main/res/drawable/slider_thumb.xml +++ b/app/src/main/res/drawable/slider_thumb.xml @@ -1,8 +1,9 @@ - + + android:height="20dp" + android:width="3dp" /> + android:color="?colorAccent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_album_detail.xml b/app/src/main/res/layout/activity_album_detail.xml index 00c73947..c0ebf5dd 100644 --- a/app/src/main/res/layout/activity_album_detail.xml +++ b/app/src/main/res/layout/activity_album_detail.xml @@ -13,7 +13,7 @@ android:layout_height="match_parent" android:scaleType="centerCrop" /> - - - - - - + android:layout_margin="16dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_album_tag_editor.xml b/app/src/main/res/layout/activity_album_tag_editor.xml index a0a9f33d..fccab64c 100644 --- a/app/src/main/res/layout/activity_album_tag_editor.xml +++ b/app/src/main/res/layout/activity_album_tag_editor.xml @@ -159,7 +159,7 @@ android:gravity="start|left" tools:ignore="RtlHardcoded" /> - - - - - - - + android:layout_margin="16dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 96e52773..6313c4f2 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -70,18 +70,12 @@ - - - - + diff --git a/app/src/main/res/layout/activity_music_controller.xml b/app/src/main/res/layout/activity_music_controller.xml index 54dce313..4a8f47ee 100644 --- a/app/src/main/res/layout/activity_music_controller.xml +++ b/app/src/main/res/layout/activity_music_controller.xml @@ -5,6 +5,199 @@ android:layout_height="match_parent" tools:context="com.kabouzeid.gramophone.ui.activities.MusicControllerActivity"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:background="#00000000" /> diff --git a/app/src/main/res/layout/activity_playlist_detail.xml b/app/src/main/res/layout/activity_playlist_detail.xml index f3567c17..e6ce5528 100644 --- a/app/src/main/res/layout/activity_playlist_detail.xml +++ b/app/src/main/res/layout/activity_playlist_detail.xml @@ -1,7 +1,6 @@ + android:layout_width="match_parent" + android:layout_height="match_parent"> - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index 475ec169..4bac50fd 100644 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -2,7 +2,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"> + android:orientation="vertical" + android:paddingTop="@dimen/status_bar_padding"> - @@ -29,7 +28,6 @@ diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index f27071fa..995f3fdd 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -1,7 +1,6 @@ - #3F51B5 #9E9E9E #424242 #1C1C1C @@ -13,6 +12,7 @@ #E91E63 #9C27B0 #5E35B1 + #3F51B5 #1976D2 #03A9F4 #00BCD4 @@ -33,6 +33,7 @@ #795548 #D32F2F #E91E63 + #FF4081 #9C27B0 #5E35B1 #1976D2 diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 5d9ae327..48169268 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -25,8 +25,4 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 302c28d3..726ce8dd 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -8,27 +8,18 @@ #3e000000 - @color/indigo_500 - @color/indigo_600 - @color/pink_500 - @color/pink_600 @color/grey_300 #fff #0C000000 @color/grey_500 #8A000000 - #D0D0D0 - @color/indigo_500 - @color/indigo_600 - @color/pink_500 @color/grey_800 @color/grey_900 #0CFFFFFF @color/grey_900 @color/white - #55000000 #FFFFFF #99FFFFFF @@ -36,6 +27,4 @@ #29ffffff - #40000000 - \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 08a3f990..7faeaf81 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -12,7 +12,8 @@ 2dp 360dp - 32dp + 20dp + 120dp 0dp diff --git a/app/src/main/res/values/materialcolors.xml b/app/src/main/res/values/materialcolors.xml index 683b6469..b9b2725b 100644 --- a/app/src/main/res/values/materialcolors.xml +++ b/app/src/main/res/values/materialcolors.xml @@ -1,11 +1,9 @@ - #e91e63 - #d81b60 + #ff4081 #3f51b5 - #3949ab #000000 #ffffff diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 386b2a76..efdad1f6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -115,6 +115,8 @@ Tag editor Everywhere else Colored album footers + Force square album art + Opaque toolbar now playing No equalizer found No audio ID, play something and try again. Open navigation drawer @@ -136,6 +138,8 @@ Only available on Lollipop. Content scrolling underneath the toolbar is visible. Album footers in the grid are colored with the album cover\'s palette. + Album art in the now playing view is forced to be squared. + The toolbar in the now playing view is opaque and no longer covers the album art. Unable to download the art for this album. Search your library… Rescanning media… diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 180b60c9..636beaa9 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -37,7 +37,6 @@ @@ -81,7 +80,9 @@ \ No newline at end of file diff --git a/app/src/main/res/xml/pref_ui.xml b/app/src/main/res/xml/pref_ui.xml index a655cb05..427fe775 100644 --- a/app/src/main/res/xml/pref_ui.xml +++ b/app/src/main/res/xml/pref_ui.xml @@ -30,6 +30,22 @@ android:layout="@layout/preference_custom" android:widgetLayout="@layout/preference_dynamiccheckbox" /> + + + +