diff --git a/.gradle/config.properties b/.gradle/config.properties
new file mode 100644
index 0000000..76e9d26
--- /dev/null
+++ b/.gradle/config.properties
@@ -0,0 +1,2 @@
+#Tue Nov 26 00:44:34 KST 2024
+java.home=C\:\\Program Files\\Android\\Android Studio1\\jbr
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..99b49d3
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+assignment02
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..8958210
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
+
+ @style/Theme.Assignment02
+
+
+
+
+ @style/Theme.Assignment02
+
+
+
+
+ @style/Theme.Assignment02
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "keyToString": {
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.cidr.known.project.marker": "true",
+ "cf.first.check.clang-format": "false",
+ "cidr.known.project.marker": "true",
+ "com.google.services.firebase.aqiPopupShown": "true",
+ "last_directory_selection": "C:/Users/Public/assignment02/app/src/main/java",
+ "last_opened_file_path": "C:/Users/Public/assignment02",
+ "project.structure.last.edited": "Modules",
+ "project.structure.proportion": "0.17",
+ "project.structure.side.proportion": "0.20431472",
+ "settings.editor.selected.configurable": "project.propVCSSupport.Mappings"
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1731406527910
+
+
+ 1731406527910
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 166076e..6856133 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -5,7 +5,7 @@ plugins {
android {
namespace = "com.example.assignment02"
- compileSdk = 34
+ compileSdk = 35
defaultConfig {
applicationId = "com.example.assignment02"
@@ -36,11 +36,15 @@ android {
}
dependencies {
- implementation("androidx.activity:activity-ktx:1.7.0")
- implementation("androidx.core:core-ktx:1.13.1")
+ implementation("com.google.code.gson:gson:2.8.8")
+ implementation("androidx.viewpager2:viewpager2:1.0.0")
+ implementation("androidx.fragment:fragment-ktx:1.3.5")
+ implementation("com.google.android.material:material:1.10.0")
+ implementation("androidx.core:core-ktx:1.15.0")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("com.google.android.material:material:1.12.0")
- implementation("androidx.constraintlayout:constraintlayout:2.1.4")
+ implementation("androidx.constraintlayout:constraintlayout:2.2.0")
+ implementation("androidx.recyclerview:recyclerview:1.4.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c9ef4a9..57c5bc4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,6 +2,10 @@
+
+
+
+
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/assignment02/MainActivity.kt b/app/src/main/java/com/example/assignment02/MainActivity.kt
deleted file mode 100644
index acbfa04..0000000
--- a/app/src/main/java/com/example/assignment02/MainActivity.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.example.assignment02
-
-import android.app.Activity
-import android.content.Intent
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import android.widget.TextView
-import android.widget.Toast
-import androidx.activity.result.contract.ActivityResultContracts
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
- val number_text: TextView = findViewById(R.id.number_text)
- val count_btn: TextView = findViewById(R.id.count_btn)
- val toast_btn: TextView = findViewById(R.id.toast_btn)
- val random_btn: TextView = findViewById(R.id.random_btn)
- val intent = Intent(this, RandomActivity::class.java)
-
- val resultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
- if (result.resultCode == Activity.RESULT_OK) {
- number_text.text = result.data?.getIntExtra("random_number", 0).toString()
- Toast.makeText(this, "OK", Toast.LENGTH_SHORT).show()
- }
- else {
- Toast.makeText(this, "오류", Toast.LENGTH_SHORT).show()
- }
- }
-
- count_btn.setOnClickListener {
- number_text.text = (number_text.text.toString().toInt()+1).toString()
- }
- toast_btn.setOnClickListener {
- Toast.makeText(this, "숫자 : "+number_text.text, Toast.LENGTH_LONG).show()
- }
- random_btn.setOnClickListener {
- intent.putExtra("number", number_text.text.toString().toInt())
- resultLauncher.launch(intent)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/assignment02/RandomActivity.kt b/app/src/main/java/com/example/assignment02/RandomActivity.kt
deleted file mode 100644
index 22307a7..0000000
--- a/app/src/main/java/com/example/assignment02/RandomActivity.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.example.assignment02
-
-import android.content.Intent
-import android.os.Bundle
-import android.widget.TextView
-import androidx.appcompat.app.AppCompatActivity
-import kotlin.random.Random
-
-class RandomActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_random)
- val number_text: TextView = findViewById(R.id.number_text)
- val number = intent.getIntExtra("number", 1)
- val resultIntent = Intent()
-
- if (number > 0){
- val random_number = Random.nextInt(0, number) // 0부터 99까지의 랜덤 값
- number_text.text = random_number.toString()
- resultIntent.putExtra("random_number", random_number)
- setResult(RESULT_OK, resultIntent)
- } else {
- number_text.text = number.toString()
- resultIntent.putExtra("random_number", number)
- setResult(RESULT_OK, resultIntent)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/assignment02/data/model/Word.kt b/app/src/main/java/com/example/assignment02/data/model/Word.kt
new file mode 100644
index 0000000..f85f36e
--- /dev/null
+++ b/app/src/main/java/com/example/assignment02/data/model/Word.kt
@@ -0,0 +1,6 @@
+package com.example.assignment02.data.model
+
+data class Word(
+ val word: String,
+ val definition: String
+)
diff --git a/app/src/main/java/com/example/assignment02/data/repository/WordDatabase.kt b/app/src/main/java/com/example/assignment02/data/repository/WordDatabase.kt
new file mode 100644
index 0000000..e876c67
--- /dev/null
+++ b/app/src/main/java/com/example/assignment02/data/repository/WordDatabase.kt
@@ -0,0 +1,23 @@
+package com.example.assignment02.data.repository
+
+import android.content.Context
+import com.example.assignment02.data.model.Word
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+
+class WordDatabase(context: Context) {
+
+ private val sharedPreferences = context.getSharedPreferences("word_db", Context.MODE_PRIVATE)
+ private val gson = Gson()
+
+ fun saveWords(wordList: List) {
+ val json = gson.toJson(wordList)
+ sharedPreferences.edit().putString("word_list", json).apply()
+ }
+
+ fun getWords(): List {
+ val json = sharedPreferences.getString("word_list", "[]") ?: "[]"
+ val type = object : TypeToken>() {}.type
+ return gson.fromJson(json, type)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/assignment02/ui/addword/AddWordActivity.kt b/app/src/main/java/com/example/assignment02/ui/addword/AddWordActivity.kt
new file mode 100644
index 0000000..6b50b43
--- /dev/null
+++ b/app/src/main/java/com/example/assignment02/ui/addword/AddWordActivity.kt
@@ -0,0 +1,43 @@
+package com.example.assignment02.ui.addword
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.widget.Button
+import android.widget.EditText
+import androidx.appcompat.app.AppCompatActivity
+import com.example.assignment02.R
+
+class AddWordActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_addword)
+
+ val wordText = findViewById(R.id.wordText)
+ val definitionText = findViewById(R.id.definitionText)
+ val button = findViewById