1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-27 18:40:32 +00:00

Rename FireTvUtils to AndroidTvUtils and isFireTv() to isTV()

Because those methods are no longer exclusive to Amazon devices
This commit is contained in:
Alexander-- 2020-01-29 03:15:50 +06:59
parent fac13fb8cb
commit caa1de8aff
8 changed files with 20 additions and 21 deletions

View File

@ -69,7 +69,7 @@ import org.schabi.newpipe.fragments.detail.VideoDetailFragment;
import org.schabi.newpipe.fragments.list.search.SearchFragment; import org.schabi.newpipe.fragments.list.search.SearchFragment;
import org.schabi.newpipe.report.ErrorActivity; import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.util.Constants; import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.FireTvUtils; import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.PeertubeHelper; import org.schabi.newpipe.util.PeertubeHelper;
@ -140,7 +140,7 @@ public class MainActivity extends AppCompatActivity {
ErrorActivity.reportUiError(this, e); ErrorActivity.reportUiError(this, e);
} }
if (FireTvUtils.isFireTv()) { if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this); FocusOverlayView.setupFocusObserver(this);
} }
} }
@ -489,7 +489,7 @@ public class MainActivity extends AppCompatActivity {
public void onBackPressed() { public void onBackPressed() {
if (DEBUG) Log.d(TAG, "onBackPressed() called"); if (DEBUG) Log.d(TAG, "onBackPressed() called");
if (FireTvUtils.isFireTv()) { if (AndroidTvUtils.isTv()) {
View drawerPanel = findViewById(R.id.navigation_layout); View drawerPanel = findViewById(R.id.navigation_layout);
if (drawer.isDrawerOpen(drawerPanel)) { if (drawer.isDrawerOpen(drawerPanel)) {
drawer.closeDrawers(); drawer.closeDrawers();

View File

@ -45,7 +45,7 @@ import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.report.UserAction;
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.FireTvUtils; import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.util.ListHelper; import org.schabi.newpipe.util.ListHelper;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.PermissionHelper; import org.schabi.newpipe.util.PermissionHelper;
@ -319,7 +319,7 @@ public class RouterActivity extends AppCompatActivity {
alertDialog.show(); alertDialog.show();
if (FireTvUtils.isFireTv()) { if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(alertDialog); FocusOverlayView.setupFocusObserver(alertDialog);
} }
} }

View File

@ -12,8 +12,7 @@ import android.view.MenuItem;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.settings.SettingsActivity; import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.util.FireTvUtils;
import org.schabi.newpipe.util.ThemeHelper; import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.views.FocusOverlayView; import org.schabi.newpipe.views.FocusOverlayView;
@ -53,7 +52,7 @@ public class DownloadActivity extends AppCompatActivity {
} }
}); });
if (FireTvUtils.isFireTv()) { if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this); FocusOverlayView.setupFocusObserver(this);
} }
} }

View File

@ -40,7 +40,7 @@ import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.search.SearchExtractor; import org.schabi.newpipe.extractor.search.SearchExtractor;
import org.schabi.newpipe.extractor.search.SearchInfo; import org.schabi.newpipe.extractor.search.SearchInfo;
import org.schabi.newpipe.util.FireTvUtils; import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.fragments.BackPressable; import org.schabi.newpipe.fragments.BackPressable;
import org.schabi.newpipe.fragments.list.BaseListFragment; import org.schabi.newpipe.fragments.list.BaseListFragment;
import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.local.history.HistoryRecordManager;
@ -471,7 +471,7 @@ public class SearchFragment
if (isSuggestionsEnabled && errorPanelRoot.getVisibility() != View.VISIBLE) { if (isSuggestionsEnabled && errorPanelRoot.getVisibility() != View.VISIBLE) {
showSuggestionsPanel(); showSuggestionsPanel();
} }
if(FireTvUtils.isFireTv()){ if(AndroidTvUtils.isTv()){
showKeyboardSearch(); showKeyboardSearch();
} }
}); });

