@@ -17,8 +17,10 @@ import androidx.core.view.isGone
1717import androidx.core.view.isInvisible
1818import androidx.core.view.isVisible
1919import androidx.interpolator.view.animation.FastOutSlowInInterpolator
20- import org.schabi.newpipe.MainActivity
2120
21+ // logs in this class are disabled by default since it's usually not useful,
22+ // you can enable them by setting this flag to MainActivity.DEBUG
23+ private const val DEBUG = false
2224private const val TAG = " ViewUtils"
2325
2426/* *
@@ -38,7 +40,7 @@ fun View.animate(
3840 delay : Long = 0,
3941 execOnEnd : Runnable ? = null
4042) {
41- if (MainActivity . DEBUG ) {
43+ if (DEBUG ) {
4244 val id = try {
4345 resources.getResourceEntryName(id)
4446 } catch (e: Exception ) {
@@ -51,7 +53,7 @@ fun View.animate(
5153 Log .d(TAG , " animate(): $msg " )
5254 }
5355 if (isVisible && enterOrExit) {
54- if (MainActivity . DEBUG ) {
56+ if (DEBUG ) {
5557 Log .d(TAG , " animate(): view was already visible > view = [$this ]" )
5658 }
5759 animate().setListener(null ).cancel()
@@ -60,7 +62,7 @@ fun View.animate(
6062 execOnEnd?.run ()
6163 return
6264 } else if ((isGone || isInvisible) && ! enterOrExit) {
63- if (MainActivity . DEBUG ) {
65+ if (DEBUG ) {
6466 Log .d(TAG , " animate(): view was already gone > view = [$this ]" )
6567 }
6668 animate().setListener(null ).cancel()
@@ -89,7 +91,7 @@ fun View.animate(
8991 * @param colorEnd the background color to end with
9092 */
9193fun View.animateBackgroundColor (duration : Long , @ColorInt colorStart : Int , @ColorInt colorEnd : Int ) {
92- if (MainActivity . DEBUG ) {
94+ if (DEBUG ) {
9395 Log .d(
9496 TAG ,
9597 " animateBackgroundColor() called with: view = [$this ], duration = [$duration ], " +
@@ -109,7 +111,7 @@ fun View.animateBackgroundColor(duration: Long, @ColorInt colorStart: Int, @Colo
109111}
110112
111113fun View.animateHeight (duration : Long , targetHeight : Int ): ValueAnimator {
112- if (MainActivity . DEBUG ) {
114+ if (DEBUG ) {
113115 Log .d(TAG , " animateHeight: duration = [$duration ], from $height to → $targetHeight in: $this " )
114116 }
115117 val animator = ValueAnimator .ofFloat(height.toFloat(), targetHeight.toFloat())
@@ -127,7 +129,7 @@ fun View.animateHeight(duration: Long, targetHeight: Int): ValueAnimator {
127129}
128130
129131fun View.animateRotation (duration : Long , targetRotation : Int ) {
130- if (MainActivity . DEBUG ) {
132+ if (DEBUG ) {
131133 Log .d(TAG , " animateRotation: duration = [$duration ], from $rotation to → $targetRotation in: $this " )
132134 }
133135 animate().setListener(null ).cancel()
0 commit comments