Skip to content

Commit

Permalink
Rename FireTvUtils to AndroidTvUtils and isFireTv() to isTV()
Browse files Browse the repository at this point in the history
Because those methods are no longer exclusive to Amazon devices
  • Loading branch information
Alexander-- committed Jan 28, 2020
1 parent fac13fb commit caa1de8
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/org/schabi/newpipe/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
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;
Expand Down Expand Up @@ -140,7 +140,7 @@ protected void onCreate(Bundle savedInstanceState) {
ErrorActivity.reportUiError(this, e);
}

if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this);
}
}
Expand Down Expand Up @@ -489,7 +489,7 @@ protected void onNewIntent(Intent intent) {
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();
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/schabi/newpipe/RouterActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
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;
Expand Down Expand Up @@ -319,7 +319,7 @@ private void showDialog(final List<AdapterChoiceItem> choices) {

alertDialog.show();

if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(alertDialog);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
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;

Expand Down Expand Up @@ -53,7 +52,7 @@ public void onGlobalLayout() {
}
});

if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
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;
Expand Down Expand Up @@ -471,7 +471,7 @@ private void initSearchListeners() {
if (isSuggestionsEnabled && errorPanelRoot.getVisibility() != View.VISIBLE) {
showSuggestionsPanel();
}
if(FireTvUtils.isFireTv()){
if(AndroidTvUtils.isTv()){
showKeyboardSearch();
}
});
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
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;
Expand Down Expand Up @@ -166,7 +166,7 @@ public void onChange(boolean selfChange) {
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);
Expand All @@ -178,7 +178,7 @@ public void onChange(boolean selfChange) {
Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION),
false, rotationObserver);

if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this);
}
}
Expand Down Expand Up @@ -206,7 +206,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
default:
break;
case KeyEvent.KEYCODE_BACK:
if (FireTvUtils.isFireTv() && playerImpl.isControlsVisible()) {
if (AndroidTvUtils.isTv() && playerImpl.isControlsVisible()) {
playerImpl.hideControls(0, 0);
hideSystemUi();
return true;
Expand Down Expand Up @@ -241,7 +241,7 @@ protected void onResume() {

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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
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;

Expand Down Expand Up @@ -59,7 +59,7 @@ protected void onCreate(Bundle savedInstanceBundle) {
.commit();
}

if (FireTvUtils.isFireTv()) {
if (AndroidTvUtils.isTv()) {
FocusOverlayView.setupFocusObserver(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
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
Expand Down Expand Up @@ -58,7 +58,7 @@ public void setOnSeekBarChangeListener(OnSeekBarChangeListener l) {

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!isInTouchMode() && FireTvUtils.isConfirmKey(keyCode)) {
if (!isInTouchMode() && AndroidTvUtils.isConfirmKey(keyCode)) {
releaseTrack();
}

Expand Down

0 comments on commit caa1de8

Please sign in to comment.