From 502d1c8fe3ad4fdcc0ae96736046ea6238cf1c78 Mon Sep 17 00:00:00 2001 From: Kevin Whitaker Date: Sun, 6 Dec 2015 18:22:10 -0500 Subject: [PATCH] Change album queue button to floating action button like in apps like gogole play music. Might decide to anchor differently in future. --- .../fragments/AlbumFragment.java | 21 ++++--------------- app/src/main/res/layout/fragment_album.xml | 12 +++++------ 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/com/magnatune/eyecreate/companionformagnatune/fragments/AlbumFragment.java b/app/src/main/java/com/magnatune/eyecreate/companionformagnatune/fragments/AlbumFragment.java index 196e586..37a9b31 100644 --- a/app/src/main/java/com/magnatune/eyecreate/companionformagnatune/fragments/AlbumFragment.java +++ b/app/src/main/java/com/magnatune/eyecreate/companionformagnatune/fragments/AlbumFragment.java @@ -1,16 +1,15 @@ package com.magnatune.eyecreate.companionformagnatune.fragments; +import android.content.res.ColorStateList; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; +import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.support.v7.graphics.Palette; -import android.support.v7.widget.CardView; -import android.view.Gravity; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.GridLayout; @@ -18,7 +17,6 @@ import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; -import android.widget.Toast; import com.magnatune.eyecreate.companionformagnatune.R; import com.magnatune.eyecreate.companionformagnatune.adapters.TracksAdapter; @@ -84,16 +82,6 @@ public class AlbumFragment extends Fragment { Album currentAlbum = db.where(Album.class).equalTo("albumsku",getArguments().getString(ARG_ALBUM_ID)).findFirst(); ((TextView)v.findViewById(R.id.album_name)).setText(currentAlbum.getAlbumname()); ((TextView)v.findViewById(R.id.artist_name)).setText(currentAlbum.getArtist().getArtistname()); - //Set up hint for button like in menu items - v.findViewById(R.id.queue_album).setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View view) { - Toast hint = Toast.makeText(view.getContext(),R.string.queue_album,Toast.LENGTH_SHORT); - hint.setGravity(Gravity.TOP|Gravity.RIGHT,25,20); - hint.show(); - return true; - } - }); Picasso.with(getActivity()).load(currentAlbum.getCover_small()).into((ImageView) v.findViewById(R.id.album_cover), new Callback() { @Override public void onSuccess() { @@ -108,12 +96,11 @@ public class AlbumFragment extends Fragment { } if (swatch != null) { ((TextView) v.findViewById(R.id.album_name)).setTextColor(swatch.getTitleTextColor()); - ((TextView) v.findViewById(R.id.queue_album)).setTextColor(swatch.getTitleTextColor()); //Get a slightly off color for button background. float[] modColor = swatch.getHsl(); modColor[2] = (float) (modColor[2]<=0.5?modColor[2]+0.1:modColor[2]-0.1); - v.findViewById(R.id.queue_album).setBackgroundColor(Color.HSVToColor(modColor)); + ((FloatingActionButton)v.findViewById(R.id.queue_album)).setBackgroundTintList(ColorStateList.valueOf(Color.HSVToColor(modColor))); ((TextView) v.findViewById(R.id.artist_name)).setTextColor(swatch.getBodyTextColor()); v.findViewById(R.id.album_details).setBackgroundColor(swatch.getRgb()); @@ -125,7 +112,7 @@ public class AlbumFragment extends Fragment { } }); - TracksAdapter adapter = new TracksAdapter(getActivity(),db.where(Track.class).equalTo("albumname",currentAlbum.getAlbumname()).equalTo("artist",currentAlbum.getArtist().getArtistname()).findAllSorted("tracknumber"),true); + TracksAdapter adapter = new TracksAdapter(getActivity(),db.where(Track.class).equalTo("albumname",currentAlbum.getAlbumname()).equalTo("artist", currentAlbum.getArtist().getArtistname()).findAllSorted("tracknumber"),true); listView.setAdapter(adapter); setListViewHeightBasedOnChildren(listView); return v; diff --git a/app/src/main/res/layout/fragment_album.xml b/app/src/main/res/layout/fragment_album.xml index dc8de24..46ddeb4 100644 --- a/app/src/main/res/layout/fragment_album.xml +++ b/app/src/main/res/layout/fragment_album.xml @@ -43,16 +43,14 @@ android:layout_height="wrap_content" android:textSize="16sp" /> - -- GitLab