Added bio information in artist page

This commit is contained in:
CappielloAntonio 2021-08-11 13:05:28 +02:00
parent 8243173e29
commit 522323073a
3 changed files with 60 additions and 7 deletions

View file

@ -33,6 +33,7 @@ public class Artist implements Parcelable {
public int albumCount;
public boolean favorite;
public String bio;
public String imageUrl;
public Artist(ArtistID3 artistID3) {
this.id = artistID3.getId();
@ -65,6 +66,7 @@ public class Artist implements Parcelable {
public Artist(ArtistInfo2 artistInfo2) {
this.similarArtists = MappingUtil.mapSimilarArtist(artistInfo2.getSimilarArtists());
this.bio = artistInfo2.getBiography();
this.imageUrl = artistInfo2.getLargeImageUrl();
}
public Artist(String id, String name) {
@ -144,7 +146,6 @@ public class Artist implements Parcelable {
this.favorite = favorite;
}
public List<Artist> getSimilarArtists() {
return similarArtists;
}
@ -161,6 +162,14 @@ public class Artist implements Parcelable {
this.bio = bio;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View file

@ -57,7 +57,7 @@ public class ArtistPageFragment extends Fragment {
init();
initAppBar();
initBackdrop();
initArtistInfo();
initPlayButtons();
initTopSongsView();
initAlbumsView();
@ -109,11 +109,15 @@ public class ArtistPageFragment extends Fragment {
});
}
private void initBackdrop() {
CustomGlideRequest.Builder
.from(requireContext(), artistPageViewModel.getArtist().getId(), CustomGlideRequest.ARTIST_PIC)
.build()
.into(bind.artistBackdropImageView);
private void initArtistInfo() {
artistPageViewModel.getArtistInfo(artistPageViewModel.getArtist().getId()).observe(requireActivity(), artist -> {
CustomGlideRequest.Builder
.from(requireContext(), null, CustomGlideRequest.ARTIST_PIC, artist.getImageUrl())
.build()
.into(bind.artistBackdropImageView);
bind.bioTextView.setText(MusicUtil.HTMLParser(artist.getBio()));
});
}
private void initPlayButtons() {

View file

@ -115,6 +115,46 @@
android:layout_marginEnd="18dp"
android:layout_marginBottom="12dp"/>
<LinearLayout
android:id="@+id/artist_page_bio_sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="22dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/HeadlineTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="16dp"
android:paddingEnd="8dp"
android:text="Bio" />
<TextView
android:id="@+id/bio_more_text_view_clickable"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="16dp"
android:text="More" />
</LinearLayout>
<TextView
android:id="@+id/bio_text_view"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="More" />
</LinearLayout>
<!-- Label and button -->
<LinearLayout
android:id="@+id/artist_page_top_songs_sector"