diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..b268ef3 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/deviceManager.xml b/.idea/deviceManager.xml new file mode 100644 index 0000000..91f9558 --- /dev/null +++ b/.idea/deviceManager.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..02c4aa5 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..7061a0d --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,61 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b2c751a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..fdf1fc8 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/2\354\243\274\354\260\250 res/BagCircle.svg" "b/2\354\243\274\354\260\250 res/BagCircle.svg" new file mode 100644 index 0000000..48b83e8 --- /dev/null +++ "b/2\354\243\274\354\260\250 res/BagCircle.svg" @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/BagSimple.svg" "b/2\354\243\274\354\260\250 res/BagSimple.svg" new file mode 100644 index 0000000..e2ea05f --- /dev/null +++ "b/2\354\243\274\354\260\250 res/BagSimple.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/HeartStraight.svg" "b/2\354\243\274\354\260\250 res/HeartStraight.svg" new file mode 100644 index 0000000..5c4e6ad --- /dev/null +++ "b/2\354\243\274\354\260\250 res/HeartStraight.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/HouseSimple.svg" "b/2\354\243\274\354\260\250 res/HouseSimple.svg" new file mode 100644 index 0000000..02a02b6 --- /dev/null +++ "b/2\354\243\274\354\260\250 res/HouseSimple.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" "b/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" new file mode 100644 index 0000000..d8ba9fa --- /dev/null +++ "b/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/User.svg" "b/2\354\243\274\354\260\250 res/User.svg" new file mode 100644 index 0000000..b39d4ad --- /dev/null +++ "b/2\354\243\274\354\260\250 res/User.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" "b/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" new file mode 100644 index 0000000..f42aa9d Binary files /dev/null and "b/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" differ diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagCircle.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagCircle.svg" new file mode 100644 index 0000000..48b83e8 --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagCircle.svg" @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagSimple.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagSimple.svg" new file mode 100644 index 0000000..e2ea05f --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagSimple.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HeartStraight.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HeartStraight.svg" new file mode 100644 index 0000000..5c4e6ad --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HeartStraight.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HouseSimple.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HouseSimple.svg" new file mode 100644 index 0000000..02a02b6 --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HouseSimple.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" new file mode 100644 index 0000000..d8ba9fa --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/User.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/User.svg" new file mode 100644 index 0000000..b39d4ad --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/User.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" new file mode 100644 index 0000000..f42aa9d Binary files /dev/null and "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" differ diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..b5ba9c4 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,62 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.compose) +} + +android { + namespace = "com.example.nike" + compileSdk { + version = release(36) { + minorApiLevel = 1 + } + } + + defaultConfig { + applicationId = "com.example.nike" + minSdk = 24 + targetSdk = 36 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + buildFeatures { + compose = true + viewBinding = true + } +} + +dependencies { + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.activity.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.graphics) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.material3) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.compose.ui.test.junit4) + debugImplementation(libs.androidx.compose.ui.tooling) + debugImplementation(libs.androidx.compose.ui.test.manifest) + implementation("com.google.android.material:material:1.12.0") + implementation("com.google.android.material:material:1.11.0") + implementation("androidx.recyclerview:recyclerview:1.3.2") +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/nike/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/nike/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..c0fa1dd --- /dev/null +++ b/app/src/androidTest/java/com/example/nike/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.nike + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.nike", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a374653 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_home_banner-playstore.png b/app/src/main/ic_home_banner-playstore.png new file mode 100644 index 0000000..d99e965 Binary files /dev/null and b/app/src/main/ic_home_banner-playstore.png differ diff --git a/app/src/main/ic_homebanner-playstore.png b/app/src/main/ic_homebanner-playstore.png new file mode 100644 index 0000000..d99e965 Binary files /dev/null and b/app/src/main/ic_homebanner-playstore.png differ diff --git a/app/src/main/ic_main_banner-playstore.png b/app/src/main/ic_main_banner-playstore.png new file mode 100644 index 0000000..4eab898 Binary files /dev/null and b/app/src/main/ic_main_banner-playstore.png differ diff --git a/app/src/main/java/com/example/nike/MainActivity.kt b/app/src/main/java/com/example/nike/MainActivity.kt new file mode 100644 index 0000000..121ed89 --- /dev/null +++ b/app/src/main/java/com/example/nike/MainActivity.kt @@ -0,0 +1,78 @@ +package com.example.nike + +import android.os.Bundle +import android.util.Log +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.Fragment +import com.example.nike.databinding.ActivityMainBinding +import com.example.nike.ui.theme.HomeFragment +import com.example.nike.ui.theme.ShopFragment +import com.example.nike.ui.theme.WishListFragment +import com.example.nike.ui.theme.CartFragment +import com.example.nike.ui.theme.ProfileFragment + +class MainActivity : AppCompatActivity() { + + private lateinit var binding: ActivityMainBinding + private val TAG = "LIFE_QUIZ" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityMainBinding.inflate(layoutInflater) + setContentView(binding.root) + Log.d(TAG, "onCreate") + + // 앱 처음 실행 시 홈 화면 표시 + if (savedInstanceState == null) { + replaceFragment(HomeFragment()) + } + + // 하단 네비게이션 클릭 이벤트 + binding.bottomNavigation.setOnItemSelectedListener { item -> + when (item.itemId) { + R.id.menu_home -> replaceFragment(HomeFragment()) + R.id.menu_shop -> replaceFragment(ShopFragment()) + R.id.menu_wishlist -> replaceFragment(WishListFragment()) + R.id.menu_cart -> replaceFragment(CartFragment()) + R.id.menu_profile -> replaceFragment(ProfileFragment()) + } + true + } + } + + override fun onStart() { + super.onStart() + Log.d(TAG, "onStart") + } + + override fun onResume() { + super.onResume() + Log.d(TAG, "onResume") + } + + override fun onPause() { + super.onPause() + Log.d(TAG, "onPause") + } + + override fun onStop() { + super.onStop() + Log.d(TAG, "onStop") + } + + override fun onDestroy() { + super.onDestroy() + Log.d(TAG, "onDestroy") + } + + override fun onRestart() { + super.onRestart() + Log.d(TAG, "onRestart") + } + + private fun replaceFragment(fragment: Fragment) { + supportFragmentManager.beginTransaction() + .replace(R.id.fragment_container, fragment) + .commit() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/CartFragment.kt b/app/src/main/java/com/example/nike/ui/theme/CartFragment.kt new file mode 100644 index 0000000..47599a3 --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/CartFragment.kt @@ -0,0 +1,18 @@ +package com.example.nike.ui.theme + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import com.example.nike.R + +class CartFragment : Fragment() { + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.fragment_cart, container, false) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/Color.kt b/app/src/main/java/com/example/nike/ui/theme/Color.kt new file mode 100644 index 0000000..afa56c4 --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.example.nike.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/HomeFragment.kt b/app/src/main/java/com/example/nike/ui/theme/HomeFragment.kt new file mode 100644 index 0000000..8529d32 --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/HomeFragment.kt @@ -0,0 +1,47 @@ +package com.example.nike.ui.theme + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.example.nike.R + +class HomeFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + val view = inflater.inflate(R.layout.fragment_home, container, false) + + val recyclerView = view.findViewById(R.id.recyclerHomeProducts) + recyclerView.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + + recyclerView.adapter = HomeProductAdapter(ProductDummyData.getHomeProducts()) { product -> + moveToDetail(product) + } + + return view + } + + private fun moveToDetail(product: Product) { + val bundle = Bundle().apply { + putString("name", product.name) + putString("price", product.price) + putInt("image", product.imageResId) + } + + val detailFragment = ProductDetailFragment() + detailFragment.arguments = bundle + + parentFragmentManager.beginTransaction() + .replace(R.id.fragment_container, detailFragment) + .addToBackStack(null) + .commit() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/HomeProductAdapter.kt b/app/src/main/java/com/example/nike/ui/theme/HomeProductAdapter.kt new file mode 100644 index 0000000..59a368f --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/HomeProductAdapter.kt @@ -0,0 +1,40 @@ +package com.example.nike.ui.theme + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import com.example.nike.R + +class HomeProductAdapter( + private val productList: List, + private val onItemClick: (Product) -> Unit +) : RecyclerView.Adapter() { + + inner class HomeProductViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val imgProduct: ImageView = itemView.findViewById(R.id.imgProduct) + val tvName: TextView = itemView.findViewById(R.id.tvName) + val tvPrice: TextView = itemView.findViewById(R.id.tvPrice) + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeProductViewHolder { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.item_home_product, parent, false) + return HomeProductViewHolder(view) + } + + override fun onBindViewHolder(holder: HomeProductViewHolder, position: Int) { + val product = productList[position] + holder.imgProduct.setImageResource(product.imageResId) + holder.tvName.text = product.name + holder.tvPrice.text = product.price + + holder.itemView.setOnClickListener { + onItemClick(product) + } + } + + override fun getItemCount(): Int = productList.size +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/Product.kt b/app/src/main/java/com/example/nike/ui/theme/Product.kt new file mode 100644 index 0000000..2a7a446 --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/Product.kt @@ -0,0 +1,11 @@ +package com.example.nike.ui.theme + +data class Product( + val imageResId: Int, + val name: String, + val description: String = "", + val colorCount: String = "", + val price: String, + val isBestSeller: Boolean = false, + var isLiked: Boolean = false +) \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/ProductDetailFragment.kt b/app/src/main/java/com/example/nike/ui/theme/ProductDetailFragment.kt new file mode 100644 index 0000000..be559ee --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/ProductDetailFragment.kt @@ -0,0 +1,35 @@ +package com.example.nike.ui.theme + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.fragment.app.Fragment +import com.example.nike.R + +class ProductDetailFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val view = inflater.inflate(R.layout.fragment_product_detail, container, false) + + val detailImage = view.findViewById(R.id.detailImage) + val detailName = view.findViewById(R.id.detailName) + val detailPrice = view.findViewById(R.id.detailPrice) + + val name = arguments?.getString("name") ?: "" + val price = arguments?.getString("price") ?: "" + val imageResId = arguments?.getInt("image") ?: R.drawable.home_banner + + detailImage.setImageResource(imageResId) + detailName.text = name + detailPrice.text = price + + return view + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/ProductDummyData.kt b/app/src/main/java/com/example/nike/ui/theme/ProductDummyData.kt new file mode 100644 index 0000000..7920f1e --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/ProductDummyData.kt @@ -0,0 +1,84 @@ +package com.example.nike.ui.theme + +import com.example.nike.R + +object ProductDummyData { + + fun getHomeProducts(): List { + return listOf( + Product( + imageResId = R.drawable.air_jordan_xxxvi, + name = "Air Jordan XXXVI", + price = "US$185" + ), + Product( + imageResId = R.drawable.nike_air_force, + name = "Nike Air Force 1 '07", + price = "US$115" + ), + Product( + imageResId = R.drawable.air_jordan_xxxvi, + name = "Jordan Essentials", + price = "US$95" + ) + ) + } + + fun getShopProducts(): MutableList { + return mutableListOf( + Product( + imageResId = R.drawable.nike_air_force, + name = "Nike Everyday Plus Cushioned", + description = "Training Ankle Socks (6 Pairs)", + colorCount = "5 Colours", + price = "US$10", + isLiked = false + ), + Product( + imageResId = R.drawable.air_jordan_xxxvi, + name = "Nike Elite Crew", + description = "Basketball Socks", + colorCount = "7 Colours", + price = "US$16", + isLiked = false + ), + Product( + imageResId = R.drawable.nike_air_force, + name = "Nike Air Force 1 '07", + description = "Women's Shoes", + colorCount = "5 Colours", + price = "US$115", + isBestSeller = true, + isLiked = false + ), + Product( + imageResId = R.drawable.air_jordan_xxxvi, + name = "Jordan Essentials", + description = "Men's Shoes", + colorCount = "2 Colours", + price = "US$115", + isBestSeller = true, + isLiked = false + ) + ) + } + + fun getWishlistDummyProducts(): MutableList { + return mutableListOf( + Product( + imageResId = R.drawable.air_jordan_xxxvi, + name = "Air Jordan 1 Mid", + price = "US$125", + isLiked = true + ), + Product( + imageResId = R.drawable.nike_air_force, + name = "Nike Everyday Plus Cushioned", + description = "Training Ankle Socks (6 Pairs)", + colorCount = "5 Colours", + price = "US$10", + isLiked = true + ) + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/ProductGridAdapter.kt b/app/src/main/java/com/example/nike/ui/theme/ProductGridAdapter.kt new file mode 100644 index 0000000..e389e4e --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/ProductGridAdapter.kt @@ -0,0 +1,62 @@ +package com.example.nike.ui.theme + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import com.example.nike.R + +class ProductGridAdapter( + private val productList: MutableList, + private val onItemClick: (Product) -> Unit +) : RecyclerView.Adapter() { + + inner class ProductViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val imgProduct: ImageView = itemView.findViewById(R.id.imgProduct) + val imgLike: ImageView = itemView.findViewById(R.id.imgLike) + val tvBestSeller: TextView = itemView.findViewById(R.id.tvBestSeller) + val tvName: TextView = itemView.findViewById(R.id.tvName) + val tvDescription: TextView = itemView.findViewById(R.id.tvDescription) + val tvColorCount: TextView = itemView.findViewById(R.id.tvColorCount) + val tvPrice: TextView = itemView.findViewById(R.id.tvPrice) + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProductViewHolder { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.item_product_grid, parent, false) + return ProductViewHolder(view) + } + + override fun onBindViewHolder(holder: ProductViewHolder, position: Int) { + val product = productList[position] + + holder.imgProduct.setImageResource(product.imageResId) + holder.tvName.text = product.name + holder.tvDescription.text = product.description + holder.tvColorCount.text = product.colorCount + holder.tvPrice.text = product.price + holder.tvBestSeller.visibility = if (product.isBestSeller) View.VISIBLE else View.GONE + + holder.imgLike.setImageResource( + if (product.isLiked) R.drawable.ic_heart_filled + else R.drawable.ic_heartstraight + ) + + holder.itemView.setOnClickListener { + onItemClick(product) + } + + holder.imgLike.setOnClickListener { + product.isLiked = !product.isLiked + + holder.imgLike.setImageResource( + if (product.isLiked) R.drawable.ic_heart_filled + else R.drawable.ic_heartstraight + ) + } + } + + override fun getItemCount(): Int = productList.size +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/ProfileFragment.kt b/app/src/main/java/com/example/nike/ui/theme/ProfileFragment.kt new file mode 100644 index 0000000..c20ca1b --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/ProfileFragment.kt @@ -0,0 +1,18 @@ +package com.example.nike.ui.theme + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import com.example.nike.R + +class ProfileFragment : Fragment() { + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.fragment_profile, container, false) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/ShopFragment.kt b/app/src/main/java/com/example/nike/ui/theme/ShopFragment.kt new file mode 100644 index 0000000..2f987f8 --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/ShopFragment.kt @@ -0,0 +1,46 @@ +package com.example.nike.ui.theme + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.example.nike.R + +class ShopFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + val view = inflater.inflate(R.layout.fragment_shop, container, false) + + val recyclerView = view.findViewById(R.id.recyclerShopProducts) + recyclerView.layoutManager = GridLayoutManager(requireContext(), 2) + + recyclerView.adapter = ProductGridAdapter(ProductDummyData.getShopProducts()) { product -> + moveToDetail(product) + } + + return view + } + + private fun moveToDetail(product: Product) { + val bundle = Bundle().apply { + putString("name", product.name) + putString("price", product.price) + putInt("image", product.imageResId) + } + + val detailFragment = ProductDetailFragment() + detailFragment.arguments = bundle + + parentFragmentManager.beginTransaction() + .replace(R.id.fragment_container, detailFragment) + .addToBackStack(null) + .commit() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/Theme.kt b/app/src/main/java/com/example/nike/ui/theme/Theme.kt new file mode 100644 index 0000000..93fd686 --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/Theme.kt @@ -0,0 +1,58 @@ +package com.example.nike.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun NikeTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/Type.kt b/app/src/main/java/com/example/nike/ui/theme/Type.kt new file mode 100644 index 0000000..d6427ff --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.example.nike.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/WishListFragment.kt b/app/src/main/java/com/example/nike/ui/theme/WishListFragment.kt new file mode 100644 index 0000000..4739620 --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/WishListFragment.kt @@ -0,0 +1,46 @@ +package com.example.nike.ui.theme + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.example.nike.R + +class WishListFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + val view = inflater.inflate(R.layout.fragment_wish_list, container, false) + + val recyclerView = view.findViewById(R.id.recyclerWishList) + recyclerView.layoutManager = GridLayoutManager(requireContext(), 2) + + recyclerView.adapter = ProductGridAdapter(ProductDummyData.getWishlistDummyProducts()) { product -> + moveToDetail(product) + } + + return view + } + + private fun moveToDetail(product: Product) { + val bundle = Bundle().apply { + putString("name", product.name) + putString("price", product.price) + putInt("image", product.imageResId) + } + + val detailFragment = ProductDetailFragment() + detailFragment.arguments = bundle + + parentFragmentManager.beginTransaction() + .replace(R.id.fragment_container, detailFragment) + .addToBackStack(null) + .commit() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nike/ui/theme/WishlistManager.kt b/app/src/main/java/com/example/nike/ui/theme/WishlistManager.kt new file mode 100644 index 0000000..5ed8a6b --- /dev/null +++ b/app/src/main/java/com/example/nike/ui/theme/WishlistManager.kt @@ -0,0 +1,5 @@ +package com.example.nike.ui.theme + +object WishlistManager { + val wishlist = mutableListOf() +} \ No newline at end of file diff --git a/app/src/main/res/color/bottom_nav_selector.xml b/app/src/main/res/color/bottom_nav_selector.xml new file mode 100644 index 0000000..740c138 --- /dev/null +++ b/app/src/main/res/color/bottom_nav_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/air_jordan_xxxvi.png b/app/src/main/res/drawable/air_jordan_xxxvi.png new file mode 100644 index 0000000..af62947 Binary files /dev/null and b/app/src/main/res/drawable/air_jordan_xxxvi.png differ diff --git a/app/src/main/res/drawable/home_banner.png b/app/src/main/res/drawable/home_banner.png new file mode 100644 index 0000000..49b926f Binary files /dev/null and b/app/src/main/res/drawable/home_banner.png differ diff --git a/app/src/main/res/drawable/ic_bagcircle.xml b/app/src/main/res/drawable/ic_bagcircle.xml new file mode 100644 index 0000000..1af2ce6 --- /dev/null +++ b/app/src/main/res/drawable/ic_bagcircle.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/ic_bagsimple.xml b/app/src/main/res/drawable/ic_bagsimple.xml new file mode 100644 index 0000000..3b6e816 --- /dev/null +++ b/app/src/main/res/drawable/ic_bagsimple.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_heart_filled.xml b/app/src/main/res/drawable/ic_heart_filled.xml new file mode 100644 index 0000000..9d7cc1b --- /dev/null +++ b/app/src/main/res/drawable/ic_heart_filled.xml @@ -0,0 +1,13 @@ + + + diff --git a/app/src/main/res/drawable/ic_heartstraight.xml b/app/src/main/res/drawable/ic_heartstraight.xml new file mode 100644 index 0000000..6597a4a --- /dev/null +++ b/app/src/main/res/drawable/ic_heartstraight.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_housesimple.xml b/app/src/main/res/drawable/ic_housesimple.xml new file mode 100644 index 0000000..a0d86b9 --- /dev/null +++ b/app/src/main/res/drawable/ic_housesimple.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..701ef27 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_listmagnifyingglass.xml b/app/src/main/res/drawable/ic_listmagnifyingglass.xml new file mode 100644 index 0000000..483d117 --- /dev/null +++ b/app/src/main/res/drawable/ic_listmagnifyingglass.xml @@ -0,0 +1,38 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_user.xml b/app/src/main/res/drawable/ic_user.xml new file mode 100644 index 0000000..1fc97b8 --- /dev/null +++ b/app/src/main/res/drawable/ic_user.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/app/src/main/res/drawable/nike_air_force.png b/app/src/main/res/drawable/nike_air_force.png new file mode 100644 index 0000000..3bf50b1 Binary files /dev/null and b/app/src/main/res/drawable/nike_air_force.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..7868a03 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,29 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_cart.xml b/app/src/main/res/layout/fragment_cart.xml new file mode 100644 index 0000000..6b13357 --- /dev/null +++ b/app/src/main/res/layout/fragment_cart.xml @@ -0,0 +1,52 @@ + + + + + + + + + + +