public void setupSaveButton() {
   // put save button on screen
   mSaveButton = new Button(MainScreen.thiz);
   mSaveButton.setBackgroundResource(R.drawable.button_save_background);
   mSaveButton.setOnClickListener(this);
   LayoutParams saveLayoutParams =
       new LayoutParams(
           (int)
               (MainScreen.mainContext
                   .getResources()
                   .getDimension(R.dimen.postprocessing_savebutton_size)),
           (int)
               (MainScreen.mainContext
                   .getResources()
                   .getDimension(R.dimen.postprocessing_savebutton_size)));
   saveLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
   saveLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
   saveLayoutParams.setMargins(
       (int) (MainScreen.thiz.getResources().getDisplayMetrics().density * 8),
       (int) (MainScreen.thiz.getResources().getDisplayMetrics().density * 8),
       0,
       0);
   ((RelativeLayout) postProcessingView.findViewById(R.id.sequenceLayout))
       .addView(mSaveButton, saveLayoutParams);
   mSaveButton.setRotation(mLayoutOrientationCurrent);
 }
 private void configMinimizedViewLayoutParams(LoopMeBannerView bannerView) {
   LayoutParams lp = (LayoutParams) bannerView.getLayoutParams();
   lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
   lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
   lp.bottomMargin = mMinimizedMode.getMarginBottom();
   lp.rightMargin = mMinimizedMode.getMarginRight();
   bannerView.setLayoutParams(lp);
 }
 private View createGameView(AndroidApplicationConfiguration var1) {
   this.gameView = this.initializeForView(new JetAdventure(this), var1);
   LayoutParams var2 = new LayoutParams(-1, -2);
   var2.addRule(10, -1);
   var2.addRule(14, -1);
   var2.addRule(2, this.adViewMain.getId());
   this.gameView.setLayoutParams(var2);
   return this.gameView;
 }
  public void onStartPostProcessing() {
    LayoutInflater inflator = ApplicationScreen.instance.getLayoutInflater();
    postProcessingView =
        inflator.inflate(R.layout.plugin_processing_sequence_postprocessing, null, false);

    mImgView = ((ImageView) postProcessingView.findViewById(R.id.sequenceImageHolder));

    if (PreviewBmp != null) {
      PreviewBmp.recycle();
    }

    paint = new Paint();
    paint.setColor(0xFF00AAEA);
    paint.setStrokeWidth(5);
    paint.setPathEffect(new DashPathEffect(new float[] {5, 5}, 0));

    PreviewBmp = mAlmaCLRShot.getPreviewBitmap();

    if (PreviewBmp != null) {
      Matrix matrix = new Matrix();
      matrix.postRotate(90);
      Bitmap rotated =
          Bitmap.createBitmap(
              PreviewBmp, 0, 0, PreviewBmp.getWidth(), PreviewBmp.getHeight(), matrix, true);
      mImgView.setImageBitmap(rotated);
      mImgView.setRotation(
          mCameraMirrored
              ? ((mDisplayOrientation == 0 || mDisplayOrientation == 180) ? 0 : 180)
              : 0);
    }

    sequenceView = ((OrderControl) postProcessingView.findViewById(R.id.seqView));
    final Bitmap[] thumbnailsArray = new Bitmap[thumbnails.size()];
    for (int i = 0; i < thumbnailsArray.length; i++) {
      Bitmap bmp = thumbnails.get(i);
      Matrix matrix = new Matrix();
      matrix.postRotate(
          mCameraMirrored
              ? ((mDisplayOrientation == 0 || mDisplayOrientation == 180) ? 270 : 90)
              : 90);
      Bitmap rotated =
          Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
      thumbnailsArray[i] = rotated;
    }
    sequenceView.setContent(thumbnailsArray, this);
    LayoutParams lp = (LayoutParams) sequenceView.getLayoutParams();
    lp.height = thumbnailsArray[0].getHeight();
    sequenceView.setLayoutParams(lp);

    sequenceView.setRotation(mCameraMirrored ? 180 : 0);

    mHandler.sendEmptyMessage(MSG_END_OF_LOADING);
  }
Exemplo n.º 5
0
  @Override
  public void update() {
    super.update();
    LayoutParams lp = (LayoutParams) getLayoutParams();
    lp.leftMargin = bounds.displayLeft;
    lp.topMargin = bounds.displayTop;
    setLayoutParams(lp);

    Log.d("Chevron", "new size:" + this.getWidth() + "," + this.getHeight());

    updatePath();
  }
 private AdView createAdView() {
   this.adViewMain = new AdView(this);
   this.adViewMain.setAdSize(AdSize.SMART_BANNER);
   this.adViewMain.setAdUnitId(AD_UNIT_ID_BANNER);
   this.adViewMain.setId(12345);
   LayoutParams var1 = new LayoutParams(-1, -2);
   var1.addRule(12, -1);
   var1.addRule(14, -1);
   this.adViewMain.setLayoutParams(var1);
   this.adViewMain.setBackgroundColor(-16777216);
   return this.adViewMain;
 }
