Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. @Nullable
  2. @Override
  3. public View getNativeAdView(@NonNull final Context context, @Nullable final ViewGroup viewGroup,
  4. @NonNull NativeAdViewType type, @NonNull String key) {
  5. final NativeAd adNative = getNativeAdAtIndex(key);
  6. if (adNative != null) {
  7. final LayoutInflater inflater = LayoutInflater.from(context);
  8. NativeAdView view;
  9. switch (type) {
  10. case GRID:
  11. view = (NativeAdView) inflater.inflate(R.layout.ad_grid, viewGroup);
  12. break;
  13. case LIST:
  14. view = (NativeAdView) inflater.inflate(R.layout.ad_list, viewGroup);
  15. break;
  16. case PLAYER_PORTRAIT:
  17. view = (NativeAdView) inflater.inflate(R.layout.ad_player_square, viewGroup);
  18. break;
  19. case PLAYER_LANDSCAPE:
  20. view = (NativeAdView) inflater.inflate(R.layout.ad_player_landscape, viewGroup);
  21. break;
  22. default:
  23. LogHelper.w(TAG_LOG, "Не обработанный тип представления:", type.name());
  24. view = (NativeAdView) inflater.inflate(R.layout.ad_list, viewGroup);
  25. }
  26. return bindView(context, view, adNative);
  27. }
  28. return null;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement