package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.R;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class SelectOneWriteOtherQuestionFragment extends
        SelectOneQuestionFragment {

    @Override
    protected void beforeAddViewHook(ViewGroup questionComponent) {
        RadioButton radioButton = new RadioButton(getActivity());
        final EditText otherText = new EditText(getActivity());
        
        radioButton.setText(R.string.other_specify);
        radioButton.setTypeface(getInstrument().getTypeFace(getActivity().getApplicationContext()));
        final int otherId = getQuestion().options().size();
        radioButton.setId(otherId);
        getRadioGroup().setOnCheckedChangeListener(new OnCheckedChangeListener() {
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                otherText.setEnabled(checkedId == otherId);
                getResponse().setResponse(checkedId+"");
                getResponse().save();
            }
        });
        getRadioGroup().addView(radioButton, otherId);
        addOtherResponseView(otherText);
        questionComponent.addView(otherText);
    }
}

@@ -99,16 +99,17 @@
 rvey.R;%0A
+%0A
 import a
@@ -163,16 +163,52 @@
 itText;%0A
+import android.widget.LinearLayout;%0A
 import a
@@ -884,32 +884,211 @@
 setId(otherId);%0A
+        radioButton.setLayoutParams(new RadioGroup.LayoutParams(%0A                LinearLayout.LayoutParams.MATCH_PARENT,%0A                LinearLayout.LayoutParams.WRAP_CONTENT));%0A
         getRadio

Fix other radio button width for right aligned languages