View File

@ -78,7 +78,7 @@ 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.AnimationUtils; import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.FireTvUtils; import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.util.KoreUtil; import org.schabi.newpipe.util.KoreUtil;
import org.schabi.newpipe.util.ListHelper; import org.schabi.newpipe.util.ListHelper;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
@ -166,7 +166,7 @@ public final class MainVideoPlayer extends AppCompatActivity
super.onChange(selfChange); super.onChange(selfChange);
if (globalScreenOrientationLocked()) { if (globalScreenOrientationLocked()) {
final boolean lastOrientationWasLandscape = defaultPreferences.getBoolean( final boolean lastOrientationWasLandscape = defaultPreferences.getBoolean(
getString(R.string.last_orientation_landscape_key), FireTvUtils.isFireTv()); getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
setLandscape(lastOrientationWasLandscape); setLandscape(lastOrientationWasLandscape);
} else { } else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
@ -178,7 +178,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 (FireTvUtils.isFireTv()) { if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this); FocusOverlayView.setupFocusObserver(this);
} }
} }
@ -206,7 +206,7 @@ public final class MainVideoPlayer extends AppCompatActivity
default: default:
break; break;
case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_BACK:
if (FireTvUtils.isFireTv() && playerImpl.isControlsVisible()) { if (AndroidTvUtils.isTv() && playerImpl.isControlsVisible()) {
playerImpl.hideControls(0, 0); playerImpl.hideControls(0, 0);
hideSystemUi(); hideSystemUi();
return true; return true;
@ -241,7 +241,7 @@ public final class MainVideoPlayer extends AppCompatActivity
if (globalScreenOrientationLocked()) { if (globalScreenOrientationLocked()) {
boolean lastOrientationWasLandscape = defaultPreferences.getBoolean( boolean lastOrientationWasLandscape = defaultPreferences.getBoolean(
getString(R.string.last_orientation_landscape_key), FireTvUtils.isFireTv()); getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
setLandscape(lastOrientationWasLandscape); setLandscape(lastOrientationWasLandscape);
} }

View File

@ -12,7 +12,7 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.util.FireTvUtils; import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.util.ThemeHelper; import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.views.FocusOverlayView; import org.schabi.newpipe.views.FocusOverlayView;
@ -59,7 +59,7 @@ public class SettingsActivity extends AppCompatActivity implements BasePreferenc
.commit(); .commit();
} }
if (FireTvUtils.isFireTv()) { if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this); FocusOverlayView.setupFocusObserver(this);
} }
} }

View File

@ -6,9 +6,9 @@ import android.content.pm.PackageManager;
import android.view.KeyEvent; import android.view.KeyEvent;
import org.schabi.newpipe.App; import org.schabi.newpipe.App;
public class FireTvUtils { public class AndroidTvUtils {
@SuppressLint("InlinedApi") @SuppressLint("InlinedApi")
public static boolean isFireTv(){ public static boolean isTv(){
final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv"; final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv";
PackageManager pm = App.getApp().getPackageManager(); PackageManager pm = App.getApp().getPackageManager();

View File

@ -25,7 +25,7 @@ import android.view.ViewTreeObserver;
import android.widget.SeekBar; import android.widget.SeekBar;
import androidx.appcompat.widget.AppCompatSeekBar; import androidx.appcompat.widget.AppCompatSeekBar;
import org.schabi.newpipe.util.FireTvUtils; import org.schabi.newpipe.util.AndroidTvUtils;
/** /**
* SeekBar, adapted for directional navigation. It emulates touch-related callbacks * SeekBar, adapted for directional navigation. It emulates touch-related callbacks
@ -58,7 +58,7 @@ public final class FocusAwareSeekBar extends AppCompatSeekBar {
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!isInTouchMode() && FireTvUtils.isConfirmKey(keyCode)) { if (!isInTouchMode() && AndroidTvUtils.isConfirmKey(keyCode)) {
releaseTrack(); releaseTrack();
} }