diff options
author | Haibo Huang <hhb@google.com> | 2019-06-06 19:15:37 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-06-06 19:15:37 -0700 |
commit | ae21f0b06e07d121cabd9d6f3bd288471ddc6e64 (patch) | |
tree | b9b384beaf7d9feb58e1ed5eb13d3cb6d8ca37a8 | |
parent | 85db764efef43c277eb17a9a3801de078c6fc997 (diff) | |
parent | d913216e27edbdea63632a5c860cc52c5e7bc86e (diff) | |
download | base-ae21f0b06e07d121cabd9d6f3bd288471ddc6e64.tar.gz |
Merge "Fix kotlinc warnings in EasterEgg."
am: d913216e27
Change-Id: Ib0128b40a8087096765b7268eaf2591973feb993
3 files changed, 30 insertions, 40 deletions
diff --git a/packages/EasterEgg/src/com/android/egg/paint/CutoutAvoidingToolbar.kt b/packages/EasterEgg/src/com/android/egg/paint/CutoutAvoidingToolbar.kt index 164fc5a5af3d..9855565c1335 100644 --- a/packages/EasterEgg/src/com/android/egg/paint/CutoutAvoidingToolbar.kt +++ b/packages/EasterEgg/src/com/android/egg/paint/CutoutAvoidingToolbar.kt @@ -26,15 +26,16 @@ class CutoutAvoidingToolbar : LinearLayout { private var _insets: WindowInsets? = null constructor(context: Context) : super(context) { - init(null, 0) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(attrs, 0) } - constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) { - init(attrs, defStyle) + constructor( + context: Context, + attrs: AttributeSet, + defStyle: Int + ) : super(context, attrs, defStyle) { } override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { @@ -81,8 +82,4 @@ class CutoutAvoidingToolbar : LinearLayout { requestLayout() } } - - private fun init(attrs: AttributeSet?, defStyle: Int) { - } - } diff --git a/packages/EasterEgg/src/com/android/egg/paint/Painting.kt b/packages/EasterEgg/src/com/android/egg/paint/Painting.kt index 5431ae539ba1..9e55d2c74be7 100644 --- a/packages/EasterEgg/src/com/android/egg/paint/Painting.kt +++ b/packages/EasterEgg/src/com/android/egg/paint/Painting.kt @@ -17,7 +17,6 @@ package com.android.egg.paint import android.content.Context -import android.content.res.Resources import android.graphics.* import android.provider.Settings import android.util.AttributeSet @@ -26,7 +25,6 @@ import android.view.MotionEvent import android.view.View import android.view.WindowInsets import java.util.concurrent.TimeUnit -import android.util.Log import android.provider.Settings.System import org.json.JSONObject @@ -86,11 +84,11 @@ public class Painting : View, SpotFilter.Plotter { } var bitmap: Bitmap? = null - var paperColor : Int = 0xFFFFFFFF.toInt() + var paperColor: Int = 0xFFFFFFFF.toInt() private var _paintCanvas: Canvas? = null private val _bitmapLock = Object() - + private var _drawPaint = Paint(Paint.ANTI_ALIAS_FLAG) private var _lastX = 0f private var _lastY = 0f @@ -113,7 +111,9 @@ public class Painting : View, SpotFilter.Plotter { FADE_TO_BLACK_CF synchronized(_bitmapLock) { - c.drawBitmap(bitmap, 0f, 0f, pt) + bitmap?.let { + c.drawBitmap(bitmap!!, 0f, 0f, pt) + } } invalidate() } @@ -122,18 +122,22 @@ public class Painting : View, SpotFilter.Plotter { } constructor(context: Context) : super(context) { - init(null, 0) + init() } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(attrs, 0) + init() } - constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) { - init(attrs, defStyle) + constructor( + context: Context, + attrs: AttributeSet, + defStyle: Int + ) : super(context, attrs, defStyle) { + init() } - private fun init(attrs: AttributeSet?, defStyle: Int) { + private fun init() { loadDevicePressureData() } @@ -264,7 +268,7 @@ public class Painting : View, SpotFilter.Plotter { super.onDraw(canvas) bitmap?.let { - canvas.drawBitmap(bitmap, 0f, 0f, _drawPaint); + canvas.drawBitmap(bitmap!!, 0f, 0f, _drawPaint) } } @@ -330,8 +334,8 @@ public class Painting : View, SpotFilter.Plotter { } if (bits.width != oldBits.height || bits.height != oldBits.width) { matrix.postScale( - bits.width.toFloat()/oldBits.height, - bits.height.toFloat()/oldBits.width) + bits.width.toFloat() / oldBits.height, + bits.height.toFloat() / oldBits.width) } c.setMatrix(matrix) } @@ -350,9 +354,10 @@ public class Painting : View, SpotFilter.Plotter { val invertPaint = Paint() invertPaint.colorFilter = INVERT_CF synchronized(_bitmapLock) { - _paintCanvas?.drawBitmap(bitmap, 0f, 0f, invertPaint) + bitmap?.let { + _paintCanvas?.drawBitmap(bitmap!!, 0f, 0f, invertPaint) + } } invalidate() } } - diff --git a/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt b/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt index 86b11e7be81e..460fa3a7241f 100644 --- a/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt +++ b/packages/EasterEgg/src/com/android/egg/paint/ToolbarView.kt @@ -17,19 +17,10 @@ package com.android.egg.paint import android.content.Context -import android.graphics.Canvas -import android.graphics.Color -import android.graphics.Paint -import android.graphics.Rect -import android.graphics.drawable.Drawable -import android.text.TextPaint -import android.transition.ChangeBounds import android.transition.Transition import android.transition.TransitionListenerAdapter -import android.transition.TransitionManager import android.util.AttributeSet import android.view.* -import android.view.animation.OvershootInterpolator import android.widget.FrameLayout class ToolbarView : FrameLayout { @@ -44,15 +35,16 @@ class ToolbarView : FrameLayout { } constructor(context: Context) : super(context) { - init(null, 0) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(attrs, 0) } - constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) { - init(attrs, defStyle) + constructor( + context: Context, + attrs: AttributeSet, + defStyle: Int + ) : super(context, attrs, defStyle) { } override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets { @@ -70,8 +62,4 @@ class ToolbarView : FrameLayout { return super.onApplyWindowInsets(insets) } - - private fun init(attrs: AttributeSet?, defStyle: Int) { - } - } |