コード例 #1
0
  public void newPyramidByName(String name) {

    Spinner spinner = (Spinner) findViewById(R.id.oldpyramids);
    spinner.setSelection(0);

    final CheckBox checkBoxOne = (CheckBox) findViewById(R.id.itemOneCheckBox);
    final CheckBox checkBoxTwo = (CheckBox) findViewById(R.id.itemTwoCheckBox);
    final CheckBox checkBoxThree = (CheckBox) findViewById(R.id.itemThreeCheckBox);
    final CheckBox checkBoxFour = (CheckBox) findViewById(R.id.itemFourCheckBox);
    final CheckBox checkBoxFive = (CheckBox) findViewById(R.id.itemFiveCheckBox);
    final CheckBox checkBoxSix = (CheckBox) findViewById(R.id.itemSixCheckBox);

    String localname = "Hold To Edit";
    pyramidName = name;

    checkBoxOne.setText(localname);
    checkBoxTwo.setText(localname);
    checkBoxThree.setText(localname);
    checkBoxFour.setText(localname);
    checkBoxFive.setText(localname);
    checkBoxSix.setText(localname);

    checkBoxOne.setChecked(false);
    checkBoxTwo.setChecked(false);
    checkBoxThree.setChecked(false);
    checkBoxFour.setChecked(false);
    checkBoxFive.setChecked(false);
    checkBoxSix.setChecked(false);

    checkBoxOne.setPaintFlags(checkBoxOne.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxTwo.setPaintFlags(checkBoxTwo.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxThree.setPaintFlags(checkBoxThree.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxFour.setPaintFlags(checkBoxFour.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxFive.setPaintFlags(checkBoxFive.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxSix.setPaintFlags(checkBoxSix.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);

    fillImagesRandomly();

    final TextView myTopName = (TextView) findViewById(R.id.TopItemCheckBox);
    myTopName.setText(name);
  }
コード例 #2
0
  public void loadCardViewByName(String name) {
    if (name.equals("*New Pyramid")) {
      newPyramid();
      return;
    }

    Cursor cursor = getPyramidCursorByName(name);
    if (cursor.getCount() > 0) {
      cursor.moveToFirst();
    } else {
      cursor.close();
      return;
    }

    // get the views
    final CheckBox checkBoxOne = (CheckBox) findViewById(R.id.itemOneCheckBox);
    final CheckBox checkBoxTwo = (CheckBox) findViewById(R.id.itemTwoCheckBox);
    final CheckBox checkBoxThree = (CheckBox) findViewById(R.id.itemThreeCheckBox);
    final CheckBox checkBoxFour = (CheckBox) findViewById(R.id.itemFourCheckBox);
    final CheckBox checkBoxFive = (CheckBox) findViewById(R.id.itemFiveCheckBox);
    final CheckBox checkBoxSix = (CheckBox) findViewById(R.id.itemSixCheckBox);

    checkBoxOne.setPaintFlags(checkBoxOne.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxTwo.setPaintFlags(checkBoxTwo.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxThree.setPaintFlags(checkBoxThree.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxFour.setPaintFlags(checkBoxFour.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxFive.setPaintFlags(checkBoxFive.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
    checkBoxSix.setPaintFlags(checkBoxSix.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);

    String nameOne = cursor.getString(2);
    String nameTwo = cursor.getString(3);
    String nameThree = cursor.getString(4);
    String nameFour = cursor.getString(5);
    String nameFive = cursor.getString(6);
    String nameSix = cursor.getString(7);

    checkBoxOne.setText(nameOne);
    checkBoxTwo.setText(nameTwo);
    checkBoxThree.setText(nameThree);
    checkBoxFour.setText(nameFour);
    checkBoxFive.setText(nameFive);
    checkBoxSix.setText(nameSix);

    int checkOne = cursor.getInt(8);
    int checkTwo = cursor.getInt(9);
    int checkThree = cursor.getInt(10);
    int checkFour = cursor.getInt(11);
    int checkFive = cursor.getInt(12);
    int checkSix = cursor.getInt(13);

    if (checkOne > 0) {
      checkBoxOne.setChecked(true);
      checkBoxOne.setPaintFlags(checkBoxOne.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      checkBoxOne.setChecked(false);
    }
    if (checkTwo > 0) {
      checkBoxTwo.setChecked(true);
      checkBoxTwo.setPaintFlags(checkBoxTwo.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      checkBoxTwo.setChecked(false);
    }
    if (checkThree > 0) {
      checkBoxThree.setChecked(true);
      checkBoxThree.setPaintFlags(checkBoxThree.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      checkBoxThree.setChecked(false);
    }
    if (checkFour > 0) {
      checkBoxFour.setChecked(true);
      checkBoxFour.setPaintFlags(checkBoxFour.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      checkBoxFour.setChecked(false);
    }
    if (checkFive > 0) {
      checkBoxFive.setChecked(true);
      checkBoxFive.setPaintFlags(checkBoxFive.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      checkBoxFive.setChecked(false);
    }
    if (checkSix > 0) {
      checkBoxSix.setChecked(true);
      checkBoxSix.setPaintFlags(checkBoxSix.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      checkBoxSix.setChecked(false);
    }

    int colorOne = cursor.getInt(14);
    int colorTwo = cursor.getInt(15);
    int colorThree = cursor.getInt(16);
    int colorFour = cursor.getInt(17);
    int colorFive = cursor.getInt(18);
    int colorSix = cursor.getInt(19);
    int colorTop = cursor.getInt(20);

    ImageView imageOne = (ImageView) findViewById(R.id.ImageViewOne);
    ImageView imageTwo = (ImageView) findViewById(R.id.ImageViewTwo);
    ImageView imageThree = (ImageView) findViewById(R.id.ImageViewThree);
    ImageView imageFour = (ImageView) findViewById(R.id.ImageViewFour);
    ImageView imageFive = (ImageView) findViewById(R.id.ImageViewFive);
    ImageView imageSix = (ImageView) findViewById(R.id.ImageViewSix);
    ImageView imageTop = (ImageView) findViewById(R.id.TopBlockImage);

    genColor(imageOne, colorOne);
    genColor(imageTwo, colorTwo);
    genColor(imageThree, colorThree);
    genColor(imageFour, colorFour);
    genColor(imageFive, colorFive);
    genColor(imageSix, colorSix);
    genColor(imageTop, colorTop);

    // get the top name
    final TextView myTopName = (TextView) findViewById(R.id.TopItemCheckBox);
    myTopName.setText(name);

    pyramidName = name;
  }