Skip to content

Commit

Permalink
Introduce UNDEFINED_RES_ID and use it instead of the "-1" hard coded …
Browse files Browse the repository at this point in the history
…value
  • Loading branch information
daniloercoli committed Feb 18, 2019
1 parent 7717a42 commit 898ff6a
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -27,10 +27,11 @@ class PromoDialog : AppCompatDialogFragment() {
private const val STATE_KEY_POSITIVE_BUTTON_LABEL = "state_key_positive_button_label"
private const val STATE_KEY_NEGATIVE_BUTTON_LABEL = "state_key_negative_button_label"
private const val STATE_KEY_NEUTRAL_BUTTON_LABEL = "state_key_neutral_button_label"
private const val UNDEFINED_RES_ID = -1
}

@DrawableRes
private var drawableResId: Int = -1
private var drawableResId: Int = UNDEFINED_RES_ID
private lateinit var fragmentTag: String
private lateinit var linkLabel: String
private lateinit var message: String
Expand All @@ -56,7 +57,7 @@ class PromoDialog : AppCompatDialogFragment() {
title: String,
message: String,
positiveButtonLabel: String,
@DrawableRes drawableResId: Int = -1,
@DrawableRes drawableResId: Int = UNDEFINED_RES_ID,
negativeButtonLabel: String = "",
linkLabel: String = "",
neutralButtonLabel: String = ""
Expand Down Expand Up @@ -114,7 +115,7 @@ class PromoDialog : AppCompatDialogFragment() {

private fun initializeView(view: View) {
val imageContainer = view.findViewById<LinearLayout>(R.id.promo_dialog_image_container)
if (drawableResId == -1) {
if (drawableResId == UNDEFINED_RES_ID) {
imageContainer.visibility = View.GONE
} else {
val image = view.findViewById<ImageView>(R.id.promo_dialog_image)
Expand Down

0 comments on commit 898ff6a

Please sign in to comment.