-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
418 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
presentation/src/main/java/com/going/presentation/todo/mytodo/detail/MyTodoDetailActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.going.presentation.todo.mytodo.detail | ||
|
||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import com.going.presentation.R | ||
import com.going.presentation.databinding.ActivityMyTodoDetailBinding | ||
import com.going.ui.base.BaseActivity | ||
import com.going.ui.extension.setOnSingleClickListener | ||
import com.going.ui.extension.toast | ||
|
||
class MyTodoDetailActivity : | ||
BaseActivity<ActivityMyTodoDetailBinding>(R.layout.activity_my_todo_detail) { | ||
|
||
private val viewModel by viewModels<MyTodoDetailViewModel>() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
initViewModel() | ||
initBackBtnClickListener() | ||
initDeleteBtnClickListener() | ||
initModBtnClickListener() | ||
setDetailData() | ||
} | ||
|
||
private fun initViewModel() { | ||
binding.vm = viewModel | ||
} | ||
|
||
private fun initBackBtnClickListener() { | ||
binding.btnMyTodoDetailBack.setOnSingleClickListener { | ||
finish() | ||
} | ||
} | ||
|
||
private fun initDeleteBtnClickListener() { | ||
binding.btnMyTodoDetailDelete.setOnSingleClickListener { | ||
// 삭제 서버 통신 | ||
finish() | ||
} | ||
} | ||
|
||
private fun initModBtnClickListener() { | ||
binding.btnMyTodoDetailMod.setOnSingleClickListener { | ||
toast(getString(R.string.will_be_update)) | ||
} | ||
} | ||
|
||
private fun setDetailData() { | ||
intent.getLongExtra(EXTRA_TODO_ID,0) | ||
// 추후 todoId를 보내서 받는 서버통신으로 변경 | ||
viewModel.todo.value = "맛있는 밥 먹기" | ||
viewModel.endDate.value = "2024.1.10" | ||
viewModel.memo.value = "오늘 완전 완전 맛있는 파스타를 먹었는데 완전 아주 그냥 이게 말이지" | ||
} | ||
|
||
companion object { | ||
const val EXTRA_TODO_ID = "EXTRA_TODO_ID" | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...entation/src/main/java/com/going/presentation/todo/mytodo/detail/MyTodoDetailViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.going.presentation.todo.mytodo.detail | ||
|
||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class MyTodoDetailViewModel : ViewModel() { | ||
|
||
val todo = MutableLiveData("") | ||
val nowTodoLength = MutableLiveData(0) | ||
|
||
val endDate = MutableLiveData("") | ||
|
||
val memo = MutableLiveData("") | ||
val nowMemoLength = MutableLiveData(0) | ||
|
||
companion object { | ||
const val MAX_TODO_LEN = 15 | ||
const val MAX_MEMO_LEN = 1000 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.