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
class MainActivity : ComponentActivity() { | |
@OptIn(ExperimentalMaterial3Api::class) | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior( | |
rememberTopAppBarState() | |
) | |
val isCollapsed = | |
remember { derivedStateOf { scrollBehavior.state.collapsedFraction < 0.5 } } |
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
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
var showSheet by remember { mutableStateOf(false) } | |
if (showSheet) { | |
BottomSheet() { | |
showSheet = 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
androidComponents { | |
onVariants(selector().all()) { variant -> | |
afterEvaluate { | |
val dataBindingTask = this.project.tasks.named( | |
"dataBindingGenBaseClasses" + variant.name.replaceFirstChar { | |
if (it.isLowerCase()) { | |
it.titlecase( | |
Locale.getDefault() | |
) | |
} else { |
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
@Composable | |
fun GmailAppBar( | |
scaffoldState: ScaffoldState, | |
scope: CoroutineScope | |
) { | |
Box( | |
modifier = Modifier | |
.padding(10.dp) | |
) { | |
Card( |
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
Exception in thread "main" java.lang.IllegalArgumentException: Name is too long | |
at com.oguzdogdu.backing.Car.setCarName(Car.kt:8) | |
at com.oguzdogdu.backing.CarKt.main(Car.kt:14) | |
at com.oguzdogdu.backing.CarKt.main(Car.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
class Car { | |
var carName: String = "" | |
get() = field | |
set(value) { | |
field = | |
if (value.length < 3) value else throw IllegalArgumentException("Name is too long") | |
} | |
} | |
fun main() { |
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 val _newsList = MutableLiveData<List<News>>() | |
val newsList: LiveData<List<News>> | |
get() = _newsList |
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
class Car { | |
var carName: String = "" | |
get() = field | |
set(value) { | |
field = value | |
} | |
var carModel: String = "" | |
get() = field | |
set(value) { |
NewerOlder