private void togglePickerOptions() {
   if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) {
     mFreqSpinner.setEnabled(false);
     mEndSpinner.setEnabled(false);
     mIntervalPreText.setEnabled(false);
     mInterval.setEnabled(false);
     mIntervalPostText.setEnabled(false);
     mMonthRepeatByRadioGroup.setEnabled(false);
     mEndCount.setEnabled(false);
     mPostEndCount.setEnabled(false);
     mEndDateTextView.setEnabled(false);
     mRepeatMonthlyByNthDayOfWeek.setEnabled(false);
     mRepeatMonthlyByNthDayOfMonth.setEnabled(false);
     for (Button button : mWeekByDayButtons) {
       button.setEnabled(false);
     }
   } else {
     mView.findViewById(R.id.options).setEnabled(true);
     mFreqSpinner.setEnabled(true);
     mEndSpinner.setEnabled(true);
     mIntervalPreText.setEnabled(true);
     mInterval.setEnabled(true);
     mIntervalPostText.setEnabled(true);
     mMonthRepeatByRadioGroup.setEnabled(true);
     mEndCount.setEnabled(true);
     mPostEndCount.setEnabled(true);
     mEndDateTextView.setEnabled(true);
     mRepeatMonthlyByNthDayOfWeek.setEnabled(true);
     mRepeatMonthlyByNthDayOfMonth.setEnabled(true);
     for (Button button : mWeekByDayButtons) {
       button.setEnabled(true);
     }
   }
   updateDoneButtonState();
 }
Beispiel #2
0
 private void startSamplingService() {
   Session.setCurrentSamplingMode(selectedMode);
   boolean success = samplingService.startSampling();
   if (success) {
     Session.resetSummary();
     Session.setSamplingStartTime(System.currentTimeMillis());
     clearSummaryTable();
     rg.setEnabled(false);
   } else {
     startStop.toggle();
   }
 }
 private static View createSwitch(
     @NonNull LayoutInflater inflater,
     @NonNull ViewGroup parent,
     @NonNull FormField field,
     @NonNull String value,
     @NonNull String instructions,
     boolean readOnly,
     @NonNull final SwitchListener switchListener) {
   final View view = inflater.inflate(R.layout.edit_user_profile_switch, parent, false);
   ((TextView) view.findViewById(R.id.label)).setText(field.getLabel());
   ((TextView) view.findViewById(R.id.instructions)).setText(instructions);
   final RadioGroup group = ((RadioGroup) view.findViewById(R.id.options));
   {
     final RadioButton optionOne = ((RadioButton) view.findViewById(R.id.option_one));
     final RadioButton optionTwo = ((RadioButton) view.findViewById(R.id.option_two));
     optionOne.setText(field.getOptions().getValues().get(0).getName());
     optionOne.setTag(field.getOptions().getValues().get(0).getValue());
     optionTwo.setText(field.getOptions().getValues().get(1).getName());
     optionTwo.setTag(field.getOptions().getValues().get(1).getValue());
   }
   for (int i = 0; i < group.getChildCount(); i++) {
     final View child = group.getChildAt(i);
     child.setEnabled(!readOnly);
     if (child.getTag().equals(value)) {
       group.check(child.getId());
       break;
     }
   }
   if (readOnly) {
     group.setEnabled(false);
     view.setBackgroundColor(view.getResources().getColor(R.color.edx_grayscale_neutral_x_light));
   } else {
     group.setOnCheckedChangeListener(
         new RadioGroup.OnCheckedChangeListener() {
           @Override
           public void onCheckedChanged(RadioGroup group, int checkedId) {
             switchListener.onSwitch((String) group.findViewById(checkedId).getTag());
           }
         });
   }
   parent.addView(view);
   return view;
 }
 @Override
 protected void enableUi(boolean enabled) {
   super.enableUi(enabled);
   radioGroup.setEnabled(enabled);
 }
Beispiel #5
0
 private void stopSamplingService() {
   samplingService.stopSampling();
   Session.setSamplingStopTime(System.currentTimeMillis());
   rg.setEnabled(true);
   populateSummaryTable();
 }