MediaView

package com.intowow.sdk

public class MediaView extends RelativeLayout

  • This class is a inner class of NativeAd

  • You should use this class after Native Ad is loaded.

Advance Integration

  • If you want to configure the media view's width, you can implement the following code after ad loaded :

RelativeLayout.LayoutParams params = new
    RelativeLayout.LayoutParams(CALCULATED_AD_WIDTH, RelativeLayout.LayoutParams.WRAP_CONTENT);

mMediaView = new MediaView(mActivity);

//  [NOTE]
//  you should call setLayoutParams before setNativeAd.
//  please just set the ad width and set height to WRAP_CONTENT, SDK would calculate the ad height automatically according to the ad aspect ratio.
//
mMediaView.setLayoutParams(params);

mMediaView.setNativeAd(mNativeAd);
  • You could also use AdProperty to configure your ad if necessary.

Map<String, Object> adProps = new HashMap<String, Object>();
adProps.put(AdProperty.AUTO_CONTROL_VOLUME, trueOrFalse);
adProps.put(AdProperty.HIDE_WIFITAG, trueOrFalse);
adProps.put(AdProperty.HIDE_SPEAKER, trueOrFalse);
adProps.put(AdProperty.HIDE_COUNTDOWN, trueOrFalse);
adProps.put(AdProperty.HIDE_AD_ICON, trueOrFalse);
adProps.put(AdProperty.VIDEO_AUTO_REPEAT, trueOrFalse);
adProps.put(AdProperty.SILENT_START, trueOrFalse);
adProps.put(AdProperty.TOUCH_EFFECT, Color.argb(125, 0, 0, 0));


MediaView mediaView = new MediaView(context, adProps);
  • AdProperty.HIDE_COUNTDOWN : if need to hide the countdown or not, the default value is false

  • AdProperty.HIDE_WIFITAG : if need to hide the Wi-Fi hint or not, the default value is false

  • AdProperty.HIDE_SPEAKER : if need to hide speaker or not, the default value is false

  • AdProperty.HIDE_AD_ICON : if need to hide ad icon or not, the default value is true

  • AdProperty.AUTO_CONTROL_VOLUME : if need to let the media view toggle video mute and unmute status when user click it, the default value is true

  • AdProperty.VIDEO_AUTO_REPEAT : if need to let the video ad auto repeat play, the default value is true

  • AdProperty.TOUCH_EFFECT : Set the touch effect by using argb color, the default effect is none.

  • AdProperty.SILENT_START : if need to let the video auto silent start, the default value is true

Public constructors

MediaView(Context context) Instantiates a new media view.

MediaView(Context context, Map adProps) Instantiates a new media view.

Public methods

void

destroy() Release the media view.

boolean

isAvailableAttachToWindow() Check if this ad is available to attach to window.

boolean

isFullScreen() Check if this ad is full screen.

boolean

isMute() Check if this ad is muted.

void

mute() Mute video ad.

void

play() Allow this ad to play.

boolean

resize(int width) Resize the media view.

boolean

resize(CEAdSize ceAdSize) Resize the media view by CEAdSize.

void

setFullScreenMode(FullScreenMode mode) Set the full screen mode.

void

void

void

stop() Disallow this ad to play.

void

unmute() Unmute video ad.

Public constructors

NativeAd

NativeAd(Context context, String placement)

Instantiates a new native ad.

Parameters

context

Context: the context.

placement

String: A specific group of ad units on which an advertiser can choose to place their ads using placement targeting.

Public methods

destroy

void destroy()

Release the media view.

isAvailableAttachToWindow

boolean isAvailableAttachToWindow()

Check if this ad is available to attach to window.

Returns

boolean

true if is available to attach to window otherwise return false.

isFullScreen

boolean isFullScreen()

Check if this ad is full screen.

Returns

boolean

true if this ad is full screen otherwise return false.

isMute

boolean isMute()

Check if this ad is muted.

Returns

boolean

true if this ad is muted otherwise return false.

mute

void mute()

Mute video ad.

play

void play()

Allow this ad to play.

resize

boolean resize(int width)

Resize the media view.

Parameters

width

int: the width.

Returns

boolean

true if resize this ad successfully otherwise return false.

resize

boolean resize(CEAdSize ceAdSize)

Resize the media view by CEAdSize.

Parameters

ceAdSize

CEAdSize: the ceAdSize.

Returns

boolean

true if resize this ad successfully otherwise return false.

setFullScreenMode

void setFullScreenMode(FullScreenMode mode)

Set the full screen mode.

Parameters

mode

FullScreenMode: NONE, RIGHT_SIDE_UP or LEFT_SIDE_UP

setNativeAd

void setNativeAd(NativeAd nativeAd)

Set the native ad. you should call this method after native ad onAdLoaded().

Parameters

nativeAd

NativeAd: the origin nativeAd you requesting.

setTouchEffect

void setTouchEffect(int argbColor)

Set touch effect. you could use AdProperty to configure this effect instead of using this method.

Parameters

argbColor

int: the argb color

stop

void stop()

Disallow this ad to play.

unmute

void unmute()

Unmute video ad.

Last updated