Exemplo n.º 7
0
 @Override
 /*.*/ public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   /*
   * You can access the container's id by calling
        ((ViewGroup)getView().getParent()).getId();
   */
   LayoutParams lparams =
       new LayoutParams(
           RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
   lparams.addRule(RelativeLayout.CENTER_IN_PARENT);
   mView.setLayoutParams(lparams);
   return mView;
 }
 // by jmpessoa
 public void setLayoutAll(int idAnchor) {
   lparams.width = lpW; // matchParent;
   lparams.height = lpH; // wrapContent;
   lparams.setMargins(MarginLeft, MarginTop, marginRight, marginBottom);
   if (idAnchor > 0) {
     for (int i = 0; i < countAnchorRule; i++) {
       lparams.addRule(lparamsAnchorRule[i], idAnchor);
     }
   }
   for (int j = 0; j < countParentRule; j++) {
     lparams.addRule(lparamsParentRule[j]);
   }
   //
   this.setLayoutParams(lparams);
 }
  // Constructor
  public jImageView(android.content.Context context, Controls ctrls, long pasobj) {
    super(context);
    // Connect Pascal I/F
    PasObj = pasobj;
    controls = ctrls;
    // Init Class
    lparams = new LayoutParams(100, 100);
    lparams.setMargins(50, 50, 0, 0);
    //
    // setAdjustViewBounds(false);
    setScaleType(ImageView.ScaleType.CENTER);
    mMatrix = new Matrix();
    // Init Event
    onClickListener =
        new OnClickListener() {
          public void onClick(View view) {
            controls.pOnClick(PasObj, Const.Click_Default);
          }
        };

    setOnClickListener(onClickListener);

    // this.setWillNotDraw(false); //false = fire OnDraw after Invalited ... true = not fire
    // onDraw... thanks to tintinux

  }
Exemplo n.º 10
0
  protected View inflateRescueButton(View parent) {
    RelativeLayout rel = new RelativeLayout(getContext());
    rel.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    rel.addView(parent);

    int buttonSize = getContext().getResources().getDimensionPixelSize(R.dimen.puzzle_title_height);

    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT | RelativeLayout.ALIGN_PARENT_TOP);
    params.width = buttonSize;
    params.height = buttonSize;
    View view = getRescueButton();
    view.setLayoutParams(params);

    rel.addView(view);
    return rel;
  }
Exemplo n.º 11
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;

    if (convertView == null) {

      mWidth = mContext.getResources().getDisplayMetrics().widthPixels;

      convertView = viewInflater.inflate(R.layout.view_grid_item_media_chooser, parent, false);

      holder = new ViewHolder();
      holder.checkBoxTextView =
          (CheckedTextView)
              convertView.findViewById(R.id.checkTextViewFromMediaChooserGridItemRowView);
      holder.imageView =
          (ImageView) convertView.findViewById(R.id.imageViewFromMediaChooserGridItemRowView);

      convertView.setTag(holder);

    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    LayoutParams imageParams = (LayoutParams) holder.imageView.getLayoutParams();
    imageParams.width = mWidth / 2;
    imageParams.height = mWidth / 2;

    holder.imageView.setLayoutParams(imageParams);

    // set the status according to this Category item

    if (mIsFromVideo) {
      new VideoLoadAsync(videoFragment, holder.imageView, false, mWidth / 2)
          .executeOnExecutor(
              MediaAsync.THREAD_POOL_EXECUTOR, mGalleryModelList.get(position).url.toString());

    } else {
      ImageLoadAsync loadAsync = new ImageLoadAsync(mContext, holder.imageView, mWidth / 2);
      loadAsync.executeOnExecutor(
          MediaAsync.THREAD_POOL_EXECUTOR, mGalleryModelList.get(position).url);
    }

    holder.checkBoxTextView.setChecked(mGalleryModelList.get(position).status);
    return convertView;
  }
Exemplo n.º 12
0
  // by jmpessoa
  public void setLayoutAll(int idAnchor) {
    lparams.width = lpW; // matchParent;
    lparams.height = lpH; // wrapContent;
    lparams.setMargins(MarginLeft, MarginTop, marginRight, marginBottom);

    if (idAnchor > 0) {
      // lparams.addRule(RelativeLayout.BELOW, id);
      // lparams.addRule(RelativeLayout.ALIGN_BASELINE, id)
      // lparams.addRule(RelativeLayout.LEFT_OF, id); //lparams.addRule(RelativeLayout.RIGHT_OF, id)
      for (int i = 0; i < countAnchorRule; i++) {
        lparams.addRule(lparamsAnchorRule[i], idAnchor);
      }
    }
    for (int j = 0; j < countParentRule; j++) {
      lparams.addRule(lparamsParentRule[j]);
    }
    //
    this.setLayoutParams(lparams);
  }
