-
-
Notifications
You must be signed in to change notification settings - Fork 243
Add physical orientation constraint using OrientationEventListener #1911
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
Changes from 5 commits
8c6a66a
df64a8a
a04a07a
9a3b672
e000b00
f1a7566
7953c7c
19bcdfb
119b776
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import android.media.AudioManager | |
| import android.os.Build | ||
| import io.github.sds100.keymapper.base.system.accessibility.IAccessibilityService | ||
| import io.github.sds100.keymapper.common.utils.Orientation | ||
| import io.github.sds100.keymapper.common.utils.PhysicalOrientation | ||
| import io.github.sds100.keymapper.common.utils.firstBlocking | ||
| import io.github.sds100.keymapper.system.bluetooth.BluetoothDeviceInfo | ||
| import io.github.sds100.keymapper.system.camera.CameraAdapter | ||
|
|
@@ -43,6 +44,7 @@ class LazyConstraintSnapshot( | |
| devicesAdapter.connectedBluetoothDevices.value | ||
| } | ||
| private val orientation: Orientation by lazy { displayAdapter.cachedOrientation } | ||
| private val physicalOrientation: PhysicalOrientation by lazy { displayAdapter.cachedPhysicalOrientation } | ||
| private val isScreenOn: Boolean by lazy { displayAdapter.isScreenOn.firstBlocking() } | ||
| private val appsPlayingMedia: List<String> by lazy { | ||
| mediaAdapter.getActiveMediaSessionPackages() | ||
|
|
@@ -117,6 +119,9 @@ class LazyConstraintSnapshot( | |
| orientation == Orientation.ORIENTATION_0 || | ||
| orientation == Orientation.ORIENTATION_180 | ||
|
|
||
| is ConstraintData.PhysicalOrientationConstraint -> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot Just call it ConstraintData.PhysicalOrientation
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in f1a7566. Renamed |
||
| physicalOrientation == constraint.data.physicalOrientation | ||
|
|
||
| is ConstraintData.ScreenOff -> !isScreenOn | ||
| is ConstraintData.ScreenOn -> isScreenOn | ||
| is ConstraintData.FlashlightOff -> !cameraAdapter.isFlashlightOn(constraint.data.lens) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot rename all these to DISPLAY_ORIENTATION_*. Do not add constraintids for general SCREEN_ORIENTATION and PHYSICAL_ORIENTATION. Refactor the ChooseConstraintViewModel to still only show the 2 orientation list items, and no more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in f1a7566. Renamed all orientation constraints to
DISPLAY_ORIENTATION_*. RemovedSCREEN_ORIENTATIONandPHYSICAL_ORIENTATIONConstraintIds. The ChooseConstraintViewModel now uses synthetic list item IDs (display_orientation,physical_orientation) for the consolidated items in the UI, while still showing only the 2 orientation entries.