File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed
CheckboxQuestion/CheckboxQuestion/src/main/java/com/aadyad/checkboxquestion Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 99import android .view .View ;
1010import android .view .ViewGroup ;
1111import android .widget .CheckBox ;
12- import android .widget .CompoundButton ;
1312import android .widget .LinearLayout ;
1413import android .widget .TextView ;
15- import android .widget .Toast ;
1614
1715import androidx .annotation .Nullable ;
1816
@@ -282,7 +280,7 @@ public void onClick(View v) {
282280 layout .setGravity (Gravity .RIGHT );
283281 }
284282
285- setLayoutOrientation (orientation );
283+ setCheckboxOrientation (orientation );
286284
287285 setQuestion (title );
288286 if (numEnabled ) {
@@ -412,7 +410,7 @@ public void setQuestionNumber(String number) {
412410 questionNumber .setText (number + ". " );
413411 }
414412
415- public void setLayoutOrientation (int orientation ){
413+ public void setCheckboxOrientation (int orientation ){
416414 View spacing1 = findViewById (R .id .spacing1 );
417415 View layoutSpacing = findViewById (R .id .spacingLayouts );
418416 View spacing2 = findViewById (R .id .spacing2 );
Original file line number Diff line number Diff line change 22
33import android .content .Context ;
44import android .util .Log ;
5- import android .view .Gravity ;
65import android .view .View ;
7- import android .view .ViewGroup ;
86import android .widget .LinearLayout ;
9- import android .widget .Toast ;
107
118import java .util .ArrayList ;
129import java .util .Arrays ;
@@ -81,10 +78,10 @@ public void setLayoutOrientation(int orientation){
8178 multipleChoiceQuestion = (MultipleChoiceQuestion ) v ;
8279 }
8380 if (yesOrNoQuestion != null ){
84- yesOrNoQuestion .setLayoutOrientation (orientation );
81+ yesOrNoQuestion .setCheckboxOrientation (orientation );
8582 }else {
8683 assert multipleChoiceQuestion != null ;
87- multipleChoiceQuestion .setLayoutOrientation (orientation );
84+ multipleChoiceQuestion .setCheckboxOrientation (orientation );
8885 }
8986 }
9087 createQuestionViews ();
@@ -193,8 +190,7 @@ public View getQuestion(int index){
193190
194191 public void addOnValueChangedRunnable (int index , Runnable r ){
195192 try {
196- MultipleChoiceQuestion multipleChoiceQuestion = (MultipleChoiceQuestion ) linearLayout .getChildAt (index );
197- multipleChoiceQuestion .doOnValueChanged (r );
193+ ((MultipleChoiceQuestion ) getQuestion (index )).doOnValueChanged (r );
198194 } catch (Exception e ) {
199195 YesOrNoQuestion yesOrNoQuestion = (YesOrNoQuestion ) linearLayout .getChildAt (index );
200196 //Todo: add do on value changed
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ public void setQuestionNumber(String number){
163163 questionNumber .setText (number + ". " );
164164 }
165165
166- public void setLayoutOrientation (int orientation ){
166+ public void setCheckboxOrientation (int orientation ){
167167
168168 View space = findViewById (R .id .spacing );
169169
You can’t perform that action at this time.
0 commit comments