my_floating_button.setOnClickListener(null)
my_floating_button.setOnClickListener {
my_floating_button.toggleMenu()
}
val llp = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
llp.width = SingleChoiceQuestionFragment.convertDpToPixel(50f, this)
llp.height = SingleChoiceQuestionFragment.convertDpToPixel(50f, this)
my_floating_button.subMenuButtons.clear()
val responses = question.responses
for (i in responses.size - 1 downTo 0) {
val floatingSubButton = FloatingSubButton(this)
var d: TextDrawable
if (responses[i] == resposesList[question.number]?.yourResponse) {
d = TextDrawable.builder()
.beginConfig()
.withBorder(4) /* thickness in px */
.textColor(Color.parseColor("#26c6da"))
.bold()
.endConfig()
.buildRound(responses[i], Color.WHITE)
} else {
d = TextDrawable.builder().buildRound(responses[i], Color.parseColor("#26c6da"))
}
floatingSubButton.background = d
my_floating_button.addFloatingSubButton(floatingSubButton, llp)
floatingSubButton.setOnClickListener {
my_floating_button.closeMenu()
question.correctResponse.let { it1 -> onResponseSelected(responses[i], question.number, it1, question.question + ".jpg") }
setCorrectButtons(question)
}
}
}`
The listener always gets called when I click the button. The method toggleMenu() does nothing when called. It does not open the menu even if it has 4 childs in it. I've done debugging