No longer need to monitor device orientation in app

This commit is contained in:
Sylvain Berfini 2022-02-03 11:48:52 +01:00
parent d69b9f99c1
commit 82f352fa81
2 changed files with 1 additions and 13 deletions

View file

@ -53,6 +53,7 @@ Group changes to describe their impact on the project, as follows:
- Dialer will no longer make DTMF sound when pressing digits
- Launcher activity
- Global push notification setting in Network, use the switch in each Account instead
- No longer need to monitor device rotation and give information to the Core, it does it by itself
## [4.5.6] - 2021-11-08

View file

@ -25,7 +25,6 @@ import android.content.res.Configuration
import android.os.Bundle
import android.util.DisplayMetrics
import android.view.Display
import android.view.Surface
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.lifecycle.lifecycleScope
@ -100,18 +99,6 @@ abstract class GenericActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
var degrees = 270
val orientation = windowManager.defaultDisplay.rotation
when (orientation) {
Surface.ROTATION_0 -> degrees = 0
Surface.ROTATION_90 -> degrees = 270
Surface.ROTATION_180 -> degrees = 180
Surface.ROTATION_270 -> degrees = 90
}
Log.i("[Generic Activity] Device orientation is $degrees (raw value is $orientation)")
val rotation = (360 - degrees) % 360
coreContext.core.deviceRotation = rotation
// Remove service notification if it has been started by device boot
coreContext.notificationsManager.stopForegroundNotificationIfPossible()
}