Esempio n. 1
0
  private void setDefaultLocation() {
    wmParams.x = defaultOffsetX;
    wmParams.y = defaultOffsetY;

    wmParams.width = defaultWidth;
    wmParams.height = defaultHeight;
  }
Esempio n. 2
0
  @Override
  protected void initUI() {
    super.initUI();
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    LayoutParams params = getWindow().getAttributes();
    params.width = LayoutParams.WRAP_CONTENT;
    params.height = LayoutParams.WRAP_CONTENT;
    params.dimAmount = 0.5f;

    CloudGlobalDialogPage page =
        (CloudGlobalDialogPage)
            ProxyFactory.getFactory(ProxyFactory.TYPE_CLOUD_GLOBAL)
                .createDetailPage(this, CloudGlobalDialogFactory.NORMAL_GLOBAL_TYPE);

    CloudGlobalDialogPage.Builder builder = new Builder(page);

    if (!TextUtils.isEmpty(title)) builder.setTitle(title);
    if (!TextUtils.isEmpty(content)) builder.setContent(content);
    builder.setOnPositiveButton(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (mOnGlobalClickListener != null) {
              mOnGlobalClickListener.onClick();
            }
            finish();
          }
        });
    setContentView(page.getView());
  }
 public void onEvent(EventsModel eventsModel) {
   if (eventsModel != null && eventsModel.getEventType() == EventType.SETTINGS_CHANGE) {
     setupParams();
     setupFloatingImage(true);
     animateHidden();
     EventTrackerHelper.sendEvent(
         "onEvent", "onLoadCompleteListener", "EventType.SETTINGS_CHANGE");
   } else if (eventsModel != null && eventsModel.getEventType() == EventType.PREVIEW) {
     mParams.height = AppHelper.toPx(context, eventsModel.getPreviewSize());
     mParams.width = AppHelper.toPx(context, eventsModel.getPreviewSize());
     try {
       EventTrackerHelper.sendEvent("onEvent", "onLoadCompleteListener", "EventType.PREVIEW");
       if (windowManager != null) {
         windowManager.updateViewLayout(FloatingHorizontalLayout.this.view, mParams);
         new Handler()
             .postDelayed(
                 new Runnable() {
                   @Override
                   public void run() {
                     setupParams();
                     setupFloatingImage(true);
                   }
                 },
                 1500);
       }
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else if (eventsModel != null && eventsModel.getEventType() == EventType.FA_BACKGROUND) {
     setupBackground();
   } else if (eventsModel != null && eventsModel.getEventType() == EventType.ICON_ALPHA) {
     animateHidden();
   }
 }
Esempio n. 4
0
  public static void addButton(
      final Fragment fragment,
      ViewGroup layout,
      final String title,
      final String onClick,
      final Class<?>[] parameters,
      final Object[] objects) {
    Button button = new Button(fragment.getActivity());
    LayoutParams params = new LayoutParams();
    params.width = 200 * getDensity(fragment.getActivity());
    params.height = 100;
    button.setLayoutParams(params);
    button.setText(title);
    button.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            if (parameters == null) {
              invoke(fragment, onClick);
            } else {
              invoke(fragment, onClick, parameters, objects);
            }
          }
        });
    layout.addView(button);
  }
  @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();
  }
Esempio n. 6
0
 private void updateLayoutParamsForPosiion(View anchor, LayoutParams p, int yOffset) {
   this.measureFloater();
   int measuredHeight = this.mPopupView.getMeasuredHeight();
   int paddingBottom = this.mPopupView.mMarker.getPaddingBottom();
   anchor.getLocationInWindow(this.mDrawingLocation);
   p.x = 0;
   p.y = this.mDrawingLocation[1] - measuredHeight + yOffset + paddingBottom;
   p.width = this.screenSize.x;
   p.height = measuredHeight;
 }
 private void setupParams() {
   int iconSize = AppHelper.getFinalSize(context);
   int pX = AppHelper.getPositionX(context);
   int pY = AppHelper.getPositionY(context);
   rParams.width = MATCH_PARENT;
   rParams.height = iconSize;
   mParams.width = iconSize;
   mParams.height = iconSize;
   if (AppHelper.isSavePositionEnabled(context)) {
     mParams.x = pX;
     mParams.y = pY;
     rParams.y = pY + iconSize;
     rParams.x = pX;
   } else {
     mParams.x = 0;
     mParams.y = 100;
     rParams.x = 0;
     rParams.y = 100 + iconSize;
   }
 }
Esempio n. 8
0
 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;
 }
