コード例 #1
0
 /** 设置开机图片 */
 public void initImgView() {
   imageview = (ImageView) this.findViewById(R.id.cp1);
   File sdcardDir = Environment.getExternalStorageDirectory();
   String path = sdcardDir.getParent() + "/" + sdcardDir.getName();
   // 得到开机图片
   Bitmap bitmap = BitmapFactory.decodeFile(path + DownLoadImg.LOCAL_DIR + DownLoadImg.IMG_NAME);
   String errorCode = shellRW.getStringValue("errorCode");
   if (bitmap == null || errorCode.equals("") || errorCode.equals("false")) {
     Resources r = this.getResources();
     InputStream is = r.openRawResource(R.drawable.cp1);
     BitmapDrawable bmpDraw = new BitmapDrawable(is);
     bitmap = bmpDraw.getBitmap();
   }
   // 缩放开机图片
   Matrix matrix = new Matrix();
   float iScreenWidth = PublicMethod.getDisplayWidth(this);
   float iScreenHeight = PublicMethod.getDisplayHeight(this);
   float w = iScreenWidth / bitmap.getWidth();
   float h = iScreenHeight / bitmap.getHeight();
   if (w != 1 || h != 1) {
     matrix.postScale(w, h);
     bitmap =
         Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
   }
   imageview.setImageBitmap(bitmap);
 }
コード例 #2
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.buy_footballlottery_layout);
    initBatchCode(Constants.LOTNO_LCB);
    iScreenWidth = PublicMethod.getDisplayWidth(this);
    TextView text_sixhalf = (TextView) findViewById(R.id.string_banquanchang);
    text_sixhalf.setVisibility(TextView.VISIBLE);
    ImageView divide = (ImageView) findViewById(R.id.image_divide_sixhalf);
    divide.setVisibility(ImageView.VISIBLE);
    JSONObject rx9LotnoInfo = PublicMethod.getCurrentLotnoBatchCode(Constants.LOTNO_LCB);
    if (rx9LotnoInfo != null) {
      // 成功获取到了期号信息
      try {
        batchCode = rx9LotnoInfo.getString("batchCode");
        qihaoxinxi[0] = batchCode;
        qihaoxinxi[1] = rx9LotnoInfo.getString("endTime");
        qihaoxinxi[2] = Constants.LOTNO_LCB;

      } catch (JSONException e) {
        qihaoxinxi[0] = "";
        qihaoxinxi[1] = "";
        qihaoxinxi[2] = Constants.LOTNO_LCB;
      }
    }
    layout_football_issue = (Button) findViewById(R.id.layout_football_issue);
    layout_football_time = (TextView) findViewById(R.id.layout_football_time);
    batchCode = qihaoxinxi[0];
    initBatchCodeView();
    createView();
    getData(qihaoxinxi[2], qihaoxinxi[0]);
  }
コード例 #3
0
  /** 创建直选机选 */
  public void createTable(LinearLayout layout) {
    for (int i = 0; i < balls.size(); i++) {
      final int index = i;
      int iScreenWidth = PublicMethod.getDisplayWidth(this);
      LinearLayout lines = new LinearLayout(layout.getContext());
      for (int j = 0; j < balls.get(i).getVZhuma().size(); j++) {
        String color = (String) balls.get(i).getVColor().get(j);
        TableLayout table;
        if (color.equals("red")) {
          table =
              PublicMethod.makeBallTableJiXuan(
                  null, iScreenWidth, redBallResId, balls.get(i).getBalls(j), this);
        } else {
          table =
              PublicMethod.makeBallTableJiXuan(
                  null, iScreenWidth, blueBallResId, balls.get(i).getBalls(j), this);
        }

        lines.addView(table);
      }
      ImageButton delet = new ImageButton(lines.getContext());
      delet.setBackgroundResource(R.drawable.shanchu);
      delet.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              if (balls.size() > 1) {
                zhumaView.removeAllViews();
                balls.remove(index);
                isOnclik = false;
                jixuanZhu.setSelection(balls.size() - 1);
                createTable(zhumaView);
              } else {
                Toast.makeText(
                        DanshiJiXuan.this,
                        getResources().getText(R.string.zhixuan_jixuan_toast),
                        Toast.LENGTH_SHORT)
                    .show();
              }
            }
          });
      LinearLayout.LayoutParams param =
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
      param.setMargins(10, 5, 0, 0);
      lines.addView(delet, param);
      lines.setGravity(Gravity.CENTER_HORIZONTAL);
      if (i % 2 == 0) {
        lines.setBackgroundResource(R.drawable.jixuan_list_bg);
      }
      lines.setPadding(0, 3, 0, 0);
      layout.addView(lines);
    }
  }
