Android: Disable links on Android TV
Because Google claims the Android TV does not have a browser and fears that users may feel insecure about their inability to release a compatible version of Chrome.
This commit is contained in:
parent
aceda2e0b8
commit
068a798fc8
|
@ -2,6 +2,7 @@ package com.reicast.emulator;
|
|||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.UiModeManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -161,6 +162,15 @@ public class MainActivity extends AppCompatActivity implements
|
|||
navigationView.getMenu().findItem(R.id.rateme_menu).setEnabled(false);
|
||||
navigationView.getMenu().findItem(R.id.rateme_menu).setVisible(false);
|
||||
}
|
||||
try {
|
||||
UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
|
||||
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
|
||||
View header = navigationView.getHeaderView(0);
|
||||
((TextView) header.findViewById(R.id.project_link)).setLinksClickable(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// They require a check, so they can fix their API
|
||||
}
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
final SearchView searchView = (SearchView) findViewById(R.id.searchView);
|
||||
|
|
|
@ -79,15 +79,15 @@ public class Gamepad {
|
|||
|
||||
public static final int Xperia_Touchpad = 1048584;
|
||||
|
||||
public static final int key_CONT_B = 0x0002;
|
||||
public static final int key_CONT_A = 0x0004;
|
||||
public static final int key_CONT_START = 0x0008;
|
||||
public static final int key_CONT_DPAD_UP = 0x0010;
|
||||
public static final int key_CONT_DPAD_DOWN = 0x0020;
|
||||
public static final int key_CONT_DPAD_LEFT = 0x0040;
|
||||
public static final int key_CONT_DPAD_RIGHT = 0x0080;
|
||||
public static final int key_CONT_Y = 0x0200;
|
||||
public static final int key_CONT_X = 0x0400;
|
||||
private static final int key_CONT_B = 0x0002;
|
||||
private static final int key_CONT_A = 0x0004;
|
||||
private static final int key_CONT_START = 0x0008;
|
||||
private static final int key_CONT_DPAD_UP = 0x0010;
|
||||
private static final int key_CONT_DPAD_DOWN = 0x0020;
|
||||
private static final int key_CONT_DPAD_LEFT = 0x0040;
|
||||
private static final int key_CONT_DPAD_RIGHT = 0x0080;
|
||||
private static final int key_CONT_Y = 0x0200;
|
||||
private static final int key_CONT_X = 0x0400;
|
||||
|
||||
public int[] getConsoleController() {
|
||||
return new int[] {
|
||||
|
@ -162,10 +162,14 @@ public class Gamepad {
|
|||
if (ouya) {
|
||||
return OuyaFacade.getInstance().isRunningOnOUYAHardware();
|
||||
} else {
|
||||
UiModeManager uiModeManager = (UiModeManager)
|
||||
context.getSystemService(Context.UI_MODE_SERVICE);
|
||||
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
|
||||
return true;
|
||||
try {
|
||||
UiModeManager uiModeManager = (UiModeManager)
|
||||
context.getSystemService(Context.UI_MODE_SERVICE);
|
||||
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Not entirely important
|
||||
}
|
||||
PackageManager pMan = context.getPackageManager();
|
||||
return pMan.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:id="@+id/project_link"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_site"
|
||||
|
|
Loading…
Reference in New Issue