Private
Public Access
1
0

Switch around Album UI to use smaller art images to make it easier for transitions and image cache. Will think about where would be best to use larger images later.

This commit is contained in:
Kevin Whitaker
2015-11-29 21:59:31 -05:00
parent d7df8e9c5d
commit a1f7138588
2 changed files with 43 additions and 21 deletions

View File

@@ -80,7 +80,8 @@ public class AlbumFragment extends Fragment {
ListView listView = (ListView) v.findViewById(R.id.album_tracks); ListView listView = (ListView) v.findViewById(R.id.album_tracks);
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());
Picasso.with(getActivity()).load(currentAlbum.getCover_large()).into((ImageView) v.findViewById(R.id.album_cover), new Callback() { ((TextView)v.findViewById(R.id.artist_name)).setText(currentAlbum.getArtist().getArtistname());
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() {
Palette colors = Palette.from(((BitmapDrawable) ((ImageView) v.findViewById(R.id.album_cover)).getDrawable()).getBitmap()).generate(); Palette colors = Palette.from(((BitmapDrawable) ((ImageView) v.findViewById(R.id.album_cover)).getDrawable()).getBitmap()).generate();
@@ -94,7 +95,8 @@ 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());
v.findViewById(R.id.album_name).setBackgroundColor(swatch.getRgb()); ((TextView) v.findViewById(R.id.artist_name)).setTextColor(swatch.getBodyTextColor());
v.findViewById(R.id.album_details).setBackgroundColor(swatch.getRgb());
} }
} }

View File

@@ -9,25 +9,45 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/album_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/album_cover" android:id="@+id/album_cover"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="match_parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="15dp"
android:paddingRight="5dp"
android:paddingTop="10dp"
android:layout_weight="2">
<TextView <TextView
android:id="@+id/album_name" android:id="@+id/album_name"
android:paddingLeft="5dp" android:layout_width="wrap_content"
android:paddingRight="5dp" android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textStyle="bold"
android:textSize="20sp" android:textSize="20sp"
android:layout_width="match_parent" android:textStyle="bold" />
android:layout_height="wrap_content" />
<TextView
android:id="@+id/artist_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<ListView <ListView
android:id="@+id/album_tracks"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/album_tracks"/>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>