Skip to content

Instantly share code, notes, and snippets.

@molidev8
Created December 7, 2022 19:01
Show Gist options
  • Save molidev8/85f895d01f907ff66b77828a19634217 to your computer and use it in GitHub Desktop.
Save molidev8/85f895d01f907ff66b77828a19634217 to your computer and use it in GitHub Desktop.
A CustomView child
class CustomSwitchThumbPill : CustomSwitchManager {
private lateinit var binding: CustomSwitchThumbPillBinding
override fun initView(
context: Context,
viewGroup: ViewGroup,
animText: Boolean,
manual: Boolean,
textVisible: Boolean,
text: String
) {
binding = CustomSwitchThumbPillBinding.inflate(LayoutInflater.from(context), viewGroup, true)
setText(text)
}
override fun setAnimText(shouldAnim: Boolean) {
// do something
}
override fun setManual(shouldBeManual: Boolean) {
// do something
}
override fun setTextVisible(shouldBeVisible: Boolean) {
// do something
}
override fun setText(text: String) {
binding.switchHint.text = text
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment