-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for onCaptureButtonPressIn and onCaptureButtonPressOut ev…
…ents on Android
- Loading branch information
Showing
5 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
android/src/main/java/com/rncamerakit/events/CaptureButtonPressInEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.rncamerakit.events | ||
|
||
import com.facebook.react.bridge.Arguments | ||
import com.facebook.react.bridge.WritableMap | ||
import com.facebook.react.uimanager.events.Event | ||
|
||
class CaptureButtonPressInEvent( | ||
surfaceId: Int, | ||
viewId: Int, | ||
private val keyCode: Int, | ||
) : Event<CaptureButtonPressInEvent>(surfaceId, viewId) { | ||
override fun getEventName(): String = EVENT_NAME | ||
|
||
override fun getEventData(): WritableMap = | ||
Arguments.createMap().apply { | ||
putInt("keyCode", keyCode) | ||
} | ||
|
||
companion object { | ||
const val EVENT_NAME = "captureButtonPressIn" | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
android/src/main/java/com/rncamerakit/events/CaptureButtonPressOutEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.rncamerakit.events | ||
|
||
import com.facebook.react.bridge.Arguments | ||
import com.facebook.react.bridge.WritableMap | ||
import com.facebook.react.uimanager.events.Event | ||
|
||
class CaptureButtonPressOutEvent( | ||
surfaceId: Int, | ||
viewId: Int, | ||
private val keyCode: Int, | ||
) : Event<CaptureButtonPressOutEvent>(surfaceId, viewId) { | ||
override fun getEventName(): String = EVENT_NAME | ||
|
||
override fun getEventData(): WritableMap = | ||
Arguments.createMap().apply { | ||
putInt("keyCode", keyCode) | ||
} | ||
|
||
companion object { | ||
const val EVENT_NAME = "captureButtonPressOut" | ||
} | ||
} |