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
15 changes: 15 additions & 0 deletions caddy/week2/Practice_Nike/.gitignore
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions caddy/week2/Practice_Nike/.idea/AndroidProjectSystem.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions caddy/week2/Practice_Nike/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions caddy/week2/Practice_Nike/.idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions caddy/week2/Practice_Nike/.idea/deviceManager.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions caddy/week2/Practice_Nike/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions caddy/week2/Practice_Nike/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions caddy/week2/Practice_Nike/.idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions caddy/week2/Practice_Nike/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
47 changes: 47 additions & 0 deletions caddy/week2/Practice_Nike/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
alias(libs.plugins.android.application)
}

android {
namespace = "com.example.practice_nike"
compileSdk {
version = release(36) {
minorApiLevel = 1
}
}

defaultConfig {
applicationId = "com.example.practice_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
}
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
21 changes: 21 additions & 0 deletions caddy/week2/Practice_Nike/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.practice_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.practice_nike", appContext.packageName)
}
}
25 changes: 25 additions & 0 deletions caddy/week2/Practice_Nike/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Practice_Nike">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.example.practice_nike

import android.os.Bundle
import android.view.View
import android.widget.Button
import androidx.fragment.app.Fragment

class CartFragment : Fragment(R.layout.fragment_cart) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val btnOrder = view.findViewById<Button>(R.id.btn_order)
btnOrder.setOnClickListener {
// MainActivity๋กœ ํ˜•๋ณ€ํ™˜ ํ›„ ๋„ค๋น„๊ฒŒ์ด์…˜ ์ด๋™ ํ•จ์ˆ˜ ํ˜ธ์ถœ
val mainActivity = activity as? MainActivity
mainActivity?.navigateToPurchaseTab()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.practice_nike

import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment

class HomeFragment : Fragment(R.layout.fragment_home)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.example.practice_nike

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.Fragment
import com.google.android.material.bottomnavigation.BottomNavigationView

class MainActivity : AppCompatActivity() {

private lateinit var bottomNav: BottomNavigationView

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// activity_main.xml (FrameLayout๊ณผ BottomNavigationView๊ฐ€ ์žˆ๋Š” ๋ ˆ์ด์•„์›ƒ) ์—ฐ๊ฒฐ
setContentView(R.layout.activity_main)

bottomNav = findViewById(R.id.bottom_nav)

// ์•ฑ์ด ์ฒ˜์Œ ์ผœ์กŒ์„ ๋•Œ ๊ธฐ๋ณธ์œผ๋กœ ๋ณด์—ฌ์ค„ ํ™”๋ฉด(ํ™ˆ) ์„ค์ •
replaceFragment(HomeFragment())

// ํ•˜๋‹จ ํƒญ ํด๋ฆญ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ
bottomNav.setOnItemSelectedListener { item ->
when (item.itemId) {
R.id.nav_home -> replaceFragment(HomeFragment())
R.id.nav_purchase -> replaceFragment(PurchaseFragment())
R.id.nav_wishlist -> replaceFragment(WishlistFragment())
R.id.nav_cart -> replaceFragment(CartFragment())
R.id.nav_profile -> replaceFragment(ProfileFragment())
}
true
}
}

// ์„ ํƒ๋œ ํ”„๋ž˜๊ทธ๋จผํŠธ๋กœ ํ™”๋ฉด์„ ๊ต์ฒดํ•˜๋Š” ํ•จ์ˆ˜
private fun replaceFragment(fragment: Fragment) {
supportFragmentManager.beginTransaction()
.replace(R.id.main_container, fragment)
.commit()
}

// ์žฅ๋ฐ”๊ตฌ๋‹ˆ ํ”„๋ž˜๊ทธ๋จผํŠธ์—์„œ '์ฃผ๋ฌธํ•˜๊ธฐ' ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ํ˜ธ์ถœ๋  ํ•จ์ˆ˜
fun navigateToPurchaseTab() {
bottomNav.selectedItemId = R.id.nav_purchase
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.practice_nike

import androidx.fragment.app.Fragment

class ProfileFragment : Fragment(R.layout.fragment_profile)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.practice_nike

import androidx.fragment.app.Fragment

class PurchaseFragment : Fragment(R.layout.fragment_purchase)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.practice_nike

import androidx.fragment.app.Fragment

class WishlistFragment : Fragment(R.layout.fragment_wishlist)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="60dp"
android:height="60dp"
android:viewportWidth="60"
android:viewportHeight="60">
<group>
<clip-path
android:pathData="M0,0h60v60h-60z"/>
<path
android:pathData="M30,30m-29,0a29,29 0,1 1,58 0a29,29 0,1 1,-58 0"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M22.5,20C22.5,18.619 23.619,17.5 25,17.5H32.5C33.881,17.5 35,18.619 35,20V20C35,21.381 33.881,22.5 32.5,22.5H22.5V20Z"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M37.188,22.5H40V40C40,41.381 38.881,42.5 37.5,42.5H20C18.619,42.5 17.5,41.381 17.5,40V22.5H30.156"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#000000"
android:strokeLineCap="round"/>
</group>
</vector>
21 changes: 21 additions & 0 deletions caddy/week2/Practice_Nike/app/src/main/res/drawable/ic_cart.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M7.647,4.5C7.647,3.119 8.766,2 10.147,2H14.618C15.901,2 16.941,3.04 16.941,4.324V4.324C16.941,5.607 15.901,6.647 14.618,6.647H7.647V4.5Z"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#767676"/>
<path
android:pathData="M19.264,6.647H21.588V19.25C21.588,20.631 20.469,21.75 19.088,21.75H5.5C4.119,21.75 3,20.631 3,19.25V6.647H13.456"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#767676"
android:strokeLineCap="round"/>
</group>
</vector>
Loading