コード例 #1
0
ファイル: SKASCIIDisplay.java プロジェクト: omusico/sk_code
 @Override
 public int getItemTop(int id) {
   // TODO Auto-generated method stub
   if (info != null) {
     return info.getnStartY();
   }
   return -1;
 }
コード例 #2
0
ファイル: SKASCIIDisplay.java プロジェクト: omusico/sk_code
 /**
  * 具体的画法
  *
  * @param paint
  * @param canvas
  */
 private void draw(Paint paint, Canvas canvas) {
   // 外形不为空画外形
   if (null != info.getsShapId()) {
     if (imageItem == null) {
       imageItem = new ImageDrawItem(info.getsShapId(), mRect);
     }
     imageItem.draw(paint, canvas);
   }
   // 画静态文本
   drawTextValue(paint, canvas);
   // 画点击输入背景提示框
   if (drawBack) {
     if (bgBitmap == null) {
       bgBitmap = ImageFileTool.getBitmap(R.drawable.rect_red_bg, mContext);
       bgRect = new Rect(0, 0, bgBitmap.getWidth(), bgBitmap.getHeight());
     }
     if (bgBitmap != null) {
       canvas.setDrawFilter(
           new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));
       if (mBitmapPaint == null) {
         mBitmapPaint = new Paint();
         mBitmapPaint.setDither(true);
         mBitmapPaint.setAntiAlias(true);
       }
       canvas.drawBitmap(bgBitmap, bgRect, mRect, mBitmapPaint);
     }
   }
   // 不可触控加上锁图标
   if (!isTouchFlag && SystemInfo.isbLockIcon()) {
     if (mLockBitmap == null) {
       mLockBitmap = ImageFileTool.getBitmap(R.drawable.lock, mContext);
     }
     if (mLockBitmap != null) {
       if (mBitmapPaint == null) {
         mBitmapPaint = new Paint();
         mBitmapPaint.setDither(true);
         mBitmapPaint.setAntiAlias(true);
       }
       canvas.drawBitmap(mLockBitmap, info.getnStartX(), info.getnStartY(), mBitmapPaint);
     }
   }
 }
コード例 #3
0
ファイル: SKASCIIDisplay.java プロジェクト: omusico/sk_code
 @Override
 public boolean setItemTop(int id, int y) {
   // TODO Auto-generated method stub
   if (info != null) {
     if (y == info.getnStartY()) {
       return true;
     }
     if (y < 0 || y > SKSceneManage.getInstance().getSceneInfo().getnSceneHeight()) {
       return false;
     }
     info.setnStartY(y);
     int t = items.rect.top;
     items.rect.top = y;
     items.rect.bottom = y - t + items.rect.bottom;
     items.mMoveRect = new Rect();
     text.setStartY(y);
     SKSceneManage.getInstance().onRefresh(items);
   } else {
     return false;
   }
   return true;
 }
