Skip to content

Commit

Permalink
[maro/#23] feat :: 5주차 구현 완료 But Memo 실행 안 됨 이슈 발생
Browse files Browse the repository at this point in the history
  • Loading branch information
leesumin0526 committed May 12, 2024
1 parent 6423da1 commit 3ca4a0f
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 0 deletions.
47 changes: 47 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/MemoActivity.kt
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
21 changes: 21 additions & 0 deletions UMC_6th/app/src/main/java/com/example/umc_6th/MemoCheckActivity.kt
Original file line number Diff line number Diff line change
@@ -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")!!
}
}
}
Binary file added UMC_6th/app/src/main/res/drawable/memo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions UMC_6th/app/src/main/res/layout/activity_memo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MemoActivity">

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:text="My Memo"
android:textSize="30sp"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<View
android:layout_width="370dp"
android:layout_height="2px"
app:layout_constraintBottom_toTopOf="@+id/textInputLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
tools:ignore="MissingConstraints" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="100dp"
app:counterEnabled="true"
app:counterMaxLength="200"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/memo_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="italic"
android:hint="Enter a note" />

</com.google.android.material.textfield.TextInputLayout>

<Button
android:id="@+id/next_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginBottom="20dp"
android:text="Completed"
android:textSize="25sp"
android:textStyle="italic"
android:fontFamily="sans-serif-light"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
32 changes: 32 additions & 0 deletions UMC_6th/app/src/main/res/layout/activity_memo_check.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MemoCheckActivity">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:text="My Memo Check"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/memo_check_text"
android:text="memo text"
android:gravity="center"
android:textSize="30sp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
76 changes: 76 additions & 0 deletions UMC_6th/app/src/main/res/layout/dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/dialog_question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="10dp"
android:text="기존에 작성 중이던\n메모가 있습니다."
android:textSize="25sp"
android:textStyle="bold"
android:textColor="#000000"
android:gravity="center"
android:background="@android:color/transparent"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="10dp"
android:text="복원하시겠습니까?"
android:textSize="20sp"
android:textColor="#000000"
android:gravity="center"
android:background="@android:color/transparent"/>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<Button
android:id="@+id/yes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:text="Yes"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="30dp"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="No"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

</LinearLayout>
Binary file added UMC_6th/app/src/main/res/raw/music_lilac.mp3
Binary file not shown.

0 comments on commit 3ca4a0f

Please sign in to comment.