コード例 #4
0
 /** 根据手机屏幕设置球的大小和球的缩放比例 */
 private void setScale() {
   int screenWith = PublicMethod.getDisplayWidth(this);
   if (screenWith <= 240) {
     BALL_WIDTH = 46 * 120 / 240;
     SCALE = (float) 140 / 240;
   } else if (screenWith > 240 && screenWith <= 320) {
     BALL_WIDTH = 46 * 160 / 240;
     SCALE = (float) 180 / 240;
   } else if (screenWith == 480) {
     BALL_WIDTH = 46;
     SCALE = 1;
   } else if (screenWith > 480) {
     BALL_WIDTH = 80;
     SCALE = (float) 1.5;
   }
 }
コード例 #5
0
 /** 根据手机屏幕设置球的大小和球的缩放比例 */
 public void setScale() {
   int screenWith = PublicMethod.getDisplayWidth(this);
   if (screenWith <= 240) {
     NoticeMainActivity.BALL_WIDTH = 46 * 120 / 240;
     NoticeMainActivity.SCALE = (float) 140 / 240;
   } else if (screenWith > 240 && screenWith <= 320) {
     NoticeMainActivity.BALL_WIDTH = 46 * 160 / 240;
     NoticeMainActivity.SCALE = (float) 180 / 240;
   } else if (screenWith == 480) {
     NoticeMainActivity.BALL_WIDTH = 46;
     NoticeMainActivity.SCALE = 1;
   } else if (screenWith > 480) {
     NoticeMainActivity.BALL_WIDTH = screenWith / 480 * 46;
     NoticeMainActivity.SCALE = (float) 1.5;
   }
 }
コード例 #6
0
  /**
   * 加载每一行的单选按钮
   *
   * @param layoutMain
   * @param line
   * @param lineNum
   */
  private void addLine(
      LinearLayout layoutMain,
      int line,
      int lineNum,
      int isDanNum,
      int danTeamNum,
      int teamNum,
      final boolean isBeijing) {
    LinearLayout layoutOne = new LinearLayout(context);
    int id = 0;
    int last = getNum(teamNum - 1, true);
    boolean isCheck = isLastCheck(teamNum, danTeamNum);
    for (int j = 0; j < lineNum; j++) {
      id = line * this.LineNum + j;
      RadioButton radio = new RadioButton(context);
      if (id < isDanNum) {
        radio.setEnabled(false);
        radio.setTextColor(Color.GRAY);
        radio.setButtonDrawable(R.drawable.radio_select);
      } else if (!isCheck && id >= last) {
        radio.setEnabled(false);
        radio.setTextColor(Color.GRAY);
        radio.setButtonDrawable(R.drawable.radio_select);
      } else {
        radio.setTextColor(Color.BLACK);
        radio.setButtonDrawable(R.drawable.radio_select);
      }
      if (isBeijing) {
        radio.setText(beijingTextId[id]);
      } else {
        radio.setText(radioTextId[id]);
      }

      int width = PublicMethod.getDisplayWidth(context);
      if (width == 720) {
        radio.setTextSize(PublicMethod.getPxInt(7, context));
      } else if (width == 640) {
        radio.setTextSize(PublicMethod.getPxInt(7, context));
      } else if (width == 240) {
        radio.setTextSize(PublicMethod.getPxInt(20, context));
      } else if (width == 320) {
        radio.setTextSize(PublicMethod.getPxInt(15, context));
      } else if (width == 800) {
        radio.setTextSize(PublicMethod.getPxInt(8, context));
      } else {
        radio.setTextSize(PublicMethod.getPxInt(10, context));
      }
      if (Constants.SCREEN_HEIGHT == 854) {
        radio.setTextSize(PublicMethod.getPxInt(8, context));
      }
      radio.setId(id);
      radio.setPadding(PublicMethod.getPxInt(20, context), 0, 0, 0);
      int withPx = PublicMethod.getPxInt(75, context); // 将dip换算成px
      radio.setLayoutParams(new LayoutParams(withPx, LayoutParams.WRAP_CONTENT));
      radio.setOnCheckedChangeListener(
          new OnCheckedChangeListener() {
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              if (isChecked) {
                if (isBeijing) {
                  ((BeiJingSingleGameIndentActivity) context).bettingNum =
                      getBeijingRadioZhu(buttonView.getText().toString());
                  ((BeiJingSingleGameIndentActivity) context).setBettingInformationShow();
                } else {
                  touzhuDialog.zhuShu = getRadioZhu(buttonView.getText().toString());
                  touzhuDialog.setAlertText();
                  setRadioPrize(buttonView.getText().toString());
                }
                clearRadio(buttonView);
              }
            }
          });
      radioBtns.add(radio);
      layoutOne.addView(radio);
    }
    layoutMain.addView(layoutOne);
  }
