diff --git a/android/app/build.gradle b/android/app/build.gradle index 83e4f8bc4..a2faf8d93 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -40,7 +40,7 @@ dependencies { implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.google.code.gson:gson:2.8.9' - + implementation 'androidx.fragment:fragment-ktx:1.4.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0' implementation 'joda-time:joda-time:2.10.10' implementation 'androidx.core:core-ktx:1.7.0' diff --git a/android/app/src/main/java/com/example/todo/model/ActionLog.kt b/android/app/src/main/java/com/example/todo/model/ActionLog.kt index 4c59c8902..02057decc 100644 --- a/android/app/src/main/java/com/example/todo/model/ActionLog.kt +++ b/android/app/src/main/java/com/example/todo/model/ActionLog.kt @@ -1,30 +1,11 @@ package com.example.todo.model -import com.example.todo.common.ActionType -import com.example.todo.common.ProgressType data class ActionLog( val title: String, val actionType: ActionType, val time: String, val nowProgressType: ProgressType, - val prevProgressType: ProgressType + val prevProgressType: ProgressType? ) { - -// override fun toString(): String { -// return when (actionType) { -// ActionType.ADD -> { -// "${nowProgressType.value}에 ${title}을 ${actionType.value}합니다" -// } -// ActionType.REMOVE -> { -// "${nowProgressType.value}에서 ${title}을 ${actionType.value}합니다" -// } -// ActionType.MOVE -> { -// "${title}을 ${prevProgressType?.value}에서 ${nowProgressType.value}로 ${actionType.value}합니다" -// } -// ActionType.UPDATE -> { -// "${title}을 ${actionType.value}합니다" -// } -// } -// } } diff --git a/android/app/src/main/java/com/example/todo/common/Common.kt b/android/app/src/main/java/com/example/todo/model/ActionType.kt similarity index 54% rename from android/app/src/main/java/com/example/todo/common/Common.kt rename to android/app/src/main/java/com/example/todo/model/ActionType.kt index 08684aa14..40c9c0bc6 100644 --- a/android/app/src/main/java/com/example/todo/common/Common.kt +++ b/android/app/src/main/java/com/example/todo/model/ActionType.kt @@ -1,11 +1,7 @@ -package com.example.todo.common +package com.example.todo.model import com.example.todo.R -enum class ProgressType(val value: Int) { - TO_DO(R.string.progress_todo), IN_PROGRESS(R.string.progress_ing), DONE(R.string.progress_done) -} - enum class ActionType(val value: Int) { ADD(R.string.action_add), REMOVE((R.string.action_remove)), MOVE((R.string.action_move)), UPDATE( R.string.action_update diff --git a/android/app/src/main/java/com/example/todo/model/ProgressType.kt b/android/app/src/main/java/com/example/todo/model/ProgressType.kt new file mode 100644 index 000000000..c0d5aa210 --- /dev/null +++ b/android/app/src/main/java/com/example/todo/model/ProgressType.kt @@ -0,0 +1,7 @@ +package com.example.todo.model + +import com.example.todo.R + +enum class ProgressType(val value: Int) { + TO_DO(R.string.progress_todo), IN_PROGRESS(R.string.progress_ing), DONE(R.string.progress_done) +} diff --git a/android/app/src/main/java/com/example/todo/model/TodoItem.kt b/android/app/src/main/java/com/example/todo/model/TodoItem.kt index 97bd1fc66..6a09d5603 100644 --- a/android/app/src/main/java/com/example/todo/model/TodoItem.kt +++ b/android/app/src/main/java/com/example/todo/model/TodoItem.kt @@ -1,8 +1,14 @@ package com.example.todo.model -import com.example.todo.common.ProgressType - -data class TodoItem(var itemId: String, val title: String, val content: String, val type: ProgressType) +data class TodoItem( + var title: String, + var content: String, + var type: ProgressType, + var itemId: Int? = null, + var next: Int? = null +) { + +} diff --git a/android/app/src/main/java/com/example/todo/network/ActionLogResponse.kt b/android/app/src/main/java/com/example/todo/network/ActionLogResponse.kt index 0447de955..4896f4a1f 100644 --- a/android/app/src/main/java/com/example/todo/network/ActionLogResponse.kt +++ b/android/app/src/main/java/com/example/todo/network/ActionLogResponse.kt @@ -1,14 +1,13 @@ package com.example.todo.network -data class JsonActionLog( - val historyId: Int, +class ActionLogResponse : ArrayList() + +data class ActionLogResponseItem( val actionType: String, val cardTitle: String, - val pastLocation: String, + val historyDateTime: String, + val historyId: Int, val nowLocation: String, - val historyDate: String + val pastLocation: String? ) -data class ActionLogResponse( - val histories: List -) diff --git a/android/app/src/main/java/com/example/todo/network/AddPostBody.kt b/android/app/src/main/java/com/example/todo/network/AddPostBody.kt new file mode 100644 index 000000000..e033a4cf1 --- /dev/null +++ b/android/app/src/main/java/com/example/todo/network/AddPostBody.kt @@ -0,0 +1,8 @@ +package com.example.todo.network + +data class AddPostBody( + val title: String, + val content: String, + val currentLocation: String, + val writer: String +) \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/network/JsonTodo.kt b/android/app/src/main/java/com/example/todo/network/JsonTodo.kt index 68ccc2581..74332106b 100644 --- a/android/app/src/main/java/com/example/todo/network/JsonTodo.kt +++ b/android/app/src/main/java/com/example/todo/network/JsonTodo.kt @@ -1,6 +1,5 @@ package com.example.todo.network -import android.icu.text.CaseMap import com.google.gson.annotations.SerializedName data class JsonTodo( diff --git a/android/app/src/main/java/com/example/todo/network/RetrofitClient.kt b/android/app/src/main/java/com/example/todo/network/RetrofitClient.kt index da4cffff2..1517a9db1 100644 --- a/android/app/src/main/java/com/example/todo/network/RetrofitClient.kt +++ b/android/app/src/main/java/com/example/todo/network/RetrofitClient.kt @@ -1,19 +1,27 @@ package com.example.todo.network +import retrofit2.Response import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory -import retrofit2.http.GET +import retrofit2.http.* interface RetrofitClient { + @POST("card") + suspend fun getCardIdx( + @Body post: AddPostBody + ): Response + @GET("cards") - suspend fun getTodos(): List + suspend fun getTodos(): Response @GET("histories") - suspend fun getActionLog(): ActionLogResponse + suspend fun getActionLog(): Response - companion object { - private const val baseUrl = "http://52.78.46.69/" + @DELETE("card/{card_id}") + suspend fun removeTodo(@Path("card_id") cardId: Int): Response + companion object { + private const val baseUrl = "http://3.37.194.187:8080/" fun create(): RetrofitClient { return Retrofit.Builder().baseUrl(baseUrl) .addConverterFactory(GsonConverterFactory.create()) diff --git a/android/app/src/main/java/com/example/todo/network/TodoResponse.kt b/android/app/src/main/java/com/example/todo/network/TodoResponse.kt new file mode 100644 index 000000000..884bfbbda --- /dev/null +++ b/android/app/src/main/java/com/example/todo/network/TodoResponse.kt @@ -0,0 +1,36 @@ +package com.example.todo.network + +import com.google.gson.annotations.SerializedName + +// Insert +data class CardIndex( + val cardId: Int +) + +data class TodoResponse( + val cardsClassifiedByLocation: CardsClassifiedByLocation +) + +abstract class TodoResponseItem( + open val content: String, + open val id: Int, + open val nextId: Int, + open val title: String, + open val uploadDateTime: String, + open val writer: String +) + +data class Todo( + val content: String, + val id: Int, + val nextId: Int, + val title: String, + val uploadDateTime: String, + val writer: String +) + +data class CardsClassifiedByLocation( + val todo: List, + val ing: List, + val done: List +) \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/respository/ActionLogDataSource.kt b/android/app/src/main/java/com/example/todo/respository/ActionLogDataSource.kt index 0a74de4dc..2d73d270b 100644 --- a/android/app/src/main/java/com/example/todo/respository/ActionLogDataSource.kt +++ b/android/app/src/main/java/com/example/todo/respository/ActionLogDataSource.kt @@ -1,8 +1,9 @@ package com.example.todo.respository -import com.example.todo.model.ActionLog -import com.example.todo.network.JsonActionLog +import com.example.todo.network.ActionLogResponse +import com.example.todo.network.ActionLogResponseItem +import retrofit2.Response interface ActionLogDataSource { - suspend fun getActionLogs(): List + suspend fun getActionLogs(): Response } \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/respository/ActionLogRemoteDataSource.kt b/android/app/src/main/java/com/example/todo/respository/ActionLogRemoteDataSource.kt index 82a48a042..65f02d6ff 100644 --- a/android/app/src/main/java/com/example/todo/respository/ActionLogRemoteDataSource.kt +++ b/android/app/src/main/java/com/example/todo/respository/ActionLogRemoteDataSource.kt @@ -1,18 +1,14 @@ package com.example.todo.respository -import android.content.Context -import android.util.Log -import com.example.todo.R -import com.example.todo.common.ActionType -import com.example.todo.common.ProgressType -import com.example.todo.model.ActionLog -import com.example.todo.network.JsonActionLog +import com.example.todo.network.ActionLogResponse +import com.example.todo.network.ActionLogResponseItem import com.example.todo.network.RetrofitClient +import retrofit2.Response class ActionLogRemoteDataSource( private val retrofitClient: RetrofitClient, ) : ActionLogDataSource { - override suspend fun getActionLogs(): List { - return retrofitClient.getActionLog().histories + override suspend fun getActionLogs(): Response { + return retrofitClient.getActionLog() } } \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/respository/ActionLogRepository.kt b/android/app/src/main/java/com/example/todo/respository/ActionLogRepository.kt index 59d5e053e..2fea7a7d0 100644 --- a/android/app/src/main/java/com/example/todo/respository/ActionLogRepository.kt +++ b/android/app/src/main/java/com/example/todo/respository/ActionLogRepository.kt @@ -2,35 +2,41 @@ package com.example.todo.respository import android.content.Context import com.example.todo.R -import com.example.todo.common.ActionType -import com.example.todo.common.ProgressType import com.example.todo.model.ActionLog -import com.example.todo.network.JsonActionLog +import com.example.todo.model.ActionType +import com.example.todo.model.ProgressType +import com.example.todo.network.ActionLogResponseItem class ActionLogRepository( private val context: Context, private val actionLogDataSource: ActionLogDataSource ) { - suspend fun getActionLogs(): List { - val jsonActionLogs = actionLogDataSource.getActionLogs() - return jsonActionLogs.map { stringActionLogToActionLog(it) } + suspend fun getActionLogs(): List? { + val response = actionLogDataSource.getActionLogs() + val jsonActionLogs = if (response.isSuccessful) response.body() else null + jsonActionLogs?.let { + return it.map { log -> stringActionLogToActionLog(log) } + } ?: return null } - private fun stringActionLogToActionLog(jsonActionLog: JsonActionLog): ActionLog { + private fun stringActionLogToActionLog(jsonActionLog: ActionLogResponseItem): ActionLog { val actionType = stringActionTypeToEnum(jsonActionLog.actionType) - val pastProgressType = stringProgressTypeToEnum(jsonActionLog.pastLocation) + val prevProgressType = + jsonActionLog.pastLocation?.let { + stringProgressTypeToEnum(it?.let { it.toString() }) + } val nowProgressType = stringProgressTypeToEnum(jsonActionLog.nowLocation) return ActionLog( jsonActionLog.cardTitle, actionType, - jsonActionLog.historyDate, - pastProgressType, - nowProgressType + jsonActionLog.historyDateTime, + nowProgressType, + prevProgressType ) } - private fun stringProgressTypeToEnum(stringProgressType: String): ProgressType { + private fun stringProgressTypeToEnum(stringProgressType: String?): ProgressType { return when (stringProgressType) { context.getString(R.string.progress_todo) -> ProgressType.TO_DO context.getString(R.string.progress_ing) -> ProgressType.IN_PROGRESS diff --git a/android/app/src/main/java/com/example/todo/respository/ToDoDataSource.kt b/android/app/src/main/java/com/example/todo/respository/ToDoDataSource.kt index 94611c64d..aed0ed6e4 100644 --- a/android/app/src/main/java/com/example/todo/respository/ToDoDataSource.kt +++ b/android/app/src/main/java/com/example/todo/respository/ToDoDataSource.kt @@ -1,7 +1,14 @@ package com.example.todo.respository import com.example.todo.model.TodoItem +import com.example.todo.network.CardIndex +import com.example.todo.network.TodoResponse +import retrofit2.Response interface ToDoDataSource { - fun getToDoItems(): List + suspend fun getTodoId(newItem: TodoItem): Response + suspend fun getInProgressId(newItem: TodoItem): Response + suspend fun getDoneId(newItem: TodoItem): Response + suspend fun getTodoItems(): Response + suspend fun removeItem(cardId: Int): Response } \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/respository/ToDoRemoteDataSource.kt b/android/app/src/main/java/com/example/todo/respository/ToDoRemoteDataSource.kt new file mode 100644 index 000000000..11dde0b09 --- /dev/null +++ b/android/app/src/main/java/com/example/todo/respository/ToDoRemoteDataSource.kt @@ -0,0 +1,38 @@ +package com.example.todo.respository + +import android.util.Log +import com.example.todo.model.TodoItem +import com.example.todo.network.AddPostBody +import com.example.todo.network.CardIndex +import com.example.todo.network.RetrofitClient +import com.example.todo.network.TodoResponse +import retrofit2.Response + +class ToDoRemoteDataSource(private val retrofitClient: RetrofitClient) : ToDoDataSource { + override suspend fun getTodoId(newItem: TodoItem): Response { + val body = AddPostBody(newItem.title, newItem.content, "todo", "Jay") + return retrofitClient.getCardIdx(body) + } + + override suspend fun getInProgressId(newItem: TodoItem): Response { + val body = AddPostBody(newItem.title, newItem.content, "inProgress", "Jay") + return retrofitClient.getCardIdx(body) + } + + override suspend fun getDoneId(newItem: TodoItem): Response { + val body = AddPostBody(newItem.title, newItem.content, "done", "Jay") + return retrofitClient.getCardIdx(body) + } + + override suspend fun getTodoItems(): Response { + val response = retrofitClient.getTodos() + Log.d("test", response.isSuccessful.toString()) + return response + } + + override suspend fun removeItem(cardId: Int): Response { + val response = retrofitClient.removeTodo(cardId) + Log.d("testDelete", response.isSuccessful.toString()) + return response + } +} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/respository/ToDoRepository.kt b/android/app/src/main/java/com/example/todo/respository/ToDoRepository.kt index 7a71c1aae..1a50c8329 100644 --- a/android/app/src/main/java/com/example/todo/respository/ToDoRepository.kt +++ b/android/app/src/main/java/com/example/todo/respository/ToDoRepository.kt @@ -1,6 +1,97 @@ package com.example.todo.respository -import android.content.Context +import android.util.Log +import com.example.todo.model.ProgressType +import com.example.todo.model.TodoItem +import com.example.todo.network.Todo +import com.example.todo.network.TodoResponseItem +import retrofit2.Response class ToDoRepository(private val toDoDataSource: ToDoDataSource) { + + suspend fun getTodoItems(): List? { + val response = toDoDataSource.getTodoItems() + Log.d("test", response.isSuccessful.toString()) + + return if (response.isSuccessful) { + val resultList = mutableListOf() + val todoJsonList = response.body()?.cardsClassifiedByLocation?.todo + val ingJsonList = response.body()?.cardsClassifiedByLocation?.ing + val doneJsonList = response.body()?.cardsClassifiedByLocation?.done + todoJsonList?.let { jsonTodoListToTodoItems(it) }?.let { resultList.addAll(it) } + ingJsonList?.let { jsonInProgressListToTodoItems(it) }?.let { resultList.addAll(it) } + doneJsonList?.let { jsonDoneToTodoItems(it) }?.let { resultList.addAll(it) } + resultList + } else null + return null + } + + private fun jsonTodoListToTodoItems(list: List): List { + return list.map { TodoItem(it.title, it.content, ProgressType.TO_DO, it.id, it.nextId) } + } + + private fun jsonInProgressListToTodoItems(list: List): List { + return list.map { + TodoItem( + it.title, + it.content, + ProgressType.IN_PROGRESS, + it.id, + it.nextId + ) + } + } + + private fun jsonDoneToTodoItems(list: List): List { + return list.map { TodoItem(it.title, it.content, ProgressType.DONE, it.id, it.nextId) } + } + + suspend fun addToDoItem(toDoList: List, newItem: TodoItem): List { + val response = toDoDataSource.getTodoId(newItem) + Log.d("testApi", response.isSuccessful.toString()) + return if (response.isSuccessful) { + val originList = toDoList.toMutableList() + + newItem.itemId = response?.body()?.cardId ?: -1 + originList[originList.size - 1].next = newItem.itemId + + originList.add(0, newItem) + originList.toList() + } else toDoList + } + + suspend fun removeToDoItem(toDoList: List, deleteItem: TodoItem): List { + val originList = toDoList.toMutableList() + deleteItem.itemId?.let { + val response = toDoDataSource.removeItem(it.toInt()) + if (response.isSuccessful) { + Log.d("testDelete", "ddd") + originList.remove(deleteItem) + } + return originList.toList() + } ?: kotlin.run { return originList.toList() } + } + + fun updateToDoItem(toDoList: List, updateItem: TodoItem): List { + val originList = toDoList.toMutableList() + val originItemIndex = originList.indexOf(originList.find { it.itemId == updateItem.itemId }) + originList[originItemIndex] = updateItem + return originList.toList() + + } + + fun updateInProgressItem(inProgressList: List, updateItem: TodoItem): List { + val originList = inProgressList.toMutableList() + val originItemIndex = originList.indexOf(originList.find { it.itemId == updateItem.itemId }) + originList[originItemIndex] = updateItem + return originList.toList() + } + + fun updateDoneItem(doneList: List, updateItem: TodoItem): List { + val originList = doneList.toMutableList() + val originItemIndex = originList.indexOf(originList.find { it.itemId == updateItem.itemId }) + originList[originItemIndex] = updateItem + return originList.toList() + } + } \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/common/ActionDiffCallback.kt b/android/app/src/main/java/com/example/todo/ui/action/ActionDiffCallback.kt similarity index 93% rename from android/app/src/main/java/com/example/todo/common/ActionDiffCallback.kt rename to android/app/src/main/java/com/example/todo/ui/action/ActionDiffCallback.kt index 8dbe265ec..227e71c7a 100644 --- a/android/app/src/main/java/com/example/todo/common/ActionDiffCallback.kt +++ b/android/app/src/main/java/com/example/todo/ui/action/ActionDiffCallback.kt @@ -1,4 +1,4 @@ -package com.example.todo.common +package com.example.todo.ui.action import androidx.recyclerview.widget.DiffUtil import com.example.todo.model.ActionLog diff --git a/android/app/src/main/java/com/example/todo/common/timeDiffUtil.kt b/android/app/src/main/java/com/example/todo/ui/action/timeDiffUtil.kt similarity index 100% rename from android/app/src/main/java/com/example/todo/common/timeDiffUtil.kt rename to android/app/src/main/java/com/example/todo/ui/action/timeDiffUtil.kt diff --git a/android/app/src/main/java/com/example/todo/ui/common/TodoTitleView.kt b/android/app/src/main/java/com/example/todo/ui/common/TodoTitleView.kt new file mode 100644 index 000000000..abc028e95 --- /dev/null +++ b/android/app/src/main/java/com/example/todo/ui/common/TodoTitleView.kt @@ -0,0 +1,28 @@ +package com.example.todo.ui.common + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.Button + +import android.widget.LinearLayout +import android.widget.TextView +import com.example.todo.R +import com.example.todo.databinding.TodoTitleViewBinding + + +class TodoTitleView(context: Context, attrs: AttributeSet) : + LinearLayout(context, attrs) { + lateinit var title: TextView + lateinit var count: TextView + lateinit var addButton: Button + + init { + LayoutInflater.from(context).inflate(R.layout.todo_title_view, this, true) + title = findViewById(R.id.tv_todo_title) + count = findViewById(R.id.tv_content_count) + addButton = findViewById(R.id.btn_add) + } + + +} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/ui/toDo/ViewModelFactory.kt b/android/app/src/main/java/com/example/todo/ui/common/ViewModelFactory.kt similarity index 69% rename from android/app/src/main/java/com/example/todo/ui/toDo/ViewModelFactory.kt rename to android/app/src/main/java/com/example/todo/ui/common/ViewModelFactory.kt index f4a575fd8..5aff38df8 100644 --- a/android/app/src/main/java/com/example/todo/ui/toDo/ViewModelFactory.kt +++ b/android/app/src/main/java/com/example/todo/ui/common/ViewModelFactory.kt @@ -1,11 +1,11 @@ -package com.example.todo.ui.toDo +package com.example.todo.ui.common import android.content.Context import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import com.example.todo.network.RetrofitClient -import com.example.todo.respository.ActionLogRemoteDataSource -import com.example.todo.respository.ActionLogRepository +import com.example.todo.respository.* +import com.example.todo.ui.toDo.ToDoViewModel import java.lang.IllegalArgumentException class ViewModelFactory(private val context: Context) : ViewModelProvider.Factory { @@ -13,7 +13,9 @@ class ViewModelFactory(private val context: Context) : ViewModelProvider.Factory return if (modelClass.isAssignableFrom(ToDoViewModel::class.java)) { val repository = ActionLogRepository(context, ActionLogRemoteDataSource(RetrofitClient.create())) - ToDoViewModel(repository) as T + + val toDoRepository= ToDoRepository(ToDoRemoteDataSource(RetrofitClient.create())) + ToDoViewModel(repository, toDoRepository) as T } else { throw IllegalArgumentException() } diff --git a/android/app/src/main/java/com/example/todo/ui/common/actionLogBindingAdapter.kt b/android/app/src/main/java/com/example/todo/ui/common/actionLogBindingAdapter.kt index cbeffa221..16b36872e 100644 --- a/android/app/src/main/java/com/example/todo/ui/common/actionLogBindingAdapter.kt +++ b/android/app/src/main/java/com/example/todo/ui/common/actionLogBindingAdapter.kt @@ -1,11 +1,25 @@ + package com.example.todo.ui.common +import android.os.Build import android.widget.TextView +import androidx.annotation.RequiresApi import androidx.databinding.BindingAdapter import com.example.todo.common.getTimeDiff -import java.text.DecimalFormat +import com.example.todo.model.ActionLog @BindingAdapter("actionLogTime") fun getAfterTime(textView: TextView, time: String) { textView.text = getTimeDiff(time) } + +@RequiresApi(Build.VERSION_CODES.N) +@BindingAdapter("actionLogMessage") +fun getMessage(textView: TextView, actionLog:ActionLog){ + val title= "${actionLog.title}" + val prevProgressType= "${actionLog.prevProgressType}" + val nowProgressType= "${actionLog.nowProgressType}" + val action= "${actionLog.actionType}" + textView.text= ( "${title}가 ${prevProgressType} 에서 ${nowProgressType} 으로 ${action} 했습니다").htmlToString() + +} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/ui/common/htmlFormatter.kt b/android/app/src/main/java/com/example/todo/ui/common/htmlFormatter.kt new file mode 100644 index 000000000..6f6c580df --- /dev/null +++ b/android/app/src/main/java/com/example/todo/ui/common/htmlFormatter.kt @@ -0,0 +1,14 @@ +package com.example.todo.ui.common + +import android.os.Build +import android.text.Html +import android.text.Spanned + + +fun String.htmlToString(): Spanned{ + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + Html.fromHtml(this, Html.FROM_HTML_MODE_LEGACY) + } else { + Html.fromHtml(this) + } +} diff --git a/android/app/src/main/java/com/example/todo/ui/toDo/ToDoActivity.kt b/android/app/src/main/java/com/example/todo/ui/toDo/ToDoActivity.kt index 902c45b3b..29d76184e 100644 --- a/android/app/src/main/java/com/example/todo/ui/toDo/ToDoActivity.kt +++ b/android/app/src/main/java/com/example/todo/ui/toDo/ToDoActivity.kt @@ -3,24 +3,21 @@ package com.example.todo.ui.toDo import android.os.Bundle import android.view.Menu import android.view.MenuItem -import android.view.View import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import androidx.core.view.GravityCompat import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.LinearLayoutManager import com.example.todo.R -import com.example.todo.common.ActionDiffCallback -import com.example.todo.common.ActionType -import com.example.todo.common.ProgressType -import com.example.todo.common.TodoDiffCallback +import com.example.todo.ui.action.ActionDiffCallback + import com.example.todo.databinding.ActivityTodoBinding -import com.example.todo.model.ActionLog +import com.example.todo.model.* -import com.example.todo.model.TodoItem import com.example.todo.ui.action.ActionAdapter +import com.example.todo.ui.common.ViewModelFactory -class ToDoActivity : AppCompatActivity() { +class ToDoActivity : AppCompatActivity(), TodoAdapter.UpdateDialogListener { private lateinit var binding: ActivityTodoBinding private lateinit var todoAdapter: TodoAdapter @@ -35,7 +32,25 @@ class ToDoActivity : AppCompatActivity() { binding = DataBindingUtil.setContentView(this, R.layout.activity_todo) setToolBar() initializeRecyclerViews() - addDummyDataInRecyclerView() + initializeTodoTitleViews() + } + + private fun initializeTodoTitleViews() { + binding.todoTitleViewTodo.title.text = resources.getString(R.string.todo_title) + binding.todoTitleViewInProgress.title.text = resources.getString(R.string.in_progress_title) + binding.todoTitleViewTodoDone.title.text = resources.getString(R.string.done_title) + binding.todoTitleViewTodo.addButton.setOnClickListener { + val addDialog = ToDoDialog(ProgressType.TO_DO) + addDialog.show(supportFragmentManager, "todoAddDialog") + } + binding.todoTitleViewInProgress.addButton.setOnClickListener { + val addDialog = ToDoDialog(ProgressType.IN_PROGRESS) + addDialog.show(supportFragmentManager, "inProgressAddDialog") + } + binding.todoTitleViewTodoDone.addButton.setOnClickListener { + val addDialog = ToDoDialog(ProgressType.DONE) + addDialog.show(supportFragmentManager, "doneAddDialog") + } } private fun setToolBar() { @@ -57,55 +72,55 @@ class ToDoActivity : AppCompatActivity() { return super.onOptionsItemSelected(item) } - private fun addDummyDataInRecyclerView() { - val todoList = mutableListOf() - val inProgressList = mutableListOf() - val doneList = mutableListOf() - val actionList = mutableListOf() - - val todo1 = TodoItem("one", "title", "content", ProgressType.TO_DO) - val todo2 = TodoItem("two", "title2", "content2\ncontentcontent", ProgressType.TO_DO) - val todo3 = TodoItem( - "two", "title2", "content2\ncontentcontent\n sdfsd", ProgressType.TO_DO - ) - - val action1 = ActionLog( - "one", - ActionType.ADD, - "2022-04-07 12:00:01", - ProgressType.TO_DO, - ProgressType.IN_PROGRESS - ) - val action2 = ActionLog( - "one", - ActionType.ADD, - "2022-04-07 10:00:01", - ProgressType.TO_DO, - ProgressType.IN_PROGRESS - ) - val action3 = ActionLog( - "one", - ActionType.ADD, - "2022-04-05 09:00:01", - ProgressType.TO_DO, - ProgressType.IN_PROGRESS - ) - - todoList.addAll(mutableListOf(todo1, todo2, todo3)) - inProgressList.addAll(mutableListOf(todo2, todo3, todo1)) - doneList.addAll(mutableListOf(todo1, todo3, todo1)) - actionList.addAll(mutableListOf(action1, action2, action3)) - - todoAdapter.submitList(todoList) - inProgressAdapter.submitList(inProgressList) - doneAdapter.submitList(doneList) - actionAdapter.submitList(actionList) - } +// private fun addDummyDataInRecyclerView() { +// val todoList = mutableListOf() +// val inProgressList = mutableListOf() +// val doneList = mutableListOf() +// val actionList = mutableListOf() +// +// val todo1 = TodoItem("one", "title", "content", ProgressType.TO_DO) +// val todo2 = TodoItem("two", "title2", "content2\ncontentcontent", ProgressType.TO_DO) +// val todo3 = TodoItem( +// "two", "title2", "content2\ncontentcontent\n sdfsd", ProgressType.TO_DO +// ) +// +// val action1 = ActionLog( +// "one", +// ActionType.ADD, +// "2022-04-07 12:00:01", +// ProgressType.TO_DO, +// ProgressType.IN_PROGRESS +// ) +// val action2 = ActionLog( +// "one", +// ActionType.ADD, +// "2022-04-07 10:00:01", +// ProgressType.TO_DO, +// ProgressType.IN_PROGRESS +// ) +// val action3 = ActionLog( +// "one", +// ActionType.ADD, +// "2022-04-05 09:00:01", +// ProgressType.TO_DO, +// ProgressType.IN_PROGRESS +// ) +// +// todoList.addAll(mutableListOf(todo1, todo2, todo3)) +// inProgressList.addAll(mutableListOf(todo2, todo3, todo1)) +// doneList.addAll(mutableListOf(todo1, todo3, todo1)) +// actionList.addAll(mutableListOf(action1, action2, action3)) +// +// todoAdapter.submitList(todoList) +// inProgressAdapter.submitList(inProgressList) +// doneAdapter.submitList(doneList) +// actionAdapter.submitList(actionList) +// } private fun initializeRecyclerViews() { - todoAdapter = TodoAdapter(TodoDiffCallback()) - inProgressAdapter = TodoAdapter(TodoDiffCallback()) - doneAdapter = TodoAdapter(TodoDiffCallback()) + todoAdapter = TodoAdapter(this,this,toDoViewModel, TodoDiffCallback()) + inProgressAdapter = TodoAdapter(this,this,toDoViewModel,TodoDiffCallback()) + doneAdapter = TodoAdapter(this,this,toDoViewModel,TodoDiffCallback()) actionAdapter = ActionAdapter(ActionDiffCallback()) binding.rvTodo.adapter = todoAdapter @@ -123,22 +138,33 @@ class ToDoActivity : AppCompatActivity() { toDoViewModel.todoList.observe(this) { todoAdapter.submitList(it) + binding.todoTitleViewTodo.count.text = it.size.toString() } toDoViewModel.inProgressList.observe(this) { inProgressAdapter.submitList(it) + + binding.todoTitleViewInProgress.count.text = it.size.toString() } toDoViewModel.doneList.observe(this) { doneAdapter.submitList(it) + binding.todoTitleViewTodoDone.count.text = it.size.toString() } toDoViewModel.actionList.observe(this) { actionAdapter.submitList(it) + // 테스트용 + // binding.todoTitleViewTodo.count.text = it?.size.toString() } + } companion object { const val TAG = "ToDoActivity" } + + override fun updateDialog(item: TodoItem) { + UpdateToDoDialog(item).show(supportFragmentManager, "update") + } } \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/ui/toDo/ToDoDialog.kt b/android/app/src/main/java/com/example/todo/ui/toDo/ToDoDialog.kt new file mode 100644 index 000000000..d676e689f --- /dev/null +++ b/android/app/src/main/java/com/example/todo/ui/toDo/ToDoDialog.kt @@ -0,0 +1,109 @@ +package com.example.todo.ui.toDo + + +import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.DialogFragment +import androidx.fragment.app.activityViewModels +import com.example.todo.databinding.DialogCardBinding +import com.example.todo.model.ProgressType +import com.example.todo.model.TodoItem + + +class ToDoDialog(private val progressType: ProgressType) : DialogFragment() { + + lateinit var binding: DialogCardBinding + private val viewModel: ToDoViewModel by activityViewModels() + private var titleValidationFlag = false + private var contentValidationFlag = false + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + binding = DialogCardBinding.inflate(inflater, container, false) + dialog?.setCanceledOnTouchOutside(false) + return binding.root + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + binding.btnRegister.setOnClickListener { + when (progressType) { + ProgressType.TO_DO -> { + val newToDoItem = TodoItem( + binding.editCardTitle.text.toString(), + binding.editCardContent.text.toString(), + ProgressType.TO_DO + ) + viewModel.addTodoItem(newToDoItem) + } + + ProgressType.IN_PROGRESS -> { + val newInProgressItem = TodoItem( + binding.editCardTitle.text.toString(), + binding.editCardContent.text.toString(), + ProgressType.IN_PROGRESS + ) + viewModel.addInProgressItem(newInProgressItem) + } + else -> { + val newDoneItem = TodoItem( + binding.editCardTitle.text.toString(), + binding.editCardContent.text.toString(), + ProgressType.DONE + ) + + viewModel.addDoneItem(newDoneItem) + } + } + dismiss() + } + + binding.btnCancle.setOnClickListener { dismiss() } + binding.editCardTitle.addTextChangedListener(titleChangeListener) + binding.editCardContent.addTextChangedListener(contentChangeListener) + } + + private val titleChangeListener = object : TextWatcher { + override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + override fun afterTextChanged(titleInput: Editable?) { + if (titleInput != null) { + titleValidationFlag = when { + (titleInput.isEmpty()) -> false + else -> true + } + } + validationFlagCheck() + } + } + + private val contentChangeListener = object : TextWatcher { + override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + override fun afterTextChanged(contentInput: Editable?) { + if (contentInput != null) { + contentValidationFlag = when { + (contentInput.isEmpty()) -> false + else -> true + } + } + validationFlagCheck() + } + } + + private fun validationFlagCheck() { + binding.btnRegister.isEnabled = titleValidationFlag && contentValidationFlag + + } + +} + diff --git a/android/app/src/main/java/com/example/todo/ui/toDo/ToDoViewModel.kt b/android/app/src/main/java/com/example/todo/ui/toDo/ToDoViewModel.kt index ab397476d..dc3117cd0 100644 --- a/android/app/src/main/java/com/example/todo/ui/toDo/ToDoViewModel.kt +++ b/android/app/src/main/java/com/example/todo/ui/toDo/ToDoViewModel.kt @@ -1,16 +1,20 @@ package com.example.todo.ui.toDo -import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.example.todo.model.ActionLog +import com.example.todo.model.ProgressType import com.example.todo.model.TodoItem import com.example.todo.respository.ActionLogRepository +import com.example.todo.respository.ToDoRepository import kotlinx.coroutines.launch -class ToDoViewModel(private val actionLogRepository: ActionLogRepository) : ViewModel() { +class ToDoViewModel( + private val actionLogRepository: ActionLogRepository, + private val toDoRepository: ToDoRepository +) : ViewModel() { private val _todoList = MutableLiveData>() private val _inProgressList = MutableLiveData>() @@ -24,13 +28,113 @@ class ToDoViewModel(private val actionLogRepository: ActionLogRepository) : View init { loadActionLog() + loadTodoList() + } + + private fun loadTodoList() { + viewModelScope.launch { + val totalList = toDoRepository.getTodoItems() + val tempTodoList = mutableListOf() + val progressList = mutableListOf() + val doneList = mutableListOf() + totalList?.forEach { + if (it.type == ProgressType.TO_DO) tempTodoList.add(it) + else if (it.type == ProgressType.IN_PROGRESS) progressList.add(it) + if (it.type == ProgressType.DONE) doneList.add(it) + } + _todoList.value = tempTodoList + _inProgressList.value = progressList + _doneList.value = doneList + } } private fun loadActionLog() { viewModelScope.launch { val actionLogs = actionLogRepository.getActionLogs() - _actionList.value = actionLogs - Log.d("ssss", actionLogs.toString()) + actionLogs?.let { _actionList.value = actionLogs } + } + } + + fun addTodoItem(item: TodoItem) { + viewModelScope.launch { + _todoList.value = todoList.value?.let { toDoRepository.addToDoItem(it, item) } + } + } + + fun addInProgressItem(item: TodoItem) { + viewModelScope.launch { + _inProgressList.value = + inProgressList.value?.let { toDoRepository.addToDoItem(it, item) } + } + } + + fun addDoneItem(item: TodoItem) { + viewModelScope.launch { + _doneList.value = doneList.value?.let { toDoRepository.addToDoItem(it, item) } + } + } + + private suspend fun deleteTodoItem(item: TodoItem) { + _todoList.value = todoList.value?.let { toDoRepository.removeToDoItem(it, item) } + } + + private suspend fun deleteInProgressItem(item: TodoItem) { + _inProgressList.value = + inProgressList.value?.let { + toDoRepository.removeToDoItem(it, item) + } + } + + private suspend fun deleteDoneItem(item: TodoItem) { + _doneList.value = doneList.value?.let { toDoRepository.removeToDoItem(it, item) } + } + + fun moveToDone(item: TodoItem) { + viewModelScope.launch { + when (item.type) { + ProgressType.IN_PROGRESS -> { + deleteInProgressItem(item) + item.type = ProgressType.DONE + addDoneItem(item) + } + ProgressType.DONE -> { + return@launch + } + else -> { + deleteTodoItem(item) + item.type = ProgressType.DONE + addDoneItem(item) + } + } + } + } + + fun deleteItem(cardItem: TodoItem) { + viewModelScope.launch { + when (cardItem.type) { + ProgressType.TO_DO -> { + deleteTodoItem(cardItem) + } + ProgressType.IN_PROGRESS -> { + deleteInProgressItem(cardItem) + } + ProgressType.DONE -> { + deleteDoneItem(cardItem) + } + } } } + + fun updateTodoItem(updateItem: TodoItem) { + _todoList.value = todoList.value?.let { toDoRepository.updateToDoItem(it, updateItem) } + } + + fun updateInProgressItem(updateItem: TodoItem) { + _inProgressList.value = + inProgressList.value?.let { toDoRepository.updateInProgressItem(it, updateItem) } + } + + fun updateDoneItem(updateItem: TodoItem) { + _doneList.value = doneList.value?.let { toDoRepository.updateDoneItem(it, updateItem) } + } } \ No newline at end of file diff --git a/android/app/src/main/java/com/example/todo/ui/toDo/TodoAdapter.kt b/android/app/src/main/java/com/example/todo/ui/toDo/TodoAdapter.kt index 0d15777d5..33ddaca8a 100644 --- a/android/app/src/main/java/com/example/todo/ui/toDo/TodoAdapter.kt +++ b/android/app/src/main/java/com/example/todo/ui/toDo/TodoAdapter.kt @@ -1,25 +1,65 @@ + package com.example.todo.ui.toDo + +import android.content.Context import android.view.LayoutInflater +import android.view.MenuItem +import android.view.View import android.view.ViewGroup +import android.widget.PopupMenu import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView +import com.example.todo.R import com.example.todo.databinding.TodoItemBinding import com.example.todo.model.TodoItem class TodoAdapter( + private val context: Context, + private val listener: UpdateDialogListener, + private val viewModel: ToDoViewModel, todoDiffCallback: DiffUtil.ItemCallback ) : ListAdapter(todoDiffCallback) { - class ViewHolder(private val itemViewBinding: TodoItemBinding) : RecyclerView.ViewHolder(itemViewBinding.root) { + + + interface UpdateDialogListener { + fun updateDialog(item: TodoItem) + } + + inner class ViewHolder(private val itemViewBinding: TodoItemBinding) : + RecyclerView.ViewHolder(itemViewBinding.root), + PopupMenu.OnMenuItemClickListener { + private lateinit var cardItem: TodoItem fun bind(cardItem: TodoItem) { + this.cardItem = cardItem itemViewBinding.toDoItem = cardItem + itemView.setOnLongClickListener { + displayPopupMenu(it) + true + } + } + + private fun displayPopupMenu(view: View) { + val popupMenu = PopupMenu(context, view) + popupMenu.menuInflater.inflate(R.menu.menu_popup, popupMenu.menu) + popupMenu.setOnMenuItemClickListener(this) + popupMenu.show() + } + + override fun onMenuItemClick(item: MenuItem?): Boolean { + when (item?.itemId) { + R.id.popup_move_to_done -> viewModel.moveToDone(cardItem) + R.id.popup_update -> listener.updateDialog(cardItem) + R.id.popup_delete -> viewModel.deleteItem(cardItem) + } + return true } } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val binding= TodoItemBinding.inflate(LayoutInflater.from(parent.context), parent, false) + val binding = TodoItemBinding.inflate(LayoutInflater.from(parent.context), parent, false) return ViewHolder(binding) } @@ -27,4 +67,4 @@ class TodoAdapter( holder.bind(getItem(position)) } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/com/example/todo/common/TodoDiffCallback.kt b/android/app/src/main/java/com/example/todo/ui/toDo/TodoDiffCallback.kt similarity index 92% rename from android/app/src/main/java/com/example/todo/common/TodoDiffCallback.kt rename to android/app/src/main/java/com/example/todo/ui/toDo/TodoDiffCallback.kt index c50d1105c..97504493c 100644 --- a/android/app/src/main/java/com/example/todo/common/TodoDiffCallback.kt +++ b/android/app/src/main/java/com/example/todo/ui/toDo/TodoDiffCallback.kt @@ -1,4 +1,4 @@ -package com.example.todo.common +package com.example.todo.ui.toDo import androidx.recyclerview.widget.DiffUtil import com.example.todo.model.TodoItem diff --git a/android/app/src/main/java/com/example/todo/ui/toDo/UpdateToDoDialog.kt b/android/app/src/main/java/com/example/todo/ui/toDo/UpdateToDoDialog.kt new file mode 100644 index 000000000..dbe2eca94 --- /dev/null +++ b/android/app/src/main/java/com/example/todo/ui/toDo/UpdateToDoDialog.kt @@ -0,0 +1,87 @@ +package com.example.todo.ui.toDo + +import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.DialogFragment +import androidx.fragment.app.activityViewModels +import com.example.todo.databinding.DialogUpdateCardBinding +import com.example.todo.model.ProgressType +import com.example.todo.model.TodoItem + +class UpdateToDoDialog(private val item: TodoItem) : DialogFragment() { + + lateinit var binding: DialogUpdateCardBinding + private val viewModel : ToDoViewModel by activityViewModels() + private var titleValidationFlag = true + private var contentValidationFlag = true + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + binding = DialogUpdateCardBinding.inflate(inflater, container, false) + binding.editCardContent.setText(item.content) + binding.editCardTitle.setText(item.title) + dialog?.setCanceledOnTouchOutside(false) + return binding.root + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + binding.btnRegister.setOnClickListener { + item.content= binding.editCardContent.text.toString() + item.title= binding.editCardTitle.text.toString() + when (item.type) { + ProgressType.TO_DO -> viewModel.updateTodoItem(item) + ProgressType.IN_PROGRESS -> viewModel.updateInProgressItem(item) + else -> viewModel.updateDoneItem(item) + } + dismiss() + } + + binding.btnCancle.setOnClickListener { dismiss() } + binding.editCardTitle.addTextChangedListener(titleChangeListener) + binding.editCardContent.addTextChangedListener(contentChangeListener) + } + + private val titleChangeListener = object : TextWatcher { + override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + override fun afterTextChanged(titleInput: Editable?) { + if (titleInput != null) { + titleValidationFlag = when { + (titleInput.isEmpty()) -> false + else -> true + } + } + validationFlagCheck() + } + } + + private val contentChangeListener = object : TextWatcher { + override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + override fun afterTextChanged(contentInput: Editable?) { + if (contentInput != null) { + contentValidationFlag = when { + (contentInput.isEmpty()) -> false + else -> true + } + } + validationFlagCheck() + } + } + + private fun validationFlagCheck() { + binding.btnRegister.isEnabled = titleValidationFlag && contentValidationFlag + + } + +} \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_baseline_add_24.xml b/android/app/src/main/res/drawable/ic_baseline_add_24.xml new file mode 100644 index 000000000..eb232541d --- /dev/null +++ b/android/app/src/main/res/drawable/ic_baseline_add_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/android/app/src/main/res/drawable/ic_baseline_close_24.xml b/android/app/src/main/res/drawable/ic_baseline_close_24.xml new file mode 100644 index 000000000..16d6d37dd --- /dev/null +++ b/android/app/src/main/res/drawable/ic_baseline_close_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/android/app/src/main/res/drawable/item_count_background.xml b/android/app/src/main/res/drawable/item_count_background.xml new file mode 100644 index 000000000..38aa16944 --- /dev/null +++ b/android/app/src/main/res/drawable/item_count_background.xml @@ -0,0 +1,14 @@ + + + + + + + /> + \ No newline at end of file diff --git a/android/app/src/main/res/layout-sw720dp-land/activity_todo.xml b/android/app/src/main/res/layout-sw720dp-land/activity_todo.xml index 7ed4c4e16..aa86e4f8e 100644 --- a/android/app/src/main/res/layout-sw720dp-land/activity_todo.xml +++ b/android/app/src/main/res/layout-sw720dp-land/activity_todo.xml @@ -16,7 +16,9 @@ + android:layout_height="match_parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintVertical_weight="7"> + + + + + + + + + app:layout_constraintTop_toBottomOf="@+id/todo_title_view_todo" /> + + app:layout_constraintTop_toBottomOf="@+id/todo_title_view_in_progress" /> + app:layout_constraintTop_toBottomOf="@+id/todo_title_view_todo_done" /> + + diff --git a/android/app/src/main/res/layout-sw720dp-land/dialog_card.xml b/android/app/src/main/res/layout-sw720dp-land/dialog_card.xml new file mode 100644 index 000000000..919f4142a --- /dev/null +++ b/android/app/src/main/res/layout-sw720dp-land/dialog_card.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout-sw720dp-land/dialog_update_card.xml b/android/app/src/main/res/layout-sw720dp-land/dialog_update_card.xml new file mode 100644 index 000000000..401d16f53 --- /dev/null +++ b/android/app/src/main/res/layout-sw720dp-land/dialog_update_card.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/layout/action_log_item.xml b/android/app/src/main/res/layout/action_log_item.xml index db303a67f..3bce73deb 100644 --- a/android/app/src/main/res/layout/action_log_item.xml +++ b/android/app/src/main/res/layout/action_log_item.xml @@ -17,6 +17,7 @@ android:paddingLeft="10dp" android:paddingTop="20dp" android:paddingRight="10dp" + android:background="@color/todo_background_green" android:paddingBottom="20dp"> @@ -24,7 +25,8 @@ android:id="@+id/tv_action_content" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@{actionLog.title}" + actionLogMessage="@{actionLog}" + style="@style/HeadLine6" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -35,6 +37,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" + style="@style/HeadLine6" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tv_action_content" /> diff --git a/android/app/src/main/res/layout/activity_todo.xml b/android/app/src/main/res/layout/activity_todo.xml index 4981980aa..aa86e4f8e 100644 --- a/android/app/src/main/res/layout/activity_todo.xml +++ b/android/app/src/main/res/layout/activity_todo.xml @@ -16,10 +16,11 @@ + android:layout_height="match_parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintVertical_weight="7"> + + + + + + + + + app:layout_constraintTop_toBottomOf="@+id/todo_title_view_todo" /> + + app:layout_constraintTop_toBottomOf="@+id/todo_title_view_in_progress" /> + app:layout_constraintTop_toBottomOf="@+id/todo_title_view_todo_done" /> + + diff --git a/android/app/src/main/res/layout/dialog_card.xml b/android/app/src/main/res/layout/dialog_card.xml new file mode 100644 index 000000000..125893e99 --- /dev/null +++ b/android/app/src/main/res/layout/dialog_card.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/dialog_update_card.xml b/android/app/src/main/res/layout/dialog_update_card.xml new file mode 100644 index 000000000..763070559 --- /dev/null +++ b/android/app/src/main/res/layout/dialog_update_card.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/layout/todo_title_view.xml b/android/app/src/main/res/layout/todo_title_view.xml new file mode 100644 index 000000000..7d1423cd0 --- /dev/null +++ b/android/app/src/main/res/layout/todo_title_view.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + +