Redesign of MusicControllerActivity, AlbumDetailActivity and ArtistDetailActivity. A lot of bugs and other small things fixed as well.

This commit is contained in:
Karim Abou Zeid 2015-05-27 17:58:50 +02:00
commit 9fe36b0a35
51 changed files with 1019 additions and 688 deletions

View file

@ -1,14 +1,17 @@
buildscript { buildscript {
repositories { repositories {
maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.fabric.io/public' }
mavenCentral()
} }
dependencies { dependencies {
classpath 'io.fabric.tools:gradle:1.18.0' classpath 'io.fabric.tools:gradle:1.18.0'
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
} }
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'io.fabric' apply plugin: 'io.fabric'
apply plugin: 'com.jakewharton.hugo'
repositories { repositories {
maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.fabric.io/public' }

View file

@ -0,0 +1,15 @@
package com.kabouzeid.gramophone.helper.bitmapblur;
import android.graphics.Bitmap;
interface BlurProcess {
/**
* Process the given image, blurring by the supplied radius.
* If radius is 0, this will return original
*
* @param original the bitmap to be blurred
* @param radius the radius in pixels to blur the image
* @return the blurred version of the image.
*/
Bitmap blur(Bitmap original, float radius);
}

View file

@ -0,0 +1,329 @@
package com.kabouzeid.gramophone.helper.bitmapblur;
import android.graphics.Bitmap;
import java.util.ArrayList;
import java.util.concurrent.Callable;
/**
* Blur using Java code.
* <p/>
* This is a compromise between Gaussian Blur and Box blur
* It creates much better looking blurs than Box Blur, but is
* 7x faster than my Gaussian Blur implementation.
* <p/>
* I called it Stack Blur because this describes best how this
* filter works internally: it creates a kind of moving stack
* of colors whilst scanning through the image. Thereby it
* just has to add one new block of color to the right side
* of the stack and remove the leftmost color. The remaining
* colors on the topmost layer of the stack are either added on
* or reduced by one, depending on if they are on the right or
* on the left side of the stack.
*
* @author Enrique López Mañas <eenriquelopez@gmail.com>
* http://www.neo-tech.es
* <p/>
* Author of the original algorithm: Mario Klingemann <mario.quasimondo.com>
* <p/>
* Based heavily on http://vitiy.info/Code/stackblur.cpp
* See http://vitiy.info/stackblur-algorithm-multi-threaded-blur-for-cpp/
* @copyright: Enrique López Mañas
* @license: Apache License 2.0
*/
class JavaBlurProcess implements BlurProcess {
private static final short[] stackblur_mul = {
512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512,
454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512,
482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456,
437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512,
497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328,
320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456,
446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335,
329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512,
505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405,
399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328,
324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271,
268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456,
451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388,
385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335,
332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292,
289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259
};
private static final byte[] stackblur_shr = {
9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24
};
@Override
public Bitmap blur(Bitmap original, float radius) {
int w = original.getWidth();
int h = original.getHeight();
int[] currentPixels = new int[w * h];
original.getPixels(currentPixels, 0, w, 0, 0, w, h);
int cores = StackBlurManager.EXECUTOR_THREADS;
ArrayList<BlurTask> horizontal = new ArrayList<BlurTask>(cores);
ArrayList<BlurTask> vertical = new ArrayList<BlurTask>(cores);
for (int i = 0; i < cores; i++) {
horizontal.add(new BlurTask(currentPixels, w, h, (int) radius, cores, i, 1));
vertical.add(new BlurTask(currentPixels, w, h, (int) radius, cores, i, 2));
}
try {
StackBlurManager.EXECUTOR.invokeAll(horizontal);
} catch (InterruptedException e) {
return null;
}
try {
StackBlurManager.EXECUTOR.invokeAll(vertical);
} catch (InterruptedException e) {
return null;
}
return Bitmap.createBitmap(currentPixels, w, h, Bitmap.Config.ARGB_8888);
}
private static void blurIteration(int[] src, int w, int h, int radius, int cores, int core, int step) {
int x, y, xp, yp, i;
int sp;
int stack_start;
int stack_i;
int src_i;
int dst_i;
long sum_r, sum_g, sum_b,
sum_in_r, sum_in_g, sum_in_b,
sum_out_r, sum_out_g, sum_out_b;
int wm = w - 1;
int hm = h - 1;
int div = (radius * 2) + 1;
int mul_sum = stackblur_mul[radius];
byte shr_sum = stackblur_shr[radius];
int[] stack = new int[div];
if (step == 1) {
int minY = core * h / cores;
int maxY = (core + 1) * h / cores;
for (y = minY; y < maxY; y++) {
sum_r = sum_g = sum_b =
sum_in_r = sum_in_g = sum_in_b =
sum_out_r = sum_out_g = sum_out_b = 0;
src_i = w * y; // start of line (0,y)
for (i = 0; i <= radius; i++) {
stack_i = i;
stack[stack_i] = src[src_i];
sum_r += ((src[src_i] >>> 16) & 0xff) * (i + 1);
sum_g += ((src[src_i] >>> 8) & 0xff) * (i + 1);
sum_b += (src[src_i] & 0xff) * (i + 1);
sum_out_r += ((src[src_i] >>> 16) & 0xff);
sum_out_g += ((src[src_i] >>> 8) & 0xff);
sum_out_b += (src[src_i] & 0xff);
}
for (i = 1; i <= radius; i++) {
if (i <= wm) src_i += 1;
stack_i = i + radius;
stack[stack_i] = src[src_i];
sum_r += ((src[src_i] >>> 16) & 0xff) * (radius + 1 - i);
sum_g += ((src[src_i] >>> 8) & 0xff) * (radius + 1 - i);
sum_b += (src[src_i] & 0xff) * (radius + 1 - i);
sum_in_r += ((src[src_i] >>> 16) & 0xff);
sum_in_g += ((src[src_i] >>> 8) & 0xff);
sum_in_b += (src[src_i] & 0xff);
}
sp = radius;
xp = radius;
if (xp > wm) xp = wm;
src_i = xp + y * w; // img.pix_ptr(xp, y);
dst_i = y * w; // img.pix_ptr(0, y);
for (x = 0; x < w; x++) {
src[dst_i] = (int)
((src[dst_i] & 0xff000000) |
((((sum_r * mul_sum) >>> shr_sum) & 0xff) << 16) |
((((sum_g * mul_sum) >>> shr_sum) & 0xff) << 8) |
((((sum_b * mul_sum) >>> shr_sum) & 0xff)));
dst_i += 1;
sum_r -= sum_out_r;
sum_g -= sum_out_g;
sum_b -= sum_out_b;
stack_start = sp + div - radius;
if (stack_start >= div) stack_start -= div;
stack_i = stack_start;
sum_out_r -= ((stack[stack_i] >>> 16) & 0xff);
sum_out_g -= ((stack[stack_i] >>> 8) & 0xff);
sum_out_b -= (stack[stack_i] & 0xff);
if (xp < wm) {
src_i += 1;
++xp;
}
stack[stack_i] = src[src_i];
sum_in_r += ((src[src_i] >>> 16) & 0xff);
sum_in_g += ((src[src_i] >>> 8) & 0xff);
sum_in_b += (src[src_i] & 0xff);
sum_r += sum_in_r;
sum_g += sum_in_g;
sum_b += sum_in_b;
++sp;
if (sp >= div) sp = 0;
stack_i = sp;
sum_out_r += ((stack[stack_i] >>> 16) & 0xff);
sum_out_g += ((stack[stack_i] >>> 8) & 0xff);
sum_out_b += (stack[stack_i] & 0xff);
sum_in_r -= ((stack[stack_i] >>> 16) & 0xff);
sum_in_g -= ((stack[stack_i] >>> 8) & 0xff);
sum_in_b -= (stack[stack_i] & 0xff);
}
}
}
// step 2
else if (step == 2) {
int minX = core * w / cores;
int maxX = (core + 1) * w / cores;
for (x = minX; x < maxX; x++) {
sum_r = sum_g = sum_b =
sum_in_r = sum_in_g = sum_in_b =
sum_out_r = sum_out_g = sum_out_b = 0;
src_i = x; // x,0
for (i = 0; i <= radius; i++) {
stack_i = i;
stack[stack_i] = src[src_i];
sum_r += ((src[src_i] >>> 16) & 0xff) * (i + 1);
sum_g += ((src[src_i] >>> 8) & 0xff) * (i + 1);
sum_b += (src[src_i] & 0xff) * (i + 1);
sum_out_r += ((src[src_i] >>> 16) & 0xff);
sum_out_g += ((src[src_i] >>> 8) & 0xff);
sum_out_b += (src[src_i] & 0xff);
}
for (i = 1; i <= radius; i++) {
if (i <= hm) src_i += w; // +stride
stack_i = i + radius;
stack[stack_i] = src[src_i];
sum_r += ((src[src_i] >>> 16) & 0xff) * (radius + 1 - i);
sum_g += ((src[src_i] >>> 8) & 0xff) * (radius + 1 - i);
sum_b += (src[src_i] & 0xff) * (radius + 1 - i);
sum_in_r += ((src[src_i] >>> 16) & 0xff);
sum_in_g += ((src[src_i] >>> 8) & 0xff);
sum_in_b += (src[src_i] & 0xff);
}
sp = radius;
yp = radius;
if (yp > hm) yp = hm;
src_i = x + yp * w; // img.pix_ptr(x, yp);
dst_i = x; // img.pix_ptr(x, 0);
for (y = 0; y < h; y++) {
src[dst_i] = (int)
((src[dst_i] & 0xff000000) |
((((sum_r * mul_sum) >>> shr_sum) & 0xff) << 16) |
((((sum_g * mul_sum) >>> shr_sum) & 0xff) << 8) |
((((sum_b * mul_sum) >>> shr_sum) & 0xff)));
dst_i += w;
sum_r -= sum_out_r;
sum_g -= sum_out_g;
sum_b -= sum_out_b;
stack_start = sp + div - radius;
if (stack_start >= div) stack_start -= div;
stack_i = stack_start;
sum_out_r -= ((stack[stack_i] >>> 16) & 0xff);
sum_out_g -= ((stack[stack_i] >>> 8) & 0xff);
sum_out_b -= (stack[stack_i] & 0xff);
if (yp < hm) {
src_i += w; // stride
++yp;
}
stack[stack_i] = src[src_i];
sum_in_r += ((src[src_i] >>> 16) & 0xff);
sum_in_g += ((src[src_i] >>> 8) & 0xff);
sum_in_b += (src[src_i] & 0xff);
sum_r += sum_in_r;
sum_g += sum_in_g;
sum_b += sum_in_b;
++sp;
if (sp >= div) sp = 0;
stack_i = sp;
sum_out_r += ((stack[stack_i] >>> 16) & 0xff);
sum_out_g += ((stack[stack_i] >>> 8) & 0xff);
sum_out_b += (stack[stack_i] & 0xff);
sum_in_r -= ((stack[stack_i] >>> 16) & 0xff);
sum_in_g -= ((stack[stack_i] >>> 8) & 0xff);
sum_in_b -= (stack[stack_i] & 0xff);
}
}
}
}
private static class BlurTask implements Callable<Void> {
private final int[] _src;
private final int _w;
private final int _h;
private final int _radius;
private final int _totalCores;
private final int _coreIndex;
private final int _round;
public BlurTask(int[] src, int w, int h, int radius, int totalCores, int coreIndex, int round) {
_src = src;
_w = w;
_h = h;
_radius = radius;
_totalCores = totalCores;
_coreIndex = coreIndex;
_round = round;
}
@Override
public Void call() throws Exception {
blurIteration(_src, _w, _h, _radius, _totalCores, _coreIndex, _round);
return null;
}
}
}

View file

@ -0,0 +1,89 @@
/**
* StackBlur v1.0 for Android
*
* @Author: Enrique López Mañas <eenriquelopez@gmail.com>
* http://www.lopez-manas.com
* <p/>
* Author of the original algorithm: Mario Klingemann <mario.quasimondo.com>
* <p/>
* This is a compromise between Gaussian Blur and Box blur
* It creates much better looking blurs than Box Blur, but is
* 7x faster than my Gaussian Blur implementation.
* <p/>
* I called it Stack Blur because this describes best how this
* filter works internally: it creates a kind of moving stack
* of colors whilst scanning through the image. Thereby it
* just has to add one new block of color to the right side
* of the stack and remove the leftmost color. The remaining
* colors on the topmost layer of the stack are either added on
* or reduced by one, depending on if they are on the right or
* on the left side of the stack.
* @copyright: Enrique López Mañas
* @license: Apache License 2.0
*/
package com.kabouzeid.gramophone.helper.bitmapblur;
import android.graphics.Bitmap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class StackBlurManager {
static final int EXECUTOR_THREADS = Runtime.getRuntime().availableProcessors();
static final ExecutorService EXECUTOR = Executors.newFixedThreadPool(EXECUTOR_THREADS);
/**
* Original image
*/
private final Bitmap _image;
/**
* Most recent result of blurring
*/
private Bitmap _result;
/**
* Method of blurring
*/
private final BlurProcess _blurProcess;
/**
* Constructor method (basic initialization and construction of the pixel array)
*
* @param image The image that will be analyed
*/
public StackBlurManager(Bitmap image) {
_image = image;
_blurProcess = new JavaBlurProcess();
}
/**
* Process the image on the given radius. Radius must be at least 1
*
* @param radius
*/
public Bitmap process(int radius) {
_result = _blurProcess.blur(_image, radius);
return _result;
}
/**
* Returns the blurred image as a bitmap
*
* @return blurred image
*/
public Bitmap returnBlurredImage() {
return _result;
}
/**
* Returns the original image as a bitmap
*
* @return the original bitmap image
*/
public Bitmap getImage() {
return this._image;
}
}

View file

@ -13,8 +13,7 @@ public class UIPreferenceChangedEvent {
public static final int COLORED_NAVIGATION_BAR_CURRENT_PLAYING_CHANGED = 6; public static final int COLORED_NAVIGATION_BAR_CURRENT_PLAYING_CHANGED = 6;
public static final int COLORED_NAVIGATION_BAR_CHANGED = 10; public static final int COLORED_NAVIGATION_BAR_CHANGED = 10;
public static final int COLORED_NAVIGATION_BAR_OTHER_SCREENS_CHANGED = 7; public static final int COLORED_NAVIGATION_BAR_OTHER_SCREENS_CHANGED = 7;
public static final int PLAYBACK_CONTROLLER_CARD_CHANGED = 8; public static final int TOOLBAR_TRANSPARENT_CHANGED = 8;
public static final int TOOLBAR_TRANSPARENT_CHANGED = 9;
private final int action; private final int action;
private final Object value; private final Object value;

View file

@ -1,8 +1,10 @@
package com.kabouzeid.gramophone.ui.activities; package com.kabouzeid.gramophone.ui.activities;
import android.animation.Animator;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -10,9 +12,12 @@ import android.support.v4.util.Pair;
import android.support.v7.graphics.Palette; import android.support.v7.graphics.Palette;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.transition.Transition;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -23,12 +28,14 @@ import com.kabouzeid.gramophone.App;
import com.kabouzeid.gramophone.R; import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter; import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter;
import com.kabouzeid.gramophone.helper.MusicPlayerRemote; import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
import com.kabouzeid.gramophone.helper.bitmapblur.StackBlurManager;
import com.kabouzeid.gramophone.interfaces.CabHolder; import com.kabouzeid.gramophone.interfaces.CabHolder;
import com.kabouzeid.gramophone.interfaces.PaletteColorHolder; import com.kabouzeid.gramophone.interfaces.PaletteColorHolder;
import com.kabouzeid.gramophone.loader.AlbumLoader; import com.kabouzeid.gramophone.loader.AlbumLoader;
import com.kabouzeid.gramophone.loader.AlbumSongLoader; import com.kabouzeid.gramophone.loader.AlbumSongLoader;
import com.kabouzeid.gramophone.misc.AppKeys; import com.kabouzeid.gramophone.misc.AppKeys;
import com.kabouzeid.gramophone.misc.SmallObservableScrollViewCallbacks; import com.kabouzeid.gramophone.misc.SmallObservableScrollViewCallbacks;
import com.kabouzeid.gramophone.misc.SmallTransitionListener;
import com.kabouzeid.gramophone.model.Album; import com.kabouzeid.gramophone.model.Album;
import com.kabouzeid.gramophone.model.DataBaseChangedEvent; import com.kabouzeid.gramophone.model.DataBaseChangedEvent;
import com.kabouzeid.gramophone.model.Song; import com.kabouzeid.gramophone.model.Song;
@ -65,6 +72,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
private ArrayList<Song> songs; private ArrayList<Song> songs;
private View statusBar; private View statusBar;
private ImageView albumArtImageView; private ImageView albumArtImageView;
private ImageView albumArtBackground;
private View songsBackgroundView; private View songsBackgroundView;
private TextView albumTitleView; private TextView albumTitleView;
private Toolbar toolbar; private Toolbar toolbar;
@ -106,7 +114,6 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(true);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_album_detail); setContentView(R.layout.activity_album_detail);
@ -115,7 +122,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
if (Util.isAtLeastLollipop()) { if (Util.isAtLeastLollipop()) {
postponeEnterTransition(); postponeEnterTransition();
if (PreferenceUtils.getInstance(this).coloredNavigationBarAlbumEnabled()) if (PreferenceUtils.getInstance(this).coloredNavigationBarAlbumEnabled())
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color)); setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
} }
Bundle intentExtras = getIntent().getExtras(); Bundle intentExtras = getIntent().getExtras();
@ -132,6 +139,29 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
setUpObservableListViewParams(); setUpObservableListViewParams();
setUpToolBar(); setUpToolBar();
setUpViews(); setUpViews();
if (Util.isAtLeastLollipop()) {
getWindow().getEnterTransition().addListener(new SmallTransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
albumArtBackground.setVisibility(View.INVISIBLE);
}
@Override
public void onTransitionEnd(Transition transition) {
int cx = (albumArtBackground.getLeft() + albumArtBackground.getRight()) / 2;
int cy = (albumArtBackground.getTop() + albumArtBackground.getBottom()) / 2;
int finalRadius = Math.max(albumArtBackground.getWidth(), albumArtBackground.getHeight());
Animator animator = ViewAnimationUtils.createCircularReveal(albumArtBackground, cx, cy, albumArtImageView.getWidth() / 2, finalRadius);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(1000);
animator.start();
albumArtBackground.setVisibility(View.VISIBLE);
}
});
}
} }
@Override @Override
@ -144,6 +174,11 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
return false; return false;
} }
@Override
protected boolean shouldSetStatusBarTranslucent() {
return true;
}
@Override @Override
public String getTag() { public String getTag() {
return TAG; return TAG;
@ -151,11 +186,12 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
private void initViews() { private void initViews() {
albumArtImageView = (ImageView) findViewById(R.id.album_art); albumArtImageView = (ImageView) findViewById(R.id.album_art);
albumArtBackground = (ImageView) findViewById(R.id.album_art_background);
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
recyclerView = (ObservableRecyclerView) findViewById(R.id.list); recyclerView = (ObservableRecyclerView) findViewById(R.id.list);
albumTitleView = (TextView) findViewById(R.id.album_title); albumTitleView = (TextView) findViewById(R.id.album_title);
songsBackgroundView = findViewById(R.id.list_background); songsBackgroundView = findViewById(R.id.list_background);
statusBar = findViewById(R.id.statusBar); statusBar = findViewById(R.id.status_bar);
} }
private void setUpObservableListViewParams() { private void setUpObservableListViewParams() {
@ -166,7 +202,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height); titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
headerOffset = toolbarHeight; headerOffset = toolbarHeight;
if (Util.isAtLeastKitKat()) if (Util.isAtLeastKitKat())
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin); headerOffset += getResources().getDimensionPixelSize(R.dimen.status_bar_padding);
} }
private void setUpViews() { private void setUpViews() {
@ -190,6 +226,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
@Override @Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) { public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
applyPalette(null); applyPalette(null);
albumArtBackground.setImageBitmap(new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_album_art)).process(10));
if (Util.isAtLeastLollipop()) startPostponedEnterTransition(); if (Util.isAtLeastLollipop()) startPostponedEnterTransition();
} }
@ -197,6 +234,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
applyPalette(loadedImage); applyPalette(loadedImage);
albumArtBackground.setImageBitmap(new StackBlurManager(loadedImage).process(10));
if (Util.isAtLeastLollipop()) startPostponedEnterTransition(); if (Util.isAtLeastLollipop()) startPostponedEnterTransition();
} }
} }
@ -216,7 +254,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
albumTitleView.setBackgroundColor(toolbarColor); albumTitleView.setBackgroundColor(toolbarColor);
albumTitleView.setTextColor(vibrantSwatch.getTitleTextColor()); albumTitleView.setTextColor(vibrantSwatch.getTitleTextColor());
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(AlbumDetailActivity.this).coloredNavigationBarAlbumEnabled()) if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(AlbumDetailActivity.this).coloredNavigationBarAlbumEnabled())
getWindow().setNavigationBarColor(toolbarColor); setNavigationBarColor(toolbarColor);
notifyTaskColorChange(toolbarColor); notifyTaskColorChange(toolbarColor);
} else { } else {
resetColors(); resetColors();
@ -238,7 +276,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
albumTitleView.setTextColor(titleTextColor); albumTitleView.setTextColor(titleTextColor);
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled()) if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color)); setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
notifyTaskColorChange(toolbarColor); notifyTaskColorChange(toolbarColor);
} }
@ -256,9 +294,9 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setNavigationBarColored(boolean colored) { private void setNavigationBarColored(boolean colored) {
if (colored) { if (colored) {
if (Util.isAtLeastLollipop()) getWindow().setNavigationBarColor(toolbarColor); setNavigationBarColor(toolbarColor);
} else { } else {
if (Util.isAtLeastLollipop()) getWindow().setNavigationBarColor(Color.BLACK); setNavigationBarColor(Color.BLACK);
} }
} }
@ -405,4 +443,10 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
}); });
return cab; return cab;
} }
@Override
public void onBackPressed() {
if (cab != null && cab.isActive()) cab.finish();
else super.onBackPressed();
}
} }

