generated from AND-SOPT-ANDROID/and-sopt-android-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
369 additions
and
289 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
package org.sopt.and | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
|
||
@Serializable | ||
sealed class Route(val route: String) { | ||
@Serializable | ||
data object Home : Route("home") | ||
|
||
data class SignIn(val email: String = "", val password: String = "") : | ||
Route("signIn?email={email}&password={password}") { | ||
fun createRoute(email: String = "", password: String = "") = | ||
"signIn?email=$email&password=$password" | ||
} | ||
@Serializable | ||
data object SignIn : Route("signIn") | ||
|
||
@Serializable | ||
data object SignUp : Route("signUp") | ||
|
||
@Serializable | ||
data object Search : Route("search") | ||
|
||
data class MyPage(val email: String) : Route("myPage?email={email}") { | ||
fun createRoute(email: String) = "myPage?email=$email" | ||
} | ||
@Serializable | ||
data object MyPage : Route("myPage") | ||
} |
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,32 @@ | ||
// data/ServicePool.kt | ||
package org.sopt.and.data | ||
|
||
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory | ||
import kotlinx.serialization.json.Json | ||
import okhttp3.MediaType.Companion.toMediaType | ||
import okhttp3.OkHttpClient | ||
import okhttp3.logging.HttpLoggingInterceptor | ||
import org.sopt.and.BuildConfig | ||
import org.sopt.and.data.service.AuthService | ||
import retrofit2.Retrofit | ||
|
||
object ServicePool { | ||
private val json = Json { | ||
ignoreUnknownKeys = true | ||
coerceInputValues = true | ||
} | ||
|
||
private val okHttpClient = OkHttpClient.Builder() | ||
.addInterceptor(HttpLoggingInterceptor().apply { | ||
level = HttpLoggingInterceptor.Level.BODY | ||
}) | ||
.build() | ||
|
||
private val retrofit: Retrofit = Retrofit.Builder() | ||
.baseUrl(BuildConfig.BASE_URL) | ||
.addConverterFactory(json.asConverterFactory("application/json".toMediaType())) | ||
.client(okHttpClient) | ||
.build() | ||
|
||
val authService: AuthService by lazy { retrofit.create(AuthService::class.java) } | ||
} |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package org.sopt.and.domain | ||
|
||
data class User( | ||
var email: String = "", | ||
var password: String = "" | ||
val username: String = "", | ||
val password: String = "", | ||
val hobby: String = "" // hobby 필드 추가 | ||
) |
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
55 changes: 55 additions & 0 deletions
55
app/src/main/java/org/sopt/and/presentation/component/TextInputField.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,55 @@ | ||
// presentation/component/TextInputField.kt | ||
package org.sopt.and.presentation.component | ||
|
||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TextField | ||
import androidx.compose.material3.TextFieldDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun TextInputField( | ||
value: String, | ||
onValueChange: (String) -> Unit, | ||
modifier: Modifier = Modifier, | ||
placeholder: String = "", | ||
isError: Boolean = false, | ||
maxLength: Int = 8, | ||
singleLine: Boolean = true | ||
) { | ||
TextField( | ||
value = value, | ||
onValueChange = { | ||
if (it.length <= maxLength) { | ||
onValueChange(it) | ||
} | ||
}, | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.height(60.dp), | ||
placeholder = { | ||
Text( | ||
text = placeholder, | ||
color = Color.Gray | ||
) | ||
}, | ||
colors = TextFieldDefaults.colors( | ||
focusedContainerColor = Color.DarkGray, | ||
unfocusedContainerColor = Color.DarkGray, | ||
focusedTextColor = Color.White, | ||
unfocusedTextColor = Color.White, | ||
focusedIndicatorColor = if (isError) Color.Red.copy(alpha = 0.5f) else Color.Transparent, | ||
unfocusedIndicatorColor = if (isError) Color.Red.copy(alpha = 0.5f) else Color.Transparent, | ||
errorContainerColor = Color.DarkGray, | ||
errorIndicatorColor = Color.Red.copy(alpha = 0.5f) | ||
), | ||
shape = RoundedCornerShape(5.dp), | ||
singleLine = singleLine, | ||
isError = isError | ||
) | ||
} |
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
Oops, something went wrong.