Пример #1
0
  @VisibleForTesting
  public MoPubNative(
      @NonNull final Context context,
      @NonNull final String adUnitId,
      @NonNull AdRendererRegistry adRendererRegistry,
      @NonNull final MoPubNativeNetworkListener moPubNativeNetworkListener) {
    Preconditions.checkNotNull(context, "Context may not be null.");
    Preconditions.checkNotNull(adUnitId, "AdUnitId may not be null.");
    Preconditions.checkNotNull(adRendererRegistry, "AdRendererRegistry may not be null.");
    Preconditions.checkNotNull(
        moPubNativeNetworkListener, "MoPubNativeNetworkListener may not be null.");

    ManifestUtils.checkNativeActivitiesDeclared(context);

    mContext = new WeakReference<Context>(context);
    mAdUnitId = adUnitId;
    mMoPubNativeNetworkListener = moPubNativeNetworkListener;
    mAdRendererRegistry = adRendererRegistry;
    mVolleyListener =
        new AdRequest.Listener() {
          @Override
          public void onSuccess(@NonNull final AdResponse response) {
            onAdLoad(response);
          }

          @Override
          public void onErrorResponse(@NonNull final VolleyError volleyError) {
            onAdError(volleyError);
          }
        };

    // warm up cache for google play services info
    fetchAdvertisingInfoAsync(context, null);
  }
Пример #2
0
  @Deprecated
  public AdapterHelper(@NonNull final Context context, final int start, final int interval) {
    Preconditions.checkNotNull(context, "Context cannot be null.");
    Preconditions.checkArgument(context instanceof Activity, "Context must be an Activity.");
    Preconditions.checkArgument(start >= 0, "start position must be non-negative");
    Preconditions.checkArgument(interval >= 2, "interval must be at least 2");

    mActivity = new WeakReference<Activity>((Activity) context);
    mApplicationContext = context.getApplicationContext();
    mStart = start;
    mInterval = interval;
  }
  public void setClosePosition(@NonNull ClosePosition closePosition) {
    Preconditions.checkNotNull(closePosition);

    mClosePosition = closePosition;
    mCloseBoundChanged = true;
    invalidate();
  }
 static MoPubClientPositioning clone(MoPubClientPositioning mopubclientpositioning) {
   Preconditions.checkNotNull(mopubclientpositioning);
   MoPubClientPositioning mopubclientpositioning1 = new MoPubClientPositioning();
   mopubclientpositioning1.mFixedPositions.addAll(mopubclientpositioning.mFixedPositions);
   mopubclientpositioning1.mRepeatInterval = mopubclientpositioning.mRepeatInterval;
   return mopubclientpositioning1;
 }
    @Override
    protected void performAction(
        @NonNull final Context context,
        @NonNull final Uri uri,
        @NonNull final UrlHandler urlHandler)
        throws IntentNotResolvableException {
      Preconditions.checkNotNull(context);
      Preconditions.checkNotNull(uri);

      final String chooserText = "Share via";
      final String errorMessage = "Could not handle share tweet intent with URI " + uri;
      try {
        final Intent shareTweetIntent = Intents.intentForShareTweet(uri);
        final Intent chooserIntent = Intent.createChooser(shareTweetIntent, chooserText);
        Intents.launchIntentForUserClick(context, chooserIntent, errorMessage);
      } catch (UrlParseException e) {
        throw new IntentNotResolvableException(errorMessage + "\n\t" + e.getMessage());
      }
    }
 private List getVideoTrackersByAttribute(String s)
 {
     Preconditions.checkNotNull(s);
     ArrayList arraylist = new ArrayList();
     Node node = XmlUtils.getFirstMatchingChildNode(mLinearNode, "TrackingEvents");
     if (node != null)
     {
         s = XmlUtils.getMatchingChildNodes(node, "Tracking", "event", Collections.singletonList(s)).iterator();
         while (s.hasNext()) 
         {
             String s1 = XmlUtils.getNodeValue((Node)s.next());
             if (s1 != null)
             {
                 arraylist.add(s1);
             }
         }
     }
     return arraylist;
 }
 @Override
 public boolean shouldTryHandlingUrl(@NonNull final Uri uri) {
   Preconditions.checkNotNull(uri);
   return "mopubshare".equals(uri.getScheme()) && "tweet".equals(uri.getHost());
 }
 private void addQuartileTrackerWithFraction(List list, List list1, float f)
 {
     Preconditions.checkNotNull(list, "trackers cannot be null");
     Preconditions.checkNotNull(list1, "urls cannot be null");
     for (list1 = list1.iterator(); list1.hasNext(); list.add(new VastFractionalProgressTracker((String)list1.next(), f))) { }
 }
 VastLinearXmlManager(Node node)
 {
     Preconditions.checkNotNull(node);
     mLinearNode = node;
 }