View file

@ -1,8 +1,10 @@
package com.kabouzeid.gramophone.ui.activities; package com.kabouzeid.gramophone.ui.activities;
import android.animation.Animator;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -17,6 +19,8 @@ import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -30,6 +34,7 @@ import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.adapter.ArtistAlbumAdapter; import com.kabouzeid.gramophone.adapter.ArtistAlbumAdapter;
import com.kabouzeid.gramophone.adapter.songadapter.ArtistSongAdapter; import com.kabouzeid.gramophone.adapter.songadapter.ArtistSongAdapter;
import com.kabouzeid.gramophone.helper.MusicPlayerRemote; import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
import com.kabouzeid.gramophone.helper.bitmapblur.StackBlurManager;
import com.kabouzeid.gramophone.interfaces.CabHolder; import com.kabouzeid.gramophone.interfaces.CabHolder;
import com.kabouzeid.gramophone.interfaces.PaletteColorHolder; import com.kabouzeid.gramophone.interfaces.PaletteColorHolder;
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistBiographyLoader; import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistBiographyLoader;
@ -39,6 +44,7 @@ import com.kabouzeid.gramophone.loader.ArtistLoader;
import com.kabouzeid.gramophone.loader.ArtistSongLoader; import com.kabouzeid.gramophone.loader.ArtistSongLoader;
import com.kabouzeid.gramophone.misc.AppKeys; import com.kabouzeid.gramophone.misc.AppKeys;
import com.kabouzeid.gramophone.misc.SmallObservableScrollViewCallbacks; import com.kabouzeid.gramophone.misc.SmallObservableScrollViewCallbacks;
import com.kabouzeid.gramophone.misc.SmallTransitionListener;
import com.kabouzeid.gramophone.model.Album; import com.kabouzeid.gramophone.model.Album;
import com.kabouzeid.gramophone.model.Artist; import com.kabouzeid.gramophone.model.Artist;
import com.kabouzeid.gramophone.model.DataBaseChangedEvent; import com.kabouzeid.gramophone.model.DataBaseChangedEvent;
@ -71,6 +77,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
private ObservableListView songListView; private ObservableListView songListView;
private View statusBar; private View statusBar;
private ImageView artistImage; private ImageView artistImage;
private ImageView artistImageBackground;
private View songsBackgroundView; private View songsBackgroundView;
private TextView artistNameTv; private TextView artistNameTv;
private Toolbar toolbar; private Toolbar toolbar;
@ -121,7 +128,6 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(true);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_artist_detail); setContentView(R.layout.activity_artist_detail);
@ -130,7 +136,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
if (Util.isAtLeastLollipop()) { if (Util.isAtLeastLollipop()) {
postponeEnterTransition(); postponeEnterTransition();
if (PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled()) if (PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color)); setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
} }
getIntentExtras(); getIntentExtras();
@ -146,6 +152,29 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
fixLollipopTransitionImageWrongSize(); fixLollipopTransitionImageWrongSize();
startPostponedEnterTransition(); startPostponedEnterTransition();
} }
if (Util.isAtLeastLollipop()) {
getWindow().getEnterTransition().addListener(new SmallTransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
artistImageBackground.setVisibility(View.INVISIBLE);
}
@Override
public void onTransitionEnd(Transition transition) {
int cx = (artistImageBackground.getLeft() + artistImageBackground.getRight()) / 2;
int cy = (artistImageBackground.getTop() + artistImageBackground.getBottom()) / 2;
int finalRadius = Math.max(artistImageBackground.getWidth(), artistImageBackground.getHeight());
Animator animator = ViewAnimationUtils.createCircularReveal(artistImageBackground, cx, cy, artistImage.getWidth() / 2, finalRadius);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(1000);
animator.start();
artistImageBackground.setVisibility(View.VISIBLE);
}
});
}
} }
@Override @Override
@ -158,13 +187,19 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
return false; return false;
} }
@Override
protected boolean shouldSetStatusBarTranslucent() {
return true;
}
private void initViews() { private void initViews() {
artistImage = (ImageView) findViewById(R.id.artist_image); artistImage = (ImageView) findViewById(R.id.artist_image);
artistImageBackground = (ImageView) findViewById(R.id.artist_image_background);
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
songListView = (ObservableListView) findViewById(R.id.list); songListView = (ObservableListView) findViewById(R.id.list);
artistNameTv = (TextView) findViewById(R.id.artist_name); artistNameTv = (TextView) findViewById(R.id.artist_name);
songsBackgroundView = findViewById(R.id.list_background); songsBackgroundView = findViewById(R.id.list_background);
statusBar = findViewById(R.id.statusBar); statusBar = findViewById(R.id.status_bar);
songListHeader = LayoutInflater.from(this).inflate(R.layout.artist_detail_header, songListView, false); songListHeader = LayoutInflater.from(this).inflate(R.layout.artist_detail_header, songListView, false);
albumRecyclerView = (RecyclerView) songListHeader.findViewById(R.id.recycler_view); albumRecyclerView = (RecyclerView) songListHeader.findViewById(R.id.recycler_view);
@ -178,7 +213,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height); titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
headerOffset = toolbarHeight; headerOffset = toolbarHeight;
if (Util.isAtLeastKitKat()) if (Util.isAtLeastKitKat())
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin); headerOffset += getResources().getDimensionPixelSize(R.dimen.status_bar_padding);
} }
@Override @Override
@ -203,9 +238,9 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setNavigationBarColored(boolean colored) { private void setNavigationBarColored(boolean colored) {
if (colored) { if (colored) {
if (Util.isAtLeastLollipop()) getWindow().setNavigationBarColor(toolbarColor); setNavigationBarColor(toolbarColor);
} else { } else {
if (Util.isAtLeastLollipop()) getWindow().setNavigationBarColor(Color.BLACK); setNavigationBarColor(Color.BLACK);
} }
} }
@ -257,6 +292,8 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
} }
private void setUpArtistImageAndApplyPalette(final boolean forceDownload) { private void setUpArtistImageAndApplyPalette(final boolean forceDownload) {
final StackBlurManager defaultArtistImageBlurManager = new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_artist_image));
artistImageBackground.setImageBitmap(defaultArtistImageBlurManager.process(10));
LastFMArtistImageUrlLoader.loadArtistImageUrl(this, artist.name, forceDownload, new LastFMArtistImageUrlLoader.ArtistImageUrlLoaderCallback() { LastFMArtistImageUrlLoader.loadArtistImageUrl(this, artist.name, forceDownload, new LastFMArtistImageUrlLoader.ArtistImageUrlLoaderCallback() {
@Override @Override
public void onArtistImageUrlLoaded(final String url) { public void onArtistImageUrlLoaded(final String url) {
@ -272,11 +309,13 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
@Override @Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) { public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
applyPalette(null); applyPalette(null);
artistImageBackground.setImageBitmap(defaultArtistImageBlurManager.returnBlurredImage());
} }
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
applyPalette(loadedImage); applyPalette(loadedImage);
artistImageBackground.setImageBitmap(new StackBlurManager(loadedImage).process(10));
} }
} }
); );
@ -297,7 +336,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
artistNameTv.setBackgroundColor(vibrantSwatch.getRgb()); artistNameTv.setBackgroundColor(vibrantSwatch.getRgb());
artistNameTv.setTextColor(vibrantSwatch.getTitleTextColor()); artistNameTv.setTextColor(vibrantSwatch.getTitleTextColor());
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(ArtistDetailActivity.this).coloredNavigationBarArtistEnabled()) if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(ArtistDetailActivity.this).coloredNavigationBarArtistEnabled())
getWindow().setNavigationBarColor(vibrantSwatch.getRgb()); setNavigationBarColor(vibrantSwatch.getRgb());
notifyTaskColorChange(toolbarColor); notifyTaskColorChange(toolbarColor);
} else { } else {
resetColors(); resetColors();
@ -336,7 +375,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
artistNameTv.setTextColor(titleTextColor); artistNameTv.setTextColor(titleTextColor);
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled()) if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color)); setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
notifyTaskColorChange(toolbarColor); notifyTaskColorChange(toolbarColor);
} }
@ -491,4 +530,10 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
}); });
return cab; return cab;
} }
@Override
public void onBackPressed() {
if (cab != null && cab.isActive()) cab.finish();
else super.onBackPressed();
}
} }

