Skip to content

Commit b0f4575

Browse files
author
e16din
committed
Update code.
1 parent 2bc3ac0 commit b0f4575

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

  • codeview/src/main/java/io/github/kbiakov/codeview

codeview/src/main/java/io/github/kbiakov/codeview/CodeView.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class CodeView : RelativeLayout {
121121
*/
122122
var adapter: AbstractCodeAdapter<*>?
123123
get() {
124-
return rvCodeContent.adapter as AbstractCodeAdapter<*>
124+
return rvCodeContent.adapter as? AbstractCodeAdapter<*>
125125
}
126126
set(adapter) {
127127
rvCodeContent.adapter = adapter
@@ -172,18 +172,16 @@ class CodeView : RelativeLayout {
172172
// default color theme provided by enum
173173
fun colorTheme(colorTheme: ColorTheme): CodeView {
174174
this.colorTheme = colorTheme.with()
175-
if (rvCodeContent.adapter != null) {
176-
adapter?.colorTheme = this.colorTheme
177-
}
175+
adapter?.colorTheme = this.colorTheme
176+
178177
return this
179178
}
180179

181180
// custom color theme provided by user
182181
fun colorTheme(colorTheme: ColorThemeData): CodeView {
183182
this.colorTheme = colorTheme
184-
if (rvCodeContent.adapter != null) {
185-
adapter?.colorTheme = this.colorTheme
186-
}
183+
adapter?.colorTheme = this.colorTheme
184+
187185
return this
188186
}
189187

0 commit comments

Comments
 (0)