You can change the code by using structual equality instead as below:
// use structual equality instead ---v
if (visibility and View.SYSTEM_UI_FLAG_FULLSCREEN == 0) {
decorView.systemUiVisibility = flags
}
Why don’t suggest to use referential equality? you can see my answer here.
On the other hand, when you use referential/identity equality maybe return false
, for example:
val ranged = arrayListOf(127, 127)
println(ranged[0] === ranged[1]) // true
println(ranged[0] == ranged[1]) // true
val exclusive = arrayListOf(128, 128)
// v--- print `false` here
println(exclusive[0] === exclusive[1]) // false
println(exclusive[0] == exclusive[1]) // true