Exemplo n.º 13
0
 @Override
 public void onGlobalLayout() {
   Rect r = new Rect();
   baseRoot.getGlobalVisibleRect(r);
   // 进入Activity时会布局,第一次调用onGlobalLayout,先记录开始软键盘没有弹出时底部的位置
   if (rootBottom == Integer.MIN_VALUE) {
     rootBottom = r.bottom;
     return;
   }
   // adjustResize,软键盘弹出后高度会变小
   if (r.bottom < rootBottom) {
     // 按照键盘高度设置表情框和发送图片按钮框的高度
     keyboardHeight = rootBottom - r.bottom;
     SystemConfigSp.instance().init(MessageActivity.this);
     SystemConfigSp.instance().setIntConfig(currentInputMethod, keyboardHeight);
     LayoutParams params = (LayoutParams) addOthersPanelView.getLayoutParams();
     params.height = keyboardHeight;
     LayoutParams params1 = (LayoutParams) emoLayout.getLayoutParams();
     params1.height = keyboardHeight;
   }
 }
 private void e() {
   this.k = (TextView) findViewById(R.id.search_devices_title);
   this.l = (TextView) findViewById(R.id.search_devices_info);
   this.k.setText(R.string.find_weight_scale_info);
   this.l.setText(a.f);
   this.m = (ImageView) findViewById(R.id.search_devices_mili_icon);
   this.m.setImageResource(R.drawable.mi_logo);
   this.j = (LinePieChartView) findViewById(R.id.searching_pie_chart);
   LayoutParams layoutParams = (LayoutParams) this.j.getLayoutParams();
   layoutParams.width = (int) getResources().getDimension(R.dimen.draw_weight_icon_w);
   layoutParams.height = (int) getResources().getDimension(R.dimen.draw_weight_icon_w);
   this.j.a(4);
   this.j.d_();
   findViewById(R.id.search_single_frame)
       .setBackgroundColor(getResources().getColor(R.color.bg_mode_weight));
   this.n = (TextView) findViewById(R.id.search_devices_weight_value);
   this.o = findViewById(R.id.right_button);
   this.o.setOnClickListener(this);
   if (!DeviceSource.hasBindWeight()) {
     this.o.performClick();
   }
 }
