-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: 마이페이지 닉네임 임시로 지정 * feat: 바로가기 기능 구현 * feat: 참여버튼 클릭 시 댓글방으로 가도록 기능 구현 * feat: 신고하기 이미지 추가 * style: lint적용 * refactor: 불러오는 공모 페이지 사이즈 변경
- Loading branch information
Showing
10 changed files
with
130 additions
and
6 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
android/app/src/main/java/com/zzang/chongdae/presentation/util/Event.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,17 @@ | ||
package com.zzang.chongdae.presentation.util | ||
|
||
open class Event<out T>(private val content: T) { | ||
var hasBeenHandled = false | ||
private set | ||
|
||
fun getContentIfNotHandled(): T? { | ||
return if (hasBeenHandled) { | ||
null | ||
} else { | ||
hasBeenHandled = true | ||
content | ||
} | ||
} | ||
|
||
fun peekContent(): T = content | ||
} |
15 changes: 15 additions & 0 deletions
15
android/app/src/main/java/com/zzang/chongdae/presentation/util/MutableSingleLiveData.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,15 @@ | ||
package com.zzang.chongdae.presentation.util | ||
|
||
class MutableSingleLiveData<T> : SingleLiveData<T> { | ||
constructor() : super() | ||
|
||
constructor(value: T) : super(value) | ||
|
||
public override fun postValue(value: T) { | ||
super.postValue(value) | ||
} | ||
|
||
public override fun setValue(value: T) { | ||
super.setValue(value) | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
android/app/src/main/java/com/zzang/chongdae/presentation/util/SingleLiveData.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,38 @@ | ||
package com.zzang.chongdae.presentation.util | ||
|
||
import androidx.lifecycle.LifecycleOwner | ||
import androidx.lifecycle.MutableLiveData | ||
|
||
abstract class SingleLiveData<T> { | ||
private val liveData = MutableLiveData<Event<T>>() | ||
|
||
protected constructor() | ||
|
||
protected constructor(value: T) { | ||
liveData.value = Event(value) | ||
} | ||
|
||
protected open fun setValue(value: T) { | ||
liveData.value = Event(value) | ||
} | ||
|
||
protected open fun postValue(value: T) { | ||
liveData.postValue(Event(value)) | ||
} | ||
|
||
fun getValue() = liveData.value?.peekContent() | ||
|
||
fun observe( | ||
owner: LifecycleOwner, | ||
onResult: (T) -> Unit, | ||
) { | ||
liveData.observe(owner) { it.getContentIfNotHandled()?.let(onResult) } | ||
} | ||
|
||
fun observePeek( | ||
owner: LifecycleOwner, | ||
onResult: (T) -> Unit, | ||
) { | ||
liveData.observe(owner) { onResult(it.peekContent()) } | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<group> | ||
<clip-path | ||
android:pathData="M0,0h24v24h-24z"/> | ||
<path | ||
android:pathData="M11.999,7C13.552,7 15.044,7.602 16.162,8.678C17.28,9.755 17.937,11.224 17.995,12.775L17.999,13V20H18.999C19.254,20 19.499,20.098 19.685,20.273C19.87,20.448 19.982,20.687 19.997,20.941C20.011,21.196 19.929,21.446 19.765,21.642C19.601,21.837 19.369,21.963 19.116,21.993L18.999,22H4.999C4.745,22 4.499,21.902 4.314,21.727C4.129,21.552 4.017,21.313 4.002,21.059C3.987,20.804 4.07,20.554 4.234,20.358C4.397,20.163 4.629,20.037 4.882,20.007L4.999,20H5.999V13C5.999,11.409 6.632,9.883 7.757,8.757C8.882,7.632 10.408,7 11.999,7ZM11.142,11.986L9.651,14.47C9.559,14.623 9.51,14.798 9.507,14.977C9.505,15.156 9.55,15.332 9.638,15.488C9.726,15.643 9.854,15.773 10.009,15.863C10.163,15.953 10.339,16 10.517,16H11.733L11.142,16.985C11.012,17.212 10.975,17.481 11.041,17.735C11.106,17.989 11.269,18.207 11.494,18.342C11.718,18.477 11.987,18.518 12.242,18.457C12.497,18.396 12.717,18.237 12.856,18.015L14.347,15.53C14.439,15.377 14.489,15.202 14.491,15.023C14.494,14.844 14.449,14.668 14.361,14.512C14.272,14.357 14.145,14.227 13.99,14.137C13.836,14.047 13.66,14 13.481,14H12.265L12.856,13.015C12.987,12.788 13.024,12.519 12.958,12.265C12.892,12.011 12.73,11.793 12.505,11.658C12.281,11.523 12.012,11.482 11.757,11.543C11.502,11.604 11.281,11.763 11.142,11.985V11.986ZM5.541,5.139L5.635,5.222L6.342,5.929C6.522,6.109 6.626,6.35 6.634,6.604C6.641,6.858 6.552,7.106 6.384,7.296C6.216,7.487 5.982,7.606 5.729,7.63C5.476,7.654 5.223,7.581 5.022,7.426L4.928,7.343L4.221,6.636C4.042,6.456 3.938,6.215 3.93,5.961C3.922,5.707 4.012,5.459 4.18,5.269C4.348,5.078 4.582,4.959 4.835,4.935C5.088,4.911 5.34,4.984 5.541,5.139ZM19.777,5.222C19.965,5.41 20.07,5.664 20.07,5.929C20.07,6.194 19.965,6.448 19.777,6.636L19.07,7.343C18.978,7.439 18.868,7.515 18.746,7.567C18.624,7.62 18.493,7.647 18.36,7.648C18.227,7.649 18.095,7.624 17.972,7.574C17.85,7.524 17.738,7.449 17.644,7.355C17.55,7.261 17.476,7.15 17.426,7.027C17.375,6.904 17.35,6.772 17.351,6.64C17.352,6.507 17.38,6.376 17.432,6.254C17.485,6.132 17.561,6.021 17.656,5.929L18.363,5.222C18.551,5.035 18.805,4.929 19.07,4.929C19.336,4.929 19.59,5.035 19.777,5.222ZM11.999,2C12.265,2 12.519,2.105 12.707,2.293C12.894,2.48 12.999,2.735 12.999,3V4C12.999,4.265 12.894,4.52 12.707,4.707C12.519,4.895 12.265,5 11.999,5C11.734,5 11.48,4.895 11.292,4.707C11.105,4.52 10.999,4.265 10.999,4V3C10.999,2.735 11.105,2.48 11.292,2.293C11.48,2.105 11.734,2 11.999,2Z" | ||
android:fillColor="#F15642" | ||
android:fillType="evenOdd"/> | ||
</group> | ||
</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
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