set large icon for playback notification

This commit is contained in:
Akinwale Ariwodola 2020-06-05 09:30:54 +01:00
parent 673b85b2aa
commit c73509a4ca
2 changed files with 26 additions and 2 deletions

View file

@ -56,7 +56,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01' implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha06' implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.2.2' implementation 'androidx.navigation:navigation-fragment:2.2.2'

View file

@ -46,6 +46,10 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.BitmapImageViewTarget;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.ImageViewTarget;
import com.bumptech.glide.request.transition.Transition;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ext.cast.CastPlayer; import com.google.android.exoplayer2.ext.cast.CastPlayer;
@ -60,6 +64,7 @@ import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.iid.FirebaseInstanceId; import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult; import com.google.firebase.iid.InstanceIdResult;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.ActionBarDrawerToggle;
@ -204,11 +209,14 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public static boolean startingShareActivity = false; public static boolean startingShareActivity = false;
public static boolean startingPermissionRequest = false; public static boolean startingPermissionRequest = false;
public static boolean startingSignInFlowActivity = false; public static boolean startingSignInFlowActivity = false;
@Getter @Getter
private boolean enteringPIPMode = false; private boolean enteringPIPMode = false;
private boolean fullSyncInProgress = false; private boolean fullSyncInProgress = false;
private int queuedSyncCount = 0; private int queuedSyncCount = 0;
private String cameraOutputFilename; private String cameraOutputFilename;
private Bitmap nowPlayingClaimBitmap;
@Setter @Setter
private BackPressInterceptor backPressInterceptor; private BackPressInterceptor backPressInterceptor;
@ -1647,7 +1655,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Nullable @Nullable
@Override @Override
public Bitmap getCurrentLargeIcon(Player player, PlayerNotificationManager.BitmapCallback callback) { public Bitmap getCurrentLargeIcon(Player player, PlayerNotificationManager.BitmapCallback callback) {
return null; if (nowPlayingClaimBitmap == null &&
nowPlayingClaim != null &&
!Helper.isNullOrEmpty(nowPlayingClaim.getThumbnailUrl())) {
Glide.with(getApplicationContext()).asBitmap().load(nowPlayingClaim.getThumbnailUrl()).into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
nowPlayingClaimBitmap = resource;
callback.onBitmap(resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
return nowPlayingClaimBitmap;
} }
} }