mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-30 23:03:00 +00:00 
			
		
		
		
	AndroidTvUtils -> DeviceUtils
This commit is contained in:
		| @@ -68,7 +68,7 @@ import org.schabi.newpipe.player.VideoPlayer; | |||||||
| import org.schabi.newpipe.player.event.OnKeyDownListener; | import org.schabi.newpipe.player.event.OnKeyDownListener; | ||||||
| import org.schabi.newpipe.player.playqueue.PlayQueue; | import org.schabi.newpipe.player.playqueue.PlayQueue; | ||||||
| import org.schabi.newpipe.report.ErrorActivity; | import org.schabi.newpipe.report.ErrorActivity; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.Constants; | import org.schabi.newpipe.util.Constants; | ||||||
| import org.schabi.newpipe.util.KioskTranslator; | import org.schabi.newpipe.util.KioskTranslator; | ||||||
| import org.schabi.newpipe.util.Localization; | import org.schabi.newpipe.util.Localization; | ||||||
| @@ -144,7 +144,7 @@ public class MainActivity extends AppCompatActivity { | |||||||
|             ErrorActivity.reportUiError(this, e); |             ErrorActivity.reportUiError(this, e); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (AndroidTvUtils.isTv(this)) { |         if (DeviceUtils.isTv(this)) { | ||||||
|             FocusOverlayView.setupFocusObserver(this); |             FocusOverlayView.setupFocusObserver(this); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -545,7 +545,7 @@ public class MainActivity extends AppCompatActivity { | |||||||
|             Log.d(TAG, "onBackPressed() called"); |             Log.d(TAG, "onBackPressed() called"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (AndroidTvUtils.isTv(this)) { |         if (DeviceUtils.isTv(this)) { | ||||||
|             View drawerPanel = findViewById(R.id.navigation); |             View drawerPanel = findViewById(R.id.navigation); | ||||||
|             if (drawer.isDrawerOpen(drawerPanel)) { |             if (drawer.isDrawerOpen(drawerPanel)) { | ||||||
|                 drawer.closeDrawers(); |                 drawer.closeDrawers(); | ||||||
|   | |||||||
| @@ -44,7 +44,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueue; | |||||||
| import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue; | import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue; | ||||||
| import org.schabi.newpipe.player.playqueue.SinglePlayQueue; | import org.schabi.newpipe.player.playqueue.SinglePlayQueue; | ||||||
| import org.schabi.newpipe.report.UserAction; | import org.schabi.newpipe.report.UserAction; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.Constants; | import org.schabi.newpipe.util.Constants; | ||||||
| import org.schabi.newpipe.util.ExtractorHelper; | import org.schabi.newpipe.util.ExtractorHelper; | ||||||
| import org.schabi.newpipe.util.ListHelper; | import org.schabi.newpipe.util.ListHelper; | ||||||
| @@ -347,7 +347,7 @@ public class RouterActivity extends AppCompatActivity { | |||||||
|  |  | ||||||
|         alertDialog.show(); |         alertDialog.show(); | ||||||
|  |  | ||||||
|         if (AndroidTvUtils.isTv(this)) { |         if (DeviceUtils.isTv(this)) { | ||||||
|             FocusOverlayView.setupFocusObserver(alertDialog); |             FocusOverlayView.setupFocusObserver(alertDialog); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ import androidx.appcompat.app.AppCompatActivity; | |||||||
| import androidx.appcompat.widget.Toolbar; | import androidx.appcompat.widget.Toolbar; | ||||||
|  |  | ||||||
| import org.schabi.newpipe.R; | import org.schabi.newpipe.R; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.ThemeHelper; | import org.schabi.newpipe.util.ThemeHelper; | ||||||
| import org.schabi.newpipe.views.FocusOverlayView; | import org.schabi.newpipe.views.FocusOverlayView; | ||||||
|  |  | ||||||
| @@ -57,7 +57,7 @@ public class DownloadActivity extends AppCompatActivity { | |||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         if (AndroidTvUtils.isTv(this)) { |         if (DeviceUtils.isTv(this)) { | ||||||
|             FocusOverlayView.setupFocusObserver(this); |             FocusOverlayView.setupFocusObserver(this); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -92,7 +92,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueueItem; | |||||||
| import org.schabi.newpipe.player.playqueue.SinglePlayQueue; | import org.schabi.newpipe.player.playqueue.SinglePlayQueue; | ||||||
| import org.schabi.newpipe.report.ErrorActivity; | import org.schabi.newpipe.report.ErrorActivity; | ||||||
| import org.schabi.newpipe.report.UserAction; | import org.schabi.newpipe.report.UserAction; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.Constants; | import org.schabi.newpipe.util.Constants; | ||||||
| import org.schabi.newpipe.util.ExtractorHelper; | import org.schabi.newpipe.util.ExtractorHelper; | ||||||
| import org.schabi.newpipe.util.ImageDisplayConstants; | import org.schabi.newpipe.util.ImageDisplayConstants; | ||||||
| @@ -767,7 +767,7 @@ public class VideoDetailFragment | |||||||
|  |  | ||||||
|         thumbnailBackgroundButton.requestFocus(); |         thumbnailBackgroundButton.requestFocus(); | ||||||
|  |  | ||||||
|         if (AndroidTvUtils.isTv(getContext())) { |         if (DeviceUtils.isTv(getContext())) { | ||||||
|             // remove ripple effects from detail controls |             // remove ripple effects from detail controls | ||||||
|             final int transparent = getResources().getColor(R.color.transparent_background_color); |             final int transparent = getResources().getColor(R.color.transparent_background_color); | ||||||
|             detailControlsAddToPlaylist.setBackgroundColor(transparent); |             detailControlsAddToPlaylist.setBackgroundColor(transparent); | ||||||
| @@ -880,7 +880,7 @@ public class VideoDetailFragment | |||||||
|  |  | ||||||
|         // If we are in fullscreen mode just exit from it via first back press |         // If we are in fullscreen mode just exit from it via first back press | ||||||
|         if (player != null && player.isFullscreen()) { |         if (player != null && player.isFullscreen()) { | ||||||
|             if (!PlayerHelper.isTablet(activity)) { |             if (!DeviceUtils.isTablet(activity)) { | ||||||
|                 player.onPause(); |                 player.onPause(); | ||||||
|             } |             } | ||||||
|             restoreDefaultOrientation(); |             restoreDefaultOrientation(); | ||||||
| @@ -1449,7 +1449,7 @@ public class VideoDetailFragment | |||||||
|         // User can tap on Play button and video will be in fullscreen mode again |         // User can tap on Play button and video will be in fullscreen mode again | ||||||
|         // Note for tablet: trying to avoid orientation changes since it's not easy |         // Note for tablet: trying to avoid orientation changes since it's not easy | ||||||
|         // to physically rotate the tablet every time |         // to physically rotate the tablet every time | ||||||
|         if (!PlayerHelper.isTablet(activity)) { |         if (!DeviceUtils.isTablet(activity)) { | ||||||
|             activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); |             activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -1945,7 +1945,7 @@ public class VideoDetailFragment | |||||||
|         // In tablet user experience will be better if screen will not be rotated |         // In tablet user experience will be better if screen will not be rotated | ||||||
|         // from landscape to portrait every time. |         // from landscape to portrait every time. | ||||||
|         // Just turn on fullscreen mode in landscape orientation |         // Just turn on fullscreen mode in landscape orientation | ||||||
|         if (isLandscape() && PlayerHelper.isTablet(activity)) { |         if (isLandscape() && DeviceUtils.isTablet(activity)) { | ||||||
|             player.toggleFullscreen(); |             player.toggleFullscreen(); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @@ -2185,7 +2185,7 @@ public class VideoDetailFragment | |||||||
|                                 && player != null |                                 && player != null | ||||||
|                                 && player.isPlaying() |                                 && player.isPlaying() | ||||||
|                                 && !player.isFullscreen() |                                 && !player.isFullscreen() | ||||||
|                                 && !PlayerHelper.isTablet(activity) |                                 && !DeviceUtils.isTablet(activity) | ||||||
|                                 && player.videoPlayerSelected()) { |                                 && player.videoPlayerSelected()) { | ||||||
|                             player.toggleFullscreen(); |                             player.toggleFullscreen(); | ||||||
|                         } |                         } | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ import org.schabi.newpipe.fragments.list.BaseListFragment; | |||||||
| import org.schabi.newpipe.local.history.HistoryRecordManager; | import org.schabi.newpipe.local.history.HistoryRecordManager; | ||||||
| import org.schabi.newpipe.report.ErrorActivity; | import org.schabi.newpipe.report.ErrorActivity; | ||||||
| import org.schabi.newpipe.report.UserAction; | import org.schabi.newpipe.report.UserAction; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.AnimationUtils; | import org.schabi.newpipe.util.AnimationUtils; | ||||||
| import org.schabi.newpipe.util.Constants; | import org.schabi.newpipe.util.Constants; | ||||||
| import org.schabi.newpipe.util.ExtractorHelper; | import org.schabi.newpipe.util.ExtractorHelper; | ||||||
| @@ -525,7 +525,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I | |||||||
|             if (isSuggestionsEnabled && errorPanelRoot.getVisibility() != View.VISIBLE) { |             if (isSuggestionsEnabled && errorPanelRoot.getVisibility() != View.VISIBLE) { | ||||||
|                 showSuggestionsPanel(); |                 showSuggestionsPanel(); | ||||||
|             } |             } | ||||||
|             if (AndroidTvUtils.isTv(getContext())) { |             if (DeviceUtils.isTv(getContext())) { | ||||||
|                 showKeyboardSearch(); |                 showKeyboardSearch(); | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ import org.schabi.newpipe.extractor.comments.CommentsInfoItem; | |||||||
| import org.schabi.newpipe.info_list.InfoItemBuilder; | import org.schabi.newpipe.info_list.InfoItemBuilder; | ||||||
| import org.schabi.newpipe.local.history.HistoryRecordManager; | import org.schabi.newpipe.local.history.HistoryRecordManager; | ||||||
| import org.schabi.newpipe.report.ErrorActivity; | import org.schabi.newpipe.report.ErrorActivity; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.CommentTextOnTouchListener; | import org.schabi.newpipe.util.CommentTextOnTouchListener; | ||||||
| import org.schabi.newpipe.util.ImageDisplayConstants; | import org.schabi.newpipe.util.ImageDisplayConstants; | ||||||
| import org.schabi.newpipe.util.Localization; | import org.schabi.newpipe.util.Localization; | ||||||
| @@ -126,7 +126,7 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder { | |||||||
|  |  | ||||||
|  |  | ||||||
|         itemView.setOnLongClickListener(view -> { |         itemView.setOnLongClickListener(view -> { | ||||||
|             if (AndroidTvUtils.isTv(itemBuilder.getContext())) { |             if (DeviceUtils.isTv(itemBuilder.getContext())) { | ||||||
|                 openCommentAuthor(item); |                 openCommentAuthor(item); | ||||||
|             } else { |             } else { | ||||||
|                 ShareUtils.copyToClipboard(itemBuilder.getContext(), commentText); |                 ShareUtils.copyToClipboard(itemBuilder.getContext(), commentText); | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ import org.schabi.newpipe.local.subscription.dialog.FeedGroupDialogViewModel.Dia | |||||||
| import org.schabi.newpipe.local.subscription.item.EmptyPlaceholderItem | import org.schabi.newpipe.local.subscription.item.EmptyPlaceholderItem | ||||||
| import org.schabi.newpipe.local.subscription.item.PickerIconItem | import org.schabi.newpipe.local.subscription.item.PickerIconItem | ||||||
| import org.schabi.newpipe.local.subscription.item.PickerSubscriptionItem | import org.schabi.newpipe.local.subscription.item.PickerSubscriptionItem | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils | import org.schabi.newpipe.util.DeviceUtils | ||||||
| import org.schabi.newpipe.util.ThemeHelper | import org.schabi.newpipe.util.ThemeHelper | ||||||
|  |  | ||||||
| class FeedGroupDialog : DialogFragment(), BackPressable { | class FeedGroupDialog : DialogFragment(), BackPressable { | ||||||
| @@ -237,7 +237,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         toolbar_search_edit_text.setOnClickListener { |         toolbar_search_edit_text.setOnClickListener { | ||||||
|             if (AndroidTvUtils.isTv(context)) { |             if (DeviceUtils.isTv(context)) { | ||||||
|                 showKeyboardSearch() |                 showKeyboardSearch() | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -80,7 +80,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueueItemHolder; | |||||||
| import org.schabi.newpipe.player.playqueue.PlayQueueItemTouchCallback; | import org.schabi.newpipe.player.playqueue.PlayQueueItemTouchCallback; | ||||||
| import org.schabi.newpipe.player.resolver.MediaSourceTag; | import org.schabi.newpipe.player.resolver.MediaSourceTag; | ||||||
| import org.schabi.newpipe.player.resolver.VideoPlaybackResolver; | import org.schabi.newpipe.player.resolver.VideoPlaybackResolver; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.AnimationUtils; | import org.schabi.newpipe.util.AnimationUtils; | ||||||
| import org.schabi.newpipe.util.KoreUtil; | import org.schabi.newpipe.util.KoreUtil; | ||||||
| import org.schabi.newpipe.util.ListHelper; | import org.schabi.newpipe.util.ListHelper; | ||||||
| @@ -179,7 +179,7 @@ public final class MainVideoPlayer extends AppCompatActivity | |||||||
|                     final String orientKey = getString(R.string.last_orientation_landscape_key); |                     final String orientKey = getString(R.string.last_orientation_landscape_key); | ||||||
|  |  | ||||||
|                     final boolean lastOrientationWasLandscape = defaultPreferences |                     final boolean lastOrientationWasLandscape = defaultPreferences | ||||||
|                             .getBoolean(orientKey, AndroidTvUtils.isTv(getApplicationContext())); |                             .getBoolean(orientKey, DeviceUtils.isTv(getApplicationContext())); | ||||||
|                     setLandscape(lastOrientationWasLandscape); |                     setLandscape(lastOrientationWasLandscape); | ||||||
|                 } else { |                 } else { | ||||||
|                     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); |                     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); | ||||||
| @@ -191,7 +191,7 @@ public final class MainVideoPlayer extends AppCompatActivity | |||||||
|                 Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION), |                 Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION), | ||||||
|                 false, rotationObserver); |                 false, rotationObserver); | ||||||
|  |  | ||||||
|         if (AndroidTvUtils.isTv(this)) { |         if (DeviceUtils.isTv(this)) { | ||||||
|             FocusOverlayView.setupFocusObserver(this); |             FocusOverlayView.setupFocusObserver(this); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -223,7 +223,7 @@ public final class MainVideoPlayer extends AppCompatActivity | |||||||
|             default: |             default: | ||||||
|                 break; |                 break; | ||||||
|             case KeyEvent.KEYCODE_BACK: |             case KeyEvent.KEYCODE_BACK: | ||||||
|                 if (AndroidTvUtils.isTv(getApplicationContext()) |                 if (DeviceUtils.isTv(getApplicationContext()) | ||||||
|                         && playerImpl.isControlsVisible()) { |                         && playerImpl.isControlsVisible()) { | ||||||
|                     playerImpl.hideControls(0, 0); |                     playerImpl.hideControls(0, 0); | ||||||
|                     hideSystemUi(); |                     hideSystemUi(); | ||||||
| @@ -272,7 +272,7 @@ public final class MainVideoPlayer extends AppCompatActivity | |||||||
|             final String orientKey = getString(R.string.last_orientation_landscape_key); |             final String orientKey = getString(R.string.last_orientation_landscape_key); | ||||||
|  |  | ||||||
|             boolean lastOrientationWasLandscape = defaultPreferences |             boolean lastOrientationWasLandscape = defaultPreferences | ||||||
|                     .getBoolean(orientKey, AndroidTvUtils.isTv(getApplicationContext())); |                     .getBoolean(orientKey, DeviceUtils.isTv(getApplicationContext())); | ||||||
|             setLandscape(lastOrientationWasLandscape); |             setLandscape(lastOrientationWasLandscape); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -94,7 +94,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueueItemTouchCallback; | |||||||
| import org.schabi.newpipe.player.resolver.AudioPlaybackResolver; | import org.schabi.newpipe.player.resolver.AudioPlaybackResolver; | ||||||
| import org.schabi.newpipe.player.resolver.MediaSourceTag; | import org.schabi.newpipe.player.resolver.MediaSourceTag; | ||||||
| import org.schabi.newpipe.player.resolver.VideoPlaybackResolver; | import org.schabi.newpipe.player.resolver.VideoPlaybackResolver; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.AnimationUtils; | import org.schabi.newpipe.util.AnimationUtils; | ||||||
| import org.schabi.newpipe.util.Constants; | import org.schabi.newpipe.util.Constants; | ||||||
| import org.schabi.newpipe.util.KoreUtil; | import org.schabi.newpipe.util.KoreUtil; | ||||||
| @@ -117,7 +117,6 @@ import static org.schabi.newpipe.player.MainPlayer.ACTION_REPEAT; | |||||||
| import static org.schabi.newpipe.player.MainPlayer.NOTIFICATION_ID; | import static org.schabi.newpipe.player.MainPlayer.NOTIFICATION_ID; | ||||||
| import static org.schabi.newpipe.player.helper.PlayerHelper.MinimizeMode.MINIMIZE_ON_EXIT_MODE_BACKGROUND; | import static org.schabi.newpipe.player.helper.PlayerHelper.MinimizeMode.MINIMIZE_ON_EXIT_MODE_BACKGROUND; | ||||||
| import static org.schabi.newpipe.player.helper.PlayerHelper.getTimeString; | import static org.schabi.newpipe.player.helper.PlayerHelper.getTimeString; | ||||||
| import static org.schabi.newpipe.player.helper.PlayerHelper.isTablet; |  | ||||||
| import static org.schabi.newpipe.util.AnimationUtils.Type.SLIDE_AND_ALPHA; | import static org.schabi.newpipe.util.AnimationUtils.Type.SLIDE_AND_ALPHA; | ||||||
| import static org.schabi.newpipe.util.AnimationUtils.animateRotation; | import static org.schabi.newpipe.util.AnimationUtils.animateRotation; | ||||||
| import static org.schabi.newpipe.util.AnimationUtils.animateView; | import static org.schabi.newpipe.util.AnimationUtils.animateView; | ||||||
| @@ -481,7 +480,7 @@ public class VideoPlayerImpl extends VideoPlayer | |||||||
|             default: |             default: | ||||||
|                 break; |                 break; | ||||||
|             case KeyEvent.KEYCODE_BACK: |             case KeyEvent.KEYCODE_BACK: | ||||||
|                 if (AndroidTvUtils.isTv(service) && isControlsVisible()) { |                 if (DeviceUtils.isTv(service) && isControlsVisible()) { | ||||||
|                     hideControls(0, 0); |                     hideControls(0, 0); | ||||||
|                     hideSystemUIIfNeeded(); |                     hideSystemUIIfNeeded(); | ||||||
|                     return true; |                     return true; | ||||||
| @@ -930,7 +929,7 @@ public class VideoPlayerImpl extends VideoPlayer | |||||||
|  |  | ||||||
|     private void setupScreenRotationButton() { |     private void setupScreenRotationButton() { | ||||||
|         final boolean orientationLocked = PlayerHelper.globalScreenOrientationLocked(service); |         final boolean orientationLocked = PlayerHelper.globalScreenOrientationLocked(service); | ||||||
|         final boolean tabletInLandscape = isTablet(service) && service.isLandscape(); |         final boolean tabletInLandscape = DeviceUtils.isTablet(service) && service.isLandscape(); | ||||||
|         final boolean showButton = videoPlayerSelected() |         final boolean showButton = videoPlayerSelected() | ||||||
|                 && (orientationLocked || isVerticalVideo || tabletInLandscape); |                 && (orientationLocked || isVerticalVideo || tabletInLandscape); | ||||||
|         screenRotationButton.setVisibility(showButton ? View.VISIBLE : View.GONE); |         screenRotationButton.setVisibility(showButton ? View.VISIBLE : View.GONE); | ||||||
| @@ -1542,7 +1541,7 @@ public class VideoPlayerImpl extends VideoPlayer | |||||||
|         // And the situations when we need to set custom height is |         // And the situations when we need to set custom height is | ||||||
|         // in fullscreen mode in tablet in non-multiWindow mode or with vertical video. |         // in fullscreen mode in tablet in non-multiWindow mode or with vertical video. | ||||||
|         // Other than that MATCH_PARENT is good |         // Other than that MATCH_PARENT is good | ||||||
|         final boolean navBarAtTheBottom = PlayerHelper.isTablet(service) || !service.isLandscape(); |         final boolean navBarAtTheBottom = DeviceUtils.isTablet(service) || !service.isLandscape(); | ||||||
|         controlsRoot.getLayoutParams().height = isFullscreen && !isInMultiWindow() |         controlsRoot.getLayoutParams().height = isFullscreen && !isInMultiWindow() | ||||||
|                 && navBarAtTheBottom ? size.y : ViewGroup.LayoutParams.MATCH_PARENT; |                 && navBarAtTheBottom ? size.y : ViewGroup.LayoutParams.MATCH_PARENT; | ||||||
|         controlsRoot.requestLayout(); |         controlsRoot.requestLayout(); | ||||||
| @@ -1612,7 +1611,7 @@ public class VideoPlayerImpl extends VideoPlayer | |||||||
|         if (parent != null |         if (parent != null | ||||||
|                 && videoInLandscapeButNotInFullscreen |                 && videoInLandscapeButNotInFullscreen | ||||||
|                 && playingState |                 && playingState | ||||||
|                 && !PlayerHelper.isTablet(service)) { |                 && !DeviceUtils.isTablet(service)) { | ||||||
|             toggleFullscreen(); |             toggleFullscreen(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -362,13 +362,6 @@ public final class PlayerHelper { | |||||||
|                 context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 0; |                 context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 0; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static boolean isTablet(@NonNull final Context context) { |  | ||||||
|         return (context |  | ||||||
|                 .getResources() |  | ||||||
|                 .getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) |  | ||||||
|                 >= Configuration.SCREENLAYOUT_SIZE_LARGE; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     //////////////////////////////////////////////////////////////////////////// |     //////////////////////////////////////////////////////////////////////////// | ||||||
|     // Private helpers |     // Private helpers | ||||||
|     //////////////////////////////////////////////////////////////////////////// |     //////////////////////////////////////////////////////////////////////////// | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ import androidx.preference.Preference; | |||||||
| import androidx.preference.PreferenceFragmentCompat; | import androidx.preference.PreferenceFragmentCompat; | ||||||
|  |  | ||||||
| import org.schabi.newpipe.R; | import org.schabi.newpipe.R; | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
| import org.schabi.newpipe.util.ThemeHelper; | import org.schabi.newpipe.util.ThemeHelper; | ||||||
| import org.schabi.newpipe.views.FocusOverlayView; | import org.schabi.newpipe.views.FocusOverlayView; | ||||||
|  |  | ||||||
| @@ -62,7 +62,7 @@ public class SettingsActivity extends AppCompatActivity | |||||||
|                     .commit(); |                     .commit(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (AndroidTvUtils.isTv(this)) { |         if (DeviceUtils.isTv(this)) { | ||||||
|             FocusOverlayView.setupFocusObserver(this); |             FocusOverlayView.setupFocusObserver(this); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -8,22 +8,23 @@ import android.os.BatteryManager; | |||||||
| import android.os.Build; | import android.os.Build; | ||||||
| import android.view.KeyEvent; | import android.view.KeyEvent; | ||||||
| 
 | 
 | ||||||
|  | import androidx.annotation.NonNull; | ||||||
| import org.schabi.newpipe.App; | import org.schabi.newpipe.App; | ||||||
| 
 | 
 | ||||||
| import static android.content.Context.BATTERY_SERVICE; | import static android.content.Context.BATTERY_SERVICE; | ||||||
| import static android.content.Context.UI_MODE_SERVICE; | import static android.content.Context.UI_MODE_SERVICE; | ||||||
| 
 | 
 | ||||||
| public final class AndroidTvUtils { | public final class DeviceUtils { | ||||||
| 
 | 
 | ||||||
|     private static final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv"; |     private static final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv"; | ||||||
|     private static Boolean isTV = null; |     private static Boolean isTV = null; | ||||||
| 
 | 
 | ||||||
|     private AndroidTvUtils() { |     private DeviceUtils() { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static boolean isTv(final Context context) { |     public static boolean isTv(final Context context) { | ||||||
|         if (AndroidTvUtils.isTV != null) { |         if (isTV != null) { | ||||||
|             return AndroidTvUtils.isTV; |             return isTV; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         PackageManager pm = App.getApp().getPackageManager(); |         PackageManager pm = App.getApp().getPackageManager(); | ||||||
| @@ -48,8 +49,15 @@ public final class AndroidTvUtils { | |||||||
|             isTv = isTv || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK); |             isTv = isTv || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         AndroidTvUtils.isTV = isTv; |         DeviceUtils.isTV = isTv; | ||||||
|         return AndroidTvUtils.isTV; |         return DeviceUtils.isTV; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static boolean isTablet(@NonNull final Context context) { | ||||||
|  |         return (context | ||||||
|  |                 .getResources() | ||||||
|  |                 .getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) | ||||||
|  |                 >= Configuration.SCREENLAYOUT_SIZE_LARGE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static boolean isConfirmKey(final int keyCode) { |     public static boolean isConfirmKey(final int keyCode) { | ||||||
| @@ -26,7 +26,7 @@ import android.widget.SeekBar; | |||||||
|  |  | ||||||
| import androidx.appcompat.widget.AppCompatSeekBar; | import androidx.appcompat.widget.AppCompatSeekBar; | ||||||
|  |  | ||||||
| import org.schabi.newpipe.util.AndroidTvUtils; | import org.schabi.newpipe.util.DeviceUtils; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * SeekBar, adapted for directional navigation. It emulates touch-related callbacks |  * SeekBar, adapted for directional navigation. It emulates touch-related callbacks | ||||||
| @@ -60,7 +60,7 @@ public final class FocusAwareSeekBar extends AppCompatSeekBar { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean onKeyDown(final int keyCode, final KeyEvent event) { |     public boolean onKeyDown(final int keyCode, final KeyEvent event) { | ||||||
|         if (!isInTouchMode() && AndroidTvUtils.isConfirmKey(keyCode)) { |         if (!isInTouchMode() && DeviceUtils.isConfirmKey(keyCode)) { | ||||||
|             releaseTrack(); |             releaseTrack(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Avently
					Avently