-
Notifications
You must be signed in to change notification settings - Fork 74
[Android] Team04(Stitch&스타크)- Toolbar 및 Navigation Drawer 구현 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
renovatio0424
merged 18 commits into
codesquad-members-2022:team-04
from
taewooyo:develop_android
Apr 8, 2022
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
54c2dd0
Update issue templates
taewooyo ae72e0e
Delete .github/ISSUE_TEMPLATE directory
taewooyo 1bbe567
feat: 프로젝트 생성
jminie-o8o d270249
feat : 백엔드 폴더 분리, 백엔드 기본 프로젝트 설정
Louie-03 490ca95
Merge pull request #1 from bn-tw2020/feature/add-backend-project
Louie-03 ea92890
Merge pull request #2 from bn-tw2020/develop
Louie-03 126623e
Delete BackEnd directory
jminie-o8o 32ee93d
feat: ToolBar구현 및 DataBinding 설정
jminie-o8o bb90504
Merge pull request #11 from jminie-o8o/feature/toolbar-#3
taewooyo 56958bd
ui: 코드정렬 및 최상단 배경색 추가
taewooyo d73c31b
ui: navigation_drawer 리사이클러 뷰 레이아웃 추가#14
taewooyo 4031c35
feat: navigation_drawer 리사이클러 뷰 어댑터, 데이터 연결#14
taewooyo 2f4a323
Merge pull request #16 from bn-tw2020/feature/navigation_drawer-#14
jminie-o8o 50a2907
docs: README.md
taewooyo a1cdf96
refactor: 시간 포맷 로직 개선, enum class 도입-#14
taewooyo e6f466f
Merge pull request #21 from bn-tw2020/feature/navigation_drawer-#14
jminie-o8o 0188b40
feat: 카드 추가 기능-#17
jminie-o8o e3cd3b2
Merge pull request #24 from jminie-o8o/feature/add_card-#17
taewooyo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
7 changes: 7 additions & 0 deletions
7
android/app/src/main/java/com/example/todolist/model/Status.kt
This file contains hidden or 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,7 @@ | ||
| package com.example.todolist.model | ||
|
|
||
| enum class Status(val status: String) { | ||
| TODO("todo"), | ||
| IN_PROGRESS("inProgress"), | ||
| DONE("done") | ||
| } |
This file contains hidden or 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,8 @@ | ||
| package com.example.todolist.model | ||
|
|
||
| data class Task( | ||
| val title: String?, | ||
| val content: String?, | ||
| val status: Status, | ||
| val author: String = "Android" | ||
| ) |
90 changes: 90 additions & 0 deletions
90
android/app/src/main/java/com/example/todolist/ui/Dialog.kt
This file contains hidden or 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,90 @@ | ||
| package com.example.todolist.ui | ||
|
|
||
| import android.graphics.Color | ||
| import android.graphics.drawable.ColorDrawable | ||
| 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 android.view.Window | ||
| import androidx.fragment.app.DialogFragment | ||
| import androidx.fragment.app.activityViewModels | ||
| import com.example.todolist.databinding.DialogNewCardBinding | ||
| import com.example.todolist.model.Status | ||
| import com.example.todolist.model.Task | ||
|
|
||
| class Dialog : DialogFragment() { | ||
| private var _binding: DialogNewCardBinding? = null | ||
| private val binding get() = _binding | ||
| private val viewModel: ViewModel by activityViewModels() | ||
| private var titleFlag = false | ||
| private var contentsFlag = false | ||
|
|
||
| override fun onCreateView( | ||
| inflater: LayoutInflater, | ||
| container: ViewGroup?, | ||
| savedInstanceState: Bundle? | ||
| ): View? { | ||
| _binding = DialogNewCardBinding.inflate(inflater, container, false) | ||
| dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) // 다이얼로그의 곡선 주변에 배경색을 맞춰주는 코드 | ||
| dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE) | ||
| dialog?.setCanceledOnTouchOutside(false) // 다이얼로그 외부의 영역 터치 시 취소 불가능 | ||
|
|
||
| return binding?.root | ||
| } | ||
|
|
||
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
| binding?.btnCancel?.setOnClickListener { dismiss() } | ||
|
|
||
| binding?.etTitle?.addTextChangedListener(titleListener) | ||
| binding?.etContents?.addTextChangedListener(contentsListener) | ||
|
|
||
| binding?.btnRegister?.setOnClickListener { | ||
| val task = Task( | ||
| binding?.etTitle?.text?.toString(), | ||
| binding?.etContents?.text?.toString(), | ||
| Status.TODO | ||
| ) | ||
| viewModel.addTask(task) | ||
| dismiss() | ||
| } | ||
| } | ||
|
|
||
| private val titleListener = 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(s: Editable?) { | ||
| if (s != null) { | ||
| titleFlag = when { | ||
| s.isEmpty() -> false | ||
| else -> true | ||
| } | ||
| } | ||
| flagCheck() | ||
| } | ||
| } | ||
|
|
||
| private val contentsListener = 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(s: Editable?) { | ||
| if (s != null) { | ||
| contentsFlag = when { | ||
| s.isEmpty() -> false | ||
| else -> true | ||
| } | ||
| } | ||
| flagCheck() | ||
| } | ||
| } | ||
|
|
||
| fun flagCheck() { | ||
| binding?.btnRegister?.isEnabled = titleFlag && contentsFlag | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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
6 changes: 6 additions & 0 deletions
6
android/app/src/main/res/drawable-v24/disable_dialog_button.xml
This file contains hidden or 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,6 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:shape="rectangle"> | ||
| <solid android:color="@color/todo_light_blue" /> | ||
| <corners android:radius="10dp" /> | ||
| </shape> |
This file contains hidden or 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,6 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:shape="rectangle"> | ||
| <solid android:color="@color/todo_blue" /> | ||
| <corners android:radius="10dp" /> | ||
| </shape> |
This file contains hidden or 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,5 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:shape="oval"> | ||
| <solid android:color="@color/todo_gray02"/> | ||
| </shape> |
7 changes: 7 additions & 0 deletions
7
android/app/src/main/res/drawable/dialog_background_white.xml
This file contains hidden or 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,7 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:shape="rectangle"> | ||
| <solid android:color="@color/todo_white"/> | ||
| <stroke android:width="2dp" android:color="@color/todo_blue" /> | ||
| <corners android:radius="10dp"/> | ||
| </shape> |
This file contains hidden or 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,6 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:shape="rectangle"> | ||
| <solid android:color="@color/todo_grey04" /> | ||
| <corners android:radius="10dp" /> | ||
| </shape> |
This file contains hidden or 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,5 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <size android:width="1.5dp"/> | ||
| <solid android:color="@color/todo_grey03"/> | ||
| </shape> |
This file contains hidden or 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,5 @@ | ||
| <vector android:height="24dp" android:tint="#BDBDBD" | ||
| android:viewportHeight="24" android:viewportWidth="24" | ||
| android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/> | ||
| </vector> |
This file contains hidden or 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,5 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <item android:drawable="@drawable/able_dialog_button" android:state_enabled="true" /> | ||
| <item android:drawable="@drawable/disable_dialog_button" android:state_enabled="false" /> | ||
| </selector> |
This file contains hidden or 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,9 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <item | ||
| android:color="@color/todo_white" | ||
| android:state_enabled="true" /> | ||
| <item | ||
| android:color="@color/todo_grey05" | ||
| android:state_enabled="false" /> | ||
| </selector> |
This file contains hidden or 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 hidden or 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,94 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
|
|
||
| <layout 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"> | ||
|
|
||
| <data> | ||
|
|
||
| </data> | ||
|
|
||
| <FrameLayout | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:background="@android:color/transparent"> | ||
|
|
||
| <androidx.constraintlayout.widget.ConstraintLayout | ||
| android:id="@+id/cl_dialog" | ||
| android:layout_width="540dp" | ||
| android:layout_height="200dp" | ||
| android:layout_gravity="center" | ||
| android:background="@drawable/dialog_background_white" | ||
| android:gravity="center"> | ||
|
|
||
| <TextView | ||
| android:id="@+id/tv_add_dialog_title" | ||
| style="@style/TextHeadline5.bold.20" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginHorizontal="16dp" | ||
| android:layout_marginTop="16dp" | ||
| android:text="@string/label_add_new_card" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toTopOf="parent" /> | ||
|
|
||
| <EditText | ||
| android:id="@+id/et_title" | ||
| style="@style/Subtitle1.bold" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginHorizontal="16dp" | ||
| android:layout_marginTop="20dp" | ||
| android:background="@android:color/transparent" | ||
| android:hint="@string/label_dialog_add_title" | ||
| android:importantForAutofill="no" | ||
| android:inputType="text" | ||
| android:textCursorDrawable="@drawable/edittext_cursor" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/tv_add_dialog_title" /> | ||
|
|
||
| <EditText | ||
| android:id="@+id/et_contents" | ||
| style="@style/Subtitle1.14" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginHorizontal="16dp" | ||
| android:layout_marginTop="14dp" | ||
| android:background="@android:color/transparent" | ||
| android:hint="@string/label_dialog_add_contents" | ||
| android:importantForAutofill="no" | ||
| android:inputType="text" | ||
| android:textCursorDrawable="@drawable/edittext_cursor" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/et_title" /> | ||
|
|
||
| <androidx.appcompat.widget.AppCompatButton | ||
| android:id="@+id/btn_register" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="40dp" | ||
| android:layout_marginEnd="20dp" | ||
| android:layout_marginBottom="15dp" | ||
| android:background="@drawable/selector_dialog_button" | ||
| android:enabled="false" | ||
| android:text="@string/label_dialog_register" | ||
| android:textColor="@drawable/selector_dialog_text" | ||
| app:layout_constraintBottom_toBottomOf="parent" | ||
| app:layout_constraintEnd_toEndOf="parent" /> | ||
|
|
||
| <androidx.appcompat.widget.AppCompatButton | ||
| android:id="@+id/btn_cancel" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="40dp" | ||
| android:layout_marginEnd="20dp" | ||
| android:layout_marginBottom="15dp" | ||
| android:background="@drawable/dialog_button_cancel" | ||
| android:text="@string/label_dialog_cancel" | ||
| app:layout_constraintBottom_toBottomOf="parent" | ||
| app:layout_constraintEnd_toStartOf="@+id/btn_register" /> | ||
|
|
||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||
|
|
||
|
|
||
| </FrameLayout> | ||
| </layout> |
This file contains hidden or 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,49 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <layout 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"> | ||
|
|
||
| <data> | ||
|
|
||
| </data> | ||
|
|
||
| <androidx.constraintlayout.widget.ConstraintLayout | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content"> | ||
|
|
||
| <TextView | ||
| android:id="@+id/tv_todo_title" | ||
| style="@style/Subtitle1.bold.18" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="@string/label_todo_title" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toTopOf="parent" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/tv_todo_badge" | ||
| style="@style/Subtitle2.bold" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginStart="8dp" | ||
| android:background="@drawable/badge_background_gray" | ||
| android:padding="2dp" | ||
| app:layout_constraintStart_toEndOf="@+id/tv_todo_title" | ||
| app:layout_constraintTop_toTopOf="parent" | ||
| tools:text="113" /> | ||
|
|
||
|
|
||
| <ImageButton | ||
| android:id="@+id/btn_todo_add" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginStart="136dp" | ||
| android:background="@android:color/transparent" | ||
| android:contentDescription="@string/description_add_button" | ||
| android:src="@drawable/ic_baseline_add_24" | ||
| app:layout_constraintStart_toEndOf="@+id/tv_todo_badge" | ||
| app:layout_constraintTop_toTopOf="parent" /> | ||
|
|
||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||
| </layout> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jminie-o8o
다이얼로그를
DialogFragment로 구현하셨던 이유가 무엇인가요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@renovatio0424
DialogFragment는 말 그대로 Fragment 이기 때문에 Fragment 의 생명주기를 활용할 수 있습니다.Dialog를 활용할 때 Activity가 파괴되더라도 dialog가 존재하여 생기는 메모리 leak 등을 방지할 수 있는 장점이 있기 때문에
DialogFragment로 구현했습니다.