Skip to content

Commit c4014f2

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

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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
@@ -23,6 +23,16 @@ const val baseURL = "http://127.0.0.1:5600"
2323

2424
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener, WebUIFragment.OnFragmentInteractionListener {
2525

26+
override fun onConfigurationChanged(newConfig: Configuration) {
27+
super.onConfigurationChanged(newConfig)
28+
// Checks the orientation of the screen
29+
if (newConfig.orientation === Configuration.ORIENTATION_LANDSCAPE) {
30+
Log.i(TAG, "Screen orientation changed to landscape")
31+
} else if (newConfig.orientation === Configuration.ORIENTATION_PORTRAIT){
32+
Log.i(TAG, "Screen orientation changed to portrait")
33+
}
34+
}
35+
2636
private lateinit var binding: ActivityMainBinding
2737

2838
val version: String

0 commit comments

Comments
 (0)