Ejemplo n.º 1
0
 @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;
     }
     int hen = y - info.getnStartY();
     info.setnStartY(y);
     int t = items.rect.top;
     items.rect.top = y;
     items.rect.bottom = y - t + items.rect.bottom;
     items.mMoveRect = new Rect();
     if (info.getfPointList() != null) {
       for (int i = 0; i < info.getfPointList().size(); i++) {
         PointF p = info.getfPointList().get(i);
         p.y = p.y + hen;
       }
     }
     SKSceneManage.getInstance().onRefresh(items);
   } else {
     return false;
   }
   return true;
 }
Ejemplo n.º 2
0
 // 窗口显示的时候,判断定时器是否打开 如果打开则销毁
 @Override
 public void onShow() {
   // TODO Auto-generated method stub
   if (SKTimer.getInstance().getBinder().isRegister(SKSceneManage.getInstance().sCallback)) {
     SKTimer.getInstance().getBinder().onDestroy(SKSceneManage.getInstance().sCallback);
   }
 }
Ejemplo n.º 3
0
 @Override
 public boolean setItemLeft(int id, int x) {
   // TODO Auto-generated method stub
   if (info != null) {
     if (x == info.getnStartX()) {
       return true;
     }
     if (x < 0 || x > SKSceneManage.getInstance().getSceneInfo().getnSceneWidth()) {
       return false;
     }
     int len = x - info.getnStartX();
     info.setnStartX(x);
     int l = items.rect.left;
     items.rect.left = x;
     items.rect.right = x - l + items.rect.right;
     items.mMoveRect = new Rect();
     if (info.getfPointList() != null) {
       for (int i = 0; i < info.getfPointList().size(); i++) {
         PointF p = info.getfPointList().get(i);
         p.x = p.x + len;
       }
     }
     SKSceneManage.getInstance().onRefresh(items);
   } else {
     return false;
   }
   return true;
 }
Ejemplo n.º 4
0
 // 当关闭popWindow 时 是否 启动定时器
 @Override
 public void onStart() {
   if (drawBack) {
     // 关闭键盘 把背景去掉
     drawBack = false;
     SKSceneManage.getInstance().onRefresh(items);
   }
   SKSceneManage.getInstance().timeOut();
 }
Ejemplo n.º 5
0
 @Override
 public boolean isTouch() {
   // TODO Auto-generated method stub
   asciiIsTouch();
   SKSceneManage.getInstance().onRefresh(items);
   return isTouchFlag;
 }
Ejemplo n.º 6
0
  private void init() {
    if (null == info) {
      return;
    }

    freeIsShow();
    SKSceneManage.getInstance().onRefresh(items);
  }
Ejemplo n.º 7
0
 @Override
 public boolean setItemTouchable(int id, boolean v) {
   // TODO Auto-generated method stub
   if (v == isTouchFlag) {
     return true;
   }
   isTouchFlag = v;
   SKSceneManage.getInstance().onRefresh(items);
   return true;
 }
Ejemplo n.º 8
0
        @Override
        public void addrValueNotic(Vector<Byte> nStatusValue) {
          if (nStatusValue != null) {
            if (info.getnAddress() != null) {
              Vector<Short> mIData = new Vector<Short>();
              boolean result = PlcRegCmnStcTools.bytesToShorts(nStatusValue, mIData);
              if (result) {
                int value = mIData.get(0);
                int temp = info.getnAddress().nAddrValue + value;
                if (temp < 0) {
                  SKPlcNoticThread.getInstance().destoryCallback(valueCall, sceneId);
                  showValue = "";
                  SKSceneManage.getInstance().onRefresh(items);
                  return;
                }
                if (info.getmOffSetAddress() == null) {
                  AddrProp addrProp = new AddrProp();
                  addrProp.eAddrRWprop = info.getnAddress().eAddrRWprop;
                  addrProp.eConnectType = info.getnAddress().eConnectType;
                  addrProp.nAddrId = info.getnAddress().nAddrId;
                  addrProp.nAddrLen = info.getnAddress().nAddrLen;
                  addrProp.nAddrValue = temp;
                  addrProp.nPlcStationIndex = info.getnAddress().nPlcStationIndex;
                  addrProp.nRegIndex = info.getnAddress().nRegIndex;
                  addrProp.nUserPlcId = info.getnAddress().nUserPlcId;
                  addrProp.sPlcProtocol = info.getnAddress().sPlcProtocol;
                  info.setmOffSetAddress(addrProp);
                } else {
                  info.getmOffSetAddress().nAddrValue = temp;
                }

                SKPlcNoticThread.getInstance().destoryCallback(valueCall, sceneId);
                SKPlcNoticThread.getInstance()
                    .addNoticProp(info.getmOffSetAddress(), valueCall, false, sceneId, true);

                if (info.getnAddress().eConnectType > 1) {
                  SKSceneManage.getInstance()
                      .updateSceneReadAddrs(sceneId, info.getmOffSetAddress());
                }
              }
            }
          }
        }
