StormDialog - TEAMSTORMERS/STORM_Android GitHub Wiki
StormDialog ์ฌ์ฉ๋ฐฉ๋ฒ
StormDialogBuilder(dialogImg: Int, title: String)
๋ก StormDialog Buildํ๊ธฐ
-
ํ์ ์์ฑ
-
dialogImg
: ์๋ ์ธ ๊ฐ์ง ์ค ํ๋๋ฅผ ์ ํํ์ฌ ์ฌ์ฉํ๋ฉด ๋จ-
StormDialogBuilder.STORM_LOGO
- ์คํฐ ๋ก๊ณ
-
StormDialogBuilder.THUNDER_LOGO
- ๋ฒ๊ฐ ๋ชจ์ ๋ก๊ณ
-
StormDialogBuilder.LOADING_LOGO
- ๋ก๋ฉ ์ค ์ ๋๋ฉ์ด์
-
-
title
: ๋ค์ด์ผ๋ก๊ทธ์ ๋ค์ด๊ฐ ํ์ดํ
-
-
์ ํ ์์ฑ
-
setContentRes(contentRes: Int)
- ๋ด์ฉ์ผ๋ก ๋ค์ด๊ฐ ๋ ์ด์์์ ID ex)
R.layout.view_rule_reminder
- ๋ด์ฉ์ผ๋ก ๋ค์ด๊ฐ ๋ ์ด์์์ ID ex)
-
setContentText(contentText: String)
- ๋ด์ฉ์ผ๋ก ๋ค์ด๊ฐ ํ ์คํธ
-
setButtonArray(stormDialogButtonArray: ArrayList<StormDialogButton>)
- ์ธ๋ก ๋ฒํผ์ผ๋ก ์ฌ์ฉ๋ ๋ฒํผ ์ด๋ฆ๊ณผ ๋ฆฌ์ค๋๋ก ์ด๋ฃจ์ด์ง
StormDialogButton
๋ค์ ๋ฐฐ์ด
- ์ธ๋ก ๋ฒํผ์ผ๋ก ์ฌ์ฉ๋ ๋ฒํผ ์ด๋ฆ๊ณผ ๋ฆฌ์ค๋๋ก ์ด๋ฃจ์ด์ง
-
setHorizontalArray(stormDialogButtonArray: ArrayList<StormDialogButton>)
- ๊ฐ๋ก ๋ฒํผ์ผ๋ก ์ฌ์ฉ๋ ๋ฒํผ ์ด๋ฆ๊ณผ ๋ฆฌ์ค๋๋ก ์ด๋ฃจ์ด์ง
StormDialogButton
๋ค์ ๋ฐฐ์ด
- ๊ฐ๋ก ๋ฒํผ์ผ๋ก ์ฌ์ฉ๋ ๋ฒํผ ์ด๋ฆ๊ณผ ๋ฆฌ์ค๋๋ก ์ด๋ฃจ์ด์ง
-
-
์ฃผ์์ฌํญ
ContentRes
์ContentText
๋ฅผ ํจ๊ป ์ฌ์ฉํ๋ฉด ์์ธ๊ฐ ๋ฐ์ํ๊ธฐ ๋๋ฌธ์ ๋ ์ค ํ๋๋ง ์ฌ์ฉํ๊ฑฐ๋ ๋ ๋ค ์ฌ์ฉํ์ง ๋ง ๊ฒ. ๊ฐ๋ก ๋ฒํผ๊ณผ ์ธ๋ก ๋ฒํผ์ ํจ๊ป ์ฌ์ฉํ ๊ฒฝ์ฐ ๊ฐ๋ก ๋ฒํผ์ ๊ฐ์ฅ ์๋์ ์์นํ๊ฒ ๋จ
-
Build
- ํ์ํ ์์ฑ์ ๋ชจ๋ ์ง์ ํ์์ผ๋ฉด
.build()
๋ฉ์๋๋ก ์ต์ขStormDialog
์ธ์คํด์ค๋ฅผ ๋ฆฌํด๋ฐ์ ์ ์๋ค.
- ํ์ํ ์์ฑ์ ๋ชจ๋ ์ง์ ํ์์ผ๋ฉด
-
๋ค์ด์ผ๋ก๊ทธ ๋์ฐ๊ธฐ
- ์์ฑ๋
StormDialog
์ธ์คํด์ค์์.show(manager: FragmentManager, tag: String)
๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ฉด ๋ค์ด์ผ๋ก๊ทธ๊ฐ ๋์์ง
- ์์ฑ๋
-
์์ ์ฝ๋
StormDialogBuilder(StormDialogBuilder.STORM_LOGO, "๋ธ๋ ์ธ์คํ ๋ฐ ๋ฃฐ ๋ฆฌ๋ง์ธ๋")
.setContentRes(R.layout.view_rule_reminder)
.setHorizontalArray(buttonArray)
.build()
.show(supportFragmentManager, "rulereminder")
StormDialogButton
๋ฒํผ์ ์ถ๊ฐ ํ๊ณ ์ ํ ๋ ํด๋น ๋ชจ๋ธ์ ์ด์ฉ
- ํ๋กํผํฐ
text: String
- ๋ฒํผ์ ๋ค์ด๊ฐ ํ ์คํธ ex) ํ์ธ, ์ทจ์ ๋ฑ๋ฑ
accentColor: Boolean
- ๋ฒํผ์ ๊ฐ์กฐ ์์ด ๋ค์ด๊ฐ๋์ง ์ฌ๋ถ
listener: StormDialogButton.OnClickListener
- ๋ฒํผ์ ๋๋ ์ ๋ ์คํ๋ ์ฝ๋ฐฑ ๋ฆฌ์ค๋
์์ ์ฝ๋
val buttonArray = ArrayList<StormDialogButton>()
buttonArray.add(
StormDialogButton("์ทจ์", true, object : StormDialogButton.OnClickListener {
override fun onClick() {
Toast.makeText(applicationContext, "์ทจ์ ๋๋ ์", Toast.LENGTH_SHORT).show()
}
})
)
buttonArray.add(
StormDialogButton("ํ์ธ", true, object : StormDialogButton.OnClickListener {
override fun onClick() {
Toast.makeText(applicationContext, "ํ์ธ ๋๋ ์", Toast.LENGTH_SHORT).show()
}
})
)
StormDialogBuilder(StormDialogBuilder.STORM_LOGO, "๋ธ๋ ์ธ์คํ ๋ฐ ๋ฃฐ ๋ฆฌ๋ง์ธ๋")
.setContentRes(R.layout.view_rule_reminder)
.setHorizontalArray(buttonArray)
.build()
.show(supportFragmentManager, "rulereminder")