Android: Add inspection & quickfix to convert findViewById to api 26

#KT-19940 Fixed Target Version 1.1.5
This commit is contained in:
Vyacheslav Gerasimov
2017-08-30 18:19:58 +03:00
parent be900a76d8
commit 5220dfc0ad
15 changed files with 303 additions and 13 deletions
@@ -0,0 +1,28 @@
// INTENTION_TEXT: Convert cast to findViewById with type parameter
// INSPECTION_CLASS: org.jetbrains.kotlin.android.inspection.TypeParameterFindViewByIdInspection
import android.app.Activity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
class OtherActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_other)
val tvHello = <caret>findViewById(R.id.tvHello) as TextView?
}
}
class R {
object layout {
val activity_other = 100500
}
object id {
val tvHello = 0
}
}
@@ -0,0 +1,28 @@
// INTENTION_TEXT: Convert cast to findViewById with type parameter
// INSPECTION_CLASS: org.jetbrains.kotlin.android.inspection.TypeParameterFindViewByIdInspection
import android.app.Activity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
class OtherActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_other)
val tvHello = findViewById<TextView>(R.id.tvHello)
}
}
class R {
object layout {
val activity_other = 100500
}
object id {
val tvHello = 0
}
}
@@ -0,0 +1,28 @@
// INTENTION_TEXT: Convert cast to findViewById with type parameter
// INSPECTION_CLASS: org.jetbrains.kotlin.android.inspection.TypeParameterFindViewByIdInspection
import android.app.Activity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
class OtherActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_other)
val tvHello = <caret>findViewById(R.id.tvHello) as TextView
}
}
class R {
object layout {
val activity_other = 100500
}
object id {
val tvHello = 0
}
}
@@ -0,0 +1,28 @@
// INTENTION_TEXT: Convert cast to findViewById with type parameter
// INSPECTION_CLASS: org.jetbrains.kotlin.android.inspection.TypeParameterFindViewByIdInspection
import android.app.Activity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
class OtherActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_other)
val tvHello = findViewById<TextView>(R.id.tvHello)
}
}
class R {
object layout {
val activity_other = 100500
}
object id {
val tvHello = 0
}
}