Esempio n. 9
0
 private void showAsPopup(Activity activity) {
   activity.requestWindowFeature(Window.FEATURE_ACTION_BAR);
   activity
       .getWindow()
       .setFlags(
           WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_DIM_BEHIND);
   LayoutParams params = activity.getWindow().getAttributes();
   params.height = LayoutParams.MATCH_PARENT;
   params.width = 850; // fixed width
   params.alpha = 1.0f;
   params.dimAmount = 0.5f;
   activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
 }
  private void setWindow() {
    WindowManager m = getWindowManager();
    Display d = m.getDefaultDisplay(); // Ϊ��ȡ��Ļ�?��
    Point outsize = new Point();
    LayoutParams p = getWindow().getAttributes(); // ��ȡ�Ի���ǰ�IJ���ֵ
    d.getSize(outsize);
    p.height = (int) (outsize.y * 0.8); // �߶�����Ϊ��Ļ��0.8
    p.width = (int) (outsize.x * 0.8); // �������Ϊ��Ļ��0.8
    p.alpha = 1.0f; // ���ñ���͸����
    p.dimAmount = 0.0f; // ���úڰ���

    getWindow().setAttributes(p); // ������Ч
    getWindow().setGravity(Gravity.CENTER); // ���ÿ��Ҷ���
  }
Esempio n. 11
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);
 }
Esempio n. 12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.hookup_tutorial);
    sInstance = this;

    LayoutParams params = getWindow().getAttributes();
    params.height = LayoutParams.MATCH_PARENT;
    params.width = LayoutParams.MATCH_PARENT;
    getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);

    setDuration(LONG_ANIM_DURATION);
    mTutorialLayout = (RelativeLayout) findViewById(R.id.rlTutorial);
    mTutorialText = (TextView) findViewById(R.id.tvTutorialText);
    mTutorialText.setText(getIntent().getStringExtra(TEXT));
    setTranslateAnimations();
    startTranslateAnimations();
  }
Esempio n. 13
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.thumb_dialog);
   final ListView view = (ListView) findViewById(R.id.thumbListView);
   view.setAdapter(new ThumbAdapter(movie.getThumb(), width, height, context));
   LayoutParams params = getWindow().getAttributes();
   params.width = width;
   params.height = LayoutParams.WRAP_CONTENT;
   getWindow().setAttributes((LayoutParams) params);
   view.setOnItemClickListener(
       new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
           Thumb thumb = (Thumb) view.getItemAtPosition(position);
           movie.setActiveThumb(thumb.getValue());
           new HelperFactory(context).saveOrUpdate(movie);
         }
       });
 }
Esempio n. 14
0
 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);
 }
Esempio n. 15
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());
  }
  @Override
  public void onClick(View v) {

    switch (v.getId()) {
      case R.id.hire_comment:
      case R.id.hire_comment_num:
        if (!mCommentLayout.isShown()) {
          showCommentView();
        } else {
          hideCommentView();
        }
        break;

      case R.id.hire_share:
        if (mShareDialog == null) {
          mShareDialog = new Dialog(DetailHireActivity.this, R.style.login_dialog);
          mShareDialog.setCanceledOnTouchOutside(true);
          Window win = mShareDialog.getWindow();
          LayoutParams params = new LayoutParams();
          params.width = LayoutParams.MATCH_PARENT;
          params.height = LayoutParams.WRAP_CONTENT;
          params.x = 0;
          params.y = 0;
          win.setAttributes(params);
          mShareDialog.setContentView(R.layout.dialog_share);
          mShareDialog.findViewById(R.id.share_by_sina).setOnClickListener(this);
          mShareDialog.findViewById(R.id.share_by_weixin).setOnClickListener(this);
          mShareDialog.findViewById(R.id.share_by_tencent).setOnClickListener(this);
          mShareDialog.findViewById(R.id.share_by_email).setOnClickListener(this);
          mShareDialog.findViewById(R.id.share_cancel).setOnClickListener(this);
          mShareDialog.findViewById(R.id.share_layout).setOnClickListener(this);
        }
        mShareDialog.show();
        break;
      case R.id.share_by_sina:
        mShareDialog.dismiss();
        break;
      case R.id.share_by_weixin:
        mShareDialog.dismiss();
        break;
      case R.id.share_by_tencent:
        mShareDialog.dismiss();
        break;
      case R.id.share_by_email:
        mShareDialog.dismiss();
        break;
      case R.id.share_cancel:
      case R.id.share_layout:
        mShareDialog.dismiss();
        break;
      case R.id.comment_send:
        String content = mContent.getText().toString();
        if (TextUtils.isEmpty(content)) {
          UIHelper.showToastShort(DetailHireActivity.this, getString(R.string.no_comment));
          return;
        }
        CommonUtils.hideSystemKeyBoard(DetailHireActivity.this, mContent);
        mContent.setText("");
        break;
      case R.id.hire_introduction:
        if (!mCompanyLayout.isShown()) {
          showCompanyView();
        } else {
          hideCompanyView();
        }
        break;
      case R.id.hire_add:
        if (mSelectDialog == null) {
          mSelectDialog = new Dialog(DetailHireActivity.this, R.style.login_dialog);
          mSelectDialog.setCanceledOnTouchOutside(true);
          Window win = mSelectDialog.getWindow();
          LayoutParams params = new LayoutParams();
          params.width = LayoutParams.MATCH_PARENT;
          params.height = LayoutParams.WRAP_CONTENT;
          params.x = 0;
          params.y = 0;
          win.setAttributes(params);
          mSelectDialog.setContentView(R.layout.dailog_select);
          ListView mListView = (ListView) mSelectDialog.findViewById(R.id.select_listview);
          SelectAdapter myAdapter = new SelectAdapter(DetailHireActivity.this);
          mListView.setAdapter(myAdapter);
          mSelectDialog.findViewById(R.id.select_cancel).setOnClickListener(this);
          mSelectDialog.findViewById(R.id.select_layout).setOnClickListener(this);
        }
        mSelectDialog.show();
        break;
      case R.id.select_layout:
        mSelectDialog.dismiss();
        break;
      case R.id.select_cancel:
        mSelectDialog.dismiss();
        break;

      case R.id.hire_contact:
        if (mContactDialog == null) {
          mContactDialog = new Dialog(DetailHireActivity.this, R.style.login_dialog);
          mContactDialog.setCanceledOnTouchOutside(true);
          Window win = mContactDialog.getWindow();
          LayoutParams params = new LayoutParams();
          params.width = LayoutParams.MATCH_PARENT;
          params.height = LayoutParams.WRAP_CONTENT;
          params.x = 0;
          params.y = 0;
          win.setAttributes(params);
          mContactDialog.setContentView(R.layout.dialog_contact);
          mContactDialog.findViewById(R.id.contact_by_call).setOnClickListener(this);
          mContactDialog.findViewById(R.id.contact_by_mail).setOnClickListener(this);
          mContactDialog.findViewById(R.id.contact_by_address).setOnClickListener(this);
          mContactDialog.findViewById(R.id.contact_cancel).setOnClickListener(this);
          mContactDialog.findViewById(R.id.contact_layout).setOnClickListener(this);
        }
        mContactDialog.show();
        break;
      case R.id.contact_by_call:
        CommonUtils.toCall(DetailHireActivity.this, "63074459");
        break;
      case R.id.contact_by_mail:
        CommonUtils.sendEmail(DetailHireActivity.this, String.valueOf(R.string.email_location));
        break;
      case R.id.contact_by_address:
        CommonUtils.showMapByWeb(
            DetailHireActivity.this,
            20,
            30,
            String.valueOf(R.string.map_title),
            String.valueOf(R.string.map_location));
        break;
      case R.id.contact_layout:
      case R.id.contact_cancel:
        mContactDialog.dismiss();
        break;
      default:
        break;
    }
  }
