private void initView(Context context) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.layout_shuffle, this); candidateLayout = (LinearLayout) findViewById(R.id.CandidateLayout); senatorLayout = (LinearLayout) findViewById(R.id.SenatorLayout); candidate = (ShuffleCardCandidate) findViewById(R.id.candidate); senator = (ShuffleCardSenator) findViewById(R.id.senator); candidate.setDesk(this, candidateLayout); senator.setDesk(this, senatorLayout); }
public void InitDatas() { vGap = dip2px(vGapDip, getContext()); hGap = dip2px(hGapDip, getContext()); buttonCellWidth = DisplayUtil.getScreenWidth(getContext()) / Columns; buttonHeight = dip2px(buttonHeightDip, getContext()); buttonWidth = buttonCellWidth - hGap * 2; buttonCellHeight = buttonHeight + vGap * 2; minSelectedZoneHeight = buttonCellHeight * 3; senator.setStandardMinHeight(minSelectedZoneHeight); senator.setList(selectedButtons); candidate.setList(unselectedButtons); }
public ArrayList<MovableButton> getButtons() { ArrayList<MovableButton> buttons = new ArrayList<>(); buttons.addAll(senator.getSortedList()); buttons.addAll(candidate.getSortedList()); return buttons; }
private void shuffleButtons() { senator.shuffleButtons(); candidate.shuffleButtons(); }