Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Fixed screen orientation to portrait (#121)
Browse files Browse the repository at this point in the history
* added restriction to portrait and reversed portrait orientation only

* suppress SourceLockedOrientationActivity lint error
  • Loading branch information
pwoessner authored Jun 3, 2020
1 parent 0b0e544 commit 7573920
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7573920

Please sign in to comment.