Added html parser in every occurrence

This commit is contained in:
CappielloAntonio 2021-08-01 12:59:26 +02:00
parent d5ab23cb11
commit 779e87065b
7 changed files with 22 additions and 14 deletions

View file

@ -1,6 +1,7 @@
package com.cappielloantonio.play.ui.fragment;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@ -115,8 +116,8 @@ public class AlbumPageFragment extends Fragment {
bind.animToolbar.setTitle(albumPageViewModel.getAlbum().getTitle());
bind.albumNameLabel.setText(albumPageViewModel.getAlbum().getTitle());
bind.albumArtistLabel.setText(albumPageViewModel.getAlbum().getArtistName());
bind.albumNameLabel.setText(Html.fromHtml(albumPageViewModel.getAlbum().getTitle(), Html.FROM_HTML_MODE_COMPACT));
bind.albumArtistLabel.setText(Html.fromHtml(albumPageViewModel.getAlbum().getArtistName(), Html.FROM_HTML_MODE_COMPACT));
bind.albumReleaseYearLabel.setText(albumPageViewModel.getAlbum().getYear() != 0 ? String.valueOf(albumPageViewModel.getAlbum().getYear()) : "");
bind.animToolbar.setNavigationOnClickListener(v -> activity.navController.navigateUp());

View file

@ -1,6 +1,7 @@
package com.cappielloantonio.play.ui.fragment;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -95,7 +96,7 @@ public class FilterFragment extends Fragment {
bind.filterContainer.setVisibility(View.VISIBLE);
for (Genre genre : genres) {
Chip chip = (Chip) requireActivity().getLayoutInflater().inflate(R.layout.chip_search_filter_genre, null, false);
chip.setText(genre.getName());
chip.setText(Html.fromHtml(genre.getName(), Html.FROM_HTML_MODE_COMPACT));
chip.setChecked(filterViewModel.getFilters().contains(genre.getId()));
chip.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked)

View file

@ -2,6 +2,7 @@ package com.cappielloantonio.play.ui.fragment;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -257,11 +258,11 @@ public class PlayerBottomSheetFragment extends Fragment implements MusicServiceE
}
private void setSongInfo(Song song) {
bind.playerBodyLayout.playerSongTitleLabel.setText(song.getTitle());
bind.playerBodyLayout.playerArtistNameLabel.setText(song.getArtistName());
bind.playerBodyLayout.playerSongTitleLabel.setText(Html.fromHtml(song.getTitle(), Html.FROM_HTML_MODE_COMPACT));
bind.playerBodyLayout.playerArtistNameLabel.setText(Html.fromHtml(song.getArtistName(), Html.FROM_HTML_MODE_COMPACT));
bind.playerHeaderLayout.playerHeaderSongTitleLabel.setText(song.getTitle());
bind.playerHeaderLayout.playerHeaderSongArtistLabel.setText(song.getArtistName());
bind.playerHeaderLayout.playerHeaderSongTitleLabel.setText(Html.fromHtml(song.getTitle(), Html.FROM_HTML_MODE_COMPACT));
bind.playerHeaderLayout.playerHeaderSongArtistLabel.setText(Html.fromHtml(song.getArtistName(), Html.FROM_HTML_MODE_COMPACT));
CustomGlideRequest.Builder
.from(requireContext(), song.getPrimary(), song.getBlurHash(), CustomGlideRequest.SONG_PIC)

View file

@ -1,6 +1,7 @@
package com.cappielloantonio.play.ui.fragment;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -70,11 +71,11 @@ public class SongListPageFragment extends Fragment {
} else if (getArguments().getString(Song.BY_GENRE) != null) {
songListPageViewModel.title = Song.BY_GENRE;
songListPageViewModel.genre = getArguments().getParcelable("genre_object");
bind.pageTitleLabel.setText(songListPageViewModel.genre.getName() + ": all tracks");
bind.pageTitleLabel.setText(Html.fromHtml(songListPageViewModel.genre.getName(), Html.FROM_HTML_MODE_COMPACT) + ": all tracks");
} else if (getArguments().getString(Song.BY_ARTIST) != null) {
songListPageViewModel.title = Song.BY_ARTIST;
songListPageViewModel.artist = getArguments().getParcelable("artist_object");
bind.pageTitleLabel.setText(songListPageViewModel.artist.getName() + "'s top tracks");
bind.pageTitleLabel.setText(Html.fromHtml(songListPageViewModel.artist.getName(), Html.FROM_HTML_MODE_COMPACT) + "'s top tracks");
} else if (getArguments().getString(Song.BY_GENRES) != null) {
songListPageViewModel.title = Song.BY_GENRES;
songListPageViewModel.filters = getArguments().getStringArrayList("filters_list");

View file

@ -1,6 +1,7 @@
package com.cappielloantonio.play.ui.fragment.bottomsheetdialog;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -77,11 +78,11 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
.into(coverAlbum);
titleAlbum = view.findViewById(R.id.album_title_text_view);
titleAlbum.setText(albumBottomSheetViewModel.getAlbum().getTitle());
titleAlbum.setText(Html.fromHtml(albumBottomSheetViewModel.getAlbum().getTitle(), Html.FROM_HTML_MODE_COMPACT));
titleAlbum.setSelected(true);
artistAlbum = view.findViewById(R.id.album_artist_text_view);
artistAlbum.setText(albumBottomSheetViewModel.getAlbum().getArtistName());
artistAlbum.setText(Html.fromHtml(albumBottomSheetViewModel.getAlbum().getArtistName(), Html.FROM_HTML_MODE_COMPACT));
favoriteToggle = view.findViewById(R.id.button_favorite);
favoriteToggle.setChecked(albumBottomSheetViewModel.getAlbum().isFavorite());

View file

@ -1,6 +1,7 @@
package com.cappielloantonio.play.ui.fragment.bottomsheetdialog;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -69,7 +70,7 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
.into(coverArtist);
nameArtist = view.findViewById(R.id.song_title_text_view);
nameArtist.setText(artistBottomSheetViewModel.getArtist().getName());
nameArtist.setText(Html.fromHtml(artistBottomSheetViewModel.getArtist().getName(), Html.FROM_HTML_MODE_COMPACT));
nameArtist.setSelected(true);
favoriteToggle = view.findViewById(R.id.button_favorite);

View file

@ -1,6 +1,7 @@
package com.cappielloantonio.play.ui.fragment.bottomsheetdialog;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -73,11 +74,12 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
.into(coverSong);
titleSong = view.findViewById(R.id.song_title_text_view);
titleSong.setText(songBottomSheetViewModel.getSong().getTitle());
titleSong.setText(Html.fromHtml(songBottomSheetViewModel.getSong().getTitle(), Html.FROM_HTML_MODE_COMPACT));
titleSong.setSelected(true);
artistSong = view.findViewById(R.id.song_artist_text_view);
artistSong.setText(songBottomSheetViewModel.getSong().getArtistName());
artistSong.setText(Html.fromHtml(songBottomSheetViewModel.getSong().getArtistName(), Html.FROM_HTML_MODE_COMPACT));
favoriteToggle = view.findViewById(R.id.button_favorite);
favoriteToggle.setChecked(songBottomSheetViewModel.getSong().isFavorite());