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

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

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
// Checks the orientation of the screen
if (newConfig.orientation === Configuration.ORIENTATION_LANDSCAPE) {
Log.i(TAG, "Screen orientation changed to landscape")
} else if (newConfig.orientation === Configuration.ORIENTATION_PORTRAIT){
Log.i(TAG, "Screen orientation changed to portrait")
}
}

private lateinit var binding: ActivityMainBinding

val version: String
Expand Down

0 comments on commit c4014f2

Please sign in to comment.