forked from yy0ung/nibobnebob
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#86 refactor : DatePicker 함수 -> Class 변경
- Loading branch information
Showing
4 changed files
with
33 additions
and
39 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Aos/app/src/main/java/com/avengers/nibobnebob/presentation/customview/CalendarDatePicker.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,27 @@ | ||
package com.avengers.nibobnebob.presentation.customview | ||
|
||
|
||
import androidx.fragment.app.FragmentManager | ||
import com.avengers.nibobnebob.presentation.ui.toDateString | ||
import com.google.android.material.datepicker.MaterialDatePicker | ||
|
||
class CalendarDatePicker( | ||
private val onSelectDateListener: (String) -> Unit | ||
) { | ||
private val datePicker = MaterialDatePicker.Builder.datePicker() | ||
.setTitleText("생일을 고르세요") | ||
.setSelection(MaterialDatePicker.todayInUtcMilliseconds()) | ||
.build() | ||
|
||
init{ | ||
datePicker.addOnPositiveButtonClickListener { | ||
onSelectDateListener(it.toDateString()) | ||
} | ||
} | ||
|
||
fun show(fragmentManager: FragmentManager){ | ||
datePicker.show(fragmentManager,"") | ||
} | ||
} | ||
|
||
|
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
33 changes: 0 additions & 33 deletions
33
Aos/app/src/main/java/com/avengers/nibobnebob/presentation/util/DatePicker.kt
This file was deleted.
Oops, something went wrong.