Package com.naver.ads.ui
Class NasViewDecorator
-
- All Implemented Interfaces:
-
com.naver.ads.ui.AspectRatioDecorator,com.naver.ads.ui.NasDecorator,com.naver.ads.ui.RoundCornerDecorator
public final class NasViewDecorator extends ViewDecorator implements NasDecorator
Decorator implementations for applying rounded corner and aspect ratio to the given view.
-
-
Constructor Summary
Constructors Constructor Description NasViewDecorator(View view, ViewDecorator.SuperOnMeasureDispatcher superOnMeasureDispatcher, ViewDecorator.SuperDrawDispatcher superDrawDispatcher, ViewDecorator.SuperDispatchDrawDispatcher superDispatchDrawDispatcher)Creates a NasViewDecorator instance.
-
Method Summary
Modifier and Type Method Description UnitsetAspectRatio(Float aspectRatio)Sets the aspect ratio that this view should satisfy. UnitsetAspectRatioListener(AspectRatioDecorator.AspectRatioListener aspectRatioListener)Sets the AspectRatioListener. UnitsetResizeMode(AspectRatioDecorator.ResizeMode resizeMode)Sets the ResizeMode. UnitsetCornerRadius(Float cornerRadius)Sets the radius for each corner. UnitsetCornerRadius(Float topLeft, Float topRight, Float bottomRight, Float bottomLeft)Sets different radius for each corners. UnitsetBorderColor(Integer borderColor)Sets the color to be used for the border line. UnitsetBorderWidth(Float borderWidth)Sets the width that will be used for the border line. Unitdraw(Canvas canvas)Called when the android.view.View.draw method is called on the given view. UnitdispatchDraw(Canvas canvas)Called when the android.view.View.dispatchDraw method is called on the given view. UnitonMeasure(Integer widthMeasureSpec, Integer heightMeasureSpec)Called when the android.view.View.onMeasure method is called on the given view. UnitonSizeChanged(Integer w, Integer h, Integer oldw, Integer oldh)Called when the android.view.View.onSizeChanged method is called on the given view. -
-
Constructor Detail
-
NasViewDecorator
NasViewDecorator(View view, ViewDecorator.SuperOnMeasureDispatcher superOnMeasureDispatcher, ViewDecorator.SuperDrawDispatcher superDrawDispatcher, ViewDecorator.SuperDispatchDrawDispatcher superDispatchDrawDispatcher)
Creates a NasViewDecorator instance.- Parameters:
view- the view which rounded corner and aspect ratio will be applied.superOnMeasureDispatcher- the dispatcher that calls the android.view.View.onMeasure method of the parent of the given view.superDrawDispatcher- the dispatcher that calls the android.view.View.draw method of the parent of the given view.superDispatchDrawDispatcher- the dispatcher that calls the android.view.View.dispatchDraw method of the parent of the given view.
-
-
Method Detail
-
setAspectRatio
Unit setAspectRatio(Float aspectRatio)
Sets the aspect ratio that this view should satisfy.
- Parameters:
aspectRatio- the with to height ratio.
-
setAspectRatioListener
Unit setAspectRatioListener(AspectRatioDecorator.AspectRatioListener aspectRatioListener)
Sets the AspectRatioListener.
- Parameters:
aspectRatioListener- the listener to be notified about aspect ratios changes, or null to clear a listener that was previously set.
-
setResizeMode
Unit setResizeMode(AspectRatioDecorator.ResizeMode resizeMode)
Sets the ResizeMode.
- Parameters:
resizeMode- the ResizeMode.
-
setCornerRadius
Unit setCornerRadius(Float cornerRadius)
Sets the radius for each corner.
- Parameters:
cornerRadius- the radius for each corner to set.
-
setCornerRadius
Unit setCornerRadius(Float topLeft, Float topRight, Float bottomRight, Float bottomLeft)
Sets different radius for each corners.
- Parameters:
topLeft- the radius of top-left cornertopRight- the radius of top-right cornerbottomRight- the radius of bottom-right cornerbottomLeft- the radius of bottom-left corner
-
setBorderColor
Unit setBorderColor(Integer borderColor)
Sets the color to be used for the border line. By default
Color.Transparentis used.- Parameters:
borderColor- the color to be used for the border line.
-
setBorderWidth
Unit setBorderWidth(Float borderWidth)
Sets the width that will be used for the border line. By default 0 is used.
-
draw
Unit draw(Canvas canvas)
Called when the android.view.View.draw method is called on the given view.
- Parameters:
canvas- the canvas to draw into
-
dispatchDraw
Unit dispatchDraw(Canvas canvas)
Called when the android.view.View.dispatchDraw method is called on the given view.
- Parameters:
canvas- the canvas to draw into
-
onMeasure
Unit onMeasure(Integer widthMeasureSpec, Integer heightMeasureSpec)
Called when the android.view.View.onMeasure method is called on the given view.
- Parameters:
widthMeasureSpec- horizontal space requirements as imposed by the parent.heightMeasureSpec- vertical space requirements as imposed by the parent.
-
onSizeChanged
Unit onSizeChanged(Integer w, Integer h, Integer oldw, Integer oldh)
Called when the android.view.View.onSizeChanged method is called on the given view.
- Parameters:
w- the current width of the given view.h- the current height of the given view.oldw- the old width of the given view.oldh- the old height of the given view.
-
-
-
-