-
Notifications
You must be signed in to change notification settings - Fork 5
5.7. λͺ©ν
Seulgi Kim edited this page Jan 15, 2021
·
2 revisions
(1) νκ·Έλ₯Ό ν΅ν΄ μνλ³λ‘ λ€λ₯Έ layoutμ 보μ¬μ€
(1) λμμ΄λμ μꡬμ λ°λΌ Custom Dialog μμ±
-
λ°μ΄ν° λ°μΈλ©μ μ¬μ©ν΄
visibility
μμ± μ²λ¦¬ -
fragment_goal.xml
<data>
<import type="android.view.View" />
...
<variable
name="isNotGoalExistThisWeek"
type="Boolean" />
<variable
name="isNotGoalExist"
type="Boolean" />
<variable
name="isGoalExist"
type="Boolean" />
</data>
...
<include
android:id="@+id/layout_keyword_exist"
layout="@layout/layout_goal_fragment_keyword_exist"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="@{isGoalExist ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_alert"
app:temp="@{1}"/>
<include
android:id="@+id/layout_keyword_not_this_week"
layout="@layout/layout_not_keyword_this_week"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="@{isNotGoalExist ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_alert"
app:temp="@{1}"
tools:visibility="gone" />
<include
android:id="@+id/layout_keyword_not"
layout="@layout/layout_goal_fragment_not_keyword"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="@{isNotGoalExistThisWeek ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_alert"
app:temp="@{1}"
tools:visibility="gone" />
...
- GoalAchieveDialog.kt
class GoalAchieveDialog(context: Context) : Dialog(context) {
private lateinit var binding: LayoutGoalAchieveDialogBinding
private var listener: (() -> Unit)? = null
fun setNegativeButtonClickListener(listener: (() -> Unit)): GoalAchieveDialog {
this.listener = listener
return this
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val layoutParams = WindowManager.LayoutParams().apply {
flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND
dimAmount = 0.8f
}
window?.let {
it.attributes = layoutParams
it.setBackgroundDrawableResource(android.R.color.transparent);
}
binding= LayoutGoalAchieveDialogBinding.inflate(LayoutInflater.from(context))
setContentView(binding.root)
binding.ivCancel.setOnClickListener {
listener?.invoke()
dismiss()
}
}
}
λͺ©ν Main | λͺ©ν Detail | λͺ©ν Add |
---|---|---|