@Override
  protected void displayAD() {
    if (null == mWindowManager) {
      mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    }
    lpWindow = new LayoutParams();
    lpWindow.type = LayoutParams.TYPE_SYSTEM_ALERT;
    lpWindow.flags = LayoutParams.FLAG_NOT_FOCUSABLE;
    lpWindow.gravity = Gravity.TOP;
    Point point = new Point();
    mWindowManager.getDefaultDisplay().getRealSize(point);
    lpWindow.x = 0;
    lpWindow.y = 0;

    lpWindow.width = point.x;
    lpWindow.height =
        CommonUtils.dip2px(
            mContext, mContext.getResources().getDimension(R.dimen.advanced_float_window_height));
    lpWindow.format = PixelFormat.RGBA_8888;

    if (null == mRootView) {
      if (null == mInflater) {
        mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
      mRootView = mInflater.inflate(R.layout.advanced_banner_window, null);
    }
    initViews();
    initDatas();
  }
 private LayoutParams createPopupLayout(IBinder token) {
   LayoutParams p = new LayoutParams();
   p.gravity = 8388659;
   p.width = -1;
   p.height = -1;
   p.format = -3;
   p.flags = this.computeFlags(p.flags);
   p.type = 1000;
   p.token = token;
   p.softInputMode = 3;
   p.setTitle("DiscreteSeekBar Indicator:" + Integer.toHexString(this.hashCode()));
   return p;
 }
Beispiel #3
0
 private void initFloatView() {
   wmParams = new LayoutParams();
   wmParams.format = PixelFormat.RGBA_8888;
   wmParams.x = PreSetting.getInstance().getFloatViewX();
   wmParams.y = PreSetting.getInstance().getFloatViewY();
   wmParams.width = LayoutParams.WRAP_CONTENT;
   wmParams.height = LayoutParams.WRAP_CONTENT;
   wmParams.flags = LayoutParams.FLAG_SHOW_WHEN_LOCKED | LayoutParams.FLAG_NOT_FOCUSABLE;
   wmParams.type = LayoutParams.TYPE_PHONE;
   wmParams.windowAnimations = android.R.style.Animation_Translucent;
   LayoutInflater inflater = LayoutInflater.from(getApplication());
   mFloatView = inflater.inflate(R.layout.layout_floatbutton, null);
   mFloatView.setOnTouchListener(onTouchListener);
   mFloatView.setOnClickListener(onClickListener);
   ((ButtonFloatSmall) mFloatView).setRippleColor(Color.TRANSPARENT);
   //		((ButtonFloatSmall)mFloatView).getBackground().setAlpha(50);
 }
  @Override
  protected void displayAD() {
    if (null == mWindowManager) {
      mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    }
    LayoutParams lpWindow = new LayoutParams();
    lpWindow.type = LayoutParams.TYPE_SYSTEM_ALERT;
    lpWindow.flags = LayoutParams.FLAG_DIM_BEHIND;
    lpWindow.dimAmount = 0.8f;
    lpWindow.gravity = Gravity.CENTER;
    Point point = new Point();
    mWindowManager.getDefaultDisplay().getRealSize(point);
    lpWindow.x = 0;
    lpWindow.y = 0;

    lpWindow.width =
        CommonUtils.dip2px(
            mContext, mContext.getResources().getDimension(R.dimen.simple_window_width));
    lpWindow.height =
        CommonUtils.dip2px(
            mContext, mContext.getResources().getDimension(R.dimen.simple_window_height));
    lpWindow.format = PixelFormat.RGBA_8888;

    if (null == mRootView) {
      if (null == mInflater) {
        mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
      mRootView = mInflater.inflate(R.layout.simple_window, null);
    }
    mWindowManager.addView(mRootView, lpWindow);
    initViews();
    initDatas();
    super.displayAD();

    SharedPreferences sp = mContext.getSharedPreferences(AMConstants.SP_NAME, Context.MODE_PRIVATE);
    sp.edit().putLong(AMConstants.SP_LAST_AD_STAMP, System.currentTimeMillis()).commit();

    AdDisplayUploadRequest request = new AdDisplayUploadRequest(null);
    request.start(mAD.getDisplayPager());
  }