Implement quickfixes for Android Lint api issues
#KT-16624 Fixed #KT-16625 Fixed #KT-14947 Fixed
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.myapp
|
||||
|
||||
class R {
|
||||
object string {
|
||||
val app_name = 0x7f060021
|
||||
val resource_id = 0x7f060022
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp;
|
||||
|
||||
public final class R {
|
||||
public static final class string {
|
||||
|
||||
}
|
||||
public static final class color {
|
||||
public static final int super_green = 0x7f060021;
|
||||
}
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"isApplicable": false,
|
||||
"intentionText": "Create color value resource 'super_green'"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import android.app.Activity
|
||||
import com.myapp.R
|
||||
|
||||
fun Activity.getSuperGreenColor() = getColor(R.color.<caret>super_green)
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp;
|
||||
|
||||
public final class R {
|
||||
public static final class string {
|
||||
|
||||
}
|
||||
public static final class color {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import android.app.Activity
|
||||
import com.myapp.R
|
||||
|
||||
fun Activity.getSuperGreenColor() = getColor(R.color.super_green)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="super_green">a</color>
|
||||
</resources>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<resources>
|
||||
</resources>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import android.app.Activity
|
||||
import com.myapp.R
|
||||
|
||||
fun Activity.getSuperGreenColor() = getColor(R.color.<caret>super_green)
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"resDirectory": "../../res",
|
||||
"intentionText": "Create color value resource 'super_green'"
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp;
|
||||
|
||||
public final class R {
|
||||
public static final class string {
|
||||
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int activity_main = 0x7f060021;
|
||||
}
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"isApplicable": false,
|
||||
"intentionText": "Create layout resource file 'activity_main.xml'"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import android.app.Activity
|
||||
import com.myapp.R
|
||||
|
||||
fun Activity.getSetMainContentView() = setContentView(R.layout.<caret>activity_main)
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp;
|
||||
|
||||
public final class R {
|
||||
public static final class string {
|
||||
|
||||
}
|
||||
public static final class layout {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import android.app.Activity
|
||||
import com.myapp.R
|
||||
|
||||
fun Activity.getSetMainContentView() = setContentView(R.layout.activity_main)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</LinearLayout>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<resources>
|
||||
</resources>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import android.app.Activity
|
||||
import com.myapp.R
|
||||
|
||||
fun Activity.getSetMainContentView() = setContentView(R.layout.<caret>activity_main)
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"resDirectory": "../../res",
|
||||
"intentionText": "Create layout resource file 'activity_main.xml'"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.myapp;
|
||||
|
||||
public final class R {
|
||||
public static final class string {
|
||||
public static final int my_activity_title = 0x7f060021;
|
||||
}
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"isApplicable": false,
|
||||
"intentionText": "Create string value resource 'my_activity_title'"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import android.content.Context
|
||||
import com.myapp.R
|
||||
|
||||
fun Context.getActivityTitle() = getString(R.string.<caret>my_activity_title)
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.myapp;
|
||||
|
||||
public final class R {
|
||||
public static final class string {
|
||||
public static final int app_name = 0x7f060021;
|
||||
public static final int resource_id = 0x7f060022;
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import android.content.Context
|
||||
import com.myapp.R
|
||||
|
||||
fun Context.getActivityTitle() = getString(R.string.<caret>my_activity_title)
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="my_activity_title">a</string>
|
||||
</resources>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import android.content.Context
|
||||
import com.myapp.R
|
||||
|
||||
fun Context.getActivityTitle() = getString(R.string.<caret>my_activity_title)
|
||||
|
||||
idea/testData/android/resourceIntention/createStringValueResource/simpleFunction/simpleFunction.test
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"resDirectory": "../../res",
|
||||
"intentionText": "Create string value resource 'my_activity_title'"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
fun Activity.getSomeText() {
|
||||
getString(R.string.resource_id)
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some text</string>
|
||||
</resources>
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
fun Activity.getSomeText() {
|
||||
"some <caret>text"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
class MyActivity: Activity() {
|
||||
fun foo() {
|
||||
val a = getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
class MyActivity: Activity() {
|
||||
fun foo() {
|
||||
val a = "some <caret>string"
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
|
||||
class MyActivity: Activity() {
|
||||
class Helper {
|
||||
fun test(context: Context) {
|
||||
val b = context.getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
|
||||
class MyActivity: Activity() {
|
||||
class Helper {
|
||||
fun test(context: Context) {
|
||||
val b = "some <caret>string"
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.myapp
|
||||
|
||||
import android.content.Context
|
||||
|
||||
fun foo(context: Context) {
|
||||
with (context) {
|
||||
with (2) {
|
||||
getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T, R> with(receiver: T, block: T.() -> R): R = receiver.block()
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">zxc</string>
|
||||
</resources>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
package com.myapp
|
||||
|
||||
import android.content.Context
|
||||
|
||||
fun foo(context: Context) {
|
||||
with (context) {
|
||||
with (2) {
|
||||
"z<caret>xc"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T, R> with(receiver: T, block: T.() -> R): R = receiver.block()
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.content.Context
|
||||
|
||||
fun getSomeText(context: Context) {
|
||||
context.getString(R.string.resource_id)
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some text</string>
|
||||
</resources>
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.content.Context
|
||||
|
||||
fun getSomeText(context: Context) {
|
||||
"some <caret>text"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.myapp
|
||||
|
||||
import android.content.Context
|
||||
|
||||
fun <T: Context> T.getText(): String? = getString(R.string.resource_id)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some text</string>
|
||||
</resources>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.myapp
|
||||
|
||||
import android.content.Context
|
||||
|
||||
fun <T: Context> T.getText(): String? = "some <caret>text"
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
class MyActivity: Activity() {
|
||||
inner class Helper {
|
||||
fun a(): String = "q"
|
||||
|
||||
inner class HelperOfHelper {
|
||||
fun b(): String = getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
class MyActivity: Activity() {
|
||||
inner class Helper {
|
||||
fun a(): String = "q"
|
||||
|
||||
inner class HelperOfHelper {
|
||||
fun b(): String = "some <caret>string"
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
|
||||
class MyActivity: Activity() {
|
||||
inner class SubView constructor(context: Context): View(context) {
|
||||
fun test() {
|
||||
val b = context.getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
|
||||
class MyActivity: Activity() {
|
||||
inner class SubView constructor(context: Context): View(context) {
|
||||
fun test() {
|
||||
val b = "some <caret>string"
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
|
||||
class MyActivity: Activity() {
|
||||
object A {
|
||||
fun doSomething(context: Context) {
|
||||
context.getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
|
||||
class MyActivity: Activity() {
|
||||
object A {
|
||||
fun doSomething(context: Context) {
|
||||
"some <caret>string"
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
class MyActivity: Activity() {
|
||||
fun foo() {
|
||||
object {
|
||||
val text = getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
class MyActivity: Activity() {
|
||||
fun foo() {
|
||||
object {
|
||||
val text = "some <caret>string"
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
|
||||
fun foo(context: Context) {
|
||||
object {
|
||||
val text = context.getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
|
||||
fun foo(context: Context) {
|
||||
object {
|
||||
val text = "some <caret>string"
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
fun foo() {
|
||||
val a = "some"
|
||||
val b = "text"
|
||||
val bar = "$a <caret>+ $b"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource",
|
||||
"isApplicable": false
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
|
||||
class MyActivity: Activity() {
|
||||
fun View.foo() {
|
||||
val a = context.getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
|
||||
class MyActivity: Activity() {
|
||||
fun View.foo() {
|
||||
val a = "some <caret>string"
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
|
||||
class DemoView constructor(context: Context): View(context) {
|
||||
fun test() {
|
||||
val b = context.getString(R.string.resource_id)
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="resource_id">some string</string>
|
||||
</resources>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.myapp
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
|
||||
class DemoView constructor(context: Context): View(context) {
|
||||
fun test() {
|
||||
val b = "some <caret>string"
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rFile": "../../R.kt",
|
||||
"resDirectory": "../../res",
|
||||
"intentionClass": "org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource"
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<resources>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user