Skip to content

Instantly share code, notes, and snippets.

@socmia
Created November 9, 2018 08:53
Show Gist options
  • Save socmia/1d94a3a74c796219fa67b5ce4006448a to your computer and use it in GitHub Desktop.
Save socmia/1d94a3a74c796219fa67b5ce4006448a to your computer and use it in GitHub Desktop.
class SegmentView(context: Context, attrs: AttributeSet) : LinearLayout(context, attrs) {
init {
View.inflate(context, R.layout. segment_button, this);
val btnSeg1: Button = findViewById(R.id.button)
val btnSeg2: Button = findViewById(R.id.button2)
}
}
fun toastMe(v: View) {
val myToast = Toast.makeText(this, "Toast me clicked", Toast.LENGTH_LONG)
myToast.show()
}
fun countMe(v: View) {
val shouldCountTextMe = findViewById<TextView>(R.id.textView)
val countStr = shouldCountTextMe.text.toString()
var count: Int = Integer.parseInt(countStr)
count++
shouldCountTextMe.text = count.toString();
}
fun countYou(id: Int){
when(id) {
1 -> {
Log.d("Loi", "FONT");
}
2 -> {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment