Package com.my.target.nativeads
Class NativeAppwallAd
- java.lang.Object
-
- com.my.target.common.BaseAd
-
- com.my.target.nativeads.NativeAppwallAd
-
public final class NativeAppwallAd extends BaseAd
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNativeAppwallAd.AppwallAdListener
-
Field Summary
-
Fields inherited from class com.my.target.common.BaseAd
adConfig, metricFactory
-
-
Constructor Summary
Constructors Constructor Description NativeAppwallAd(int slotId, android.content.Context context)Public constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Close, destroy the ad and free resourcesvoiddismiss()Closes Ad Activityjava.util.ArrayList<NativeAppwallBanner>getBanners()Receiving loaded banners.longgetCachePeriod()NativeAppwallAd.AppwallAdListenergetListener()Get events listener of an advertisementjava.lang.StringgetTitle()intgetTitleBackgroundColor()intgetTitleSupplementaryColor()intgetTitleTextColor()voidhandleBannerClick(NativeAppwallBanner banner)Handling a click on a banner in the case of a custom implementation of the AppWall list (without using AppwallAdView).voidhandleBannerShow(NativeAppwallBanner banner)Send a banner display of your own AppWall list implementation (without using AppwallAdView).voidhandleBannersShow(java.util.List<NativeAppwallBanner> banners)Send a banners display of your own AppWall list implementation (without using AppwallAdView).booleanhasNotifications()Checking for banner notificationsbooleanisAutoLoadImages()booleanisHideStatusBarInDialog()voidload()Start loading ads.static voidloadImageToView(ImageData imageData, android.widget.ImageView view)Asynchronously loads imageData to view.java.lang.StringprepareBannerClickLink(NativeAppwallBanner banner)Prepares click, removes notification from bannervoidregisterAppwallAdView(AppwallAdView view)Registration of theAppwallAdViewcomponent for displaying the list of ads.voidsetAutoLoadImages(boolean autoLoadImages)voidsetCachePeriod(long cachePeriod)Returns time, during which the ad cache will be valid.voidsetHideStatusBarInDialog(boolean hideStatusBarInDialog)voidsetListener(NativeAppwallAd.AppwallAdListener listener)Set events listener of an advertisement Must be called beforeload()voidsetTitle(java.lang.String title)voidsetTitleBackgroundColor(int titleBackgroundColor)Setting the background color of the Appwall creative's header if it is displayed in the ActivityvoidsetTitleSupplementaryColor(int titleSupplementaryColor)Setting an additional background color for the Appwall creative header, if it is displayed in the separate Activity.voidsetTitleTextColor(int titleTextColor)Setting the color of the Appwall creative's header if it is displayed in the Activityvoidshow()Showing Ad creative in the ActivityvoidunregisterAppwallAdView()View de-registration.-
Methods inherited from class com.my.target.common.BaseAd
getCustomParams, isLoadCalled, setAdNetworkConfig
-
-
-
-
Method Detail
-
loadImageToView
public static void loadImageToView(@NonNull ImageData imageData, @NonNull android.widget.ImageView view)Asynchronously loads imageData to view. If imageData already has been downloaded, it will take picture from the cache- Parameters:
imageData- image to downloadview- ImageView- See Also:
ImageData,ImageView
-
getListener
@Nullable public NativeAppwallAd.AppwallAdListener getListener()
Get events listener of an advertisement- Returns:
- an instance of listener
- See Also:
NativeAppwallAd.AppwallAdListener
-
setListener
public void setListener(@Nullable NativeAppwallAd.AppwallAdListener listener)Set events listener of an advertisement Must be called beforeload()- See Also:
NativeAppwallAd.AppwallAdListener
-
isHideStatusBarInDialog
public boolean isHideStatusBarInDialog()
- Returns:
- if hiding the status of the bar when shown through the dialog is turned on/off
-
setHideStatusBarInDialog
public void setHideStatusBarInDialog(boolean hideStatusBarInDialog)
- Parameters:
hideStatusBarInDialog- On/off hiding the status of the bar when shown through the dialog.
-
setAutoLoadImages
public void setAutoLoadImages(boolean autoLoadImages)
- Parameters:
autoLoadImages- on/off loading images on ad request
-
isAutoLoadImages
public boolean isAutoLoadImages()
- Returns:
- on/off loading images on ad request
-
getCachePeriod
public long getCachePeriod()
- Returns:
- value in milliseconds, during which the ad cache will be valid
-
setCachePeriod
public void setCachePeriod(long cachePeriod)
Returns time, during which the ad cache will be valid. If the time has not expired yet, the request for the advertisement will return the value from the cache. Default value is 24 hours- Parameters:
cachePeriod- value in milliseconds
-
getBanners
@NonNull public java.util.ArrayList<NativeAppwallBanner> getBanners()
Receiving loaded banners. The list is empty if the download has failed or has failed.- Returns:
- the list of loaded banners
- See Also:
load()
-
getTitle
@NonNull public java.lang.String getTitle()
-
setTitle
public void setTitle(@NonNull java.lang.String title)- Parameters:
title- Sets the title of the Appwall creative if it is displayed in the Activity- See Also:
show()
-
getTitleBackgroundColor
public int getTitleBackgroundColor()
-
setTitleBackgroundColor
public void setTitleBackgroundColor(int titleBackgroundColor)
Setting the background color of the Appwall creative's header if it is displayed in the Activity- Parameters:
titleBackgroundColor- title background color- See Also:
show()
-
getTitleSupplementaryColor
public int getTitleSupplementaryColor()
-
setTitleSupplementaryColor
public void setTitleSupplementaryColor(int titleSupplementaryColor)
Setting an additional background color for the Appwall creative header, if it is displayed in the separate Activity. The secondary color is the background of the status bar (Android 5+, or the shading bar color in Android 2.2-2.3).- Parameters:
titleSupplementaryColor- title supplementary color
-
getTitleTextColor
public int getTitleTextColor()
-
setTitleTextColor
public void setTitleTextColor(int titleTextColor)
Setting the color of the Appwall creative's header if it is displayed in the Activity- Parameters:
titleTextColor- title color- See Also:
show()
-
load
public void load()
Start loading ads. In case of successful loading, the onLoad method will be called on the object passed as a listener, in case of loading error or if there is no advertisement to be shown - the onNoAd Listener must be added before loading- See Also:
setListener(AppwallAdListener)
-
hasNotifications
public boolean hasNotifications()
Checking for banner notifications- Returns:
- if one of banner has notification
-
registerAppwallAdView
public void registerAppwallAdView(@NonNull AppwallAdView view)Registration of theAppwallAdViewcomponent for displaying the list of ads. Registration includes setting tracking clicks and impressions of list banners.- Parameters:
view- view to register- See Also:
AppwallAdView
-
unregisterAppwallAdView
public void unregisterAppwallAdView()
View de-registration. Stops timers, frees resources. Must be called after view is no longer needed
-
show
public void show()
Showing Ad creative in the Activity
-
dismiss
public void dismiss()
Closes Ad Activity
-
destroy
public void destroy()
Close, destroy the ad and free resources
-
handleBannerClick
public void handleBannerClick(NativeAppwallBanner banner)
Handling a click on a banner in the case of a custom implementation of the AppWall list (without using AppwallAdView). Processing a click involves opening the link associated with the banner and sending the click to the server.- Parameters:
banner- the model of the banner to be clicked
-
prepareBannerClickLink
@Nullable public java.lang.String prepareBannerClickLink(NativeAppwallBanner banner)
Prepares click, removes notification from banner- Parameters:
banner- banner model- Returns:
- click link of the banner
-
handleBannersShow
public void handleBannersShow(@NonNull java.util.List<NativeAppwallBanner> banners)Send a banners display of your own AppWall list implementation (without using AppwallAdView).- Parameters:
banners- list of banners to show
-
handleBannerShow
public void handleBannerShow(@NonNull NativeAppwallBanner banner)Send a banner display of your own AppWall list implementation (without using AppwallAdView).- Parameters:
banner- to show
-
-