Ejemplo n.º 1
0
  public JiLuView(BasketBall_Shot_Activity activity) {
    super(activity);
    this.activity = activity;
    this.getHolder().addCallback(this);
    paint = new Paint();
    paint.setAntiAlias(true);
    initBitmap();
    String sql_select = "select grade,time from paihangbang  order by grade desc limit 0,30;";
    vector = SQLiteUtil.query(sql_select); // 从数据库中取出相应的数据
    fanggeGeshu = vector.size();
    if (fanggeGeshu < 12) {
      fanggeGeshu = 12;
    }
    timeStartX = sXtart + 15 * ratio_width; // 滚动背景的起始位置
    timeStartY = sYtart + 150 * ratio_height;

    timeStartXCaiJian = timeStartX + 20 * ratio_height; // 裁剪框的起始位置
    timeStartYCaiJian = sYtart + timeStartY + 100 * ratio_height;

    caijianWidth = 430 * ratio_width;
    caijianHeight = 400 * ratio_height; // 裁剪框的宽高

    timegradeinitX = timeStartXCaiJian;
    timegradeinitY = timeStartYCaiJian; // timeStartY+73*ratio_height;//滚动方格的初始位置

    timegradeStartX = timegradeinitX;
    timeGradeStartY = timegradeinitY; // 绘制滚动时的起始位置
  }
Ejemplo n.º 2
0
  @Override
  public boolean onTouchEvent(MotionEvent e) {
    float x = e.getX();
    float y = e.getY();

    switch (e.getAction()) {
      case MotionEvent.ACTION_DOWN:
        if (x > timeStartX
            && x < timeStartX + caijianWidth / 2
            && y > timeStartY
            && y < timeStartY + 74 * ratio_height) { // 如果点击按照时间排序
          Log.w("dsfjdskfj", "2222222222");
          String sql_select = "select grade,time from paihangbang   desc limit 0,30;";
          vector = SQLiteUtil.query(sql_select); // 从数据库中取出相应的数据
          isnoGradePaixu = false;
        } else if (x > timeStartX + caijianWidth / 2
            && x < timeStartX + caijianWidth
            && y > timeStartY
            && y < timeStartY + 74 * ratio_height) { // 点击按照成绩排序
          isnoGradePaixu = true;
          String sql_select = "select grade,time from paihangbang  order by grade desc limit 0,30;";
          vector = SQLiteUtil.query(sql_select); // 从数据库中取出相应的数据
          Log.w("dsfjdskfj", "11111111");
        }

        if (x > timeStartX
            && x < timeStartX + caijianWidth
            && y > timeStartYCaiJian + 74 * ratio_height
            && y < timeStartYCaiJian + caijianHeight + 74 * ratio_height) {
          mDounX = x;
          mDounY = y;
          mtimeGradeStartY = timeGradeStartY;
          isnoDianJi = true;
        } else {
          isnoDianJi = false;
        }
        if (x > sXtart + 50 * ratio_width
            && x < sXtart + 50 * ratio_width + 160 * ratio_width
            && y > sYtart + 700 * ratio_height
            && y < sYtart + 780 * ratio_height) { // 返回按钮
          isnoQueDing = true;
        } else {
          isnoQueDing = false;
        }
        if (x > sXtart + 270 * ratio_width
            && x < sXtart + 270 * ratio_width + 160 * ratio_width
            && y > sYtart + 700 * ratio_height
            && y < sYtart + 780 * ratio_height) { // 确定按钮
          isnoFanhui = true;
        } else {
          isnoFanhui = false;
        }
        onDrawcanvas();
        break;
      case MotionEvent.ACTION_MOVE:
        float dy = y - mDounY;
        if (isnoDianJi == true) {
          if (mtimeGradeStartY + dy < timegradeinitY + caijianHeight - fanggeGeshu * geziHeight) {
            timeGradeStartY = timegradeinitY + caijianHeight - fanggeGeshu * geziHeight;
          } else if (mtimeGradeStartY + dy > timegradeinitY) {
            timeGradeStartY = timegradeinitY;
          } else {
            timeGradeStartY = mtimeGradeStartY + dy;
          }
          onDrawcanvas();
        }

        break;
      case MotionEvent.ACTION_UP:
        if (isnoQueDing
            && x > sXtart + 50 * ratio_width
            && x < sXtart + 50 * ratio_width + 160 * ratio_width
            && y > sYtart + 700 * ratio_height
            && y < sYtart + 780 * ratio_height) { // 返回按钮
          isnoQueDing = false; // 确定
          activity.xiaoxichuli.sendEmptyMessage(CAIDAN_RETRY); // 返回到菜单界面
        } else {
          isnoQueDing = false;
        }
        if (isnoFanhui
            && x > sXtart + 270 * ratio_width
            && x < sXtart + 270 * ratio_width + 160 * ratio_width
            && y > sYtart + 700 * ratio_height
            && y < sYtart + 780 * ratio_height) { // 确定按钮
          isnoFanhui = false; // 返回
          activity.xiaoxichuli.sendEmptyMessage(CAIDAN_RETRY); // 返回到菜单界面
        } else {
          isnoFanhui = false;
        }

        if (isnoDianJi) {
          isnoDianJi = false;
        }
        onDrawcanvas();
        break;
    }
    return true;
  }