コード例 #1
0
  private void showAttributePalette() {
    iap.images.clear();
    int myWidth = virtualWidth;
    int myX = 2;
    int myY = 2;
    int inc = 2;
    for (int i = 0; i < Attribute.maxAttRef; i++) {
      long[] bitMask = Attribute.getIdBit(i);
      if (((selectionMaskYes[0] & bitMask[0]) != 0) || ((selectionMaskYes[1] & bitMask[1]) != 0))
        inc = 1;
      else if (((selectionMaskNo[0] & bitMask[0]) != 0) || ((selectionMaskNo[1] & bitMask[1]) != 0))
        inc = 0;
      else inc = 2;
      Attribute att = new Attribute(i, inc);
      mImage rawImg = att.getImage();
      attImage img =
          new attImage(
              rawImg.getHeight() != TILESIZE - 2
                  ? rawImg.scale(TILESIZE - 2, TILESIZE - 2, null, Image.FOR_DISPLAY)
                  : rawImg,
              att);

      if (myX + TILESIZE > myWidth) {
        myX = 2;
        myY += TILESIZE;
      }
      img.location = new Rect(myX, myY, TILESIZE, TILESIZE);
      iap.addImage(img);
      myX += TILESIZE;
    }
    iap.repaintNow();
  }
コード例 #2
0
  private void setIapSize(int width, int height) {
    iap.setPreferredSize(width, height);
    Global.getPref().log("[AttributesSelector:changeIapSize]  pref. area: " + width + "x" + height);

    int anzPerWidth = width / (TILESIZE + 2) - 1;
    virtualWidth = anzPerWidth * (TILESIZE + 2);
    double max = Attribute.maxAttRef;
    int anzPerHeight = (int) java.lang.Math.ceil(max / anzPerWidth);
    iap.virtualSize.set(0, 0, virtualWidth, anzPerHeight * (TILESIZE + 2));
    Global.getPref()
        .log(
            "[AttributesSelector:setIapSize] virt. area: "
                + virtualWidth
                + "x"
                + anzPerHeight * (TILESIZE + 2));
  }
コード例 #3
0
 public AttributesSelector() {
   scp.setOptions(MyScrollBarPanel.NeverShowHorizontalScrollers);
   TILESIZE = 30;
   W_OFFSET = 100;
   H_OFFSET = 150;
   if (Vm.isMobile()) {
     if (MyLocale.getScreenWidth() == 240 & MyLocale.getScreenHeight() == 320) {
       TILESIZE = 28;
       W_OFFSET = 80;
       H_OFFSET = 120;
     }
     if (MyLocale.getScreenWidth() == 320 & MyLocale.getScreenHeight() == 240) {}
     if (MyLocale.getScreenWidth() == 480 & MyLocale.getScreenHeight() == 640) {}
     if (MyLocale.getScreenWidth() == 480 & MyLocale.getScreenHeight() == 800) {}
     if (MyLocale.getScreenWidth() == 640 & MyLocale.getScreenHeight() == 480) {}
   } else {
     TILESIZE = 36;
     W_OFFSET = 106;
     H_OFFSET = 150;
   }
   iap.virtualSize = new Rect(0, 0, 0, 0); // create once
   addLast(scp, STRETCH, FILL);
   addLast(mInfo = new mLabel(""), HSTRETCH, HFILL);
 }