View file

@ -23,6 +23,7 @@ import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.SubMenu; import android.view.SubMenu;
import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.afollestad.materialcab.MaterialCab; import com.afollestad.materialcab.MaterialCab;
@ -72,10 +73,10 @@ public class MainActivity extends AbsFabActivity
private PagerSlidingTabStrip slidingTabLayout; private PagerSlidingTabStrip slidingTabLayout;
private int currentPage = -1; private int currentPage = -1;
private MaterialCab cab; private MaterialCab cab;
private View statusBar;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(!Util.isAtLeastLollipop());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
@ -92,7 +93,7 @@ public class MainActivity extends AbsFabActivity
@Override @Override
protected boolean shouldColorStatusBar() { protected boolean shouldColorStatusBar() {
return !Util.isAtLeastLollipop(); return false;
} }
@Override @Override
@ -100,6 +101,11 @@ public class MainActivity extends AbsFabActivity
return PreferenceUtils.getInstance(this).coloredNavigationBarOtherScreensEnabled(); return PreferenceUtils.getInstance(this).coloredNavigationBarOtherScreensEnabled();
} }
@Override
protected boolean shouldSetStatusBarTranslucent() {
return true;
}
private void setUpViewPager() { private void setUpViewPager() {
pagerAdapter = new PagerAdapter(this, getSupportFragmentManager()); pagerAdapter = new PagerAdapter(this, getSupportFragmentManager());
final PagerAdapter.MusicFragments[] fragments = PagerAdapter.MusicFragments.values(); final PagerAdapter.MusicFragments[] fragments = PagerAdapter.MusicFragments.values();
@ -144,6 +150,7 @@ public class MainActivity extends AbsFabActivity
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationDrawerFragment = (NavigationDrawerFragment) navigationDrawerFragment = (NavigationDrawerFragment)
getFragmentManager().findFragmentById(R.id.navigation_drawer); getFragmentManager().findFragmentById(R.id.navigation_drawer);
statusBar = findViewById(R.id.status_bar);
} }
private void setUpToolBar() { private void setUpToolBar() {
@ -159,6 +166,7 @@ public class MainActivity extends AbsFabActivity
final int colorPrimary = PreferenceUtils.getInstance(this).getThemeColorPrimary(); final int colorPrimary = PreferenceUtils.getInstance(this).getThemeColorPrimary();
ViewUtil.setBackgroundAlpha(toolbar, alpha, colorPrimary); ViewUtil.setBackgroundAlpha(toolbar, alpha, colorPrimary);
ViewUtil.setBackgroundAlpha(slidingTabLayout, alpha, colorPrimary); ViewUtil.setBackgroundAlpha(slidingTabLayout, alpha, colorPrimary);
ViewUtil.setBackgroundAlpha(statusBar, alpha, colorPrimary);
} }
private void setUpDrawerToggle() { private void setUpDrawerToggle() {
@ -178,9 +186,6 @@ public class MainActivity extends AbsFabActivity
} }
private void setUpDrawerLayout() { private void setUpDrawerLayout() {
drawerLayout.setStatusBarBackgroundColor(PreferenceUtils
.getInstance(this).getThemeColorPrimaryDarker());
FrameLayout navDrawerFrame = (FrameLayout) findViewById(R.id.nav_drawer_frame); FrameLayout navDrawerFrame = (FrameLayout) findViewById(R.id.nav_drawer_frame);
int navDrawerMargin = getResources().getDimensionPixelSize(R.dimen.nav_drawer_margin); int navDrawerMargin = getResources().getDimensionPixelSize(R.dimen.nav_drawer_margin);
DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
@ -364,11 +369,9 @@ public class MainActivity extends AbsFabActivity
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (navigationDrawerFragment.isDrawerOpen()) { if (navigationDrawerFragment.isDrawerOpen()) drawerLayout.closeDrawers();
drawerLayout.closeDrawers(); else if (cab != null && cab.isActive()) cab.finish();
return; else super.onBackPressed();
}
super.onBackPressed();
} }
@Override @Override

