()
| 75 | } |
| 76 | |
| 77 | private void generateLayout() { |
| 78 | |
| 79 | LinearLayout layout = (LinearLayout) rootView |
| 80 | .findViewById(R.id.layoutLoginConfig); |
| 81 | SyncWizardValues syncValues = new SyncWizardValues(); |
| 82 | List<SyncValue> syncValuesList = syncValues.syncValues(); |
| 83 | if (syncValuesList.size() == 0) { |
| 84 | getActivity().finish(); |
| 85 | getActivity().startActivity(getActivity().getIntent()); |
| 86 | } |
| 87 | checkbox = new CheckBox[syncValuesList.size()]; |
| 88 | rdoGroups = new RadioGroup[syncValuesList.size()]; |
| 89 | TextView[] txvTitles = new TextView[syncValuesList.size()]; |
| 90 | int i = 0; |
| 91 | int id = 1; |
| 92 | Typeface tf_light = Typeface.create("sans-serif-light", 0); |
| 93 | Typeface tf_bold = Typeface.create("sans-serif-condensed", 0); |
| 94 | for (SyncValue value : syncValuesList) { |
| 95 | if (!value.getIsGroup()) { |
| 96 | if (value.getType() == SyncValue.Type.CHECKBOX) { |
| 97 | checkbox[i] = new CheckBox(scope.context()); |
| 98 | checkbox[i].setId(id); |
| 99 | checkbox[i].setText(value.getTitle()); |
| 100 | checkbox[i].setTypeface(tf_light); |
| 101 | layout.addView(checkbox[i]); |
| 102 | } else { |
| 103 | rdoGroups[i] = new RadioGroup(scope.context()); |
| 104 | rdoGroups[i].setId(i + 50); |
| 105 | RadioButton[] rdoButtons = new RadioButton[value |
| 106 | .getRadioGroups().size()]; |
| 107 | int mId = 1; |
| 108 | int j = 0; |
| 109 | for (SyncValue rdoVal : value.getRadioGroups()) { |
| 110 | rdoButtons[j] = new RadioButton(scope.context()); |
| 111 | rdoButtons[j].setId(mId); |
| 112 | rdoButtons[j].setText(rdoVal.getTitle()); |
| 113 | rdoButtons[j].setTypeface(tf_light); |
| 114 | rdoGroups[i].addView(rdoButtons[j]); |
| 115 | mId++; |
| 116 | j++; |
| 117 | } |
| 118 | layout.addView(rdoGroups[i]); |
| 119 | } |
| 120 | authorities.put(id + "", value.getAuthority()); |
| 121 | i++; |
| 122 | id++; |
| 123 | } else { |
| 124 | txvTitles[i] = new TextView(scope.context()); |
| 125 | txvTitles[i].setId(id); |
| 126 | txvTitles[i].setText(value.getTitle()); |
| 127 | txvTitles[i].setAllCaps(true); |
| 128 | txvTitles[i].setPadding(0, 5, 0, 3); |
| 129 | txvTitles[i].setTypeface(tf_bold); |
| 130 | layout.addView(txvTitles[i]); |
| 131 | View lineView = new View(scope.context()); |
| 132 | lineView.setBackgroundColor(Color.parseColor("#BEBEBE")); |
| 133 | lineView.setLayoutParams(new LayoutParams( |
| 134 | LayoutParams.MATCH_PARENT, 1)); |
no test coverage detected