-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
๐:: (#42) ์ํ ์ผ๊ธฐ Local CR ๊ธฐ๋ฅ ๊ตฌํ
- Loading branch information
Showing
80 changed files
with
259 additions
and
37 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
22 changes: 22 additions & 0 deletions
22
...in/java/com/yongjincompany/hackerthonandroid/features/calendar/utils/DayStateDecorator.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,22 @@ | ||
package com.yongjincompany.hackerthonandroid.features.calendar.utils | ||
|
||
import android.content.Context | ||
import androidx.core.content.ContextCompat | ||
import com.prolificinteractive.materialcalendarview.CalendarDay | ||
import com.prolificinteractive.materialcalendarview.DayViewDecorator | ||
import com.prolificinteractive.materialcalendarview.DayViewFacade | ||
import com.prolificinteractive.materialcalendarview.spans.DotSpan | ||
import com.yongjincompany.hackerthonandroid.R | ||
|
||
|
||
class DayStateDecorator(val context: Context, val dates: List<String>): DayViewDecorator { | ||
|
||
override fun shouldDecorate(day: CalendarDay): Boolean { | ||
return dates.contains("${day.year}-${String.format("%02d", day.month)}-${String.format("%02d", day.day)}") | ||
} | ||
|
||
override fun decorate(view: DayViewFacade) { | ||
view.addSpan(DotSpan(5f, ContextCompat.getColor(context, R.color.main))) | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
.../main/java/com/yongjincompany/hackerthonandroid/features/calendar/utils/TodayDecorator.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,20 @@ | ||
package com.yongjincompany.hackerthonandroid.features.calendar.utils | ||
|
||
import android.content.Context | ||
import android.graphics.Color | ||
import android.text.style.ForegroundColorSpan | ||
import com.prolificinteractive.materialcalendarview.CalendarDay | ||
import com.prolificinteractive.materialcalendarview.DayViewDecorator | ||
import com.prolificinteractive.materialcalendarview.DayViewFacade | ||
|
||
class TodayDecorator:DayViewDecorator { | ||
|
||
private var date = CalendarDay.today() | ||
|
||
override fun shouldDecorate(day: CalendarDay?): Boolean { | ||
return day?.equals(date)!! | ||
} | ||
override fun decorate(view: DayViewFacade?) { | ||
view?.addSpan(object: ForegroundColorSpan(Color.parseColor("#D5B4FF")){}) | ||
} | ||
} |
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
18 changes: 17 additions & 1 deletion
18
...c/main/java/com/yongjincompany/hackerthonandroid/features/diary/vm/StateDiaryViewModel.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 |
---|---|---|
@@ -1,10 +1,26 @@ | ||
package com.yongjincompany.hackerthonandroid.features.diary.vm | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.yongjincompany.hackerthonandroid.database.RoomDatabase | ||
import com.yongjincompany.hackerthonandroid.database.entity.DayStateEntity | ||
import kotlinx.coroutines.launch | ||
|
||
class StateDiaryViewModel : ViewModel() { | ||
|
||
var database: RoomDatabase? = null | ||
|
||
|
||
fun saveState(date: String, bodyState: String, mood: String, behaviorChange: String) { | ||
viewModelScope.launch { | ||
database?.dayStateDao()?.insertDayState( | ||
DayStateEntity( | ||
date, | ||
bodyState = bodyState, | ||
mood = mood, | ||
behaviorChange = behaviorChange, | ||
) | ||
) | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.