View file

@ -1,37 +1,41 @@
package com.kabouzeid.gramophone.ui.activities; package com.kabouzeid.gramophone.ui.activities;
import android.animation.Animator;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Intent; import android.content.Intent;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.graphics.Palette; import android.support.v7.graphics.Palette;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.transition.Transition;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import com.afollestad.materialdialogs.ThemeSingleton; import com.afollestad.materialdialogs.ThemeSingleton;
import com.afollestad.materialdialogs.util.DialogUtils; import com.afollestad.materialdialogs.util.DialogUtils;
import com.kabouzeid.gramophone.App;
import com.kabouzeid.gramophone.R; import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.dialogs.AddToPlaylistDialog; import com.kabouzeid.gramophone.dialogs.AddToPlaylistDialog;
import com.kabouzeid.gramophone.dialogs.ColorChooserDialog;
import com.kabouzeid.gramophone.dialogs.SongDetailDialog; import com.kabouzeid.gramophone.dialogs.SongDetailDialog;
import com.kabouzeid.gramophone.helper.MusicPlayerRemote; import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistImageUrlLoader; import com.kabouzeid.gramophone.helper.bitmapblur.StackBlurManager;
import com.kabouzeid.gramophone.loader.SongFilePathLoader; import com.kabouzeid.gramophone.loader.SongFilePathLoader;
import com.kabouzeid.gramophone.misc.AppKeys; import com.kabouzeid.gramophone.misc.AppKeys;
import com.kabouzeid.gramophone.misc.SmallTransitionListener;
import com.kabouzeid.gramophone.model.MusicRemoteEvent; import com.kabouzeid.gramophone.model.MusicRemoteEvent;
import com.kabouzeid.gramophone.model.Song; import com.kabouzeid.gramophone.model.Song;
import com.kabouzeid.gramophone.model.UIPreferenceChangedEvent;
import com.kabouzeid.gramophone.service.MusicService; import com.kabouzeid.gramophone.service.MusicService;
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity; import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity; import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity;
@ -45,7 +49,6 @@ import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.FailReason; import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import com.squareup.otto.Subscribe;
import java.io.File; import java.io.File;
@ -57,42 +60,65 @@ public class MusicControllerActivity extends AbsFabActivity {
private Song song; private Song song;
private ImageView albumArt; private ImageView albumArt;
private ImageView artistImage; private ImageView albumArtBackground;
private TextView songTitle; private TextView songTitle;
private TextView songArtist; private TextView songArtist;
private TextView currentSongProgress; private TextView currentSongProgress;
private TextView totalSongDuration; private TextView totalSongDuration;
private View footer; private View footer;
private View progressContainer;
private SeekBar progressSlider; private SeekBar progressSlider;
private ImageButton nextButton; private ImageButton nextButton;
private ImageButton prevButton; private ImageButton prevButton;
private ImageButton repeatButton; private ImageButton repeatButton;
private ImageButton shuffleButton; private ImageButton shuffleButton;
private View mediaControllerContainer; private View mediaControllerContainer;
private Toolbar toolbar;
private int lastFooterColor = -1; private int lastFooterColor = -1;
private boolean killThreads = false; private boolean killThreads = false;
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(true);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_music_controller); setContentView(R.layout.activity_music_controller);
App.bus.register(this);
initViews(); initViews();
albumArtBackground.setAlpha(0.7f);
moveSeekBarIntoPlace(); moveSeekBarIntoPlace();
setUpMusicControllers(); setUpMusicControllers();
prepareViewsForOpenAnimation(); setSupportActionBar(toolbar);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
getSupportActionBar().setTitle(null); getSupportActionBar().setTitle(null);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (Util.isAtLeastLollipop()) {
getWindow().getEnterTransition().addListener(new SmallTransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
mediaControllerContainer.setVisibility(View.INVISIBLE);
}
@Override
public void onTransitionEnd(Transition transition) {
int cx = (getFab().getLeft() + getFab().getRight()) / 2;
int cy = (getFab().getTop() + getFab().getBottom()) / 2;
int finalRadius = Math.max(mediaControllerContainer.getWidth(), mediaControllerContainer.getHeight());
Animator animator = ViewAnimationUtils.createCircularReveal(mediaControllerContainer, cx, cy, getFab().getWidth() / 2, finalRadius);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(1000);
animator.start();
int i = footer.getHeight();
mediaControllerContainer.setVisibility(View.VISIBLE);
}
});
}
} }
@Override @Override
@ -111,11 +137,16 @@ public class MusicControllerActivity extends AbsFabActivity {
return false; // let other code handle this below return false; // let other code handle this below
} }
@Override
protected boolean shouldSetStatusBarTranslucent() {
return true;
}
private void moveSeekBarIntoPlace() { private void moveSeekBarIntoPlace() {
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) progressSlider.getLayoutParams(); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) progressSlider.getLayoutParams();
progressSlider.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); progressSlider.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
final int seekBarMarginLeftRight = getResources().getDimensionPixelSize(R.dimen.seek_bar_margin_left_right); final int seekBarMarginLeftRight = getResources().getDimensionPixelSize(R.dimen.seek_bar_margin_left_right);
lp.setMargins(seekBarMarginLeftRight, 0, seekBarMarginLeftRight, -(progressSlider.getMeasuredHeight() / 2)); lp.setMargins(seekBarMarginLeftRight, getResources().getDimensionPixelSize(R.dimen.progress_container_height) - (progressSlider.getMeasuredHeight() / 2), seekBarMarginLeftRight, 0);
progressSlider.setLayoutParams(lp); progressSlider.setLayoutParams(lp);
} }
@ -125,7 +156,7 @@ public class MusicControllerActivity extends AbsFabActivity {
repeatButton = (ImageButton) findViewById(R.id.repeat_button); repeatButton = (ImageButton) findViewById(R.id.repeat_button);
shuffleButton = (ImageButton) findViewById(R.id.shuffle_button); shuffleButton = (ImageButton) findViewById(R.id.shuffle_button);
albumArt = (ImageView) findViewById(R.id.album_art); albumArt = (ImageView) findViewById(R.id.album_art);
artistImage = (ImageView) findViewById(R.id.artist_image); albumArtBackground = (ImageView) findViewById(R.id.album_art_background);
songTitle = (TextView) findViewById(R.id.song_title); songTitle = (TextView) findViewById(R.id.song_title);
songArtist = (TextView) findViewById(R.id.song_artist); songArtist = (TextView) findViewById(R.id.song_artist);
currentSongProgress = (TextView) findViewById(R.id.song_current_progress); currentSongProgress = (TextView) findViewById(R.id.song_current_progress);
@ -133,6 +164,8 @@ public class MusicControllerActivity extends AbsFabActivity {
footer = findViewById(R.id.footer); footer = findViewById(R.id.footer);
progressSlider = (SeekBar) findViewById(R.id.progress_slider); progressSlider = (SeekBar) findViewById(R.id.progress_slider);
mediaControllerContainer = findViewById(R.id.media_controller_container); mediaControllerContainer = findViewById(R.id.media_controller_container);
toolbar = (Toolbar) findViewById(R.id.toolbar);
progressContainer = findViewById(R.id.progress_container);
} }
private void setUpMusicControllers() { private void setUpMusicControllers() {
@ -140,26 +173,6 @@ public class MusicControllerActivity extends AbsFabActivity {
setUpRepeatButton(); setUpRepeatButton();
setUpShuffleButton(); setUpShuffleButton();
setUpProgressSlider(); setUpProgressSlider();
setUpBox(PreferenceUtils.getInstance(this).playbackControllerBoxEnabled());
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setUpBox(boolean boxEnabled) {
if (boxEnabled) {
if (Util.isAtLeastLollipop()) {
mediaControllerContainer.setElevation(getResources().getDimensionPixelSize(R.dimen.cardview_default_elevation));
}
mediaControllerContainer.setBackgroundColor(
DialogUtils.resolveColor(this, R.attr.music_controller_container_color));
} else {
if (Util.isAtLeastLollipop() && !Util.isInPortraitMode(this)) {
mediaControllerContainer.setElevation(getResources().getDimensionPixelSize(R.dimen.cardview_default_elevation));
mediaControllerContainer.setBackgroundColor(
DialogUtils.resolveColor(this, R.attr.music_controller_container_color));
} else {
mediaControllerContainer.setBackground(null);
}
}
} }
private static void setTint(SeekBar seekBar, int color) { private static void setTint(SeekBar seekBar, int color) {
@ -264,10 +277,6 @@ public class MusicControllerActivity extends AbsFabActivity {
} }
} }
private void prepareViewsForOpenAnimation() {
footer.setPivotY(0);
footer.setScaleY(0);
}
@Override @Override
public String getTag() { public String getTag() {
@ -277,6 +286,7 @@ public class MusicControllerActivity extends AbsFabActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
updateControllerState();
startMusicControllerStateUpdateThread(); startMusicControllerStateUpdateThread();
updateCurrentSong(); updateCurrentSong();
} }
@ -284,7 +294,6 @@ public class MusicControllerActivity extends AbsFabActivity {
private void updateCurrentSong() { private void updateCurrentSong() {
getCurrentSong(); getCurrentSong();
setHeadersText(); setHeadersText();
setUpArtistArt();
setUpAlbumArtAndApplyPalette(); setUpAlbumArtAndApplyPalette();
totalSongDuration.setText(MusicUtil.getReadableDurationString(song.duration)); totalSongDuration.setText(MusicUtil.getReadableDurationString(song.duration));
currentSongProgress.setText(MusicUtil.getReadableDurationString(-1)); currentSongProgress.setText(MusicUtil.getReadableDurationString(-1));
@ -307,17 +316,18 @@ public class MusicControllerActivity extends AbsFabActivity {
new DisplayImageOptions.Builder() new DisplayImageOptions.Builder()
.cacheInMemory(true) .cacheInMemory(true)
.showImageOnFail(R.drawable.default_album_art) .showImageOnFail(R.drawable.default_album_art)
.resetViewBeforeLoading(true)
.build(), .build(),
new SimpleImageLoadingListener() { new SimpleImageLoadingListener() {
@Override @Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) { public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
applyPalette(null); applyPalette(null);
albumArtBackground.setImageBitmap(new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_album_art)).process(10));
} }
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
applyPalette(loadedImage); applyPalette(loadedImage);
albumArtBackground.setImageBitmap(new StackBlurManager(loadedImage).process(10));
} }
} }
); );
@ -335,6 +345,8 @@ public class MusicControllerActivity extends AbsFabActivity {
animateColorChange(swatchRgb); animateColorChange(swatchRgb);
songTitle.setTextColor(vibrantSwatch.getTitleTextColor()); songTitle.setTextColor(vibrantSwatch.getTitleTextColor());
songArtist.setTextColor(vibrantSwatch.getBodyTextColor()); songArtist.setTextColor(vibrantSwatch.getBodyTextColor());
currentSongProgress.setTextColor(vibrantSwatch.getTitleTextColor());
totalSongDuration.setTextColor(vibrantSwatch.getTitleTextColor());
notifyTaskColorChange(swatchRgb); notifyTaskColorChange(swatchRgb);
} else { } else {
resetColors(); resetColors();
@ -355,6 +367,8 @@ public class MusicControllerActivity extends AbsFabActivity {
songTitle.setTextColor(songTitleTextColor); songTitle.setTextColor(songTitleTextColor);
songArtist.setTextColor(artistNameTextColor); songArtist.setTextColor(artistNameTextColor);
currentSongProgress.setTextColor(artistNameTextColor);
totalSongDuration.setTextColor(artistNameTextColor);
notifyTaskColorChange(defaultBarColor); notifyTaskColorChange(defaultBarColor);
} }
@ -363,34 +377,19 @@ public class MusicControllerActivity extends AbsFabActivity {
private void animateColorChange(final int newColor) { private void animateColorChange(final int newColor) {
if (lastFooterColor != -1 && lastFooterColor != newColor) { if (lastFooterColor != -1 && lastFooterColor != newColor) {
ViewUtil.animateViewColor(footer, lastFooterColor, newColor, 300); ViewUtil.animateViewColor(footer, lastFooterColor, newColor, 300);
ViewUtil.animateViewColor(progressContainer, ColorChooserDialog.shiftColorDown(lastFooterColor), ColorChooserDialog.shiftColorDown(newColor), 300);
ViewUtil.animateViewColor(toolbar, lastFooterColor, newColor, 300);
} else { } else {
footer.setBackgroundColor(newColor); footer.setBackgroundColor(newColor);
progressContainer.setBackgroundColor(ColorChooserDialog.shiftColorDown(newColor));
toolbar.setBackgroundColor(newColor);
} }
setStatusBarColor(newColor);
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarCurrentPlayingEnabled()) if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarCurrentPlayingEnabled())
getWindow().setNavigationBarColor(newColor); setNavigationBarColor(newColor);
lastFooterColor = newColor; lastFooterColor = newColor;
} }
private void setUpArtistArt() {
if (artistImage != null) {
artistImage.setImageResource(R.drawable.default_artist_image);
LastFMArtistImageUrlLoader.loadArtistImageUrl(this, song.artistName, false, new LastFMArtistImageUrlLoader.ArtistImageUrlLoaderCallback() {
@Override
public void onArtistImageUrlLoaded(String url) {
ImageLoader.getInstance().displayImage(url,
artistImage,
new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.showImageOnFail(R.drawable.default_artist_image)
.resetViewBeforeLoading(true)
.build()
);
}
});
}
}
private void getCurrentSong() { private void getCurrentSong() {
song = MusicPlayerRemote.getCurrentSong(); song = MusicPlayerRemote.getCurrentSong();
if (song.id == -1) { if (song.id == -1) {
@ -430,9 +429,8 @@ public class MusicControllerActivity extends AbsFabActivity {
}).start(); }).start();
} }
@Override
protected void updateControllerState() { protected void updateControllerState() {
super.updateControllerState(); updateFabState();
updateRepeatState(); updateRepeatState();
updateShuffleState(); updateShuffleState();
} }
@ -522,19 +520,4 @@ public class MusicControllerActivity extends AbsFabActivity {
.setStartDelay(startDelay) .setStartDelay(startDelay)
.start(); .start();
} }
@Subscribe
public void onUIPrefsChanged(UIPreferenceChangedEvent event) {
switch (event.getAction()) {
case UIPreferenceChangedEvent.PLAYBACK_CONTROLLER_CARD_CHANGED:
setUpBox((boolean) event.getValue());
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
App.bus.unregister(this);
}
} }

