Class DynamicAdUtils
java.lang.Object
com.pranavpandey.android.dynamic.ads.util.DynamicAdUtils
Helper class to perform ads related operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatFactor to calculate the acceptable ad size. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.android.gms.ads.AdSizeReturns the ad size for the supplied activity.static com.google.android.gms.ads.AdSizeReturns the ad size for the supplied activity and container.static intgetAppOpenAdOrientation(Context activity) Returns the orientation for the app open ad.static booleanisOnlyStore(com.google.android.gms.ads.nativead.NativeAd nativeAd) Checks whether the ad has only the store data.static voidSet drawable for the image view and manage its visibility according to the data.static voidSet rating value for the rating bar.static voidset(TextView textView, CharSequence text) Set text for the text view and manage its visibility according to the data.static voidsetEnabled(View view, boolean enabled) Set a view enabled or disabled.static voidsetVisibility(View view, int visibility) Set visibility for the view.
-
Field Details
-
AD_SIZE_FACTOR
public static final float AD_SIZE_FACTORFactor to calculate the acceptable ad size.- See Also:
-
-
Constructor Details
-
DynamicAdUtils
public DynamicAdUtils()
-
-
Method Details
-
getAdSize
@NonNull public static com.google.android.gms.ads.AdSize getAdSize(@Nullable Context activity, @Nullable View container) Returns the ad size for the supplied activity and container.- Parameters:
activity- The activity to calculate the ad size.container- The ad container to be used.- Returns:
- The ad size for the supplied activity and container.
- See Also:
-
AdSize.FLUID
-
getAdSize
Returns the ad size for the supplied activity.- Parameters:
activity- The activity to calculate the ad size.- Returns:
- The ad size for the supplied activity.
- See Also:
-
getAppOpenAdOrientation
Returns the orientation for the app open ad.- Parameters:
activity- The activity to retrieve the screen orientation.- Returns:
- The orientation for the app open ad.
- See Also:
-
AppOpenAd.APP_OPEN_AD_ORIENTATION_PORTRAITAppOpenAd.APP_OPEN_AD_ORIENTATION_LANDSCAPE
-
isOnlyStore
Checks whether the ad has only the store data.- Parameters:
nativeAd- The ad to be checked.- Returns:
trueif the ad has only the store data.
-
set
Set drawable for the image view and manage its visibility according to the data.- Parameters:
imageView- The image view to set the drawable.drawable- The drawable to be set.
-
set
Set text for the text view and manage its visibility according to the data.- Parameters:
textView- The text view to set the text.text- The text to be set.
-
set
Set rating value for the rating bar.- Parameters:
ratingBar- The rating bar to set the rating.rating- The rating value to be set.
-
setVisibility
Set visibility for the view.- Parameters:
view- The view to set the visibility.visibility- The visibility to be set.
-
setEnabled
Set a view enabled or disabled.- Parameters:
view- The view to be enabled or disabled.enabled-trueto enable the view.
-