Skip to content

Commit cb73424

Browse files
committed
fix: re-enable orientation change, without reloading webview
1 parent a082295 commit cb73424

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

mobile/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
<activity
3131
android:name=".MainActivity"
3232
android:label="@string/app_name"
33-
android:screenOrientation="portrait"
34-
android:configChanges="orientation"
33+
android:configChanges="orientation|screenSize"
3534
android:theme="@style/AppTheme.NoActionBar"
3635
android:exported="true">
3736

mobile/src/main/java/net/activitywatch/android/MainActivity.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
8484
}
8585
}
8686

87+
override fun onConfigurationChanged(newConfig: Configuration) {
88+
super.onConfigurationChanged(newConfig)
89+
// Checks the orientation of the screen
90+
if (newConfig.orientation === Configuration.ORIENTATION_LANDSCAPE) {
91+
Log.i(TAG, "Screen orientation changed to landscape")
92+
} else if (newConfig.orientation === Configuration.ORIENTATION_PORTRAIT){
93+
Log.i(TAG, "Screen orientation changed to portrait")
94+
}
95+
}
96+
8797
override fun onCreateOptionsMenu(menu: Menu): Boolean {
8898
// Inflate the menu; this adds items to the action bar if it is present.
8999
menuInflater.inflate(R.menu.main, menu)

0 commit comments

Comments
 (0)