コード例 #7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    //		RuyicaiActivityManager.getInstance().addActivity(this);
    super.onCreate(savedInstanceState);

    // ----- 设置全屏
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.ruyichuanqing_ssq_zixuan);
    // 王艳玲7.6返回
    ImageView rtnview = (ImageView) findViewById(R.id.ruyipackage_btn_return_ssq);
    rtnview.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            finish();
          }
        });

    scrollView = (ScrollView) findViewById(R.id.ruyichuanqing_ssq_scrollview);

    LinearLayout iV = (LinearLayout) findViewById(R.id.ruyichuanqing_ssq_layout_id);

    {
      iScreenWidth = PublicMethod.getDisplayWidth(this);

      int redBallViewNum = 33;
      SSQRedZhixuanBallTable =
          makeBallTable(
              iV,
              R.id.table_ssq_zixuan_red,
              iScreenWidth,
              redBallViewNum,
              SSQRedBallResId,
              SSQ_RED_ZIXUAN_START,
              1);

      int blueBallViewNum = 16;
      SSQBlueZhixuanBallTable =
          makeBallTable(
              iV,
              R.id.table_ssq_zixuan_blue,
              iScreenWidth,
              blueBallViewNum,
              SSQBlueBallResId,
              SSQ_BLUE_ZIXUAN_START,
              1);

      mTextSumMoney = (TextView) iV.findViewById(R.id.text_sum_money_ssq_zixuan);
      mTextSumMoney.setText(getResources().getString(R.string.please_choose_number));

      mSeekBarBeishu = (SeekBar) iV.findViewById(R.id.ssq_zixuan_seek_beishu);
      mSeekBarBeishu.setOnSeekBarChangeListener(this);
      mSeekBarBeishu.setProgress(iProgressBeishu);

      mTextBeishu = (TextView) iV.findViewById(R.id.ssq_zixuan_text_beishu);
      mTextBeishu.setText("" + iProgressBeishu);

      ImageButton addBtn = (ImageButton) iV.findViewById(R.id.ssq_seekbar_add_zixuan);
      ImageButton subtractBtn = (ImageButton) iV.findViewById(R.id.ssq_seekbar_subtract_zixuan);
      addBtn.setOnClickListener(
          new ImageButton.OnClickListener() {

            @Override
            public void onClick(View v) {
              mSeekBarBeishu.setProgress(++iProgressBeishu);
            }
          });
      subtractBtn.setOnClickListener(
          new ImageButton.OnClickListener() {

            @Override
            public void onClick(View v) {
              mSeekBarBeishu.setProgress(--iProgressBeishu);
            }
          });
    }

    sureBtn = (Button) findViewById(R.id.ssq_sure_zixuan);
    sureBtn.setOnClickListener(
        new Button.OnClickListener() {

          @Override
          public void onClick(View v) {
            int redNums = SSQRedZhixuanBallTable.getHighlightBallNums();
            int blueNums = SSQBlueZhixuanBallTable.getHighlightBallNums();
            iZhushu = (int) getZhuShu(redBallNumbers.length, blueBallNumbers.length);
            if (redNums < 6 || blueNums < 1) {
              AlertDialog.Builder builder = new AlertDialog.Builder(RuyiExpressFeelSsqZixuan.this);
              builder.setTitle(getResources().getString(R.string.please_choose_number));
              builder.setMessage("请至少选择6个红球和1个篮球");
              // 确定
              builder.setPositiveButton(
                  R.string.ok,
                  new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {}
                  });
              builder.show();
            } else if (iZhushu * 2 > 100000) {
              DialogExcessive();
            } else {
              // iZhushu = (int) getZhuShu(redBallNumbers.length,
              // blueBallNumbers.length);
              Intent intent =
                  new Intent(RuyiExpressFeelSsqZixuan.this, RuyiExpressFeelSuccess.class);
              Bundle ssqZixuanBundle = new Bundle();
              ssqZixuanBundle.putString("success", "ssqZixuan");
              ssqZixuanBundle.putIntArray("redBall", redBallNumbers);
              ssqZixuanBundle.putIntArray("blueBall", blueBallNumbers);
              ssqZixuanBundle.putInt("ssqzixuanzhushu", iZhushu);
              ssqZixuanBundle.putInt("ssqzixuanbeishu", iProgressBeishu);
              intent.putExtras(ssqZixuanBundle);
              // wangyl 7.12 赠送成功后返回处理
              startActivityForResult(intent, SSQ_INTENT);
            }
          }
        });

    newselected = (Button) findViewById(R.id.ssq_newselectd_zixuan);
    newselected.setOnClickListener(
        new Button.OnClickListener() {

          @Override
          public void onClick(View v) {
            SSQRedZhixuanBallTable.clearAllHighlights();
            SSQBlueZhixuanBallTable.clearAllHighlights();
            mTextSumMoney.setText(getResources().getString(R.string.please_choose_number));
            mSeekBarBeishu.setProgress(1);
          }
        });
  }
