1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2026-05-02 19:51:23 +00:00

-Modified popup video player to show extra options only when screen is large enough.

-Modified available resize options for different player modes.
-Fixed caption menu not working on popup player.
-Extracted hardcoded strings.
-Added button effects to both main and popup players.
This commit is contained in:
John Zhen Mo
2018-02-07 13:11:19 -08:00
parent 6485327b97
commit 880676d670
7 changed files with 142 additions and 75 deletions

View File

@@ -4,7 +4,6 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.util.DisplayMetrics;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.util.MimeTypes;
@@ -75,22 +74,13 @@ public class PlayerHelper {
public static String resizeTypeOf(@NonNull final Context context,
@AspectRatioFrameLayout.ResizeMode final int resizeMode) {
switch (resizeMode) {
case RESIZE_MODE_FIT: return "FIT";
case RESIZE_MODE_FILL: return "FILL";
case RESIZE_MODE_FIXED_HEIGHT: return "HEIGHT";
case RESIZE_MODE_FIXED_WIDTH: return "WIDTH";
case RESIZE_MODE_ZOOM: return "ZOOM";
case RESIZE_MODE_FIT: return context.getResources().getString(R.string.resize_fit);
case RESIZE_MODE_FILL: return context.getResources().getString(R.string.resize_fill);
case RESIZE_MODE_ZOOM: return context.getResources().getString(R.string.resize_zoom);
default: throw new IllegalArgumentException("Unrecognized resize mode: " + resizeMode);
}
}
public static float getCaptionSizePx(@NonNull final Context context) {
final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
final int minimumLength = Math.min(metrics.heightPixels, metrics.widthPixels);
// todo: expose size control to users
return (float) minimumLength / 20f;
}
public static boolean isResumeAfterAudioFocusGain(@NonNull final Context context) {
return isResumeAfterAudioFocusGain(context, false);
}