Skip to content

Commit

Permalink
fix: re-enable orientation change, without reloading webview
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Jan 5, 2024
1 parent a082295 commit cb73424
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions mobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:configChanges="orientation|screenSize"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">

Expand Down
10 changes: 10 additions & 0 deletions mobile/src/main/java/net/activitywatch/android/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
}

override fun onConfigurationChanged(newConfig: Configuration) {

Check failure on line 87 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Test

Unresolved reference: Configuration

Check failure on line 87 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Test

Unresolved reference: Configuration

Check failure on line 87 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Build apk

Unresolved reference: Configuration

Check failure on line 87 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Build aab

Unresolved reference: Configuration
super.onConfigurationChanged(newConfig)
// Checks the orientation of the screen
if (newConfig.orientation === Configuration.ORIENTATION_LANDSCAPE) {

Check failure on line 90 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Test

Unresolved reference: Configuration

Check failure on line 90 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Test

Unresolved reference: Configuration

Check failure on line 90 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Build apk

Unresolved reference: Configuration

Check failure on line 90 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Build aab

Unresolved reference: Configuration
Log.i(TAG, "Screen orientation changed to landscape")
} else if (newConfig.orientation === Configuration.ORIENTATION_PORTRAIT){

Check failure on line 92 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Test

Unresolved reference: Configuration

Check failure on line 92 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Test

Unresolved reference: Configuration

Check failure on line 92 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Build apk

Unresolved reference: Configuration

Check failure on line 92 in mobile/src/main/java/net/activitywatch/android/MainActivity.kt

View workflow job for this annotation

GitHub Actions / Build aab

Unresolved reference: Configuration
Log.i(TAG, "Screen orientation changed to portrait")
}
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.main, menu)
Expand Down

0 comments on commit cb73424

Please sign in to comment.