コード例 #8
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      index = position;
      ViewHolder holder = null;
      Info info = (Info) mList.get(position);

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.join_info_listview_item, null);
        holder = new ViewHolder();
        holder.type = (TextView) convertView.findViewById(R.id.join_info_item_text_name);
        holder.ding = (TextView) convertView.findViewById(R.id.join_info_item_text_ding);
        holder.name = (TextView) convertView.findViewById(R.id.join_info_item_text_faqiren);
        holder.starNum = (LinearLayout) convertView.findViewById(R.id.join_info_item_linear_star);
        holder.progress = (TextView) convertView.findViewById(R.id.join_info_item_text_progress);
        holder.allAtm = (TextView) convertView.findViewById(R.id.join_info_item_text_all_amt);
        holder.layoutLeft =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_left);
        holder.layoutCenter =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_center);
        holder.layoutRight =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_right);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      if (info.getIsTop().equals("true")) {
        holder.ding.setBackgroundResource(R.drawable.join_top);
        holder.ding.setVisibility(view.VISIBLE);
      } else {
        holder.ding.setVisibility(view.GONE);
      }
      int with = PublicMethod.getDisplayWidth(JoinInfoActivity.this);
      if (with == 800) {
        LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(
                PublicMethod.getPxInt(110, JoinInfoActivity.this),
                PublicMethod.getPxInt(28, JoinInfoActivity.this));
        holder.type.setLayoutParams(params);
        LinearLayout.LayoutParams paramsLayout =
            new LinearLayout.LayoutParams(250, LayoutParams.WRAP_CONTENT);
        holder.layoutLeft.setLayoutParams(paramsLayout);
        holder.layoutCenter.setLayoutParams(paramsLayout);
        holder.layoutRight.setLayoutParams(paramsLayout);
      }
      holder.type.setText(info.getLottype());
      holder.name.setText("发起人:" + getusername(info.getName()));
      holder.progress.setText(info.getProgress() + "(" + info.getSafe() + ")");
      holder.allAtm.setText(info.getAllAtm() + "元");
      // holder.atm.setText("¥"+info.getAtm());
      // holder.safe.setText(info.getSafe());
      PublicMethod.createStar(
          holder.starNum,
          info.getCrown(),
          info.getGrayCrown(),
          info.getCup(),
          info.getGrayCup(),
          info.getDiamond(),
          info.getGrayDiamond(),
          info.getStarNum(),
          info.getGrayStarNum(),
          JoinInfoActivity.this,
          4);
      return convertView;
    }