Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: re-enable orientation change, without reloading webview #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
}
}

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
Loading