Merge branch 'master' into dev
This commit is contained in:
commit
b59a601b52
76 changed files with 866 additions and 95 deletions
|
|
@ -3557,15 +3557,27 @@ public final class Player implements
|
|||
}
|
||||
|
||||
// apply caption language from previous user preference
|
||||
final List<String> selectedPreferredLanguages =
|
||||
trackSelector.getParameters().preferredTextLanguages;
|
||||
final int textRendererIndex = getCaptionRendererIndex();
|
||||
if (textRendererIndex == RENDERER_UNAVAILABLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If user prefers to show no caption, then disable the renderer.
|
||||
// Otherwise, DefaultTrackSelector may automatically find an available caption
|
||||
// and display that.
|
||||
final String userPreferredLanguage =
|
||||
prefs.getString(context.getString(R.string.caption_user_set_key), null);
|
||||
final int textRendererIndex = getCaptionRendererIndex();
|
||||
if (userPreferredLanguage == null) {
|
||||
trackSelector.setParameters(trackSelector.buildUponParameters()
|
||||
.setRendererDisabled(textRendererIndex, true));
|
||||
return;
|
||||
}
|
||||
|
||||
if (userPreferredLanguage != null
|
||||
&& !selectedPreferredLanguages.contains(userPreferredLanguage)
|
||||
&& textRendererIndex != RENDERER_UNAVAILABLE) {
|
||||
// Only set preferred language if it does not match the user preference,
|
||||
// otherwise there might be an infinite cycle at onTextTracksChanged.
|
||||
final List<String> selectedPreferredLanguages =
|
||||
trackSelector.getParameters().preferredTextLanguages;
|
||||
if (!selectedPreferredLanguages.contains(userPreferredLanguage)) {
|
||||
trackSelector.setParameters(trackSelector.buildUponParameters()
|
||||
.setPreferredTextLanguages(userPreferredLanguage,
|
||||
PlayerHelper.captionLanguageStemOf(userPreferredLanguage))
|
||||
|
|
|
|||
|
|
@ -78,6 +78,20 @@ public final class PlayerHelper {
|
|||
private static final NumberFormat SPEED_FORMATTER = new DecimalFormat("0.##x");
|
||||
private static final NumberFormat PITCH_FORMATTER = new DecimalFormat("##%");
|
||||
|
||||
/**
|
||||
* Maximum opacity allowed for Android 12 and higher to allow touches on other apps when using
|
||||
* NewPipe's popup player.
|
||||
*
|
||||
* <p>
|
||||
* This value is hardcoded instead of being get dynamically with the method linked of the
|
||||
* constant documentation below, because it is not static and popup player layout parameters
|
||||
* are generated with static methods.
|
||||
* </p>
|
||||
*
|
||||
* @see WindowManager.LayoutParams#FLAG_NOT_TOUCHABLE
|
||||
*/
|
||||
private static final float MAXIMUM_OPACITY_ALLOWED_FOR_S_AND_HIGHER = 0.8f;
|
||||
|
||||
@Retention(SOURCE)
|
||||
@IntDef({AUTOPLAY_TYPE_ALWAYS, AUTOPLAY_TYPE_WIFI,
|
||||
AUTOPLAY_TYPE_NEVER})
|
||||
|
|
@ -412,7 +426,7 @@ public final class PlayerHelper {
|
|||
context.getString(R.string.progressive_load_interval_key),
|
||||
context.getString(R.string.progressive_load_interval_default_value));
|
||||
|
||||
if (context.getString(R.string.progressive_load_interval_default_value)
|
||||
if (context.getString(R.string.progressive_load_interval_exoplayer_default_value)
|
||||
.equals(preferredIntervalBytes)) {
|
||||
return ProgressiveMediaSource.DEFAULT_LOADING_CHECK_INTERVAL_BYTES;
|
||||
}
|
||||
|
|
@ -587,6 +601,12 @@ public final class PlayerHelper {
|
|||
flags,
|
||||
PixelFormat.TRANSLUCENT);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
// Setting maximum opacity allowed for touch events to other apps for Android 12 and
|
||||
// higher to prevent non interaction when using other apps with the popup player
|
||||
closeOverlayLayoutParams.alpha = MAXIMUM_OPACITY_ALLOWED_FOR_S_AND_HIGHER;
|
||||
}
|
||||
|
||||
closeOverlayLayoutParams.gravity = Gravity.LEFT | Gravity.TOP;
|
||||
closeOverlayLayoutParams.softInputMode =
|
||||
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ class NotificationsSettingsFragment : BasePreferenceFragment(), OnSharedPreferen
|
|||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
addPreferencesFromResource(R.xml.notifications_settings)
|
||||
|
||||
// main check is done in onResume, but also do it here to prevent flickering
|
||||
preferenceScreen.isEnabled =
|
||||
NotificationHelper.areNotificationsEnabledOnDevice(requireContext())
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
|
@ -64,7 +68,7 @@ class NotificationsSettingsFragment : BasePreferenceFragment(), OnSharedPreferen
|
|||
// If they are disabled, show a snackbar informing the user about that
|
||||
// while allowing them to open the device's app settings.
|
||||
val enabled = NotificationHelper.areNotificationsEnabledOnDevice(requireContext())
|
||||
preferenceScreen.isEnabled = enabled
|
||||
preferenceScreen.isEnabled = enabled // it is disabled by default, see the xml
|
||||
if (!enabled) {
|
||||
if (notificationWarningSnackbar == null) {
|
||||
notificationWarningSnackbar = Snackbar.make(
|
||||
|
|
@ -85,9 +89,6 @@ class NotificationsSettingsFragment : BasePreferenceFragment(), OnSharedPreferen
|
|||
show()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
notificationWarningSnackbar?.dismiss()
|
||||
notificationWarningSnackbar = null
|
||||
}
|
||||
|
||||
// (Re-)Create loader
|
||||
|
|
@ -102,6 +103,9 @@ class NotificationsSettingsFragment : BasePreferenceFragment(), OnSharedPreferen
|
|||
loader?.dispose()
|
||||
loader = null
|
||||
|
||||
notificationWarningSnackbar?.dismiss()
|
||||
notificationWarningSnackbar = null
|
||||
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue