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 .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
1 change: 1 addition & 0 deletions .idea/.name

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

6 changes: 6 additions & 0 deletions .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 .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 .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 .idea/deviceManager.xml

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

19 changes: 19 additions & 0 deletions .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 .idea/migrations.xml

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

6 changes: 6 additions & 0 deletions .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 .idea/runConfigurations.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

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

android {
namespace = "com.example.umc"
compileSdk = 34 // 안정 버전

defaultConfig {
applicationId = "com.example.umc"
minSdk = 24
targetSdk = 34
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
}
kotlinOptions {
jvmTarget = "11"
}

buildFeatures {
viewBinding = true //ViewBinding 활성화
}
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.appcompat)
implementation(libs.constraintlayout)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.ktx)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
21 changes: 21 additions & 0 deletions 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.umc

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.umc", appContext.packageName)
}
}
39 changes: 39 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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.UMC9thAndroid" >

<!-- EmotionActivity를 Launcher로 등록 -> 맨 처음 나오는 화면 -->
<activity
android:name=".ui.EmotionActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.UMC9thAndroid" >

<!-- 이 액티비티가 앱의 시작점이라는 의미 (아이콘을 눌렀을 때 실행) -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<!-- MainActivity는 이제 일반 액티비티, 처음 실행 할때는 열리지 않게 -->
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.UMC9thAndroid" />
</application>

</manifest>
61 changes: 61 additions & 0 deletions app/src/main/java/com/example/umc/EmotionActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.example.umc.ui

import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.example.umc.R
import com.example.umc.databinding.ActivityEmotionBinding

class EmotionActivity : AppCompatActivity() {
// 뷰 바인딩 변수 선언 (activity_emotion.xml이랑 연결해주는 역할을 수행
private lateinit var binding: ActivityEmotionBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// 바인딩 초기화 후 레이아웃 붙이기
binding = ActivityEmotionBinding.inflate(layoutInflater)
setContentView(binding.root)

// 감정 이미지들에 클릭 이벤트 연결 (1주차 워크북)
setEmotionClickListeners()
}

// 각 감정 우표 이미지 클릭 이벤트 실행 함수
private fun setEmotionClickListeners() {
// 행복 -> Toast 메시지 출력, 텍스트 색상 변경
binding.ivHappy.setOnClickListener {
showEmotion(R.string.toast_happy, binding.tvHappy, R.color.happyColor)
}

// 들뜸 -> Toast 메시지 출력, 텍스트 색상 변경
binding.ivExcited.setOnClickListener {
showEmotion(R.string.toast_excited, binding.tvExcited, R.color.excitedColor)
}

// 보통 -> Toast 메시지 출력, 텍스트 색상 변경
binding.ivNormal.setOnClickListener {
showEmotion(R.string.toast_normal, binding.tvNormal, R.color.normalColor)
}

// 불안 -> Toast 메시지 출력, 텍스트 색상 변경
binding.ivAnxious.setOnClickListener {
showEmotion(R.string.toast_anxious, binding.tvAnxious, R.color.anxiousColor)
}

// 속상 -> Toast 메시지 출력, 텍스트 색상 변경
binding.ivSad.setOnClickListener {
showEmotion(R.string.toast_sad, binding.tvSad, R.color.sadColor)
}
}

// 감정 선택 시 공통 실행 함수
// 위에 클릭 이벤트 작동 시 함수 적용
private fun showEmotion(messageRes: Int, textView: android.widget.TextView, colorRes: Int) {
// 메시지 보여주기
Toast.makeText(this, getString(messageRes), Toast.LENGTH_SHORT).show()
// 텍스트 색상 변경 (ContextCompat 함수는 구글링에서 찾은 함수, 색상 리소스를 가져오도록 도와줌)
textView.setTextColor(ContextCompat.getColor(this, colorRes))
}
}
19 changes: 19 additions & 0 deletions app/src/main/java/com/example/umc/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.example.umc

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.umc.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

binding.tvMain.text = "Welcome UMC_9th!!"
}
}
32 changes: 32 additions & 0 deletions app/src/main/res/drawable/ic_angry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="45dp"
android:viewportWidth="40"
android:viewportHeight="45">
<path
android:pathData="M13.264,3.543L13.487,3.639L13.708,3.536L20.001,0.599L26.403,3.537L26.629,3.641L26.854,3.539L33.366,0.597L39.456,3.391V40.741L33.467,43.535L26.517,40.587L26.29,40.49L26.068,40.598L19.992,43.53L13.484,40.592L13.261,40.49L13.037,40.592L6.525,43.531L0.544,40.741V3.387L6.424,0.596L13.264,3.543Z"
android:strokeWidth="1.08696"
android:fillColor="#F6F6F6"
android:strokeColor="#000000"/>
<path
android:pathData="M4.239,6.413h31.304v31.522h-31.304z"
android:strokeWidth="1.08696"
android:fillColor="#EB8B8B"
android:strokeColor="#000000"/>
<path
android:pathData="M27.319,14.562C27.319,15.524 26.638,16.304 25.798,16.304C24.957,16.304 24.276,15.524 24.276,14.562C24.276,14.291 25.109,14.357 25.801,14.152C26.545,13.931 27.319,13.6 27.319,14.562Z"
android:fillColor="#000000"/>
<path
android:pathData="M14.493,14.562C14.493,15.524 15.175,16.304 16.015,16.304C16.855,16.304 17.537,15.524 17.537,14.562C17.537,14.291 16.704,14.357 16.012,14.152C15.267,13.931 14.493,13.6 14.493,14.562Z"
android:fillColor="#000000"/>
<path
android:pathData="M20.472,20.544m-2.826,0a2.826,2.826 0,1 1,5.652 0a2.826,2.826 0,1 1,-5.652 0"
android:strokeWidth="1.08696"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M28.829,30.431C28.829,30.431 23.923,26.038 20.147,25.664C16.347,25.289 10.652,28.682 10.652,28.682"
android:strokeWidth="1.08696"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
</vector>
Loading