-
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.
Browse files
Browse the repository at this point in the history
Feature/#23 story api
- Loading branch information
Showing
116 changed files
with
1,724 additions
and
328 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
50 changes: 50 additions & 0 deletions
50
common-ui/src/main/java/com/najudoryeong/mineme/common_ui/CalendarUtil.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,50 @@ | ||
package com.najudoryeong.mineme.common_ui | ||
|
||
import android.widget.DatePicker | ||
import android.widget.TextView | ||
import java.text.SimpleDateFormat | ||
import java.util.* | ||
|
||
class CalendarUtil { | ||
companion object { | ||
|
||
private val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.KOREA) | ||
|
||
private fun Calendar.getYear() = get(Calendar.YEAR) | ||
private fun Calendar.getMonth() = get(Calendar.MONTH)+1 | ||
private fun Calendar.getDay() = get(Calendar.DAY_OF_MONTH) | ||
|
||
|
||
fun getTodayDate(): String = Calendar.getInstance().let { | ||
return "${it.getYear()}-${it.getMonth()}-${it.getDay()}" | ||
} | ||
|
||
// private fun getDateFormat(year : String, month: String, day: String) : String = "${year} ${getMonthFormat(month)}" | ||
|
||
fun DatePicker.getDate() = "$year-${month+1}-$dayOfMonth" | ||
|
||
fun parseStringToDate(textView: TextView): Date? = | ||
dateFormat.parse(textView.text.toString()) | ||
|
||
fun getMonthFormat(month: String): String { | ||
return when (month.toInt()) { | ||
Calendar.FEBRUARY -> "Feb" | ||
Calendar.MARCH -> "Mar" | ||
Calendar.APRIL -> "Apr" | ||
Calendar.MAY -> "May" | ||
Calendar.JUNE -> "Jun" | ||
Calendar.JULY -> "Jul" | ||
Calendar.AUGUST -> "Aug" | ||
Calendar.SEPTEMBER -> "Sep" | ||
Calendar.OCTOBER -> "Oct" | ||
Calendar.NOVEMBER -> "Nov" | ||
Calendar.DECEMBER -> "Dec" | ||
else -> throw IllegalArgumentException("Invalid month: $month") | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
} |
62 changes: 62 additions & 0 deletions
62
common-ui/src/main/java/com/najudoryeong/mineme/common_ui/DialogForDatePicker.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,62 @@ | ||
package com.najudoryeong.mineme.common_ui | ||
|
||
import android.app.Dialog | ||
import android.content.Context | ||
import android.graphics.Color | ||
import android.graphics.drawable.ColorDrawable | ||
import android.os.Bundle | ||
import com.najudoryeong.mineme.common_ui.CalendarUtil.Companion.getDate | ||
import com.najudoryeong.mineme.common_ui.databinding.DialogForDatepickerBinding | ||
import java.util.* | ||
|
||
class DialogForDatePicker( | ||
context: Context, | ||
private val initDate: Date, | ||
private val onClickPositiveButton: (String) -> Unit | ||
) : Dialog(context) { | ||
private lateinit var binding: DialogForDatepickerBinding | ||
private var calendar: Calendar = Calendar.getInstance() | ||
|
||
init { | ||
calendar.time = initDate | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
binding = DialogForDatepickerBinding.inflate(layoutInflater).apply { | ||
datePicker.init(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH),null) | ||
positiveButton.setOnClickListener { | ||
onClickPositiveButton.invoke(datePicker.getDate()) | ||
dismiss() | ||
} | ||
negativeButton.setOnClickListener { | ||
dismiss() | ||
} | ||
} | ||
setContentView(binding.root) | ||
|
||
window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) | ||
} | ||
|
||
class Builder(private val context: Context) { | ||
private lateinit var initDate: Date | ||
private var onClickPositiveButton : (String) -> Unit = {} | ||
|
||
|
||
fun setInitDate(initDate: Date) = apply { | ||
this.initDate = initDate | ||
} | ||
|
||
fun setOnClickPositiveButton(onClickPositiveButton: (String) -> Unit) = apply { | ||
this.onClickPositiveButton = onClickPositiveButton | ||
} | ||
|
||
|
||
fun build() = DialogForDatePicker( | ||
context, | ||
initDate, | ||
onClickPositiveButton | ||
) | ||
} | ||
} |
2 changes: 0 additions & 2 deletions
2
common-ui/src/main/java/com/najudoryeong/mineme/common_ui/MainActivityUtil.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
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,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="20dp" | ||
android:height="20dp" | ||
android:viewportWidth="20" | ||
android:viewportHeight="20"> | ||
<path | ||
android:pathData="M11.767,12.833L15.592,9.008C15.747,8.852 15.834,8.641 15.834,8.421C15.834,8.201 15.747,7.99 15.592,7.833C15.514,7.755 15.422,7.693 15.321,7.651C15.219,7.609 15.11,7.587 15,7.587C14.89,7.587 14.781,7.609 14.679,7.651C14.578,7.693 14.486,7.755 14.408,7.833L10.592,11.667C10.514,11.745 10.422,11.807 10.321,11.849C10.219,11.892 10.11,11.913 10,11.913C9.89,11.913 9.781,11.892 9.68,11.849C9.578,11.807 9.486,11.745 9.408,11.667L5.592,7.833C5.436,7.676 5.224,7.588 5.003,7.587C4.782,7.586 4.569,7.673 4.412,7.829C4.256,7.985 4.167,8.197 4.166,8.418C4.165,8.639 4.253,8.851 4.408,9.008L8.233,12.833C8.702,13.302 9.337,13.564 10,13.564C10.663,13.564 11.298,13.302 11.767,12.833Z" | ||
android:fillColor="#B0B0B1"/> | ||
</vector> |
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,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item> | ||
<layer-list> | ||
<item> | ||
<shape android:shape="rectangle"> | ||
<stroke android:width="1dp" android:color="#B0B0B1" /> | ||
<solid android:color="#FFFFFF" /> | ||
<corners android:radius="10dp" /> | ||
<padding android:right="12dp" /> | ||
</shape> | ||
</item> | ||
<item android:width="25dp" android:height="25dp" android:drawable="@drawable/img_dropdown" android:gravity="center|end" /> | ||
</layer-list> | ||
</item> | ||
</selector> |
Oops, something went wrong.