View file

@ -26,7 +26,6 @@ import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
import com.kabouzeid.gramophone.util.NavigationUtil; import com.kabouzeid.gramophone.util.NavigationUtil;
import com.kabouzeid.gramophone.util.PlaylistsUtil; import com.kabouzeid.gramophone.util.PlaylistsUtil;
import com.kabouzeid.gramophone.util.PreferenceUtils; import com.kabouzeid.gramophone.util.PreferenceUtils;
import com.kabouzeid.gramophone.util.Util;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,7 +41,6 @@ public class PlaylistDetailActivity extends AbsFabActivity implements CabHolder
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(!Util.isAtLeastLollipop());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playlist_detail); setContentView(R.layout.activity_playlist_detail);
@ -94,6 +92,11 @@ public class PlaylistDetailActivity extends AbsFabActivity implements CabHolder
return PreferenceUtils.getInstance(this).coloredNavigationBarPlaylistEnabled(); return PreferenceUtils.getInstance(this).coloredNavigationBarPlaylistEnabled();
} }
@Override
protected boolean shouldSetStatusBarTranslucent() {
return true;
}
private void getIntentExtras() { private void getIntentExtras() {
Bundle intentExtras = getIntent().getExtras(); Bundle intentExtras = getIntent().getExtras();
final int playlistId = intentExtras.getInt(AppKeys.E_PLAYLIST); final int playlistId = intentExtras.getInt(AppKeys.E_PLAYLIST);
@ -163,4 +166,10 @@ public class PlaylistDetailActivity extends AbsFabActivity implements CabHolder
break; break;
} }
} }
@Override
public void onBackPressed() {
if (cab != null && cab.isActive()) cab.finish();
else super.onBackPressed();
}
} }

View file

@ -34,7 +34,6 @@ public class SearchActivity extends AbsBaseActivity {
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(false);
setTitle(null); setTitle(null);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search); setContentView(R.layout.activity_search);
@ -72,6 +71,11 @@ public class SearchActivity extends AbsBaseActivity {
return true; return true;
} }
@Override
protected boolean shouldSetStatusBarTranslucent() {
return true;
}
@Override @Override
public String getTag() { public String getTag() {
return TAG; return TAG;

View file

@ -22,7 +22,6 @@ import com.kabouzeid.gramophone.prefs.ColorChooserPreference;
import com.kabouzeid.gramophone.ui.activities.base.AbsBaseActivity; import com.kabouzeid.gramophone.ui.activities.base.AbsBaseActivity;
import com.kabouzeid.gramophone.util.NavigationUtil; import com.kabouzeid.gramophone.util.NavigationUtil;
import com.kabouzeid.gramophone.util.PreferenceUtils; import com.kabouzeid.gramophone.util.PreferenceUtils;
import com.kabouzeid.gramophone.util.Util;
import java.util.Set; import java.util.Set;
@ -31,7 +30,6 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(!Util.isAtLeastLollipop());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preferences); setContentView(R.layout.activity_preferences);
@ -54,6 +52,11 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
return PreferenceUtils.getInstance(this).coloredNavigationBarOtherScreensEnabled(); return PreferenceUtils.getInstance(this).coloredNavigationBarOtherScreensEnabled();
} }
@Override
protected boolean shouldSetStatusBarTranslucent() {
return true;
}
@Override @Override
public void onColorSelection(int title, int color) { public void onColorSelection(int title, int color) {
if (title == R.string.primary_color) { if (title == R.string.primary_color) {
@ -137,14 +140,6 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
} }
}); });
findPreference("playback_controller_card").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
App.bus.post(new UIPreferenceChangedEvent(UIPreferenceChangedEvent.PLAYBACK_CONTROLLER_CARD_CHANGED, o));
return true;
}
});
Preference colorNavBar = findPreference("colored_navigation_bar"); Preference colorNavBar = findPreference("colored_navigation_bar");
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
colorNavBar.setEnabled(false); colorNavBar.setEnabled(false);

View file

