mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Fixed crash when viewing share
This commit is contained in:
parent
0be309fb22
commit
955dc1b015
1 changed files with 11 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ import androidx.media3.common.util.UnstableApi;
|
||||||
import com.cappielloantonio.tempo.R;
|
import com.cappielloantonio.tempo.R;
|
||||||
import com.cappielloantonio.tempo.glide.CustomGlideRequest;
|
import com.cappielloantonio.tempo.glide.CustomGlideRequest;
|
||||||
import com.cappielloantonio.tempo.subsonic.models.Share;
|
import com.cappielloantonio.tempo.subsonic.models.Share;
|
||||||
|
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||||
import com.cappielloantonio.tempo.ui.dialog.ShareUpdateDialog;
|
import com.cappielloantonio.tempo.ui.dialog.ShareUpdateDialog;
|
||||||
import com.cappielloantonio.tempo.util.Constants;
|
import com.cappielloantonio.tempo.util.Constants;
|
||||||
import com.cappielloantonio.tempo.util.UIUtil;
|
import com.cappielloantonio.tempo.util.UIUtil;
|
||||||
|
|
@ -24,6 +25,8 @@ import com.cappielloantonio.tempo.viewmodel.HomeViewModel;
|
||||||
import com.cappielloantonio.tempo.viewmodel.ShareBottomSheetViewModel;
|
import com.cappielloantonio.tempo.viewmodel.ShareBottomSheetViewModel;
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public class ShareBottomSheetDialog extends BottomSheetDialogFragment implements View.OnClickListener {
|
public class ShareBottomSheetDialog extends BottomSheetDialogFragment implements View.OnClickListener {
|
||||||
|
|
||||||
|
|
@ -50,8 +53,15 @@ public class ShareBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||||
private void init(View view) {
|
private void init(View view) {
|
||||||
ImageView shareCover = view.findViewById(R.id.share_cover_image_view);
|
ImageView shareCover = view.findViewById(R.id.share_cover_image_view);
|
||||||
|
|
||||||
|
String coverArtId = null;
|
||||||
|
List<Child> entries = shareBottomSheetViewModel.getShare().getEntries();
|
||||||
|
|
||||||
|
if (entries != null && !entries.isEmpty()) {
|
||||||
|
coverArtId = entries.get(0).getCoverArtId();
|
||||||
|
}
|
||||||
|
|
||||||
CustomGlideRequest.Builder
|
CustomGlideRequest.Builder
|
||||||
.from(requireContext(), shareBottomSheetViewModel.getShare().getEntries().get(0).getCoverArtId(), CustomGlideRequest.ResourceType.Unknown)
|
.from(requireContext(), coverArtId, CustomGlideRequest.ResourceType.Unknown)
|
||||||
.build()
|
.build()
|
||||||
.into(shareCover);
|
.into(shareCover);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue