File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
android/app/src/main/kotlin/de/tum/in/tumcampus Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -10,19 +10,17 @@ import io.flutter.embedding.android.FlutterActivity
1010class MainActivity : FlutterActivity () {
1111 @SuppressLint(" SourceLockedOrientationActivity" )
1212 override fun onCreate (savedInstanceState : Bundle ? ) {
13- super .onCreate(savedInstanceState)
14-
15- requestedOrientation = if (isTablet(this )) {
16- ActivityInfo .SCREEN_ORIENTATION_UNSPECIFIED
17- } else {
18- ActivityInfo .SCREEN_ORIENTATION_PORTRAIT
13+ if (isPhone(this )) {
14+ requestedOrientation = ActivityInfo .SCREEN_ORIENTATION_PORTRAIT
1915 }
16+
17+ super .onCreate(savedInstanceState)
2018 }
2119}
2220
23- fun isTablet (context : Context ): Boolean {
21+ fun isPhone (context : Context ): Boolean {
2422 val resources = context.resources
2523 val configuration = resources.configuration
2624 val screenWidthDp = configuration.screenWidthDp
27- return screenWidthDp > = resources.getDimension(R .dimen.min_tablet_width_dp)
25+ return screenWidthDp < = resources.getDimension(R .dimen.min_tablet_width_dp)
2826}
You can’t perform that action at this time.
0 commit comments