Change album queue button to floating action button like in apps like gogole play music. Might decide to anchor differently in future.
This commit is contained in:
@@ -1,16 +1,15 @@
|
|||||||
package com.magnatune.eyecreate.companionformagnatune.fragments;
|
package com.magnatune.eyecreate.companionformagnatune.fragments;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.graphics.Palette;
|
import android.support.v7.graphics.Palette;
|
||||||
import android.support.v7.widget.CardView;
|
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.GridLayout;
|
import android.widget.GridLayout;
|
||||||
@@ -18,7 +17,6 @@ import android.widget.ImageView;
|
|||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.magnatune.eyecreate.companionformagnatune.R;
|
import com.magnatune.eyecreate.companionformagnatune.R;
|
||||||
import com.magnatune.eyecreate.companionformagnatune.adapters.TracksAdapter;
|
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();
|
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.album_name)).setText(currentAlbum.getAlbumname());
|
||||||
((TextView)v.findViewById(R.id.artist_name)).setText(currentAlbum.getArtist().getArtistname());
|
((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() {
|
Picasso.with(getActivity()).load(currentAlbum.getCover_small()).into((ImageView) v.findViewById(R.id.album_cover), new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@@ -108,12 +96,11 @@ public class AlbumFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
if (swatch != null) {
|
if (swatch != null) {
|
||||||
((TextView) v.findViewById(R.id.album_name)).setTextColor(swatch.getTitleTextColor());
|
((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.
|
//Get a slightly off color for button background.
|
||||||
float[] modColor = swatch.getHsl();
|
float[] modColor = swatch.getHsl();
|
||||||
modColor[2] = (float) (modColor[2]<=0.5?modColor[2]+0.1:modColor[2]-0.1);
|
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());
|
((TextView) v.findViewById(R.id.artist_name)).setTextColor(swatch.getBodyTextColor());
|
||||||
v.findViewById(R.id.album_details).setBackgroundColor(swatch.getRgb());
|
v.findViewById(R.id.album_details).setBackgroundColor(swatch.getRgb());
|
||||||
|
|||||||
@@ -43,16 +43,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<TextView
|
<android.support.design.widget.FloatingActionButton
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="+"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:paddingTop="5dp"
|
|
||||||
android:paddingBottom="5dp"
|
|
||||||
android:paddingLeft="15dp"
|
|
||||||
android:paddingRight="15dp"
|
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="5dp"
|
||||||
|
android:elevation="10dp"
|
||||||
|
app:pressedTranslationZ="10dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:src="@android:drawable/ic_media_play"
|
||||||
android:layout_gravity="right|center_vertical"
|
android:layout_gravity="right|center_vertical"
|
||||||
android:id="@+id/queue_album"/>
|
android:id="@+id/queue_album"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user