Merge remote-tracking branch 'newpipe/dev' into rebase
This commit is contained in:
commit
fac13fb8cb
69 changed files with 1878 additions and 827 deletions
43
app/src/main/java/org/schabi/newpipe/util/BitmapUtils.java
Normal file
43
app/src/main/java/org/schabi/newpipe/util/BitmapUtils.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package org.schabi.newpipe.util;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class BitmapUtils {
|
||||
|
||||
@Nullable
|
||||
public static Bitmap centerCrop(Bitmap inputBitmap, int newWidth, int newHeight) {
|
||||
if (inputBitmap == null || inputBitmap.isRecycled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
float sourceWidth = inputBitmap.getWidth();
|
||||
float sourceHeight = inputBitmap.getHeight();
|
||||
|
||||
float xScale = newWidth / sourceWidth;
|
||||
float yScale = newHeight / sourceHeight;
|
||||
|
||||
float newXScale;
|
||||
float newYScale;
|
||||
|
||||
if (yScale > xScale) {
|
||||
newXScale = xScale / yScale;
|
||||
newYScale = 1.0f;
|
||||
} else {
|
||||
newXScale = 1.0f;
|
||||
newYScale = yScale / xScale;
|
||||
}
|
||||
|
||||
float scaledWidth = newXScale * sourceWidth;
|
||||
float scaledHeight = newYScale * sourceHeight;
|
||||
|
||||
int left = (int) ((sourceWidth - scaledWidth) / 2);
|
||||
int top = (int) ((sourceHeight - scaledHeight) / 2);
|
||||
int width = (int) scaledWidth;
|
||||
int height = (int) scaledHeight;
|
||||
|
||||
return Bitmap.createBitmap(inputBitmap, left, top, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,5 +11,7 @@ public class Constants {
|
|||
public static final String KEY_THEME_CHANGE = "key_theme_change";
|
||||
public static final String KEY_MAIN_PAGE_CHANGE = "key_main_page_change";
|
||||
|
||||
public static final String KEY_ENABLE_WATCH_HISTORY = "enable_watch_history";
|
||||
|
||||
public static final int NO_SERVICE_ID = -1;
|
||||
}
|
||||
|
|
|
|||
23
app/src/main/java/org/schabi/newpipe/util/KoreUtil.java
Normal file
23
app/src/main/java/org/schabi/newpipe/util/KoreUtil.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package org.schabi.newpipe.util;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
|
||||
public class KoreUtil {
|
||||
private KoreUtil() { }
|
||||
|
||||
public static void showInstallKoreDialog(final Context context) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setMessage(R.string.kore_not_found)
|
||||
.setPositiveButton(R.string.install,
|
||||
(DialogInterface dialog, int which) -> NavigationHelper.installKore(context))
|
||||
.setNegativeButton(R.string.cancel, (DialogInterface dialog, int which) -> {
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
}
|
||||
|
|
@ -109,12 +109,14 @@ public class NavigationHelper {
|
|||
final float playbackPitch,
|
||||
final boolean playbackSkipSilence,
|
||||
@Nullable final String playbackQuality,
|
||||
final boolean resumePlayback) {
|
||||
final boolean resumePlayback,
|
||||
final boolean startPaused) {
|
||||
return getPlayerIntent(context, targetClazz, playQueue, playbackQuality, resumePlayback)
|
||||
.putExtra(BasePlayer.REPEAT_MODE, repeatMode)
|
||||
.putExtra(BasePlayer.PLAYBACK_SPEED, playbackSpeed)
|
||||
.putExtra(BasePlayer.PLAYBACK_PITCH, playbackPitch)
|
||||
.putExtra(BasePlayer.PLAYBACK_SKIP_SILENCE, playbackSkipSilence);
|
||||
.putExtra(BasePlayer.PLAYBACK_SKIP_SILENCE, playbackSkipSilence)
|
||||
.putExtra(BasePlayer.START_PAUSED, startPaused);
|
||||
}
|
||||
|
||||
public static void playOnMainPlayer(final Context context, final PlayQueue queue, final boolean resumePlayback) {
|
||||
|
|
|
|||
|
|
@ -140,7 +140,15 @@ public class StreamItemAdapter<T extends Stream, U extends Stream> extends BaseA
|
|||
if (stream instanceof SubtitlesStream) {
|
||||
formatNameView.setText(((SubtitlesStream) stream).getLanguageTag());
|
||||
} else {
|
||||
formatNameView.setText(stream.getFormat().getName());
|
||||
switch (stream.getFormat()) {
|
||||
case WEBMA_OPUS:
|
||||
// noinspection AndroidLintSetTextI18n
|
||||
formatNameView.setText("opus");
|
||||
break;
|
||||
default:
|
||||
formatNameView.setText(stream.getFormat().getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qualityView.setText(qualityString);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue