To learn more about how to use Docsify to make a light Markdown-based docs site, see:
This file contains hidden or 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
task sayDone { | |
doLast { | |
exec { | |
commandLine 'say', 'Ilk Turda Bitirelim' | |
} | |
} | |
} |
This file contains hidden or 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
task("sayDone") { | |
doLast { | |
exec { | |
commandLine("say", "Ilk Turda Bitirelim") | |
} | |
} | |
} |
This file contains hidden or 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
@Composable | |
fun WithThenBlock() { | |
var isExpanded by remember { | |
mutableStateOf(true) | |
} | |
Box( | |
modifier = Modifier | |
.height(50.dp) | |
.then( |
This file contains hidden or 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
@Composable | |
fun WithRunBlock() { | |
var isExpanded by remember { | |
mutableStateOf(true) | |
} | |
Box( | |
modifier = Modifier | |
.height(50.dp) | |
.run { |
This file contains hidden or 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
@Composable | |
fun CardItem() { | |
Card( | |
modifier = Modifier | |
.fillMaxWidth() | |
.height(100.dp) | |
.padding(horizontal = 16.dp, vertical = 8.dp), | |
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primary) | |
) { |
This file contains hidden or 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
@Composable | |
fun YourTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { | |
val dynamicColor = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S | |
val colors = if (dynamicColor) { | |
val context = LocalContext.current | |
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) | |
} else { | |
if (darkTheme) DarkColorPalette else LightColorPalette | |
} |
This file contains hidden or 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 onPictureInPictureModeChanged( | |
isInPictureInPictureMode: Boolean, | |
newConfig: Configuration? | |
) { | |
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig) | |
if (isInPictureInPictureMode){ | |
Log.d(TAG, "onPictureInPictureModeChanged: Entered PIP") | |
pipButton.visibility = View.GONE | |
} | |
else{ |
This file contains hidden or 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() { | |
super.onUserLeaveHint() | |
//when user presses home button, if not in PIP mode, enter in PIP, requires Android N and above | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ | |
Log.d(TAG, "onUserLeaveHint: was not in PIP") | |
pictureInPictureMode() | |
} | |
else{ | |
Log.d(TAG, "onUserLeaveHint: Already in PIP") | |
} |
This file contains hidden or 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 pictureInPictureMode(){ | |
//Requires Android O and higher | |
Log.d(TAG, "pictureInPictureMode: Try to enter in PIP mode") | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ | |
Log.d(TAG, "pictureInPictureMode: Supports PIP") | |
//setup PIP height width | |
val aspectRatio = Rational(videoView.width, videoView.height) | |
pictureInPictureParamsBuilder!!.setAspectRatio(aspectRatio).build() | |
enterPictureInPictureMode(pictureInPictureParamsBuilder!!.build()) | |
} |
NewerOlder