Esempio n. 1
0
  public void rotationHoriztion(int beganDegree, int endDegree, AdView view) {
    final float centerX = 320 / 2.0f;
    final float centerY = 48 / 2.0f;
    final float zDepth = -0.50f * view.getHeight();

    Rotate3dAnimation rotation =
        new Rotate3dAnimation(beganDegree, endDegree, centerX, centerY, zDepth, true);
    rotation.setDuration(1000);
    rotation.setInterpolator(new AccelerateInterpolator());
    rotation.setAnimationListener(
        new Animation.AnimationListener() {
          public void onAnimationStart(Animation animation) {}

          public void onAnimationEnd(Animation animation) {}

          public void onAnimationRepeat(Animation animation) {}
        });
    view.startAnimation(rotation);
  }
Esempio n. 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // setContentView(R.layout.main);

    // adonContainerView = (RelativeLayout)findViewById(R.id.adonContainerView);

    /*adView = new AdView(this, Width, Height); //1*/
    // 如果對於填寫adWidth和adHeight有任何疑問,請到wiki.vpon.com查詢。
    // If there is any question about adWidth and adHeight, please check wiki.vpon.com.

    RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(-2, -2);
    rl.addRule(RelativeLayout.CENTER_IN_PARENT);

    adonContainerView.addView(adView, rl); // 2

    boolean autoRefreshAd = true; // 3	

    adView.setLicenseKey(adOnKey, AdOnPlatform.CN, autoRefreshAd); // 3

    AdListener adListener = new AdListener() { // 4
          public void onRecevieAd(AdView adView) {
            // 廣告抓取成功
            Log.i("AdOn", "OnRecevieAd");
            /*
             * 廣告抓取成功時,我們建議您可以在這函式中替AdView增加一些簡單的動畫, 動畫範例程式碼如下
             */
            rotationHoriztion(0, 360, adView);
          }

          public void onFailedToRecevieAd(AdView adView) {
            // 廣告抓取失敗
            Log.i("AdOn", "OnFailesToRecevieAd");
          }
        };

    adView.setAdListener(adListener); // 5

    Log.i("AdOn SDK Version", adView.getVersion()); // 查詢目前SDK的版本
  }