Exemplo n.º 15
0
 @Override
 public void onReceive(Context context, Intent intent) {
   if (intent.getAction().equals("android.intent.action.INPUT_METHOD_CHANGED")) {
     currentInputMethod =
         Settings.Secure.getString(
             MessageActivity.this.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
     SystemConfigSp.instance()
         .setStrConfig(SystemConfigSp.SysCfgDimension.DEFAULTINPUTMETHOD, currentInputMethod);
     int height = SystemConfigSp.instance().getIntConfig(currentInputMethod);
     if (keyboardHeight != height) {
       keyboardHeight = height;
       addOthersPanelView.setVisibility(View.GONE);
       emoLayout.setVisibility(View.GONE);
       MessageActivity.this
           .getWindow()
           .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
       messageEdt.requestFocus();
       if (keyboardHeight != 0
           && addOthersPanelView.getLayoutParams().height != keyboardHeight) {
         LayoutParams params = (LayoutParams) addOthersPanelView.getLayoutParams();
         params.height = keyboardHeight;
       }
       if (keyboardHeight != 0 && emoLayout.getLayoutParams().height != keyboardHeight) {
         LayoutParams params = (LayoutParams) emoLayout.getLayoutParams();
         params.height = keyboardHeight;
       }
     } else {
       addOthersPanelView.setVisibility(View.VISIBLE);
       emoLayout.setVisibility(View.VISIBLE);
       MessageActivity.this
           .getWindow()
           .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
       messageEdt.requestFocus();
     }
   }
 }
Exemplo n.º 16
0
 // Constructor
 public jButton(android.content.Context context, Controls ctrls, long pasobj) {
   super(context);
   // Connect Pascal I/F
   controls = ctrls;
   PasObj = pasobj;
   // Init Class
   lparams = new LayoutParams(100, 100); // W,H
   lparams.setMargins(5, 5, 5, 5); // L,T,
   // Init Event
   onClickListener =
       new OnClickListener() {
         public void onClick(View view) {
           // Log.i("TAG_CLICK", "jButton_Clicked!"); //just demo for LATE logcat filter!
           controls.pOnClick(PasObj, Const.Click_Default);
         }
       };
   setOnClickListener(onClickListener);
   // Log.i("jButton","created!");
 }
Exemplo n.º 17
0
  // Constructor
  public jTextView(android.content.Context context, Controls ctrls, long pasobj) {
    super(context);
    // Connect Pascal I/F
    PasObj = pasobj;
    controls = ctrls;
    // Init Class
    lparams = new LayoutParams(100, 100); // W,H
    lparams.setMargins(5, 5, 5, 5); // L,T,

    mClipBoard = (ClipboardManager) controls.activity.getSystemService(Context.CLIPBOARD_SERVICE);

    // Init Event
    onClickListener =
        new OnClickListener() {
          public void onClick(View view) {
            if (enabled) {
              controls.pOnClick(PasObj, Const.Click_Default);
            }
          };
        };
    setOnClickListener(onClickListener);
  }
Exemplo n.º 18
0
  private void initialButton() {
    Display display = getWindowManager().getDefaultDisplay();
    height = display.getHeight();
    width = display.getWidth();
    Log.v("width  & height is:", String.valueOf(width) + ", " + String.valueOf(height));

    params.height = 50;
    params.width = 50;
    // 设置边距  (int left, int top, int right, int bottom)
    params.setMargins(10, height - 98, 0, 0);

    buttonSleep = (Button) findViewById(R.id.button_composer_sleep);
    buttonSleep.setLayoutParams(params);

    buttonThought = (Button) findViewById(R.id.button_composer_thought);
    buttonThought.setLayoutParams(params);

    buttonMusic = (Button) findViewById(R.id.button_composer_music);
    buttonMusic.setLayoutParams(params);

    buttonPlace = (Button) findViewById(R.id.button_composer_place);
    buttonPlace.setLayoutParams(params);

    buttonWith = (Button) findViewById(R.id.button_composer_with);
    buttonWith.setLayoutParams(params);

    buttonCamera = (Button) findViewById(R.id.button_composer_camera);
    buttonCamera.setLayoutParams(params);

    buttonDelete = (Button) findViewById(R.id.button_friends_delete);
    buttonDelete.setLayoutParams(params);

    buttonDelete.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (isClick == false) {
              isClick = true;
              buttonDelete.startAnimation(animRotate(-45.0f, 0.5f, 0.45f));
              buttonCamera.startAnimation(
                  animTranslate(0.0f, -180.0f, 10, height - 240, buttonCamera, 80));
              buttonWith.startAnimation(
                  animTranslate(30.0f, -150.0f, 60, height - 230, buttonWith, 100));
              buttonPlace.startAnimation(
                  animTranslate(70.0f, -120.0f, 110, height - 210, buttonPlace, 120));
              buttonMusic.startAnimation(
                  animTranslate(80.0f, -110.0f, 150, height - 180, buttonMusic, 140));
              buttonThought.startAnimation(
                  animTranslate(90.0f, -60.0f, 175, height - 135, buttonThought, 160));
              buttonSleep.startAnimation(
                  animTranslate(170.0f, -30.0f, 190, height - 90, buttonSleep, 180));

            } else {
              isClick = false;
              buttonDelete.startAnimation(animRotate(90.0f, 0.5f, 0.45f));
              buttonCamera.startAnimation(
                  animTranslate(0.0f, 140.0f, 10, height - 98, buttonCamera, 180));
              buttonWith.startAnimation(
                  animTranslate(-50.0f, 130.0f, 10, height - 98, buttonWith, 160));
              buttonPlace.startAnimation(
                  animTranslate(-100.0f, 110.0f, 10, height - 98, buttonPlace, 140));
              buttonMusic.startAnimation(
                  animTranslate(-140.0f, 80.0f, 10, height - 98, buttonMusic, 120));
              buttonThought.startAnimation(
                  animTranslate(-160.0f, 40.0f, 10, height - 98, buttonThought, 80));
              buttonSleep.startAnimation(
                  animTranslate(-170.0f, 0.0f, 10, height - 98, buttonSleep, 50));
            }
          }
        });
    buttonCamera.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            buttonCamera.startAnimation(setAnimScale(2.5f, 2.5f));
            buttonWith.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonPlace.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonMusic.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonThought.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonSleep.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonDelete.startAnimation(setAnimScale(0.0f, 0.0f));
          }
        });
    buttonWith.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            buttonWith.startAnimation(setAnimScale(2.5f, 2.5f));
            buttonCamera.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonPlace.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonMusic.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonThought.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonSleep.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonDelete.startAnimation(setAnimScale(0.0f, 0.0f));
          }
        });
    buttonPlace.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            buttonPlace.startAnimation(setAnimScale(2.5f, 2.5f));
            buttonWith.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonCamera.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonMusic.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonThought.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonSleep.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonDelete.startAnimation(setAnimScale(0.0f, 0.0f));
          }
        });
    buttonMusic.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            buttonMusic.startAnimation(setAnimScale(2.5f, 2.5f));
            buttonPlace.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonWith.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonCamera.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonThought.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonSleep.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonDelete.startAnimation(setAnimScale(0.0f, 0.0f));
          }
        });
    buttonThought.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            buttonThought.startAnimation(setAnimScale(2.5f, 2.5f));
            buttonPlace.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonWith.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonCamera.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonMusic.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonSleep.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonDelete.startAnimation(setAnimScale(0.0f, 0.0f));
          }
        });
    buttonSleep.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            buttonSleep.startAnimation(setAnimScale(2.5f, 2.5f));
            buttonPlace.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonWith.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonCamera.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonMusic.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonThought.startAnimation(setAnimScale(0.0f, 0.0f));
            buttonDelete.startAnimation(setAnimScale(0.0f, 0.0f));
          }
        });
  }