コード例 #4
0
ファイル: SKASCIIDisplay.java プロジェクト: omusico/sk_code
  public SKASCIIDisplay(Context context, int itemId, int sceneId, AcillInputInfo info) {
    mContext = context;
    isOnclick = false;
    isTouchFlag = true;
    isShowFlag = true;
    showByUser = false;
    touchByUser = false;
    showByAddr = false;
    touchByAddr = false;
    // keyIsShow = true;
    this.sceneId = sceneId;
    this.itemId = itemId;
    showValue = "";
    mPaint = new Paint();
    items = new SKItems();
    this.info = info;
    notTouchOpenKey = false;

    if (info != null) {
      mRect = new Rect();
      mRect.left = info.getnStartX();
      mRect.right = info.getnStartX() + info.getnWidth();
      mRect.top = info.getnStartY();
      mRect.bottom = info.getnStartY() + info.getnHeight();

      text = new StaticTextModel();
      text.setM_backColorPadding(info.getnBackColor());
      text.setM_eTextAlign(info.getnShowStyle());
      text.setM_nFontColor(info.getnFontColor());
      text.setM_nFontSize(info.getnFontsize());
      text.setM_sFontFamly(info.getsFontStyle());
      text.setM_textLanguageId(1);
      text.setM_textPro((short) (info.geteFontCss()));
      text.setStartX(info.getnTextStartX());
      text.setStartY(info.getnTextStartY());
      text.setRectHeight(info.getnTextHeight());
      text.setRectWidth(info.getnTextWidth());
      text.setM_alphaPadding(info.getnTransparent()); // 设置透明度
      //			if (info.getnTransparent() == 0) {
      //				text.setBorderAlpha(255);
      //				text.setLineColor(Color.BLACK);
      //				text.setLineWidth(1);
      //			}

      textItem = new TextItem(text);
      textItem.initTextPaint();
      textItem.initRectBoderPaint();
      textItem.initRectPaint();

      items.itemId = this.itemId;
      items.nCollidindId = info.getnCollidindId();
      items.nZvalue = info.getnZvalue();
      items.sceneId = sceneId;
      items.rect = mRect;
      items.mGraphics = this;

      if (null != info.getmTouchinInfo()) {
        if (-1 != info.getmTouchinInfo().getnAddrId() && info.getmTouchinInfo().isbTouchByAddr()) {
          touchByAddr = true;
        }
        if (info.getmTouchinInfo().isbTouchByUser()) {
          touchByUser = true;
        }
      }
      if (null != info.getmShowInfo()) {
        if (-1 != info.getmShowInfo().getnAddrId() && info.getmShowInfo().isbShowByAddr()) {
          showByAddr = true;
        }
        if (info.getmShowInfo().isbShowByUser()) {
          showByUser = true;
        }
      }

      // 注册地址值
      registAddr();
    }
  }
コード例 #5
0
ファイル: SKASCIIDisplay.java プロジェクト: omusico/sk_code
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    // TODO Auto-generated method stub
    // 允许输入
    SKSceneManage.getInstance().time = 0;
    boolean touch = false;
    int x = (int) event.getX();
    int y = (int) event.getY();
    if (null == info) {
      return false;
    }

    if (info.geteInputTypeId() == INPUT_TYPE.BIT) {
      return false;
    }
    if (x < info.getnStartX()
        || x > info.getnStartX() + info.getnWidth()
        || y < info.getnStartY()
        || y > info.getnStartY() + info.getnHeight()) {
      return false;
    } else {
      if (!info.isbIsinput()) { // 不允许输入 直接返回
        return false;

      } else {
        if (!isTouchFlag || !isShowFlag) {

          if (!isTouchFlag && info != null) {
            if (info.getmTouchinInfo() != null) {
              if (event.getAction() == MotionEvent.ACTION_DOWN) {
                if (info.getmTouchinInfo().isbTouchByUser()) {
                  SKSceneManage.getInstance().turnToLoginPop();
                }
              }
            }
          }

          return false;
        }

        if (event.getAction() == MotionEvent.ACTION_DOWN) {

          isOnclick = true;
          if (info.getmTouchinInfo() == null) {
            doTouch(notTouchOpenKey);
          } else {
            if (info.getmTouchinInfo().isbTimeoutCancel() == true
                && info.getmTouchinInfo().getnPressTime() > 0) {
              if (null == hand) {
                hand = new myMainHandler(Looper.getMainLooper());
              }
              hand.sendEmptyMessageDelayed(
                  TOUCHHANDER, info.getmTouchinInfo().getnPressTime() * 100);
            } else {
              doTouch(notTouchOpenKey);
            }
          }
          touch = true;
        } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
          return true;
        } else if (MotionEvent.ACTION_UP == event.getAction()
            || MotionEvent.ACTION_CANCEL == event.getAction()) {
          isOnclick = false;
          touch = true;
        }
      }
    }

    return touch;
  }