-
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.
#89 feat: NRLoading 커스텀 뷰 구현 및 전체 적용
로딩중에 터치가 되지 않도록 커스텀뷰를 제작하여 적용함
- Loading branch information
1 parent
03b1b85
commit f566ccd
Showing
5 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
presentation/src/main/java/com/nextroom/nextroom/presentation/common/NRLoading.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,45 @@ | ||
package com.nextroom.nextroom.presentation.common | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.ViewGroup | ||
import android.widget.FrameLayout | ||
import android.widget.ProgressBar | ||
import androidx.core.content.ContextCompat | ||
|
||
class NRLoading @JvmOverloads constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null, | ||
defStyleAttr: Int = 0, | ||
) : FrameLayout(context, attrs, defStyleAttr) { | ||
|
||
init { | ||
// 레이아웃의 크기를 부모의 크기로 설정 | ||
layoutParams = ViewGroup.LayoutParams( | ||
ViewGroup.LayoutParams.MATCH_PARENT, | ||
ViewGroup.LayoutParams.MATCH_PARENT, | ||
) | ||
|
||
// 배경을 투명하게 설정 | ||
setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent)) | ||
|
||
// ProgressBar를 가운데에 배치 | ||
val progressBar = ProgressBar(context).apply { | ||
layoutParams = LayoutParams( | ||
LayoutParams.WRAP_CONTENT, | ||
LayoutParams.WRAP_CONTENT, | ||
).apply { | ||
// 가운데 정렬 | ||
gravity = android.view.Gravity.CENTER | ||
} | ||
} | ||
|
||
// 로딩중에 하위 뷰 터치 막기 | ||
setOnTouchListener { _, _ -> | ||
true | ||
} | ||
|
||
// ProgressBar를 이 뷰에 추가 | ||
addView(progressBar) | ||
} | ||
} |
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