get System Bar Controller
Gets or creates a cached SystemBarController instance for this Window.
Uses View.setTag() to cache the controller instance in the decorView, ensuring one controller per Window.
이 Window에 대한 캐시된 SystemBarController 인스턴스를 가져오거나 생성합니다.
View.setTag()를 사용하여 decorView에 컨트롤러 인스턴스를 캐싱하여 Window당 하나의 컨트롤러를 보장합니다.
Why caching is needed / 캐싱이 필요한 이유:
SystemBarController creates internal helper instances (StatusBarHelper, NavigationBarHelper)
Creating multiple instances for the same Window causes memory waste and potential conflicts
Caching ensures consistent state management across multiple calls
SystemBarController는 내부 헬퍼 인스턴스를 생성합니다 (StatusBarHelper, NavigationBarHelper)
동일한 Window에 대해 여러 인스턴스를 생성하면 메모리 낭비 및 잠재적 충돌이 발생합니다
캐싱은 여러 호출에 걸쳐 일관된 상태 관리를 보장합니다
Important / 주의사항:
The controller is NOT automatically destroyed. You must manually call
onDestroy()when done.Recommended to call
onDestroy()in Activity/Dialog'sonDestroy()lifecycle method.Alternatively, use
destroySystemBarControllerCache()for automatic cleanup and cache removal.컨트롤러는 자동으로 파괴되지 않습니다. 사용 완료 시 수동으로
onDestroy()를 호출해야 합니다.Activity/Dialog의
onDestroy()라이프사이클 메서드에서onDestroy()호출을 권장합니다.또는 자동 정리 및 캐시 제거를 위해
destroySystemBarControllerCache()를 사용하세요.
Usage / 사용법:
class MyActivity : AppCompatActivity() {
private lateinit var systemBarController: SystemBarController
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Get cached controller (or create new one)
systemBarController = window.getSystemBarController()
systemBarController.setStatusBarColor(Color.RED)
}
override fun onDestroy() {
systemBarController.onDestroy()
super.onDestroy()
}
}
```<br><br>
@return Cached SystemBarController instance, or newly created instance if not cached.<br><br>
캐시된 SystemBarController 인스턴스, 캐시되지 않은 경우 새로 생성된 인스턴스.<br>