Android Open Source - plus1-android-sdk Mraid Property






From Project

Back to project page plus1-android-sdk.

License

The source code is released under:

Copyright (c) 2012, WapStart All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Red...

If you think the Android project plus1-android-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ru.wapstart.plus1.sdk;
//from   w  w  w. j  a  va  2  s. c om
import ru.wapstart.plus1.sdk.MraidView.PlacementType;
import ru.wapstart.plus1.sdk.MraidView.ViewState;

abstract class MraidProperty {
  private String sanitize(String str) {
    return (str != null) ? str.replaceAll("[^a-zA-Z0-9_,:\\s\\{\\}\\\'\\\"]", "") : "";
  }

  @Override
  public String toString() {
    return sanitize(toJsonPair());
  }

  public abstract String toJsonPair();
}

class MraidPlacementTypeProperty extends MraidProperty {
  private final PlacementType mPlacementType;

  MraidPlacementTypeProperty(PlacementType placementType) {
    mPlacementType = placementType;
  }

  public static MraidPlacementTypeProperty createWithType(
      PlacementType placementType) {
    return new MraidPlacementTypeProperty(placementType);
  }

  @Override
  public String toJsonPair() {
    return "placementType: '" + mPlacementType.toString().toLowerCase() + "'";
  }
}

class MraidScreenSizeProperty extends MraidProperty {
  private final int mScreenWidth;
  private final int mScreenHeight;

  MraidScreenSizeProperty(int width, int height) {
    mScreenWidth = width;
    mScreenHeight = height;
  }

  public static MraidScreenSizeProperty createWithSize(int width, int height) {
    return new MraidScreenSizeProperty(width, height);
  }

  @Override
  public String toJsonPair() {
    return "screenSize: { width: " + mScreenWidth + ", height: " + mScreenHeight + " }";
  }
}

class MraidStateProperty extends MraidProperty {
  private final ViewState mViewState;

  MraidStateProperty(ViewState viewState) {
    mViewState = viewState;
  }

  public static MraidStateProperty createWithViewState(ViewState viewState) {
    return new MraidStateProperty(viewState);
  }

  @Override
  public String toJsonPair() {
    return "state: '" + mViewState.toString().toLowerCase() + "'";
  }
}

class MraidViewableProperty extends MraidProperty {
  private final boolean mViewable;

  MraidViewableProperty(boolean viewable) {
    mViewable = viewable;
  }

  public static MraidViewableProperty createWithViewable(boolean viewable) {
    return new MraidViewableProperty(viewable);
  }

  @Override
  public String toJsonPair() {
    return "viewable: " + (mViewable ? "true" : "false");
  }
}




Java Source Code List

ru.wapstart.plus1.bart.BartActivity.java
ru.wapstart.plus1.sdk.AdView.java
ru.wapstart.plus1.sdk.ApplicationBrowser.java
ru.wapstart.plus1.sdk.Base64.java
ru.wapstart.plus1.sdk.BaseAdView.java
ru.wapstart.plus1.sdk.BaseRequestLoader.java
ru.wapstart.plus1.sdk.Constants.java
ru.wapstart.plus1.sdk.HtmlBannerDownloader.java
ru.wapstart.plus1.sdk.InitRequestLoader.java
ru.wapstart.plus1.sdk.JsonHelper.java
ru.wapstart.plus1.sdk.MraidAbstractController.java
ru.wapstart.plus1.sdk.MraidBrowserController.java
ru.wapstart.plus1.sdk.MraidCommandRegistry.java
ru.wapstart.plus1.sdk.MraidCommand.java
ru.wapstart.plus1.sdk.MraidDisplayController.java
ru.wapstart.plus1.sdk.MraidProperty.java
ru.wapstart.plus1.sdk.MraidView.java
ru.wapstart.plus1.sdk.Plus1AdAnimator.java
ru.wapstart.plus1.sdk.Plus1BannerAsker.java
ru.wapstart.plus1.sdk.Plus1BannerDownloadListener.java
ru.wapstart.plus1.sdk.Plus1BannerView.java
ru.wapstart.plus1.sdk.Plus1Helper.java
ru.wapstart.plus1.sdk.Plus1Request.java