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.report.ErrorActivity;
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.NavigationHelper;
import org.schabi.newpipe.util.PeertubeHelper;
@ -140,7 +140,7 @@ public class MainActivity extends AppCompatActivity {
ErrorActivity.reportUiError(this, e);
}
if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this);
}
}
@ -489,7 +489,7 @@ public class MainActivity extends AppCompatActivity {
public void onBackPressed() {
if (DEBUG) Log.d(TAG, "onBackPressed() called");
if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
View drawerPanel = findViewById(R.id.navigation_layout);
if (drawer.isDrawerOpen(drawerPanel)) {
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.util.Constants;
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.NavigationHelper;
import org.schabi.newpipe.util.PermissionHelper;
@ -319,7 +319,7 @@ public class RouterActivity extends AppCompatActivity {
alertDialog.show();
if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(alertDialog);
}
}

View file

@ -12,8 +12,7 @@ import android.view.MenuItem;
import android.view.ViewTreeObserver;
import org.schabi.newpipe.R;
import org.schabi.newpipe.settings.SettingsActivity;
import org.schabi.newpipe.util.FireTvUtils;
import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.views.FocusOverlayView;
@ -53,7 +52,7 @@ public class DownloadActivity extends AppCompatActivity {
}
});
if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
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.search.SearchExtractor;
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.list.BaseListFragment;
import org.schabi.newpipe.local.history.HistoryRecordManager;
@ -471,7 +471,7 @@ public class SearchFragment
if (isSuggestionsEnabled && errorPanelRoot.getVisibility() != View.VISIBLE) {
showSuggestionsPanel();
}
if(FireTvUtils.isFireTv()){
if(AndroidTvUtils.isTv()){
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.VideoPlaybackResolver;
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.ListHelper;
import org.schabi.newpipe.util.NavigationHelper;
@ -166,7 +166,7 @@ public final class MainVideoPlayer extends AppCompatActivity
super.onChange(selfChange);
if (globalScreenOrientationLocked()) {
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);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
@ -178,7 +178,7 @@ public final class MainVideoPlayer extends AppCompatActivity
Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION),
false, rotationObserver);
if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this);
}
}
@ -206,7 +206,7 @@ public final class MainVideoPlayer extends AppCompatActivity
default:
break;
case KeyEvent.KEYCODE_BACK:
if (FireTvUtils.isFireTv() && playerImpl.isControlsVisible()) {
if (AndroidTvUtils.isTv() && playerImpl.isControlsVisible()) {
playerImpl.hideControls(0, 0);
hideSystemUi();
return true;
@ -241,7 +241,7 @@ public final class MainVideoPlayer extends AppCompatActivity
if (globalScreenOrientationLocked()) {
boolean lastOrientationWasLandscape = defaultPreferences.getBoolean(
getString(R.string.last_orientation_landscape_key), FireTvUtils.isFireTv());
getString(R.string.last_orientation_landscape_key), AndroidTvUtils.isTv());
setLandscape(lastOrientationWasLandscape);
}

View file

@ -12,7 +12,7 @@ import android.view.Menu;
import android.view.MenuItem;
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.views.FocusOverlayView;
@ -59,7 +59,7 @@ public class SettingsActivity extends AppCompatActivity implements BasePreferenc
.commit();
}
if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this);
}
}

View file

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

View file

@ -25,7 +25,7 @@ import android.view.ViewTreeObserver;
import android.widget.SeekBar;
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
@ -58,7 +58,7 @@ public final class FocusAwareSeekBar extends AppCompatSeekBar {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!isInTouchMode() && FireTvUtils.isConfirmKey(keyCode)) {
if (!isInTouchMode() && AndroidTvUtils.isConfirmKey(keyCode)) {
releaseTrack();
}