Ejemplo n.º 9
0
 @Override
 public boolean setItemHeight(int id, int h) {
   // TODO Auto-generated method stub
   if (info != null) {
     if (h == info.getnHeight()) {
       return true;
     }
     if (h < 0 || h > SKSceneManage.getInstance().getSceneInfo().getnSceneHeight()) {
       return false;
     }
     info.setnHeight(h);
     items.rect.bottom = h - items.rect.height() + items.rect.bottom;
     items.mMoveRect = new Rect();
     SKSceneManage.getInstance().onRefresh(items);
   } else {
     return false;
   }
   return true;
 }
Ejemplo n.º 10
0
 @Override
 public boolean setItemWidth(int id, int w) {
   // TODO Auto-generated method stub
   if (info != null) {
     if (w == info.getnWidth()) {
       return true;
     }
     if (w < 0 || w > SKSceneManage.getInstance().getSceneInfo().getnSceneWidth()) {
       return false;
     }
     info.setnWidth(w);
     items.rect.right = w - items.rect.width() + items.rect.right;
     items.mMoveRect = new Rect();
     SKSceneManage.getInstance().onRefresh(items);
   } else {
     return false;
   }
   return true;
 }
Ejemplo n.º 11
0
  /** 初始化数据 */
  private void init() {
    if (null == info) {
      return;
    }

    if (null == popKey) {
      popKey =
          new SKKeyPopupWindow(
              SKSceneManage.getInstance().mContext,
              false,
              info.getnKeyId(),
              DATA_TYPE.OTHER_DATA_TYPE);
      popKey.setCallback(callback);
      popKey.setInputType(false);
      if ((AcillCode.PASSWORD & info.getnCode()) == AcillCode.PASSWORD) {
        popKey.setPassWord(true);
      } else {
        popKey.setPassWord(false);
      }
    }
    if ((AcillCode.PASSWORD & info.getnCode()) == AcillCode.PASSWORD) {
      pop =
          new GlobalPopWindow(
              SKSceneManage.getInstance().getCurrentScene(),
              WINDOW_TYPE.KEYBOARD,
              3,
              DATA_TYPE.OTHER_DATA_TYPE); // 3
      // 代表密码
    } else {
      pop =
          new GlobalPopWindow(
              SKSceneManage.getInstance().getCurrentScene(),
              WINDOW_TYPE.KEYBOARD,
              2,
              DATA_TYPE.OTHER_DATA_TYPE); // 2代表字母
    }

    asciiIsShow();
    asciiIsTouch();
    SKSceneManage.getInstance().onRefresh(items);
  }
Ejemplo n.º 12
0
 @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;
 }
Ejemplo n.º 13
0
 @Override
 public boolean setItemAlpha(int id, int alpha) {
   // TODO Auto-generated method stub
   if (info == null || alpha < 0 || alpha > 255) {
     return false;
   }
   if (info.getnAlpha() == alpha) {
     return true;
   }
   info.setnAlpha(alpha);
   mFreeLineItem.setLineAlpha(alpha);
   SKSceneManage.getInstance().onRefresh(items);
   return false;
 }
Ejemplo n.º 14
0
  @Override
  public boolean setItemLeft(int id, int x) {
    // TODO Auto-generated method stub

    if (info != null) {
      if (x == info.getnStartX()) {
        return true;
      }
      if (x < 0 || x > SKSceneManage.getInstance().getSceneInfo().getnSceneWidth()) {
        return false;
      }

      int l = items.rect.left;
      info.setnStartX(x);
      items.rect.left = x;
      items.rect.right = x - l + items.rect.right;
      items.mMoveRect = new Rect();
      text.setStartX(x);
      SKSceneManage.getInstance().onRefresh(items);
    } else {
      return false;
    }
    return true;
  }
