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
| Column( | |
| modifier = Modifier.fillMaxSize(), | |
| verticalArrangement = Arrangement.Center, | |
| horizontalAlignment = Alignment.CenterHorizontally, | |
| ) { | |
| BezierCurve( | |
| modifier = Modifier | |
| .fillMaxWidth() | |
| .padding(start = 30.dp, end = 30.dp) | |
| .height(100.dp), |
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
| package com.zhangke.framework.composable | |
| import androidx.compose.foundation.Canvas | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.runtime.getValue | |
| import androidx.compose.runtime.mutableStateOf | |
| import androidx.compose.runtime.remember | |
| import androidx.compose.runtime.setValue | |
| import androidx.compose.ui.Modifier | |
| import androidx.compose.ui.geometry.Offset |
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
| data class LoginUiState( | |
| val name:String, | |
| val avatar: String, | |
| val consentAgreed: Boolean | |
| ) | |
| fun onAgreeChecked(){ | |
| uistate = uiState.copy( | |
| consentAgreed = true, | |
| ) |
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
| class LoginViewModel @Inject constructor( | |
| private val doSomething: DoSomethingUseCase, | |
| ): ViewModel(){ | |
| fun onLoginClick(){ | |
| doSomething() | |
| } | |
| } |
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
| class DoSomethingUseCase { | |
| operator fun invoke(xxx: Foo): Bar { | |
| // ... | |
| } | |
| } |
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
| data class UserEntity(val name: String, val avatar: String) | |
| interface UserService { | |
| @GET("/user") | |
| suspend fun getUserInfo(@query("id") id: String): UserEntity | |
| } | |
| data class User(val name: String, val avatar: String) |
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
| class NotionResponse<T> : Response<T, ErrorEntry>() | |
| ... | |
| @POST("v1/search") | |
| suspend fun queryAllPages(@Body body: RequestBody): NotionResponse<NotionListEntry<NotionPage>> |
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
| // {"object":"error","status":401,"code":"unauthorized","message":"API token is invalid."} | |
| data class ErrorEntry( | |
| @SerializedName("object") | |
| val objectType: String, | |
| val status: Int, | |
| val code: String?, |
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 enqueue(callback: Callback<Response<S, E>>) { | |
| return delegate.enqueue(object : Callback<S> { | |
| override fun onResponse(call: Call<S>, response: retrofit2.Response<S>) { | |
| if (response.isSuccessful) { | |
| val body = response.body() | |
| responseInstance.success = true | |
| responseInstance.successData = body | |
| } else { | |
| val error = response.errorBody() |
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
| class ResponseCall<S, E : ErrorResponse.ErrorEntryWithMessage>( | |
| private val delegate: Call<S>, | |
| private val responseInstance: Response<S, E>, | |
| private val errorConverter: Converter<ResponseBody, E> | |
| ) : Call<Response<S, E>> { | |
| override fun enqueue(callback: Callback<Response<S, E>>) { | |
| TODO("Not yet implemented") | |
| } |
NewerOlder