@ -113,7 +113,7 @@ public abstract class AbsFabActivity extends AbsBaseActivity {
}); });
} }
private void updateFabState() { protected void updateFabState() {
if (MusicPlayerRemote.isPlaying()) { if (MusicPlayerRemote.isPlaying()) {
playPauseDrawable.setPause(); playPauseDrawable.setPause();
} else { } else {
@ -135,10 +135,6 @@ public abstract class AbsFabActivity extends AbsBaseActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
updateControllerState();
}
protected void updateControllerState() {
updateFabState(); updateFabState();
} }
@ -190,4 +186,8 @@ public abstract class AbsFabActivity extends AbsBaseActivity {
private void setFabPause() { private void setFabPause() {
playPauseDrawable.animatedPause(); playPauseDrawable.animatedPause();
} }
private void setFabColor() {
}
} }

View file

@ -3,45 +3,28 @@ package com.kabouzeid.gramophone.ui.activities.base;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import com.afollestad.materialdialogs.ThemeSingleton; import com.afollestad.materialdialogs.ThemeSingleton;
import com.kabouzeid.gramophone.R; import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.dialogs.ColorChooserDialog;
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble; import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
import com.kabouzeid.gramophone.util.PreferenceUtils; import com.kabouzeid.gramophone.util.PreferenceUtils;
import com.kabouzeid.gramophone.util.Util; import com.kabouzeid.gramophone.util.Util;
import com.readystatesoftware.systembartint.SystemBarTintManager; import com.readystatesoftware.systembartint.SystemBarTintManager;
/** /**
* @author Aidan Follestad (afollestad) * @author Aidan Follestad (afollestad), Karim Abou Zeid (kabouzeid)
*/
/**
* READ!
* <p/>
* Instructions:
* <p/>
* KitKat or Lollipop solid statusBar with the right color (primaryDark):
* - shouldColorStatusBar return true OR return false and call setStatusBarColor() in the activity with a custom color
* - setStatusBarTranslucent(!Util.isAtLeastLollipop())
* <p/>
* KitKat or Lollipop translucent statusBar (not the color is too dark on Lollipop and KitKat only does fading but MUCH better performance the setStatusBarColor in onScrollCallback)
* - shouldColorStatusBar return false DO NOT return true and do not call setStatusBarColor() in this case at all here
* - setStatusBarTranslucent(true)
* - use a view below the statusBar to color it
*/ */
public abstract class ThemeBaseActivity extends AppCompatActivity implements KabViewsDisableAble { public abstract class ThemeBaseActivity extends AppCompatActivity implements KabViewsDisableAble {
private final boolean statusBarTranslucent = shouldSetStatusBarTranslucent();
// private boolean mLastDarkTheme;
// private int mLastPrimary;
// private int mLastAccent;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(statusBarTranslucent);
setTheme(PreferenceUtils.getInstance(this).getGeneralTheme()); setTheme(PreferenceUtils.getInstance(this).getGeneralTheme());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setupTheme(); setupTheme();
@ -53,11 +36,6 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
setShouldColorNavBar(shouldColorNavBar()); setShouldColorNavBar(shouldColorNavBar());
setShouldColorStatusBar(shouldColorStatusBar()); setShouldColorStatusBar(shouldColorStatusBar());
// Persist current values so the Activity knows if they change
// mLastDarkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == 1;
// mLastPrimary = PreferenceUtils.getInstance(this).getThemeColorPrimary();
// mLastAccent = PreferenceUtils.getInstance(this).getThemeColorAccent();
// Accent colors in dialogs, and any dynamic views that pull from this singleton // Accent colors in dialogs, and any dynamic views that pull from this singleton
ThemeSingleton.get().positiveColor = PreferenceUtils.getInstance(this).getThemeColorAccent(); ThemeSingleton.get().positiveColor = PreferenceUtils.getInstance(this).getThemeColorAccent();
ThemeSingleton.get().negativeColor = ThemeSingleton.get().positiveColor; ThemeSingleton.get().negativeColor = ThemeSingleton.get().positiveColor;
@ -71,10 +49,6 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
} }
} }
protected boolean overridesTaskColor() {
return false;
}
protected void notifyTaskColorChange(int color) { protected void notifyTaskColorChange(int color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Sets color of entry in the system recents page // Sets color of entry in the system recents page
@ -86,30 +60,22 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
} }
} }
// @Override private void setStatusBarTranslucent(boolean statusBarTranslucent) {
// protected void onResume() {
// super.onResume();
// if (mLastDarkTheme != (PreferenceUtils.getInstance(this).getGeneralTheme() == 1) ||
// mLastPrimary != PreferenceUtils.getInstance(this).getThemeColorPrimary() ||
// mLastAccent != PreferenceUtils.getInstance(this).getThemeColorAccent()) {
// // Theme colors changed, recreate the Activity
// recreate();
// }
// }
protected void setStatusBarTranslucent(boolean statusBarTranslucent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Util.setStatusBarTranslucent(getWindow(), statusBarTranslucent); Util.setStatusBarTranslucent(getWindow(), statusBarTranslucent);
} }
} }
protected abstract boolean shouldColorStatusBar(); @TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected final void setNavigationBarColor(int color) {
if (Util.isAtLeastLollipop())
getWindow().setNavigationBarColor(ColorChooserDialog.shiftColorDown(color));
protected abstract boolean shouldColorNavBar(); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected final void setStatusBarColor(int color, boolean forceSystemBarTint) { protected final void setStatusBarColor(int color) {
if (!forceSystemBarTint && Util.isAtLeastLollipop()) { if (!statusBarTranslucent && Util.isAtLeastLollipop()) {
getWindow().setStatusBarColor(color); getWindow().setStatusBarColor(color);
} else { } else {
SystemBarTintManager tintManager = new SystemBarTintManager(this); SystemBarTintManager tintManager = new SystemBarTintManager(this);
@ -122,10 +88,9 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
protected final void setShouldColorNavBar(boolean shouldColorNavBar) { protected final void setShouldColorNavBar(boolean shouldColorNavBar) {
if (Util.isAtLeastLollipop()) { if (Util.isAtLeastLollipop()) {
if (shouldColorNavBar) { if (shouldColorNavBar) {
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker(); setNavigationBarColor(PreferenceUtils.getInstance(this).getThemeColorPrimary());
getWindow().setNavigationBarColor(primaryDark);
} else { } else {
getWindow().setNavigationBarColor(Color.BLACK); getWindow().setNavigationBarColor(Util.resolveColor(this, android.R.attr.navigationBarColor));
} }
} }
} }
@ -133,8 +98,8 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected final void setShouldColorStatusBar(boolean shouldColorStatusBar) { protected final void setShouldColorStatusBar(boolean shouldColorStatusBar) {
if (shouldColorStatusBar) { if (shouldColorStatusBar) {
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker(); final int primary = PreferenceUtils.getInstance(this).getThemeColorPrimary();
setStatusBarColor(primaryDark, false); setStatusBarColor(primary);
} else { } else {
if (Util.isAtLeastLollipop()) { if (Util.isAtLeastLollipop()) {
getWindow().setStatusBarColor(Util.resolveColor(this, android.R.attr.statusBarColor)); getWindow().setStatusBarColor(Util.resolveColor(this, android.R.attr.statusBarColor));
@ -144,4 +109,14 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
} }
} }
} }
protected abstract boolean shouldColorStatusBar();
protected abstract boolean shouldColorNavBar();
protected abstract boolean shouldSetStatusBarTranslucent();
protected boolean overridesTaskColor() {
return false;
}
} }

View file

@ -90,7 +90,6 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setStatusBarTranslucent(!Util.isAtLeastLollipop());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(getContentViewResId()); setContentView(getContentViewResId());
@ -123,6 +122,11 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
return false; return false;
} }
@Override
protected boolean shouldSetStatusBarTranslucent() {
return true;
}
private void initViews() { private void initViews() {
fab = (FloatingActionButton) findViewById(R.id.fab); fab = (FloatingActionButton) findViewById(R.id.fab);
scrollView = (ObservableScrollView) findViewById(R.id.observableScrollView); scrollView = (ObservableScrollView) findViewById(R.id.observableScrollView);
@ -212,9 +216,9 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
final int primaryColor = PreferenceUtils.getInstance(this).getThemeColorPrimary(); final int primaryColor = PreferenceUtils.getInstance(this).getThemeColorPrimary();
paletteColorPrimary = primaryColor; paletteColorPrimary = primaryColor;
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false); observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
setStatusBarColor(ColorChooserDialog.shiftColorDown(primaryColor), false); setStatusBarColor(primaryColor);
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled()) if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
getWindow().setNavigationBarColor(primaryColor); setNavigationBarColor(primaryColor);
notifyTaskColorChange(primaryColor); notifyTaskColorChange(primaryColor);
} }
@ -264,10 +268,9 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
toolBar.setBackgroundColor(paletteColorPrimary); toolBar.setBackgroundColor(paletteColorPrimary);
header.setBackgroundColor(paletteColorPrimary); header.setBackgroundColor(paletteColorPrimary);
int primaryDark = ColorChooserDialog.shiftColorDown(paletteColorPrimary); setStatusBarColor(paletteColorPrimary);
setStatusBarColor(primaryDark, false);
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled()) if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
getWindow().setNavigationBarColor(primaryDark); setNavigationBarColor(ColorChooserDialog.shiftColorDown(paletteColorPrimary));
} }
protected void dataChanged() { protected void dataChanged() {
@ -309,9 +312,9 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
final int vibrantColor = palette.getVibrantColor(DialogUtils.resolveColor(AbsTagEditorActivity.this, R.attr.default_bar_color)); final int vibrantColor = palette.getVibrantColor(DialogUtils.resolveColor(AbsTagEditorActivity.this, R.attr.default_bar_color));
paletteColorPrimary = vibrantColor; paletteColorPrimary = vibrantColor;
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false); observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false); setStatusBarColor(vibrantColor);
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(AbsTagEditorActivity.this).coloredNavigationBarTagEditorEnabled()) if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(AbsTagEditorActivity.this).coloredNavigationBarTagEditorEnabled())
getWindow().setNavigationBarColor(vibrantColor); setNavigationBarColor(vibrantColor);
notifyTaskColorChange(vibrantColor); notifyTaskColorChange(vibrantColor);
} else { } else {
resetColors(); resetColors();

View file

@ -15,15 +15,10 @@ public abstract class AbsMainActivityFragment extends Fragment implements KabVie
private boolean areViewsEnabled; private boolean areViewsEnabled;
protected int getTopPadding() { protected int getTopPadding() {
final int norm = Util.getActionBarSize(getActivity()) + return Util.getActionBarSize(getActivity()) +
Util.getStatusBarHeight(getActivity()) +
getResources().getDimensionPixelSize(R.dimen.tab_height) + getResources().getDimensionPixelSize(R.dimen.tab_height) +
getResources().getDimensionPixelSize(R.dimen.list_padding_vertical); getResources().getDimensionPixelSize(R.dimen.list_padding_vertical);
if (Util.isAtLeastKitKat() && !Util.isAtLeastLollipop()) {
if (Util.isInPortraitMode(getActivity()) || Util.isTablet(getActivity())) {
return norm + Util.getStatusBarHeight(getActivity());
}
}
return norm;
} }
protected int getBottomPadding() { protected int getBottomPadding() {

View file

@ -23,7 +23,7 @@ public final class PreferenceUtils {
public static final String ALBUM_SORT_ORDER = "album_sort_order"; public static final String ALBUM_SORT_ORDER = "album_sort_order";
public static final String ALBUM_SONG_SORT_ORDER = "album_song_sort_order"; public static final String ALBUM_SONG_SORT_ORDER = "album_song_sort_order";
public static final String SONG_SORT_ORDER = "song_sort_order"; public static final String SONG_SORT_ORDER = "song_sort_order";
public static final String ONLY_ON_WIFI = "auto_download_artist_images"; // public static final String ONLY_ON_WIFI = "auto_download_artist_images";
// public static final String DOWNLOAD_MISSING_ARTIST_IMAGES = "auto_download_artist_images"; // public static final String DOWNLOAD_MISSING_ARTIST_IMAGES = "auto_download_artist_images";
public static final String COLORED_ALBUM_FOOTERS = "colored_album_footers"; public static final String COLORED_ALBUM_FOOTERS = "colored_album_footers";
public static final String COLORED_NAVIGATION_BAR = "colored_navigation_bar"; public static final String COLORED_NAVIGATION_BAR = "colored_navigation_bar";
@ -33,7 +33,6 @@ public final class PreferenceUtils {
public static final String COLORED_NAVIGATION_BAR_PLAYIST = "colored_navigation_bar_playlist"; public static final String COLORED_NAVIGATION_BAR_PLAYIST = "colored_navigation_bar_playlist";
public static final String COLORED_NAVIGATION_BAR_TAG_EDITOR = "colored_navigation_bar_tag_editor"; public static final String COLORED_NAVIGATION_BAR_TAG_EDITOR = "colored_navigation_bar_tag_editor";
public static final String COLORED_NAVIGATION_BAR_OTHER_SCREENS = "colored_navigation_bar_other_screens"; public static final String COLORED_NAVIGATION_BAR_OTHER_SCREENS = "colored_navigation_bar_other_screens";
public static final String PLAYBACK_CONTROLLER_BOX = "playback_controller_card";
public static final String TRANSPARENT_TOOLBAR = "transparent_toolbar"; 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 = "album_grid_columns";
public static final String ALBUM_GRID_COLUMNS_LAND = "album_grid_columns_land"; public static final String ALBUM_GRID_COLUMNS_LAND = "album_grid_columns_land";
@ -136,7 +135,7 @@ public final class PreferenceUtils {
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")
private boolean coloredNavigationBarFor(String key) { private boolean coloredNavigationBarFor(String key) {
Set<String> defaultVals = new HashSet<>(); final Set<String> defaultVals = new HashSet<>();
defaultVals.add(COLORED_NAVIGATION_BAR_ALBUM); defaultVals.add(COLORED_NAVIGATION_BAR_ALBUM);
defaultVals.add(COLORED_NAVIGATION_BAR_ARTIST); defaultVals.add(COLORED_NAVIGATION_BAR_ARTIST);
defaultVals.add(COLORED_NAVIGATION_BAR_CURRENT_PLAYING); defaultVals.add(COLORED_NAVIGATION_BAR_CURRENT_PLAYING);
@ -148,6 +147,7 @@ public final class PreferenceUtils {
mPreferences.edit().putStringSet(COLORED_NAVIGATION_BAR, defaultVals).commit(); mPreferences.edit().putStringSet(COLORED_NAVIGATION_BAR, defaultVals).commit();
try { try {
//noinspection ConstantConditions
return mPreferences.getStringSet(COLORED_NAVIGATION_BAR, defaultVals).contains(key); return mPreferences.getStringSet(COLORED_NAVIGATION_BAR, defaultVals).contains(key);
} catch (NullPointerException e) { } catch (NullPointerException e) {
return false; return false;
@ -159,10 +159,6 @@ public final class PreferenceUtils {
// mPreferences.edit().putBoolean(COLORED_NAVIGATION_BAR_OTHER_SCREENS, coloredNavbar).commit(); // mPreferences.edit().putBoolean(COLORED_NAVIGATION_BAR_OTHER_SCREENS, coloredNavbar).commit();
// } // }
public final boolean playbackControllerBoxEnabled() {
return mPreferences.getBoolean(PLAYBACK_CONTROLLER_BOX, false);
}
public final boolean transparentToolbar() { public final boolean transparentToolbar() {
return mPreferences.getBoolean(TRANSPARENT_TOOLBAR, false); return mPreferences.getBoolean(TRANSPARENT_TOOLBAR, false);
} }

View file

@ -0,0 +1,30 @@
package com.kabouzeid.gramophone.views;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
public class HeightAndWidthFitSquarePlaceLeftRightImageView extends ImageView {
public HeightAndWidthFitSquarePlaceLeftRightImageView(Context context) {
super(context);
}
public HeightAndWidthFitSquarePlaceLeftRightImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public HeightAndWidthFitSquarePlaceLeftRightImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int small = Math.min(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(small, small);
}
}

View file

@ -7,25 +7,24 @@ import android.widget.ImageView;
/** /**
* @author Karim Abou Zeid (kabouzeid) * @author Karim Abou Zeid (kabouzeid)
*/ */
public class SquareFitImageView extends ImageView { public class HeightFitSquareImageView extends ImageView {
public SquareFitImageView(Context context) { public HeightFitSquareImageView(Context context) {
super(context); super(context);
} }
public SquareFitImageView(Context context, AttributeSet attrs) { public HeightFitSquareImageView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
} }
public SquareFitImageView(Context context, AttributeSet attrs, int defStyle) { public HeightFitSquareImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
} }
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int newWidth = Math.min(widthMeasureSpec, heightMeasureSpec);
//noinspection SuspiciousNameCombination //noinspection SuspiciousNameCombination
super.onMeasure(newWidth, newWidth); super.onMeasure(heightMeasureSpec, heightMeasureSpec);
} }
} }

View file

@ -0,0 +1,35 @@
package com.kabouzeid.gramophone.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
public class SquareIfPlaceLeftRightImageView extends ImageView {
public SquareIfPlaceLeftRightImageView(Context context) {
super(context);
}
public SquareIfPlaceLeftRightImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareIfPlaceLeftRightImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
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)
super.onMeasure(small, small);
else super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}

View file

@ -7,17 +7,17 @@ import android.widget.ImageView;
/** /**
* @author Karim Abou Zeid (kabouzeid) * @author Karim Abou Zeid (kabouzeid)
*/ */
public class SquareImageView extends ImageView { public class WidthFitSquareImageView extends ImageView {
public SquareImageView(Context context) { public WidthFitSquareImageView(Context context) {
super(context); super(context);
} }
public SquareImageView(Context context, AttributeSet attrs) { public WidthFitSquareImageView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
} }
public SquareImageView(Context context, AttributeSet attrs, int defStyle) { public WidthFitSquareImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -1,227 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.kabouzeid.gramophone.ui.activities.AlbumDetailActivity$PlaceholderFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/album_art"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="centerCrop"
android:src="@drawable/default_album_art"
android:transitionName="@string/transition_album_cover"
tools:ignore="ContentDescription,UnusedAttribute" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/artist_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer"
android:layout_alignParentTop="true"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer"
android:background="@drawable/shadow_up" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer"
android:layout_alignParentTop="true"
android:layout_margin="16dp"
android:orientation="horizontal"
tools:ignore="RtlHardcoded">
<TextView
android:id="@+id/song_current_progress"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="sans-serif-medium"
android:gravity="bottom|left|start"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/white"
android:textSize="16sp"
tools:ignore="RtlHardcoded" />
<TextView
android:id="@+id/song_total_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="sans-serif"
android:gravity="bottom|right|end"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/white"
android:textSize="16sp"
tools:ignore="RtlHardcoded" />
</LinearLayout>
<LinearLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?default_bar_color"
android:elevation="@dimen/toolbar_elevation"
android:orientation="vertical"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:orientation="vertical"
android:transitionName="@string/transition_album_text"
tools:ignore="UnusedAttribute">
<TextView
android:id="@+id/song_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?attr/title_text_color" />
<TextView
android:id="@+id/song_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textColor="?attr/caption_text_color" />
</LinearLayout>
<RelativeLayout
android:id="@+id/media_controller_placeholder"
android:layout_width="match_parent"
android:layout_height="88dp"
android:layout_gravity="bottom"
android:layout_margin="16dp"
android:background="?attr/music_controller_container_color"
android:elevation="1dp"
tools:ignore="UnusedAttribute">
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/media_controller_container"
android:layout_width="match_parent"
android:layout_height="88dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="16dp"
android:background="?attr/music_controller_container_color"
android:elevation="@dimen/toolbar_elevation"
tools:ignore="ContentDescription,UnusedAttribute">
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
style="@style/PlayPauseFab"
android:layout_centerInParent="true" />
<ImageButton
android:id="@+id/prev_button"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_centerVertical="true"
android:layout_marginEnd="-4dp"
android:layout_marginRight="-4dp"
android:layout_toLeftOf="@+id/fab"
android:layout_toStartOf="@+id/fab"
android:background="?round_selector"
android:padding="14dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_previous_white_48dp" />
<ImageButton
android:id="@+id/next_button"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_centerVertical="true"
android:layout_marginLeft="-4dp"
android:layout_marginStart="-4dp"
android:layout_toEndOf="@+id/fab"
android:layout_toRightOf="@+id/fab"
android:background="?round_selector"
android:padding="14dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_next_white_48dp" />
<ImageButton
android:id="@+id/repeat_button"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:background="?round_selector"
android:padding="14dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_repeat_grey600_48dp" />
<ImageButton
android:id="@+id/shuffle_button"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:background="?round_selector"
android:padding="14dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_shuffle_grey600_48dp" />
</RelativeLayout>
<SeekBar
android:id="@+id/progress_slider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/footer"
android:elevation="2dp"
android:padding="0dp"
android:progressTint="@color/materialmusic_accent_color"
android:thumbTint="@color/materialmusic_accent_color_darker"
tools:ignore="UnusedAttribute" />
</RelativeLayout>
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:layout_marginTop="@dimen/statusMargin"
android:background="@android:color/transparent" />
</FrameLayout>

View file

@ -7,7 +7,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/header_image_height"> android:layout_height="@dimen/header_image_height">
<com.kabouzeid.gramophone.views.SquareFitImageView <ImageView
android:id="@+id/album_art_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<com.kabouzeid.gramophone.views.SquareIfPlaceLeftRightImageView
android:id="@+id/album_art" android:id="@+id/album_art"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -68,9 +74,9 @@
android:orientation="vertical"> android:orientation="vertical">
<View <View
android:id="@+id/statusBar" android:id="@+id/status_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/statusMargin" android:layout_height="@dimen/status_bar_padding"
android:background="@android:color/transparent" /> android:background="@android:color/transparent" />
<FrameLayout <FrameLayout

View file

@ -15,7 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.kabouzeid.gramophone.views.SquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -3,14 +3,27 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView
android:id="@+id/artist_image" <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/header_image_height" android:layout_height="@dimen/header_image_height">
android:scaleType="centerCrop"
android:src="@drawable/default_artist_image" <ImageView
android:transitionName="@string/transition_artist_image" android:id="@+id/artist_image_background"
tools:ignore="ContentDescription,UnusedAttribute" /> android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<com.kabouzeid.gramophone.views.SquareIfPlaceLeftRightImageView
android:id="@+id/artist_image"
android:layout_width="match_parent"
android:layout_height="@dimen/header_image_height"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/default_artist_image"
android:transitionName="@string/transition_artist_image"
tools:ignore="ContentDescription,UnusedAttribute" />
</FrameLayout>
<View <View
android:id="@+id/list_background" android:id="@+id/list_background"
@ -62,9 +75,9 @@
android:orientation="vertical"> android:orientation="vertical">
<View <View
android:id="@+id/statusBar" android:id="@+id/status_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/statusMargin" android:layout_height="@dimen/status_bar_padding"
android:background="@android:color/transparent" /> android:background="@android:color/transparent" />
<FrameLayout <FrameLayout

View file

@ -5,7 +5,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".DrawerActivity"> tools:context=".DrawerActivity">
<FrameLayout <FrameLayout
@ -15,43 +14,31 @@
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:clipToPadding="false"
android:fitsSystemWindows="true" />
<LinearLayout <LinearLayout
android:elevation="@dimen/toolbar_elevation" android:id="@+id/toolbar_frame"
android:id="@+id/toolbarFrame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="@dimen/toolbar_elevation"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="@dimen/main_toolbar_padding_top"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
<View
android:id="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/status_bar_padding" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
android:elevation="0dp" android:elevation="0dp">
android:background="?colorPrimary">
<TextView </android.support.v7.widget.Toolbar>
android:id="@+id/toolbar_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:fontFamily="sans-serif-medium"
android:gravity="left|start|center"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="20sp"
tools:ignore="RtlHardcoded" />
</android.support.v7.widget.Toolbar>
<ViewStub <ViewStub
android:id="@+id/cab_stub" android:id="@+id/cab_stub"
@ -87,7 +74,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|right|bottom" android:layout_gravity="end|right|bottom"
android:fitsSystemWindows="true"
tools:ignore="RtlHardcoded"> tools:ignore="RtlHardcoded">
<com.melnykov.fab.FloatingActionButton <com.melnykov.fab.FloatingActionButton
@ -99,14 +85,12 @@
</FrameLayout> </FrameLayout>
<com.kabouzeid.gramophone.views.ScrimInsetsFrameLayout <FrameLayout
android:id="@+id/nav_drawer_frame" android:id="@+id/nav_drawer_frame"
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:clickable="true" android:clickable="true">
android:fitsSystemWindows="true"
app:insetForeground="@color/scrim_inset_color">
<fragment <fragment
android:id="@+id/navigation_drawer" android:id="@+id/navigation_drawer"
@ -116,6 +100,6 @@
android:tag="NAV_DRAWER" android:tag="NAV_DRAWER"
tools:layout="@layout/fragment_navigation_drawer" /> tools:layout="@layout/fragment_navigation_drawer" />
</com.kabouzeid.gramophone.views.ScrimInsetsFrameLayout> </FrameLayout>
</android.support.v4.widget.DrawerLayout> </android.support.v4.widget.DrawerLayout>

View file

@ -1,207 +1,218 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.kabouzeid.gramophone.ui.activities.AlbumDetailActivity$PlaceholderFragment">
<ImageView xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/album_art" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="match_parent" tools:context="com.kabouzeid.gramophone.ui.activities.MusicControllerActivity">
android:layout_above="@+id/footer"
android:background="@color/black"
android:scaleType="centerCrop"
android:src="@drawable/default_album_art"
android:transitionName="@string/transition_album_cover"
tools:ignore="ContentDescription,UnusedAttribute" />
<LinearLayout <!-- TOOLBAR-->
android:orientation="vertical"
android:id="@+id/dummy_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View <FrameLayout
android:layout_width="match_parent" android:id="@+id/toolbar_frame"
android:layout_height="@dimen/statusMargin" />
<View
android:layout_width="match_parent"
android:layout_height="?actionBarSize" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shadow_down"
android:layout_alignBottom="@+id/dummy_toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer"
android:background="@drawable/shadow_up"
android:layout_alignTop="@+id/progress_container" />
<LinearLayout
android:id="@+id/progress_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/footer" android:paddingTop="@dimen/status_bar_padding">
android:orientation="horizontal"
android:padding="16dp">
<TextView <android.support.v7.widget.Toolbar
android:id="@+id/song_current_progress" android:id="@+id/toolbar"
android:layout_width="wrap_content" style="@style/Toolbar"
android:layout_height="match_parent" android:background="?default_bar_color" />
android:layout_weight="1" </FrameLayout>
android:fontFamily="sans-serif-medium"
android:gravity="bottom|left|start"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:ignore="RtlHardcoded" />
<TextView <!-- BOTTOM-->
android:id="@+id/song_total_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="sans-serif"
android:gravity="bottom|right|end"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/white"
android:textSize="16sp"
tools:ignore="RtlHardcoded" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/footer" android:id="@+id/footer_frame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/media_controller_container"
android:background="?default_bar_color"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="72dp"
android:paddingRight="72dp"
android:paddingTop="16dp"
android:transitionName="@string/transition_album_text"
android:elevation="@dimen/toolbar_elevation"
tools:ignore="UnusedAttribute">
<TextView
android:id="@+id/song_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?attr/title_text_color" />
<TextView
android:id="@+id/song_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textColor="?attr/caption_text_color" />
</LinearLayout>
<RelativeLayout
android:id="@+id/media_controller_container"
android:layout_width="match_parent"
android:layout_height="88dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" android:orientation="vertical">
android:layout_margin="16dp"
android:background="?music_controller_container_color"
android:elevation="@dimen/toolbar_elevation"
tools:ignore="ContentDescription,UnusedAttribute">
<ImageButton <FrameLayout
android:id="@+id/prev_button" android:layout_width="match_parent"
android:layout_width="72dp" android:layout_height="wrap_content">
android:layout_height="72dp"
android:layout_centerVertical="true"
android:layout_marginRight="-8dp"
android:layout_marginEnd="-8dp"
android:layout_toLeftOf="@+id/fab"
android:layout_toStartOf="@+id/fab"
android:background="?round_selector"
android:padding="22dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_previous_white_48dp" />
<ImageButton <LinearLayout
android:id="@+id/next_button" android:layout_width="match_parent"
android:layout_width="72dp" android:layout_height="wrap_content"
android:layout_height="72dp" android:orientation="vertical">
android:layout_centerVertical="true"
android:layout_marginLeft="-8dp"
android:layout_marginStart="-8dp"
android:layout_toRightOf="@+id/fab"
android:layout_toEndOf="@+id/fab"
android:background="?round_selector"
android:padding="22dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_next_white_48dp" />
<ImageButton <LinearLayout
android:id="@+id/repeat_button" android:id="@+id/progress_container"
android:layout_width="72dp" android:layout_width="match_parent"
android:layout_height="72dp" android:layout_height="@dimen/progress_container_height"
android:layout_alignParentLeft="true" android:background="?default_bar_color"
android:layout_alignParentStart="true" android:orientation="horizontal"
android:layout_centerVertical="true" android:paddingLeft="16dp"
android:layout_marginLeft="8dp" android:paddingRight="16dp">
android:layout_marginStart="8dp"
android:background="?round_selector"
android:padding="22dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_repeat_grey600_48dp" />
<ImageButton <TextView
android:id="@+id/shuffle_button" android:id="@+id/song_current_progress"
android:layout_width="72dp" android:layout_width="wrap_content"
android:layout_height="72dp" android:layout_height="match_parent"
android:layout_alignParentRight="true" android:layout_weight="1"
android:layout_alignParentEnd="true" android:fontFamily="sans-serif-medium"
android:layout_centerVertical="true" android:gravity="center_vertical|left|end"
android:layout_marginRight="8dp" android:singleLine="true"
android:layout_marginEnd="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:background="?round_selector" android:textColor="@color/white"
android:padding="22dp" android:textSize="16sp"
android:scaleType="fitCenter" android:textStyle="bold"
android:src="@drawable/ic_shuffle_grey600_48dp" /> tools:ignore="RtlHardcoded" />
<com.melnykov.fab.FloatingActionButton <TextView
android:id="@+id/fab" android:id="@+id/song_total_time"
style="@style/PlayPauseFab" android:layout_width="wrap_content"
android:layout_centerInParent="true" /> android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="sans-serif"
android:gravity="center_vertical|right|end"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/white"
android:textSize="16sp"
tools:ignore="RtlHardcoded" />
</RelativeLayout> </LinearLayout>
<SeekBar <LinearLayout
android:id="@+id/progress_slider" android:id="@+id/footer"
style="@style/MusicProgressSlider" android:layout_width="match_parent"
android:layout_above="@+id/footer" android:layout_height="wrap_content"
android:elevation="2dp" android:background="?default_bar_color"
tools:ignore="UnusedAttribute" /> android:elevation="@dimen/toolbar_elevation"
android:orientation="vertical"
android:padding="16dp"
android:transitionName="@string/transition_album_text"
tools:ignore="UnusedAttribute">
<android.support.v7.widget.Toolbar <TextView
android:id="@+id/toolbar" android:id="@+id/song_title"
style="@style/Toolbar" android:layout_width="match_parent"
android:layout_marginTop="@dimen/statusMargin" android:layout_height="wrap_content"
android:background="@android:color/transparent" /> android:fontFamily="sans-serif-medium"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?attr/title_text_color" />
<TextView
android:id="@+id/song_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textColor="?attr/caption_text_color" />
</LinearLayout>
<RelativeLayout
android:background="?music_controller_container_color"
android:id="@+id/media_controller_container"
android:layout_width="match_parent"
android:layout_height="88dp"
tools:ignore="ContentDescription,UnusedAttribute">
<ImageButton
android:id="@+id/prev_button"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_centerVertical="true"
android:layout_marginEnd="-8dp"
android:layout_marginRight="-8dp"
android:layout_toLeftOf="@+id/fab"
android:layout_toStartOf="@+id/fab"
android:background="?round_selector"
android:padding="22dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_previous_white_48dp" />
<ImageButton
android:id="@+id/next_button"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_centerVertical="true"
android:layout_marginLeft="-8dp"
android:layout_marginStart="-8dp"
android:layout_toEndOf="@+id/fab"
android:layout_toRightOf="@+id/fab"
android:background="?round_selector"
android:padding="22dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_next_white_48dp" />
<ImageButton
android:id="@+id/repeat_button"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:background="?round_selector"
android:padding="22dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_repeat_white_48dp" />
<ImageButton
android:id="@+id/shuffle_button"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:background="?round_selector"
android:padding="22dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_shuffle_white_48dp" />
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
style="@style/PlayPauseFab"
android:layout_centerInParent="true" />
</RelativeLayout>
</LinearLayout>
<SeekBar
android:id="@+id/progress_slider"
style="@style/MusicProgressSlider"
android:elevation="2dp"
tools:ignore="UnusedAttribute" />
</FrameLayout>
</LinearLayout>
<!-- ALBUMART-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/footer_frame"
android:layout_below="@id/toolbar_frame"
android:background="@color/black">
<ImageView
android:id="@+id/album_art_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" />
<com.kabouzeid.gramophone.views.HeightAndWidthFitSquarePlaceLeftRightImageView
android:id="@+id/album_art"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/default_album_art"
android:transitionName="@string/transition_album_cover"
tools:ignore="ContentDescription,UnusedAttribute" />
</FrameLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -7,7 +7,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="@dimen/main_toolbar_padding_top"> android:paddingTop="@dimen/status_bar_padding">
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -15,7 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.kabouzeid.gramophone.views.SquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -18,7 +18,7 @@
android:orientation="vertical" android:orientation="vertical"
tools:ignore="UnusedAttribute,UselessParent"> tools:ignore="UnusedAttribute,UselessParent">
<com.kabouzeid.gramophone.views.SquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView
android:id="@+id/album_art" android:id="@+id/album_art"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -13,7 +13,7 @@
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingStart="16dp"> android:paddingStart="16dp">
<com.kabouzeid.gramophone.views.SquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView
android:id="@+id/album_art" android:id="@+id/album_art"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"

View file

@ -8,7 +8,7 @@
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingStart="16dp"> android:paddingStart="16dp">
<com.kabouzeid.gramophone.views.SquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"

View file

@ -13,7 +13,7 @@
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp"> android:paddingRight="16dp">
<com.kabouzeid.gramophone.views.SquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView
android:id="@+id/album_art" android:id="@+id/album_art"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"

View file

@ -16,7 +16,7 @@
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp"> android:paddingRight="16dp">
<com.kabouzeid.gramophone.views.SquareImageView <com.kabouzeid.gramophone.views.WidthFitSquareImageView
android:id="@+id/album_art" android:id="@+id/album_art"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="statusMargin">25dp</dimen> <dimen name="status_bar_padding">25dp</dimen>
<dimen name="navigation_drawer_image_height">165dp</dimen> <dimen name="navigation_drawer_image_height">165dp</dimen>
<dimen name="main_toolbar_padding_top">@dimen/statusMargin</dimen>
</resources> </resources>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="statusMargin">25dp</dimen> <dimen name="status_bar_padding">25dp</dimen>
<dimen name="navigation_drawer_image_height">165dp</dimen> <dimen name="navigation_drawer_image_height">165dp</dimen>
<dimen name="main_toolbar_padding_top">0dp</dimen>
</resources> </resources>

View file

@ -29,6 +29,7 @@
</style> </style>
<style name="MusicProgressSlider" parent="MusicProgressSliderParent"> <style name="MusicProgressSlider" parent="MusicProgressSliderParent">
<item name="android:progressBackgroundTint">#00000000</item>
<item name="android:elevation">2dp</item> <item name="android:elevation">2dp</item>
<item name="android:padding">0dp</item> <item name="android:padding">0dp</item>
</style> </style>

View file

@ -15,7 +15,7 @@
<color name="materialmusic_music_controller_container_color">@color/grey_300</color> <color name="materialmusic_music_controller_container_color">@color/grey_300</color>
<color name="materialmusic_navigation_drawer_background_color">#fff</color> <color name="materialmusic_navigation_drawer_background_color">#fff</color>
<color name="materialmusic_separator_color">#0C000000</color> <color name="materialmusic_separator_color">#0C000000</color>
<color name="materialmusic_default_bar_color">@color/grey_300</color> <color name="materialmusic_default_bar_color">@color/grey_500</color>
<color name="materialmusic_themed_drawable_color">#8A000000</color> <color name="materialmusic_themed_drawable_color">#8A000000</color>
<color name="list_item_selector_activated">#D0D0D0</color> <color name="list_item_selector_activated">#D0D0D0</color>

View file

@ -12,9 +12,9 @@
<dimen name="toolbar_elevation">2dp</dimen> <dimen name="toolbar_elevation">2dp</dimen>
<dimen name="header_image_height">360dp</dimen> <dimen name="header_image_height">360dp</dimen>
<dimen name="progress_container_height">32dp</dimen>
<dimen name="statusMargin">0dp</dimen> <dimen name="status_bar_padding">0dp</dimen>
<dimen name="main_toolbar_padding_top">0dp</dimen>
<!-- Notification template --> <!-- Notification template -->
<dimen name="notification_big_icon_height">64.0dip</dimen> <dimen name="notification_big_icon_height">64.0dip</dimen>

View file

@ -41,6 +41,7 @@
</style> </style>
<style name="Toolbar"> <style name="Toolbar">
<item name="titleMarginStart">16dp</item>
<item name="android:layout_width">match_parent</item> <item name="android:layout_width">match_parent</item>
<item name="android:layout_height">?attr/actionBarSize</item> <item name="android:layout_height">?attr/actionBarSize</item>
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> <item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>

View file

@ -30,13 +30,6 @@
android:layout="@layout/preference_custom" android:layout="@layout/preference_custom"
android:widgetLayout="@layout/preference_dynamiccheckbox" /> android:widgetLayout="@layout/preference_dynamiccheckbox" />
<CheckBoxPreference
android:defaultValue="false"
android:key="playback_controller_card"
android:title="@string/pref_title_show_playback_controller_card"
android:layout="@layout/preference_custom"
android:widgetLayout="@layout/preference_dynamiccheckbox" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="colored_album_footers" android:key="colored_album_footers"