Exemplo n.º 19
0
 // by jmpessoa
 public void setLParamWidth(int w) {
   lpW = w;
   lparams.width = w;
 }
Exemplo n.º 20
0
  /** Initializes the origin state of the layer */
  private void initState() {
    mStickContainerToRightLeftOrMiddle.equals("left");
    // Sticks container to right or left
    LayoutParams rlp = (LayoutParams) mSlidingLayer.getLayoutParams();
    int textResource;
    Drawable d;

    if (mStickContainerToRightLeftOrMiddle.equals("right")) {
      textResource = R.string.swipe_right_label;
      d = getResources().getDrawable(R.drawable.container_rocket_right);

      rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    } else if (mStickContainerToRightLeftOrMiddle.equals("left")) {
      textResource = R.string.swipe_left_label;
      // d = getResources().getDrawable(R.drawable.container_rocket_left);

      rlp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    } else if (mStickContainerToRightLeftOrMiddle.equals("top")) {
      textResource = R.string.swipe_up_label;
      d = getResources().getDrawable(R.drawable.container_rocket);

      mSlidingLayer.setStickTo(SlidingLayer.STICK_TO_TOP);
      rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
      rlp.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
      rlp.height = getResources().getDimensionPixelSize(R.dimen.layer_width);
    } else if (mStickContainerToRightLeftOrMiddle.equals("bottom")) {
      textResource = R.string.swipe_down_label;
      d = getResources().getDrawable(R.drawable.container_rocket);

      mSlidingLayer.setStickTo(SlidingLayer.STICK_TO_BOTTOM);
      rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      rlp.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
      rlp.height = getResources().getDimensionPixelSize(R.dimen.layer_width);
    } else {
      textResource = R.string.swipe_label;
      d = getResources().getDrawable(R.drawable.container_rocket);

      rlp.addRule(RelativeLayout.CENTER_IN_PARENT);
      rlp.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
    }

    // d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
    // swipeText.setCompoundDrawables(null, d, null, null);
    // swipeText.setText(getResources().getString(textResource));
    mSlidingLayer.setLayoutParams(rlp);

    // Sets the shadow of the container
    if (mShowShadow) {
      mSlidingLayer.setShadowWidthRes(R.dimen.shadow_width);
      mSlidingLayer.setShadowDrawable(R.drawable.sidebar_shadow);
    } else {
      mSlidingLayer.setShadowWidth(20);
      mSlidingLayer.setShadowDrawable(null);
    }
    if (mShowOffset) {
      mSlidingLayer.setOffsetWidth(getResources().getDimensionPixelOffset(R.dimen.offset_width));
    } else {
      mSlidingLayer.setOffsetWidth(0);
    }
  }
Exemplo n.º 21
0
 public void setLParamHeight(int h) {
   lpH = h;
   lparams.height = h;
 }
