@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();
  }
示例#2
0
  public void setFullScreen() {
    wmParams.gravity = Gravity.LEFT | Gravity.TOP;

    setWindowSize(mScreenWidth, mScreenHeight); // debugging -100
    this.setWindowPadding(0, 100);

    setTVLocation(new float[] {0, 0});
  }
 public LayoutParams getClingWindowLayoutParams() {
   LayoutParams lp = new LayoutParams(-1, -1, 2005, 16777480, -3);
   lp.privateFlags |= 16;
   lp.setTitle(TAG);
   lp.windowAnimations = 16974566;
   lp.gravity = 119;
   return lp;
 }
 private void initWindows() {
   windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
   windowManager.getDefaultDisplay().getSize(szWindow);
   mParams =
       new LayoutParams(
           TYPE_PRIORITY_PHONE /* to appear on top of keyboard */,
           FLAG_NOT_FOCUSABLE | FLAG_NOT_TOUCH_MODAL,
           PixelFormat.TRANSLUCENT);
   rParams =
       new LayoutParams(
           TYPE_PRIORITY_PHONE /* to appear on top of keyboard */,
           FLAG_NOT_FOCUSABLE | FLAG_NOT_TOUCH_MODAL,
           PixelFormat.TRANSLUCENT);
   setupParams();
   mParams.gravity = Gravity.LEFT | Gravity.TOP;
   rParams.gravity = Gravity.LEFT | Gravity.TOP;
   initView();
 }
示例#5
0
  public void setAsPOPLeftWindow() {
    wmParams.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;

    wmParams.x = 0;
    wmParams.y = 0;

    int w = mScreenWidth / 2;
    int h = (int) ((float) mScreenHeight / mScreenWidth * mScreenWidth / 2);
    setWindowSize(w, h);

    setTVLocation(new float[] {0, mScreenHeight / 2 - h / 2});
  }
 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;
 }
  public UserInfoDialog(Context context) {
    super(context, R.style.Dialog);
    setContentView(R.layout.user_center_content);

    // 设置点击对话框之外能消失
    setCanceledOnTouchOutside(true);
    // 设置window属性
    lp = getWindow().getAttributes();
    lp.gravity = Gravity.TOP;
    lp.dimAmount = 0; // 去背景遮盖
    lp.alpha = 1.0f;
    lp.y = 55;
    getWindow().setAttributes(lp);
  }
 public void showIndicator(View parent, Rect touchBounds) {
   if (this.isShowing()) {
     this.mPopupView.mMarker.animateOpen();
   } else {
     IBinder windowToken = parent.getWindowToken();
     if (windowToken != null) {
       LayoutParams p = this.createPopupLayout(windowToken);
       p.gravity = 8388659;
       this.updateLayoutParamsForPosiion(parent, p, touchBounds.bottom);
       this.mShowing = true;
       this.translateViewIntoPosition(touchBounds.centerX());
       this.invokePopup(p);
     }
   }
 }
示例#9
0
  public LoadingDialog(Context context) {
    super(context, R.style.Dialog);

    this.mContext = context;

    inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.loadingdialog, null);
    setContentView(layout);

    // 璁剧疆window灞炴�
    lp = getWindow().getAttributes();
    lp.gravity = Gravity.CENTER;
    lp.dimAmount = 0; // 鍘昏儗鏅伄鐩�
    lp.alpha = 1.0f;
    getWindow().setAttributes(lp);
  }
示例#10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_address);

    mListView = (ListView) findViewById(R.id.dialog_listview);
    // 设置adapter
    setAdapter(mAdapter);
    setOnItemClickListener(mListener);

    // 改变样式-->window的样式
    Window window = getWindow();
    LayoutParams params = window.getAttributes();
    params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; // 设置弹出位置
    window.setAttributes(params);
  }
 private void addTabViewToWindow(View view, int x, int y, int w, int h, Boolean touchable) {
   int flags = 16843544;
   if (!touchable.booleanValue()) {
     flags = 16843544 | 16;
   }
   LayoutParams params = new LayoutParams(-2, -2, 2007, flags, -3);
   params.gravity = 51;
   params.width = w;
   params.height = h;
   params.x = x;
   params.y = y;
   try {
     Field privateFlags = params.getClass().getDeclaredField("privateFlags");
     privateFlags.setInt(params, privateFlags.getInt(params) | 64);
   } catch (NoSuchFieldException ex) {
     ex.printStackTrace();
   } catch (IllegalAccessException ex2) {
     ex2.printStackTrace();
   }
   getWindowManager().addView(view, params);
 }
示例#12
0
  @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());
  }
示例#13
0
 public void setWindowGravity(int gravity) {
   wmParams.gravity = gravity;
 }