Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public class ActivityMain extends AppCompatActivity implements SearchView.OnQuer

private int selectedMenuItem;

private boolean isRunningOnTV;
private boolean instanceStateWasSaved;

private Date lastExitTry;
Expand All @@ -154,6 +155,7 @@ protected void onCreate(Bundle savedInstanceState) {
Iconics.init(this);

super.onCreate(savedInstanceState);
checkIsRunningOnTV();

if (sharedPref == null) {
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
Expand Down Expand Up @@ -431,13 +433,13 @@ public void onBackPressed() {
super.onBackPressed();
}

public boolean isRunningOnTV() {
public void checkIsRunningOnTV() {
UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
return uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
isRunningOnTV = uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
}

private boolean useBottomNavigation() {
return !isRunningOnTV() && Utils.bottomNavigationEnabled(this);
return !isRunningOnTV && Utils.bottomNavigationEnabled(this);
}


Expand Down Expand Up @@ -619,7 +621,7 @@ public void onFocusChange(View v, boolean hasFocus) {
Log.d(TAG, "SearchView has focus");
prevTabsVisibility = tabsView.getVisibility();
tabsView.setVisibility(View.GONE);
if (isRunningOnTV()) {
if (isRunningOnTV) {
showSoftKeyboard(mSearchView);
}
} else {
Expand Down