Exemplo n.º 22
0
 private synchronized boolean initUI() {
   boolean z;
   try {
     if (getIntent() != null) {
       this.mbHideHeader = getIntent().getBooleanExtra("HIDE_HEADER", false);
       this.mbSendAllChecksumResponseParametersToPGServer =
           getIntent()
               .getBooleanExtra("SEND_ALL_CHECKSUM_RESPONSE_PARAMETERS_TO_PG_SERVER", false);
     }
     PaytmUtility.debugLog("Hide Header " + this.mbHideHeader);
     PaytmUtility.debugLog("Initializing the UI of Transaction Page...");
     RelativeLayout RootView = new RelativeLayout(this);
     RelativeLayout TopBar = new RelativeLayout(this);
     TopBar.setLayoutParams(new LayoutParams(-1, -2));
     TopBar.setId(1);
     TopBar.setBackgroundColor(-3355444);
     Button Cancel = new Button(this, null, 16842825);
     LayoutParams CancelParams = new LayoutParams(-2, -2);
     CancelParams.addRule(15);
     CancelParams.leftMargin = (int) (getResources().getDisplayMetrics().density * 5.0f);
     Cancel.setOnClickListener(
         new OnClickListener() {
           public void onClick(View v) {
             PaytmUtility.debugLog("User pressed back button which is present in Header Bar.");
             PaytmPGActivity.this.cancelTransaction();
           }
         });
     Cancel.setLayoutParams(CancelParams);
     Cancel.setText("Cancel");
     TextView AppName = new TextView(this);
     LayoutParams AppNameParams = new LayoutParams(-2, -2);
     AppNameParams.addRule(13);
     AppName.setLayoutParams(AppNameParams);
     AppName.setTextColor(-16777216);
     AppName.setText("Paytm Payments");
     TopBar.addView(Cancel);
     TopBar.addView(AppName);
     RelativeLayout WebLayout = new RelativeLayout(this);
     LayoutParams WebLayoutParams = new LayoutParams(-1, -1);
     WebLayoutParams.addRule(3, TopBar.getId());
     WebLayout.setLayoutParams(WebLayoutParams);
     this.mWV = new PaytmWebView(this, this.mParams);
     this.mWV.setVisibility(8);
     this.mWV.setLayoutParams(new LayoutParams(-1, -1));
     mProgress = new ProgressBar(this, null, 16842873);
     LayoutParams ProgressParams = new LayoutParams(-2, -2);
     ProgressParams.addRule(13);
     mProgress.setLayoutParams(ProgressParams);
     WebLayout.addView(this.mWV);
     WebLayout.addView(mProgress);
     RootView.addView(TopBar);
     RootView.addView(WebLayout);
     if (this.mbHideHeader) {
       TopBar.setVisibility(8);
     }
     requestWindowFeature(1);
     setContentView(RootView);
     PaytmUtility.debugLog("Initialized UI of Transaction Page.");
     z = true;
   } catch (Exception inEx) {
     PaytmUtility.debugLog("Some exception occurred while initializing UI.");
     PaytmUtility.printStackTrace(inEx);
     z = false;
   }
   return z;
 }
  private void initUI() {
    mWM = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    mScreenWidth = mWM.getDefaultDisplay().getWidth();
    mScreenHeight = mWM.getDefaultDisplay().getHeight();
    //		1找控件
    final ImageView iv_drag = (ImageView) findViewById(R.id.iv_drag);
    final Button bt_notify_top = (Button) findViewById(R.id.bt_notify_top);
    final Button bt_notify_bottom = (Button) findViewById(R.id.bt_notify_bottom);

    //		2获取归属地提示框保存的位置
    int locationX = SpUtil.getInt(this, ConstantValues.TOAST_ADDRESS_LOCATIONX, 0);
    int locationY = SpUtil.getInt(this, ConstantValues.TOAST_ADDRESS_LOCATIONY, 0);
    mLayoutParams =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    mLayoutParams.leftMargin = locationX;
    mLayoutParams.topMargin = locationY;
    iv_drag.setLayoutParams(mLayoutParams);

    if (locationY < mScreenHeight / 2) {
      bt_notify_top.setVisibility(View.INVISIBLE);
      bt_notify_bottom.setVisibility(View.VISIBLE);
    } else {
      bt_notify_top.setVisibility(View.VISIBLE);
      bt_notify_bottom.setVisibility(View.INVISIBLE);
    }

    //		4设置触摸监听事件
    iv_drag.setOnTouchListener(
        new OnTouchListener() {
          private int startX;
          private int startY;

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                //					获取按下时候的坐标,作为初始坐标
                startX = (int) event.getRawX();
                startY = (int) event.getRawY();

                break;
              case MotionEvent.ACTION_MOVE:
                //					获取移动过程中的坐标
                int moveX = (int) event.getRawX();
                int moveY = (int) event.getRawY();
                //					移动的距离
                int disX = moveX - startX;
                int disY = moveY - startY;

                int left = iv_drag.getLeft() + disX;
                int top = iv_drag.getTop() + disY;
                int right = iv_drag.getRight() + disX;
                int bottom = iv_drag.getBottom() + disY;

                if (top < mScreenHeight / 2) {
                  bt_notify_top.setVisibility(View.INVISIBLE);
                  bt_notify_bottom.setVisibility(View.VISIBLE);
                } else {
                  bt_notify_top.setVisibility(View.VISIBLE);
                  bt_notify_bottom.setVisibility(View.INVISIBLE);
                }

                //					1容错处理
                if (left < 0 || top < 0 || right > mScreenWidth || bottom > mScreenHeight - 22) {
                  return true;
                }
                //					2将移动后的坐标展示
                System.out.println(left + "----" + top + "----" + right + "----" + bottom);
                iv_drag.layout(left, top, right, bottom);
                //					3重置起始坐标
                startX = (int) event.getRawX();
                startY = (int) event.getRawY();
                break;
              case MotionEvent.ACTION_UP:
                //					4保存吐司位置坐标
                SpUtil.putInt(
                    getApplicationContext(),
                    ConstantValues.TOAST_ADDRESS_LOCATIONX,
                    iv_drag.getLeft());
                SpUtil.putInt(
                    getApplicationContext(),
                    ConstantValues.TOAST_ADDRESS_LOCATIONY,
                    iv_drag.getTop());

                break;
            }
            return false;
          }
        });

    //		5设置双击监听事件
    iv_drag.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
            mHits[mHits.length - 1] = SystemClock.uptimeMillis();
            if (mHits[mHits.length - 1] - mHits[0] < 500) {
              // 满足双击事件后,调用代码
              int left = mScreenWidth / 2 - iv_drag.getWidth() / 2;
              int top = mScreenHeight / 2 - iv_drag.getHeight() / 2;
              int right = mScreenWidth / 2 + iv_drag.getWidth() / 2;
              int bottom = mScreenHeight / 2 + iv_drag.getHeight() / 2;

              // 控件按以上规则显示
              iv_drag.layout(left, top, right, bottom);

              // 存储最终位置
              SpUtil.putInt(
                  getApplicationContext(),
                  ConstantValues.TOAST_ADDRESS_LOCATIONX,
                  iv_drag.getLeft());
              SpUtil.putInt(
                  getApplicationContext(),
                  ConstantValues.TOAST_ADDRESS_LOCATIONY,
                  iv_drag.getTop());
            }
          }
        });
  }
