List of usage examples for android.widget RadioGroup setEnabled
@RemotableViewMethod public void setEnabled(boolean enabled)
From source file:jp.co.rediscovery.firstflight.ConfigFragment.java
/** * ??? FIXME /*from w w w.java 2s . c om*/ * @param root */ private void initConfigNetwork(final View root) { final IWiFiController wifi = (mController instanceof IWiFiController) ? (IWiFiController) mController : null; final RadioGroup group = root.findViewById(R.id.network_wifi_mode_radiogroup); if (wifi != null) { final boolean outdoor = wifi.isOutdoor(); group.check(outdoor ? R.id.network_outdoor_radiobutton : R.id.network_indoor_radiobutton); group.setOnCheckedChangeListener(mOnRadioButtonCheckedChangeListener); } else { group.check(R.id.network_indoor_radiobutton); group.setEnabled(false); } }
From source file:com.serenegiant.aceparrot.ConfigFragment.java
/** * ??? FIXME //from www .j av a 2 s . co m * @param root */ private void initConfigNetwork(final View root) { final IWiFiController wifi = (mController instanceof IWiFiController) ? (IWiFiController) mController : null; final RadioGroup group = (RadioGroup) root.findViewById(R.id.network_wifi_mode_radiogroup); if (wifi != null) { final boolean outdoor = wifi.isOutdoor(); group.check(outdoor ? R.id.network_outdoor_radiobutton : R.id.network_indoor_radiobutton); group.setOnCheckedChangeListener(mOnRadioButtonCheckedChangeListener); } else { group.check(R.id.network_indoor_radiobutton); group.setEnabled(false); } }
From source file:de.da_sense.moses.client.FormFragment.java
/** * Displays a single choice question to the user. * @param question the question to be displayed * @param linearLayoutInsideAScrollView the view to add the question to * @param ordinal the ordinal number of the question i.e. 1, 2, 3, 4 or 5 *//*from w w w .j av a 2s.c o m*/ private void makeSingleChoice(final Question question, LinearLayout linearLayoutInsideAScrollView, int ordinal) { LinearLayout questionContainer = generateQuestionContainer(linearLayoutInsideAScrollView); String questionText = question.getTitle(); List<PossibleAnswer> possibleAnswers = question.getPossibleAnswers(); Collections.sort(possibleAnswers); TextView questionView = new TextView(getActivity()); questionView.setText(ordinal + ". " + questionText); if (question.isMandatory()) questionView.setTextAppearance(getActivity(), R.style.QuestionTextStyleMandatory); else questionView.setTextAppearance(getActivity(), R.style.QuestionTextStyle); questionContainer.addView(questionView); mQuestionTitleMappings.put(question, questionView); final RadioButton[] rb = new RadioButton[possibleAnswers.size()]; RadioGroup rg = new RadioGroup(getActivity()); // create the RadioGroup rg.setOrientation(RadioGroup.VERTICAL);// or RadioGroup.VERTICAL String madeAnswer = question.getAnswer(); int madeAnswerInt = -1; if (!madeAnswer.equals(Question.ANSWER_UNANSWERED)) madeAnswerInt = Integer.parseInt(madeAnswer); for (int i = 0; i < rb.length; i++) { rb[i] = new RadioButton(getActivity()); if (i % 2 == 0) rb[i].setBackgroundColor(getActivity().getResources().getColor(R.color.light_gray)); rg.addView(rb[i]); // the RadioButtons are added to the radioGroup // instead of the layout PossibleAnswer possibleAnswer = possibleAnswers.get(i); rb[i].setText(possibleAnswer.getTitle()); final int possibleAnswerId = possibleAnswer.getId(); if (madeAnswerInt == possibleAnswerId) rb[i].setChecked(true); rb[i].setTextAppearance(getActivity(), R.style.PossibleAnswerTextStyle); LayoutParams rowParam = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); rb[i].setLayoutParams(rowParam); // click handling rb[i].setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { question.setAnswer(String.valueOf(possibleAnswerId)); } }); if (mBelongsTo == WelcomeActivityPagerAdapter.TAB_HISTORY) rb[i].setEnabled(false); rb[i].setVisibility(View.VISIBLE); } rg.setVisibility(View.VISIBLE); if (mBelongsTo == WelcomeActivityPagerAdapter.TAB_HISTORY) rg.setEnabled(false); Log.i(LOG_TAG, "last rg = " + rg); questionContainer.addView(rg); }