Ejemplo n.º 15
0
 @Override
 public boolean setItemAlpha(int id, int alpha) {
   // TODO Auto-generated method stub
   if (info == null || alpha < 0 || alpha > 255) {
     return false;
   }
   if (info.getnTransparent() == alpha) {
     return true;
   }
   info.setnTransparent(alpha);
   text.setM_alphaPadding(alpha); // 设置透明度
   textItem.resetAlpha(alpha);
   SKSceneManage.getInstance().onRefresh(items);
   return false;
 }
Ejemplo n.º 16
0
        @Override
        public void onResult(String result, KEYBOARD_OPERATION type) {
          if (drawBack) {
            // 关闭键盘 把背景去掉
            drawBack = false;
            SKSceneManage.getInstance().onRefresh(items);
          }
          if (type == KEYBOARD_OPERATION.ENTER) {
            inputKeyString = result;
            if (null != inputKeyString && !"".equals(inputKeyString)) {

              writeToAddr(inputKeyString);
            }
          }
        }
Ejemplo n.º 17
0
 @Override
 public boolean setItemBackcolor(int id, short r, short g, short b) {
   // TODO Auto-generated method stub
   if (info != null) {
     int color = Color.rgb(r, g, b);
     if (color == info.getnBackColor()) {
       return true;
     }
     info.setnBackColor(color);
     text.setM_backColorPadding(color);
     textItem.resetColor(color, 2);
     SKSceneManage.getInstance().onRefresh(items);
     return true;
   }
   return false;
 }
Ejemplo n.º 18
0
  @Override
  public boolean setItemLineColor(int id, short r, short g, short b) {
    // TODO Auto-generated method stub
    if (info == null) {
      return false;
    }

    int color = Color.rgb(r, g, b);

    if (color == info.getnLineColor()) {
      return true;
    }
    info.setnLineColor(color);
    mFreeLineItem.setLineColor(color);
    SKSceneManage.getInstance().onRefresh(items);
    return true;
  }
Ejemplo n.º 19
0
  /** 打开自定义键盘 */
  private void openBoard() {
    if (SKKeyPopupWindow.keyFlagIsShow && !GlobalPopWindow.popIsShow) {
      popKey.setLastText(showValue);
      popKey.setShowMax(Integer.toString(info.getnShowCharNumber()));
      popKey.setShowMin(Integer.toString(0));
      popKey.setnStartX(info.getnBoardX());
      popKey.setnStartY(info.getnBoardY());
      popKey.initPopUpWindow();

      // 允许输入 并且勾选了输入提示 则更换背景
      if (info.isbIsinput() && info.isbInputSign()) {
        drawBack = true;
        SKSceneManage.getInstance().onRefresh(items);
      }
      popKey.showPopUpWindow();
    }
  }
Ejemplo n.º 20
0
  /** 系统键盘 */
  private void openKey() {
    // 如果显示类型是密码 则传-1 过去 辨别inputType 是text 还是password

    if (!GlobalPopWindow.popIsShow && SKKeyPopupWindow.keyFlagIsShow) {
      if (null != pop) {
        pop.setCallback(keyback);
        pop.initPopupWindow();
        pop.setInputMax(Integer.toString(info.getnShowCharNumber()));
        pop.setInputMin(Integer.toString(0));
        // 允许输入 并且勾选了输入提示 则更换背景
        if (info.isbIsinput() && info.isbInputSign()) {
          drawBack = true;
          SKSceneManage.getInstance().onRefresh(items);
        }
        pop.showPopupWindow();
      }
    }
  }
Ejemplo n.º 21
0
 @Override
 public void addrValueNotic(Vector<Byte> nStatusValue) {
   // TODO Auto-generated method stub
   if ((AcillCode.UNICODE & info.getnCode()) == AcillCode.UNICODE) {
     byte[] byteValue = new byte[nStatusValue.size() + 2];
     byteValue[0] = -1;
     byteValue[1] = -2;
     for (int i = 0; i < nStatusValue.size(); i++) {
       byteValue[i + 2] = nStatusValue.get(i);
     }
     showValue = converCodeShow(byteValue);
   } else {
     byte[] byteValue = new byte[nStatusValue.size()];
     for (int i = 0; i < nStatusValue.size(); i++) {
       byteValue[i] = nStatusValue.get(i);
     }
     showValue = converCodeShow(byteValue);
   }
   // Log.d("AAAAA", "showValue="+showValue);
   SKSceneManage.getInstance().onRefresh(items);
 }
Ejemplo n.º 22
0
 @Override
 public boolean isShow() {
   freeIsShow();
   SKSceneManage.getInstance().onRefresh(items);
   return isShowFlag;
 }
Ejemplo n.º 23
0
  @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;
  }