Esempio n. 1
0
  private void createLayout() {
    Intent intent = getIntent();
    totalPlayers = intent.getIntExtra("LOG_GAME_TOTAL_PLAYERS", 0);

    firstLine = (LinearLayout) findViewById(R.id.firstLine);
    firstLine.setOnDragListener(new MyDragListener());
    CardView firstCard = (CardView) findViewById(R.id.firstCard);
    if (firstCard != null) {
      firstCard.setOnTouchListener(new MyTouchListener());
    }
    avatarFirstLogGame = (ImageView) findViewById(R.id.avatarFirstLogGame);
    playerFirstNameLogGame = (TextView) findViewById(R.id.playerFirstNameLogGame);
    playerFirstDeckLogGame = (TextView) findViewById(R.id.playerFirstDeckLogGame);

    secondLine = (LinearLayout) findViewById(R.id.secondLine);
    secondLine.setOnDragListener(new MyDragListener());
    CardView secondCard = (CardView) findViewById(R.id.secondCard);
    if (secondCard != null) {
      secondCard.setOnTouchListener(new MyTouchListener());
    }
    avatarSecondLogGame = (ImageView) findViewById(R.id.avatarSecondLogGame);
    playerSecondNameLogGame = (TextView) findViewById(R.id.playerSecondNameLogGame);
    playerSecondDeckLogGame = (TextView) findViewById(R.id.playerSecondDeckLogGame);

    LinearLayout thirdLineParent = (LinearLayout) findViewById(R.id.thirdLineParent);
    if (totalPlayers >= 3) {
      thirdLine = (LinearLayout) findViewById(R.id.thirdLine);
      thirdLine.setOnDragListener(new MyDragListener());
      CardView thirdCard = (CardView) findViewById(R.id.thirdCard);
      if (thirdCard != null) {
        thirdCard.setOnTouchListener(new MyTouchListener());
      }
      avatarThirdLogGame = (ImageView) findViewById(R.id.avatarThirdLogGame);
      playerThirdNameLogGame = (TextView) findViewById(R.id.playerThirdNameLogGame);
      playerThirdDeckLogGame = (TextView) findViewById(R.id.playerThirdDeckLogGame);
    } else {
      if (thirdLineParent != null) {
        thirdLineParent.setVisibility(View.GONE);
      }
    }

    LinearLayout fourthLineParent = (LinearLayout) findViewById(R.id.fourthLineParent);
    if (totalPlayers >= 4) {
      fourthLine = (LinearLayout) findViewById(R.id.fourthLine);
      fourthLine.setOnDragListener(new MyDragListener());
      CardView fourthCard = (CardView) findViewById(R.id.fourthCard);
      if (fourthCard != null) {
        fourthCard.setOnTouchListener(new MyTouchListener());
      }
      avatarFourthLogGame = (ImageView) findViewById(R.id.avatarFourthLogGame);
      playerFourthNameLogGame = (TextView) findViewById(R.id.playerFourthNameLogGame);
      playerFourthDeckLogGame = (TextView) findViewById(R.id.playerFourthDeckLogGame);
    } else {
      if (fourthLineParent != null) {
        fourthLineParent.setVisibility(View.GONE);
      }
    }

    scrollView = (ScrollView) findViewById(R.id.scrollLogGame);
  }