Skip to content

Commit 52a8d88

Browse files
committed
lint fix
1 parent 40d2368 commit 52a8d88

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

library/src/main/java/de/markusressel/kodeeditor/library/view/CodeEditorView.kt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import android.view.View
99
import android.widget.TextView
1010
import androidx.annotation.CallSuper
1111
import androidx.annotation.StringRes
12+
import androidx.core.content.withStyledAttributes
1213
import com.otaliastudios.zoom.ZoomApi
1314
import com.otaliastudios.zoom.ZoomLayout
1415
import de.markusressel.kodeeditor.library.R
@@ -149,23 +150,21 @@ open class CodeEditorView
149150
}
150151

151152
private fun readParameters(attrs: AttributeSet?, defStyleAttr: Int) {
152-
val a = context.obtainStyledAttributes(attrs, R.styleable.CodeEditorView, defStyleAttr, 0)
153-
154-
val editTextBackgroundColor = a.getColor(
155-
context,
156-
defaultColor = Color.WHITE,
157-
styleableRes = R.styleable.CodeEditorView_ke_editor_backgroundColor,
158-
attr = intArrayOf(
159-
R.attr.ke_editor_backgroundColor,
160-
android.R.attr.windowBackground
153+
context.withStyledAttributes(attrs, R.styleable.CodeEditorView, defStyleAttr, 0) {
154+
val editTextBackgroundColor = getColor(
155+
context,
156+
defaultColor = Color.WHITE,
157+
styleableRes = R.styleable.CodeEditorView_ke_editor_backgroundColor,
158+
attr = intArrayOf(
159+
R.attr.ke_editor_backgroundColor,
160+
android.R.attr.windowBackground
161+
)
161162
)
162-
)
163-
codeEditText.setBackgroundColor(editTextBackgroundColor)
163+
codeEditText.setBackgroundColor(editTextBackgroundColor)
164164

165-
val maxRealZoom = a.getFloat(R.styleable.CodeEditorView_ke_editor_maxZoom, DEFAULT_MAX_ZOOM)
166-
setMaxZoom(maxRealZoom, ZoomApi.TYPE_REAL_ZOOM)
167-
168-
a.recycle()
165+
val maxRealZoom = getFloat(R.styleable.CodeEditorView_ke_editor_maxZoom, DEFAULT_MAX_ZOOM)
166+
setMaxZoom(maxRealZoom, ZoomApi.TYPE_REAL_ZOOM)
167+
}
169168
}
170169

171170
private fun inflateViews(inflater: LayoutInflater) {

0 commit comments

Comments
 (0)