diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-10-20 11:40:44 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-10-20 11:40:44 -0300 |
| commit | 290cf5de5cc36a3c748d264b58b869c571ef9ac1 (patch) | |
| tree | f6180421dd2c9617a0f8cbf8e1bcde719d7d4556 | |
| parent | 3d49e7632ddc1753ed95573d5c8e912cffa89d56 (diff) | |
| parent | 379712fb6b368e1fede63cc3236b68724031876d (diff) | |
| download | mullvadvpn-290cf5de5cc36a3c748d264b58b869c571ef9ac1.tar.xz mullvadvpn-290cf5de5cc36a3c748d264b58b869c571ef9ac1.zip | |
Merge branch 'workaround-tv-screen-orientation'
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | android/src/main/AndroidManifest.xml | 2 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt | 13 |
3 files changed, 15 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 33777c832e..7be5d010ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Line wrap the file at 100 chars. Th - Add button to remove account and WireGuard key from history in the login screen. - Improve navigation in the app using a keyboard, so that touchless devices (like TVs) can be used more smoothly. +- Run app in landscape mode on TVs. ### Fixed - Fix missing map animation after selecting a new location in the desktop app. diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 6295231f64..4c37a119fa 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -15,7 +15,7 @@ android:label="@string/app_name" android:launchMode="singleTask" android:configChanges="orientation|screenSize|screenLayout" - android:screenOrientation="portrait" + android:screenOrientation="sensorPortrait" android:windowSoftInputMode="adjustPan"> <intent-filter> <action android:name="android.intent.action.MAIN" /> diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt index 707914c455..1cb61da920 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt @@ -1,8 +1,11 @@ package net.mullvad.mullvadvpn.ui import android.app.Activity +import android.app.UiModeManager import android.content.ComponentName import android.content.Intent +import android.content.pm.ActivityInfo +import android.content.res.Configuration import android.os.Build import android.os.Bundle import android.os.IBinder @@ -33,6 +36,12 @@ class MainActivity : FragmentActivity() { private var shouldConnect = false private var visibleSecureScreens = HashSet<Fragment>() + private val deviceIsTv by lazy { + val uiModeManager = getSystemService(UI_MODE_SERVICE) as UiModeManager + + uiModeManager.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION + } + private val serviceConnectionManager = object : android.content.ServiceConnection { override fun onServiceConnected(className: ComponentName, binder: IBinder) { android.util.Log.d("mullvad", "UI successfully connected to the service") @@ -68,6 +77,10 @@ class MainActivity : FragmentActivity() { } override fun onCreate(savedInstanceState: Bundle?) { + if (deviceIsTv) { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) + } + super.onCreate(savedInstanceState) problemReport.logDirectory.complete(filesDir) |
