mirror of
https://github.com/antebudimir/tempus.git
synced 2026-04-15 16:27:26 +00:00
Hide biography section when no info is available
This commit is contained in:
parent
bae9221070
commit
c5cece8477
2 changed files with 37 additions and 24 deletions
|
|
@ -123,15 +123,9 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
|
|||
favoriteToggle.setChecked(artistPageViewModel.getArtist().getStarred() != null);
|
||||
favoriteToggle.setOnClickListener(v -> artistPageViewModel.setFavorite(requireContext()));
|
||||
|
||||
|
||||
Button bioToggle = view.findViewById(R.id.button_toggle_bio);
|
||||
bioToggle.setOnClickListener(v ->
|
||||
{
|
||||
boolean displayBio = Preferences.getArtistDisplayBiography();
|
||||
Preferences.setArtistDisplayBiography(!displayBio);
|
||||
if (bind != null)
|
||||
bind.artistPageBioSector.setVisibility(displayBio ? View.GONE : View.VISIBLE);
|
||||
});
|
||||
Toast.makeText(getActivity(), R.string.artist_no_artist_info_toast, Toast.LENGTH_SHORT).show());
|
||||
}
|
||||
|
||||
private void initAppBar() {
|
||||
|
|
@ -149,13 +143,6 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
|
|||
if (artistInfo == null) {
|
||||
if (bind != null) bind.artistPageBioSector.setVisibility(View.GONE);
|
||||
} else {
|
||||
String normalizedBio = MusicUtil.forceReadableString(artistInfo.getBiography());
|
||||
|
||||
if (bind != null)
|
||||
bind.artistPageBioSector.setVisibility(!normalizedBio.trim().isEmpty() ? View.VISIBLE : View.GONE);
|
||||
if (bind != null)
|
||||
bind.bioMoreTextViewClickable.setVisibility(artistInfo.getLastFmUrl() != null ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (getContext() != null && bind != null) {
|
||||
ArtistID3 currentArtist = artistPageViewModel.getArtist();
|
||||
String primaryId = currentArtist.getCoverArtId() != null && !currentArtist.getCoverArtId().trim().isEmpty()
|
||||
|
|
@ -205,17 +192,42 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
|
|||
.into(bind.artistBackdropImageView);
|
||||
}
|
||||
|
||||
if (bind != null) bind.bioTextView.setText(normalizedBio);
|
||||
|
||||
if (bind != null) bind.bioMoreTextViewClickable.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(artistInfo.getLastFmUrl()));
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
if (bind != null) {
|
||||
boolean displayBio = Preferences.getArtistDisplayBiography();
|
||||
bind.artistPageBioSector.setVisibility(displayBio ? View.VISIBLE : View.GONE);
|
||||
String normalizedBio = MusicUtil.forceReadableString(artistInfo.getBiography()).trim();
|
||||
String lastFmUrl = artistInfo.getLastFmUrl();
|
||||
|
||||
if (normalizedBio.isEmpty()) {
|
||||
bind.bioTextView.setVisibility(View.GONE);
|
||||
} else {
|
||||
bind.bioTextView.setText(normalizedBio);
|
||||
}
|
||||
|
||||
if (lastFmUrl == null) {
|
||||
bind.bioMoreTextViewClickable.setVisibility(View.GONE);
|
||||
} else {
|
||||
bind.bioMoreTextViewClickable.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(artistInfo.getLastFmUrl()));
|
||||
startActivity(intent);
|
||||
});
|
||||
bind.bioMoreTextViewClickable.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (!normalizedBio.isEmpty() || lastFmUrl != null) {
|
||||
View view = bind.getRoot();
|
||||
|
||||
Button bioToggle = view.findViewById(R.id.button_toggle_bio);
|
||||
bioToggle.setOnClickListener(v -> {
|
||||
if (bind != null) {
|
||||
boolean displayBio = Preferences.getArtistDisplayBiography();
|
||||
Preferences.setArtistDisplayBiography(!displayBio);
|
||||
bind.artistPageBioSector.setVisibility(displayBio ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
boolean displayBio = Preferences.getArtistDisplayBiography();
|
||||
bind.artistPageBioSector.setVisibility(displayBio ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
<string name="artist_list_page_downloaded">Downloaded artists</string>
|
||||
<string name="artist_list_page_starred">Starred artists</string>
|
||||
<string name="artist_list_page_title">Artists</string>
|
||||
<string name="artist_no_artist_info_toast">No additional artist info</string>
|
||||
<string name="artist_page_radio_button">Radio</string>
|
||||
<string name="artist_page_shuffle_button">Shuffle</string>
|
||||
<string name="artist_page_switch_layout_button">Switch layout</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue