Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Nick/Nike_compose/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ dependencies {
debugImplementation(libs.androidx.compose.ui.test.manifest)
implementation("androidx.navigation:navigation-compose:2.9.8")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
implementation("io.coil-kt:coil-compose:2.7.0")
implementation("com.squareup.retrofit2:retrofit:2.11.0")
implementation("com.squareup.retrofit2:converter-gson:2.11.0")
}
5 changes: 3 additions & 2 deletions Nick/Nike_compose/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand All @@ -11,8 +11,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Nike_compose">

<activity
android:name=".MainActivity"
android:name=".presentation.main.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Nike_compose">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.clone.nike_compose.core.api

import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

object NetworkModule {
val api: ReqresApi by lazy {
Retrofit.Builder()
.baseUrl("https://reqres.in/")
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(ReqresApi::class.java)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.clone.nike_compose.core.api

import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Query

data class ReqresUsersResponse(
val page: Int,
val per_page: Int,
val total: Int,
val total_pages: Int,
val data: List<UserDto>
)

data class UserDto(
val id: Int,
val email: String,
val first_name: String,
val last_name: String,
val avatar: String
)

interface ReqresApi {
@GET("api/users")
suspend fun getUsers(
@Query("page") page: Int = 1,
@Header("x-api-key") apiKey: String
): ReqresUsersResponse
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.clone.nike_compose.core.data

data class Goods(
val goodsId: Int,
val goodsImgResId: Int,
val goodsName: String,
val category: String,
val numberOfColour: String,
val goodsPrice: String,
var isWished: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.clone.nike_compose.core.repository

import com.clone.nike_compose.core.api.ReqresApi
import com.clone.nike_compose.core.api.UserDto

class ProfileRepository(
private val api: ReqresApi
) {
suspend fun loadUsers(): List<UserDto> {
return api.getUsers(
page = 1,
apiKey = "reqres_08962a9022be4a3499d4dbe5e1bbc482"
).data
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.clone.nike_compose.ui.cart
package com.clone.nike_compose.presentation.cart

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -21,11 +19,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.clone.nike_compose.AppDestination
import com.clone.nike_compose.R
import com.clone.nike_compose.ui.home.HomeScreen

@Preview(showBackground = true)
@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.clone.nike_compose.ui.profile
package com.clone.nike_compose.presentation.detail

import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview

@Preview(showBackground = true)
@Composable
fun PreviewProfileScreen() {
fun PreviewDetailScreen() {
MaterialTheme {
ProfileScreen()
DetailScreen()
}
}

@Composable
fun ProfileScreen() {
fun DetailScreen(
modifier: Modifier = Modifier
) {

}
Loading