Delete some unused code

This commit is contained in:
TacoTheDank 2022-03-17 23:26:34 -04:00
parent 102204e293
commit 979a320347
3 changed files with 0 additions and 393 deletions

View file

@ -1,44 +0,0 @@
package org.schabi.newpipe.util;
import android.graphics.Bitmap;
import androidx.annotation.Nullable;
public final class BitmapUtils {
private BitmapUtils() { }
@Nullable
public static Bitmap centerCrop(final Bitmap inputBitmap, final int newWidth,
final int newHeight) {
if (inputBitmap == null || inputBitmap.isRecycled()) {
return null;
}
final float sourceWidth = inputBitmap.getWidth();
final float sourceHeight = inputBitmap.getHeight();
final float xScale = newWidth / sourceWidth;
final float yScale = newHeight / sourceHeight;
final float newXScale;
final float newYScale;
if (yScale > xScale) {
newXScale = xScale / yScale;
newYScale = 1.0f;
} else {
newXScale = 1.0f;
newYScale = yScale / xScale;
}
final float scaledWidth = newXScale * sourceWidth;
final float scaledHeight = newYScale * sourceHeight;
final int left = (int) ((sourceWidth - scaledWidth) / 2);
final int top = (int) ((sourceHeight - scaledHeight) / 2);
final int width = (int) scaledWidth;
final int height = (int) scaledHeight;
return Bitmap.createBitmap(inputBitmap, left, top, width, height);
}
}

View file

@ -1,46 +0,0 @@
package org.schabi.newpipe.util;
import android.content.Context;
import android.graphics.PointF;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
public class LayoutManagerSmoothScroller extends LinearLayoutManager {
public LayoutManagerSmoothScroller(final Context context) {
super(context, VERTICAL, false);
}
public LayoutManagerSmoothScroller(final Context context, final int orientation,
final boolean reverseLayout) {
super(context, orientation, reverseLayout);
}
@Override
public void smoothScrollToPosition(final RecyclerView recyclerView,
final RecyclerView.State state, final int position) {
final RecyclerView.SmoothScroller smoothScroller
= new TopSnappedSmoothScroller(recyclerView.getContext());
smoothScroller.setTargetPosition(position);
startSmoothScroll(smoothScroller);
}
private class TopSnappedSmoothScroller extends LinearSmoothScroller {
TopSnappedSmoothScroller(final Context context) {
super(context);
}
@Override
public PointF computeScrollVectorForPosition(final int targetPosition) {
return LayoutManagerSmoothScroller.this
.computeScrollVectorForPosition(targetPosition);
}
@Override
protected int getVerticalSnapPreference() {
return SNAP_TO_START;
}
}
}