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
apply plugin: "jacoco" | |
jacoco { | |
toolVersion = deps.test.jacocoVersion | |
} | |
tasks.withType(Test) { | |
jacoco.includeNoLocationClasses = true | |
} |
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
abstract class BaseBuilder<T> { | |
abstract fun buildInternal(): T | |
} | |
fun <T, R: BaseBuilder<T>> R.build(block: R.() -> Unit): T { | |
block.invoke(this) | |
return this.buildInternal() | |
} |
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
<activity android:name="VideoActivity" | |
android:supportsPictureInPicture="true" | |
android:configChanges= | |
"screenSize|smallestScreenSize|screenLayout|orientation" | |
... |
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
activity?.enterPictureInPictureMode() |
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
override fun onUserLeaveHint() { | |
if (iWantToBeInPipModeNow()) { | |
enterPictureInPictureMode() | |
} | |
} |
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
<activity android:name="VideoActivity" | |
android:supportsPictureInPicture=“true" | |
android:autoRemoveFromRecents=“true” | |
android:configChanges= | |
"screenSize|smallestScreenSize|screenLayout|orientation" | |
... |
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
private fun startPictureInPicture(): Boolean { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && shouldStart) { | |
enterPictureInPictureMode( | |
PictureInPictureParams.Builder() | |
.setAspectRatio(…) // This has lower and upper limitations | |
.build() | |
) | |
return true | |
} | |
return false |
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
typealias OnAudioDeviceChanged = ( | |
selectedAudioDevice: AudioGenie.AudioDevice?, | |
availableAudioDevices: Set<AudioGenie.AudioDevice> | |
) -> Unit | |
val newAudioDevices: MutableSet<AudioDevice> = HashSet() | |
if (bluetoothManager.state == State.SCO_CONNECTED || bluetoothManager.state == State.SCO_CONNECTING || bluetoothManager.state == State.HEADSET_AVAILABLE | |
) { | |
newAudioDevices.add(AudioDevice.BLUETOOTH) | |
} |
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
private inner class BluetoothServiceListener : BluetoothProfile.ServiceListener { | |
// Called to notify the client when the proxy object has been connected to the service. | |
// Once we have the profile proxy object, we can use it to monitor the state of the | |
// connection and perform other operations that are relevant to the headset profile. | |
override fun onServiceConnected(profile: Int, proxy: BluetoothProfile) { | |
if (profile != BluetoothProfile.HEADSET || bluetoothState == State.UNINITIALIZED) { | |
return | |
} | |
// Android only supports one connected Bluetooth Headset at a time. | |
bluetoothHeadset = proxy as BluetoothHeadset |
OlderNewer