Disable rotation on android 7.0
This prevents a crash in android 7.0 when rotating
while using the dark theme. Could be related to the
android material components library. Only reproduced
on emulator.
@@ -18,9 +18,11 @@ package fr.acinq.phoenix
import android.content.Context
import android.content.Intent
+import android.content.pm.ActivityInfo
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkRequest
+import android.os.Build
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
@@ -54,6 +56,9 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeHelper.applyTheme(Prefs.getTheme(applicationContext))
+ if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N) {
+ requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
+ }
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main)
appKit = ViewModelProvider(this).get(AppKitModel::class.java)
appKit.networkAvailable.observe(this, Observer {
