// 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

  }
 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);
 }
 // 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);
 }
Пример #4
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!");
 }
Пример #5
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);
  }
  // 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);
  }
Пример #7
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));
          }
        });
  }