Exemplo n.º 24
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.v4frag);
    vp = (ViewPager) findViewById(R.id.pager);

    TextView textView0 = new TextView(this);
    textView0.setText("page 0");
    TextView textView1 = new TextView(this);
    textView1.setText("page 1");
    TextView textView2 = new TextView(this);
    textView2.setText("page 2");
    listViews.add(textView0);
    listViews.add(textView1);
    listViews.add(textView2);

    labels[0] = (TextView) findViewById(R.id.tv11);
    labels[0].setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            vp.setCurrentItem(0);
          }
        });
    labels[1] = (TextView) findViewById(R.id.tv12);
    labels[1].setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            vp.setCurrentItem(1);
          }
        });
    labels[2] = (TextView) findViewById(R.id.tv13);
    labels[2].setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            vp.setCurrentItem(2);
          }
        });

    tv = (TextView) findViewById(R.id.tv);
    vp.setAdapter(new MyPagerAdapter(listViews));
    WIDHT = getWindowManager().getDefaultDisplay().getWidth() / labels.length;
    LayoutParams lp = (LayoutParams) tv.getLayoutParams();
    lp.width = WIDHT;
    tv.setLayoutParams(lp);
    vp.setOnPageChangeListener(
        new OnPageChangeListener() {
          public void onPageSelected(int position) {
            System.out.println("onPageSelected");
            setSelect(position);
            TranslateAnimation animation = new TranslateAnimation(left, position * WIDHT, 0, 0);
            animation.setDuration(200);
            animation.setFillAfter(true);
            animation.setFillBefore(true);
            final int i = position;
            animation.setAnimationListener(
                new AnimationListener() {

                  public void onAnimationEnd(Animation animation) {
                    Log.d(tag, "onAnimationEnd");
                  }

                  public void onAnimationRepeat(Animation animation) {}

                  public void onAnimationStart(Animation animation) {
                    Log.d(tag, "onAnimationStart");
                    left = i * WIDHT;
                  }
                });
            tv.startAnimation(animation);
          }

          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          public void onPageScrollStateChanged(int state) {}
        });
    setSelect(0);
  }
  public BookViewController(Context context, Book boo) {
    mContext = context;
    layout = new RelativeLayout(mContext);
    book = boo;
    //		allPageNo = book.getNavPoints().size();
    allPageNo = book.getFlatNavPoints().size();
    display = ((Activity) mContext).getWindowManager().getDefaultDisplay();
    prefsManager = new PrefsManager(mContext);
    /** chapter view */
    chapter = new ChapterView(mContext, book, this);

    /*
     *content view
     */
    content = new ContentView(mContext);
    controllBarClickListener = new ControllBarClickListener(mContext, this);
    content.setControllButtonsClickListener(controllBarClickListener);

    adView = new AdView(mContext);
    LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    adView.setId(genID);
    adView.setVisibility(View.INVISIBLE);
    adView.postDelayed(
        new Runnable() {

          @Override
          public void run() {
            // TODO Auto-generated method stub
            adView.setVisibility(View.VISIBLE);
          }
        },
        1000 * 60);

    LayoutParams mainParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    mainParams.addRule(RelativeLayout.BELOW, adView.getId());

    layout.addView(adView, params);
    layout.addView(content, mainParams);
    layout.addView(chapter, mainParams);

    chapterLeftOut = new TranslateAnimation(0, -display.getWidth(), 0, 0);
    chapterLeftOut.setDuration(300);
    chapterLeftOut.setAnimationListener(
        new AnimationListener() {

          @Override
          public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub
            chapter.setVisibility(View.INVISIBLE);
          }
        });
    chapterLeftIn = new TranslateAnimation(-display.getWidth(), 0, 0, 0);
    chapterLeftIn.setDuration(300);
  }
Exemplo n.º 26
0
  /** @Description 初始化界面控件 有点庞大 todo */
  private void initView() {
    // 绑定布局资源(注意放所有资源初始化之前)
    LayoutInflater.from(this).inflate(R.layout.tt_activity_message, topContentView);

    // TOP_CONTENT_VIEW
    setLeftButton(R.drawable.tt_top_back);
    setLeftText(getResources().getString(R.string.top_left_back));
    setRightButton(R.drawable.tt_top_right_group_manager);
    topLeftBtn.setOnClickListener(this);
    letTitleTxt.setOnClickListener(this);
    topRightBtn.setOnClickListener(this);

    // 列表控件(开源PTR)
    lvPTR = (PullToRefreshListView) this.findViewById(R.id.message_list);
    textView_new_msg_tip = (TextView) findViewById(R.id.tt_new_msg_tip);
    lvPTR
        .getRefreshableView()
        .addHeaderView(
            LayoutInflater.from(this)
                .inflate(R.layout.tt_messagelist_header, lvPTR.getRefreshableView(), false));
    Drawable loadingDrawable = getResources().getDrawable(R.drawable.pull_to_refresh_indicator);
    final int indicatorWidth =
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 29, getResources().getDisplayMetrics());
    loadingDrawable.setBounds(new Rect(0, indicatorWidth, 0, indicatorWidth));
    lvPTR.getLoadingLayoutProxy().setLoadingDrawable(loadingDrawable);
    lvPTR.getRefreshableView().setCacheColorHint(Color.WHITE);
    lvPTR.getRefreshableView().setSelector(new ColorDrawable(Color.WHITE));
    lvPTR.getRefreshableView().setOnTouchListener(lvPTROnTouchListener);
    adapter = new MessageAdapter(this);
    lvPTR.setAdapter(adapter);
    lvPTR.setOnRefreshListener(this);
    lvPTR.setOnScrollListener(
        new PauseOnScrollListener(ImageLoader.getInstance(), true, true) {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {
            switch (scrollState) {
              case AbsListView.OnScrollListener.SCROLL_STATE_IDLE:
                if (view.getLastVisiblePosition() == (view.getCount() - 1)) {
                  textView_new_msg_tip.setVisibility(View.GONE);
                }
                break;
            }
          }
        });
    textView_new_msg_tip.setOnClickListener(this);

    // 界面底部输入框布局
    sendBtn = (TextView) this.findViewById(R.id.send_message_btn);
    recordAudioBtn = (Button) this.findViewById(R.id.record_voice_btn);
    audioInputImg = (ImageView) this.findViewById(R.id.voice_btn);
    messageEdt = (CustomEditView) this.findViewById(R.id.message_text);
    RelativeLayout.LayoutParams messageEdtParam = (LayoutParams) messageEdt.getLayoutParams();
    messageEdtParam.addRule(RelativeLayout.LEFT_OF, R.id.show_emo_btn);
    messageEdtParam.addRule(RelativeLayout.RIGHT_OF, R.id.voice_btn);
    keyboardInputImg = (ImageView) this.findViewById(R.id.show_keyboard_btn);
    addPhotoBtn = (ImageView) this.findViewById(R.id.show_add_photo_btn);
    addEmoBtn = (ImageView) this.findViewById(R.id.show_emo_btn);
    messageEdt.setOnFocusChangeListener(msgEditOnFocusChangeListener);
    messageEdt.setOnClickListener(this);
    messageEdt.addTextChangedListener(this);
    addPhotoBtn.setOnClickListener(this);
    addEmoBtn.setOnClickListener(this);
    keyboardInputImg.setOnClickListener(this);
    audioInputImg.setOnClickListener(this);
    recordAudioBtn.setOnTouchListener(this);
    sendBtn.setOnClickListener(this);
    initSoundVolumeDlg();

    // OTHER_PANEL_VIEW
    addOthersPanelView = findViewById(R.id.add_others_panel);
    LayoutParams params = (LayoutParams) addOthersPanelView.getLayoutParams();
    if (keyboardHeight > 0) {
      params.height = keyboardHeight;
      addOthersPanelView.setLayoutParams(params);
    }
    View takePhotoBtn = findViewById(R.id.take_photo_btn);
    View takeCameraBtn = findViewById(R.id.take_camera_btn);
    takePhotoBtn.setOnClickListener(this);
    takeCameraBtn.setOnClickListener(this);

    // EMO_LAYOUT
    emoLayout = (LinearLayout) findViewById(R.id.emo_layout);
    LayoutParams paramEmoLayout = (LayoutParams) emoLayout.getLayoutParams();
    if (keyboardHeight > 0) {
      paramEmoLayout.height = keyboardHeight;
      emoLayout.setLayoutParams(paramEmoLayout);
    }
    emoGridView = (EmoGridView) findViewById(R.id.emo_gridview);
    yayaEmoGridView = (YayaEmoGridView) findViewById(R.id.yaya_emo_gridview);
    emoRadioGroup = (RadioGroup) findViewById(R.id.emo_tab_group);
    emoGridView.setOnEmoGridViewItemClick(onEmoGridViewItemClick);
    emoGridView.setAdapter();
    yayaEmoGridView.setOnEmoGridViewItemClick(yayaOnEmoGridViewItemClick);
    yayaEmoGridView.setAdapter();
    emoRadioGroup.setOnCheckedChangeListener(emoOnCheckedChangeListener);

    // LOADING
    View view = LayoutInflater.from(MessageActivity.this).inflate(R.layout.tt_progress_ly, null);
    progressbar = (MGProgressbar) view.findViewById(R.id.tt_progress);
    LayoutParams pgParms =
        new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    pgParms.bottomMargin = 50;
    addContentView(view, pgParms);

    // ROOT_LAYOUT_LISTENER
    baseRoot.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayoutListener);
  }