Skip to content
Snippets Groups Projects
Unverified Commit 7573920f authored by Philipp Woessner's avatar Philipp Woessner Committed by GitHub
Browse files

Fixed screen orientation to portrait (#121)

* added restriction to portrait and reversed portrait orientation only

* suppress SourceLockedOrientationActivity lint error
parent 0b0e544e
No related branches found
No related tags found
No related merge requests found
package de.rki.coronawarnapp
import android.annotation.SuppressLint
import android.app.Activity
import android.app.Application
import android.content.Context
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.util.Log
import android.view.WindowManager
......@@ -76,12 +78,15 @@ class CoronaWarnApplication : Application(), LifecycleObserver,
// does not override function. Empty on intention
}
@SuppressLint("SourceLockedOrientationActivity")
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
// prevents screenshot of the app for all activities
activity.window.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
// set screen orientation to portrait
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
}
override fun onActivityResumed(activity: Activity) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment