diff --git a/UMC_6th/app/src/main/java/com/example/umc_6th/MemoActivity.kt b/UMC_6th/app/src/main/java/com/example/umc_6th/MemoActivity.kt new file mode 100644 index 0000000..17029d7 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/umc_6th/MemoActivity.kt @@ -0,0 +1,47 @@ +package com.example.umc_6th + +import android.content.Intent +import android.os.Bundle +import android.util.Log +import androidx.appcompat.app.AppCompatActivity +import com.example.umc_6th.databinding.ActivityMemoBinding + +class MemoActivity : AppCompatActivity() { + + lateinit var binding : ActivityMemoBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityMemoBinding.inflate(layoutInflater) + setContentView(binding.root) + + binding.nextBtn.setOnClickListener { + val intent = Intent(this, MemoCheckActivity::class.java) + val memoTxt = binding.memoEt.text.toString() + intent.putExtra("memo", memoTxt) + startActivity(intent) + } + } + + override fun onPause() { + super.onPause() + val sharedPreferences = getSharedPreferences("memo", MODE_PRIVATE) + val editor = sharedPreferences.edit() + val tempMemo = binding.memoEt.text.toString() + if(tempMemo.isNotEmpty()) { + editor.putString("tempMemo", tempMemo) + Log.d("tempMemo", tempMemo) + editor.apply() + } + } + + override fun onResume() { + super.onResume() + val sharedPreferences = getSharedPreferences("memo", MODE_PRIVATE) + val tempMemo = sharedPreferences.getString("tempMemo", null) + + if(tempMemo != null) { + binding.memoEt.setText(tempMemo) + } + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/java/com/example/umc_6th/MemoCheckActivity.kt b/UMC_6th/app/src/main/java/com/example/umc_6th/MemoCheckActivity.kt new file mode 100644 index 0000000..18e7a74 --- /dev/null +++ b/UMC_6th/app/src/main/java/com/example/umc_6th/MemoCheckActivity.kt @@ -0,0 +1,21 @@ +package com.example.umc_6th + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import com.example.umc_6th.databinding.ActivityMemoCheckBinding + +class MemoCheckActivity : AppCompatActivity() { + + lateinit var binding : ActivityMemoCheckBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + binding = ActivityMemoCheckBinding.inflate(layoutInflater) + setContentView(binding.root) + + if(intent.hasExtra("memo")) { + binding.memoCheckText.text = intent.getStringExtra("memo")!! + } + } +} \ No newline at end of file diff --git a/UMC_6th/app/src/main/res/drawable/memo.png b/UMC_6th/app/src/main/res/drawable/memo.png new file mode 100644 index 0000000..2ceb091 Binary files /dev/null and b/UMC_6th/app/src/main/res/drawable/memo.png differ diff --git a/UMC_6th/app/src/main/res/layout/activity_memo.xml b/UMC_6th/app/src/main/res/layout/activity_memo.xml new file mode 100644 index 0000000..f052256 --- /dev/null +++ b/UMC_6th/app/src/main/res/layout/activity_memo.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + +