コード例 #1
0
 /** 重新选择方法 */
 private void again() {
   zhumaView.removeAllViews();
   balls = new Vector();
   for (int i = 0; i < jixuanZhu.getSelectedItemPosition() + 1; i++) {
     Balls ball = ballOne.createBalls();
     balls.add(ball);
   }
   createTable(zhumaView);
 }
コード例 #2
0
 /** 重新初始化界面 */
 public void againView() {
   sensor.startAction();
   sensor.onVibrator(); // 震动
   toast.show();
   jixuanZhu.setSelection(4);
   zhumaView.removeAllViews();
   balls = new Vector();
   for (int i = 0; i < jixuanZhu.getSelectedItemPosition() + 1; i++) {
     Balls ball = ballOne.createBalls();
     balls.add(ball);
   }
   createTable(zhumaView);
 }
コード例 #3
0
  /** 创建机选界面 */
  public void createView(Balls balles, BuyImplement buyImplement, boolean isTen) {
    this.isTen = isTen;
    sensor.startAction();
    this.buyImplement = buyImplement;
    this.ballOne = balles;
    zhumaView = (LinearLayout) findViewById(R.id.buy_danshi_jixuan_linear_zhuma);
    zhumaView.removeAllViews();
    toast = Toast.makeText(this, "左右摇晃手机,重新选号!", Toast.LENGTH_SHORT);
    toast.show();
    balls = new Vector<Balls>();
    LayoutInflater inflate = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    // 初始化spinner
    jixuanZhu = (Spinner) findViewById(R.id.buy_danshi_jixuan_spinner);
    jixuanZhu.setSelection(4);
    jixuanZhu.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            int position = jixuanZhu.getSelectedItemPosition();
            if (isOnclik) {
              again();
            } else {
              isOnclik = true;
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });
    int index = jixuanZhu.getSelectedItemPosition() + 1;
    for (int i = 0; i < index; i++) {
      Balls ball = ballOne.createBalls();
      balls.add(ball);
    }
    createTable(zhumaView);
    sensor.onVibrator(); // 震动
    Button zixuanTouzhu = (Button) findViewById(R.id.buy_danshi_jixuan_img_touzhu);
    zixuanTouzhu.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            beginTouZhu();
          }
        });
    final TextView textNum = (TextView) findViewById(R.id.buy_zixuan_add_text_num);
    Button add_dialog = (Button) findViewById(R.id.buy_zixuan_img_add_delet);
    addView = new AddView(textNum, this, false);
    add_dialog.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (addView.getSize() > 0) {
              showAddViewDialog();
            } else {
              Toast.makeText(
                      DanshiJiXuan.this,
                      DanshiJiXuan.this.getString(R.string.buy_add_dialog_alert),
                      Toast.LENGTH_SHORT)
                  .show();
            }
          }
        });
    Button add = (Button) findViewById(R.id.buy_zixuan_img_add);
    add.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            addToCodes();
          }
        });

    //		ImageButton again = (ImageButton) findViewById(R.id.buy_danshi_jixuan_img_again);
    //		again.setOnClickListener(new OnClickListener() {
    //			@Override
    //			public void onClick(View v) {
    //				zhumaView.removeAllViews();
    //				balls = new Vector();
    //				for (int i = 0; i < jixuanZhu.getSelectedItemPosition() + 1; i++) {
    //					Balls ball = ballOne.createBalls();
    //					balls.add(ball);
    //				}
    //				createTable(zhumaView);
    //			}
    //		});
  }