Esempio n. 17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.setContentView(R.layout.q3_me_lax);

    final ImageView iv = (ImageView) findViewById(R.id.q3_me_lax_iv);
    final View view1 = getLayoutInflater().inflate(R.layout.q2_pw_me_fc_la, null);
    final View view2 = getLayoutInflater().inflate(R.layout.q2_pw_me_lax_av, null);
    final View view3 = getLayoutInflater().inflate(R.layout.q2_pw_me_lax_lvot, null);
    final View view4 = getLayoutInflater().inflate(R.layout.q2_pw_me_fc_rv, null);
    final View view5 = getLayoutInflater().inflate(R.layout.q2_pw_me_fc_lv, null);

    pw1 = new PopupWindow(view1);
    pw1.setBackgroundDrawable(
        getResources().getDrawable(android.R.drawable.screen_background_dark_transparent));
    pw2 = new PopupWindow(view2);
    pw2.setBackgroundDrawable(
        getResources().getDrawable(android.R.drawable.screen_background_dark_transparent));
    pw3 = new PopupWindow(view3);
    pw3.setBackgroundDrawable(
        getResources().getDrawable(android.R.drawable.screen_background_dark_transparent));
    pw4 = new PopupWindow(view4);
    pw4.setBackgroundDrawable(
        getResources().getDrawable(android.R.drawable.screen_background_dark_transparent));
    pw5 = new PopupWindow(view5);
    pw5.setBackgroundDrawable(
        getResources().getDrawable(android.R.drawable.screen_background_dark_transparent));

    // 设置activity窗口属性
    LayoutParams p = getWindow().getAttributes();
    p.height = (int) (getWindowManager().getDefaultDisplay().getHeight() * 1.0);
    p.width = (int) (getWindowManager().getDefaultDisplay().getWidth() * 0.75);
    p.dimAmount = 0f;
    getWindow().setAttributes(p);
    getWindow().setGravity(Gravity.LEFT);

    /* ib1.setLeft(50);
    ib1.setTop(200);*/
    iv.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            if (pwIsShowing()) {
              for (PopupWindow pw : pwList) {
                pw.dismiss();
              }
              pwList.clear();
            } else {
              pw1.showAtLocation(iv, Gravity.CENTER, -100, -150);
              pw1.update(160, 60);
              pw2.showAtLocation(iv, Gravity.CENTER, 10, -10);
              pw2.update(190, 60);
              pw3.showAtLocation(iv, Gravity.CENTER, -100, 80);
              pw3.update(220, 60);
              pw4.showAtLocation(iv, Gravity.CENTER, 100, 120);
              pw4.update(160, 60);
              pw5.showAtLocation(iv, Gravity.CENTER, -100, 180);
              pw5.update(160, 60);
              pwList.clear();
            }
          }
        });
  }
Esempio n. 18
0
 public void setWindowSize(int width, int height) {
   wmParams.width = width;
   wmParams.height = height;
 }