Use BitmapCompat.createScaledBitmap().
This commit is contained in:
parent
2984649106
commit
b0516fbf1d
3 changed files with 12 additions and 6 deletions
|
|
@ -8,6 +8,7 @@ import android.widget.ImageView;
|
|||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.graphics.BitmapCompat;
|
||||
import androidx.core.math.MathUtils;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
|
|
@ -91,8 +92,8 @@ public final class SeekbarPreviewThumbnailHelper {
|
|||
final float scaleFactor = (float) newWidth / srcWidth;
|
||||
final int newHeight = (int) (srcBitmap.getHeight() * scaleFactor);
|
||||
|
||||
currentSeekbarPreviewThumbnail.setImageBitmap(
|
||||
Bitmap.createScaledBitmap(srcBitmap, newWidth, newHeight, true));
|
||||
currentSeekbarPreviewThumbnail.setImageBitmap(BitmapCompat.createScaledBitmap(srcBitmap,
|
||||
newWidth, newHeight, null, true));
|
||||
} catch (final Exception ex) {
|
||||
Log.e(TAG, "Failed to resize and set seekbar preview thumbnail", ex);
|
||||
currentSeekbarPreviewThumbnail.setVisibility(View.GONE);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import androidx.annotation.Nullable;
|
|||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.core.graphics.BitmapCompat;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.math.MathUtils;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
|
@ -455,10 +456,11 @@ public abstract class VideoPlayerUi extends PlayerUi
|
|||
}
|
||||
|
||||
final float endScreenHeight = calculateMaxEndScreenThumbnailHeight(thumbnail);
|
||||
final Bitmap endScreenBitmap = Bitmap.createScaledBitmap(
|
||||
final Bitmap endScreenBitmap = BitmapCompat.createScaledBitmap(
|
||||
thumbnail,
|
||||
(int) (thumbnail.getWidth() / (thumbnail.getHeight() / endScreenHeight)),
|
||||
(int) endScreenHeight,
|
||||
null,
|
||||
true);
|
||||
|
||||
if (DEBUG) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue