! 프로젝트 만들고 나면 수정할 예정
// fragment 가 보이기 시작할때
override fun onResume() {
super.onResume()
// 알파값 조정으로 fade in 구현하기
ObjectAnimator.ofFloat(this.binding.textView, View.ALPHA, 0f,1f).apply {
duration = 2000
start()
}
// 알파값 조정으로 fade out 구현하기
ObjectAnimator.ofFloat(this.binding.textView, View.ALPHA, 1f,0f).apply {
duration = 2000
start()
}
// View 가 회전하면서 돌아오기
ObjectAnimator.ofFloat(this.binding.textView, View.ROTATION, 180f,0f).apply {
duration = 2000
start()
}
// View 가 위에서 아래로 회전하면서 돌아오기
ObjectAnimator.ofFloat(this.binding.textView, View.ROTATION_X, 180f,0f).apply {
duration = 2000
start()
}
// View 가 좌우로 회전하면서 돌아오기
ObjectAnimator.ofFloat(this.binding.textView, View.ROTATION_Y, 180f,0f).apply {
duration = 2000
start()
}
// X 축으로 줄이고 늘리기
ObjectAnimator.ofFloat(this.binding.fullscreenContent, View.SCALE_X, 0.5f,5f,1f,0.5f,2.0f,1.0f).apply {
duration = 2000
start()
}
// Y 축으로 줄이고 늘리기
ObjectAnimator.ofFloat(this.binding.fullscreenContent, View.SCALE_Y, 0.5f,5f,1f,0.5f,2.0f,1.0f).apply {
duration = 2000
start()
}
}
private fun getStatusBarHeight(): Int {
var result = 0
// val resourceId: Int = this.applicationContext.resources.getIdentifier("status_bar_height", "dimen", "android");
val resourceId: Int = resources.getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
// result = this.applicationContext.resources.getDimensionPixelSize(resourceId)
result = resources.getDimensionPixelSize(resourceId)
}
return result
}
val statusHeight = getStatusBarHeight()
private fun getNaviBarHeight(): Int {
var result = 0
// val resources: Resources = this.application.resources
val resourceId: Int = resources.getIdentifier("navigation_bar_height", "dimen", "android")
if (resourceId > 0) {
result = resources.getDimensionPixelSize(resourceId)
}
return result
}
val naviHeight = getNaviBarHeight()