1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Added a comment and excluded automatic switch of orientation on tablets and Android TVs

This commit is contained in:
Avently 2020-09-19 17:21:01 +03:00
parent 886a949a00
commit f41549ccf1
3 changed files with 12 additions and 7 deletions

View File

@ -360,11 +360,11 @@ public abstract class VideoPlayer extends BasePlayer
return true; return true;
}); });
// apply caption language from previous user preference // apply caption language from previous user preference
if (userPreferredLanguage != null && (captionLanguage.equals(userPreferredLanguage) if (userPreferredLanguage != null
|| searchForAutogenerated && captionLanguage.startsWith(userPreferredLanguage) && (captionLanguage.equals(userPreferredLanguage)
|| userPreferredLanguage.contains("(") && captionLanguage.startsWith( || (searchForAutogenerated && captionLanguage.startsWith(userPreferredLanguage))
userPreferredLanguage || (userPreferredLanguage.contains("(") && captionLanguage.startsWith(
.substring(0, userPreferredLanguage.indexOf('('))))) { userPreferredLanguage.substring(0, userPreferredLanguage.indexOf('(')))))) {
final int textRendererIndex = getRendererIndex(C.TRACK_TYPE_TEXT); final int textRendererIndex = getRendererIndex(C.TRACK_TYPE_TEXT);
if (textRendererIndex != RENDERER_UNAVAILABLE) { if (textRendererIndex != RENDERER_UNAVAILABLE) {
trackSelector.setPreferredTextLanguage(captionLanguage); trackSelector.setPreferredTextLanguage(captionLanguage);

View File

@ -956,6 +956,8 @@ public class VideoPlayerImpl extends VideoPlayer
if (orientationLocked if (orientationLocked
&& isFullscreen() && isFullscreen()
&& service.isLandscape() == isVerticalVideo && service.isLandscape() == isVerticalVideo
&& !DeviceUtils.isTv(service)
&& !DeviceUtils.isTablet(service)
&& fragmentListener != null) { && fragmentListener != null) {
fragmentListener.onScreenRotationButtonClicked(); fragmentListener.onScreenRotationButtonClicked();
} }

View File

@ -5,6 +5,7 @@ import android.util.AttributeSet;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout;
public class CustomCollapsingToolbarLayout extends CollapsingToolbarLayout { public class CustomCollapsingToolbarLayout extends CollapsingToolbarLayout {
@ -27,8 +28,10 @@ public class CustomCollapsingToolbarLayout extends CollapsingToolbarLayout {
} }
/** /**
* CollapsingToolbarLayout overrides our logic with fitsSystemWindows and ruins the layout. * CollapsingToolbarLayout sets it's own setOnApplyInsetsListener which consumes
* Override Google's method * system insets {@link CollapsingToolbarLayout#onWindowInsetChanged(WindowInsetsCompat)}
* so we will not receive them in subviews with fitsSystemWindows = true.
* Override Google's behavior
* */ * */
public void overrideListener() { public void overrideListener() {
ViewCompat.setOnApplyWindowInsetsListener(this, (v, insets) -> insets); ViewCompat.setOnApplyWindowInsetsListener(this, (v, insets) -> insets);