void updateButtonStates() { boolean active = mDPM.isAdminActive(mDeviceAdminSample); if (active) { mEnableButton.setEnabled(false); mDisableButton.setEnabled(true); mPasswordQuality.setEnabled(true); mPasswordLength.setEnabled(true); mSetPasswordButton.setEnabled(true); mPassword.setEnabled(true); mResetPasswordButton.setEnabled(true); mForceLockButton.setEnabled(true); mWipeDataButton.setEnabled(true); mWipeAllDataButton.setEnabled(true); } else { mEnableButton.setEnabled(true); mDisableButton.setEnabled(false); mPasswordQuality.setEnabled(false); mPasswordLength.setEnabled(false); mSetPasswordButton.setEnabled(false); mPassword.setEnabled(false); mResetPasswordButton.setEnabled(false); mForceLockButton.setEnabled(false); mWipeDataButton.setEnabled(false); mWipeAllDataButton.setEnabled(false); } }
@Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.detect_start_localize_button: ConnectivityManager cm = (ConnectivityManager) this.getApplicationContext().getSystemService(CONNECTIVITY_SERVICE); NetworkInfo networkInfo = cm.getActiveNetworkInfo(); if (networkInfo == null || !networkInfo.isConnected()) { myHandler.post(new FailConnectInternet()); return; } if (((String) listTypeSpinner.getSelectedItem()).equals("GPS")) { LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { Toast.makeText(getApplicationContext(), "Gps Disabled", Toast.LENGTH_SHORT).show(); return; } } startLocalizeButton.setEnabled(false); startLocalizeButton.setFocusable(false); stopLocalizeButton.setEnabled(true); stopLocalizeButton.setFocusable(true); listTypeSpinner.setEnabled(false); listTypeSpinner.setFocusable(false); countInt = 0; if (((String) listTypeSpinner.getSelectedItem()).equals("WIFI")) { wifiDetector.setConvert(convertCheckbox.isChecked()); wifiDetector.startDetectLocation(); } else { gpsDetector.startDetectLocation(); } break; case R.id.detect_stop_localize_button: startLocalizeButton.setEnabled(true); startLocalizeButton.setFocusable(true); stopLocalizeButton.setEnabled(false); stopLocalizeButton.setFocusable(false); listTypeSpinner.setEnabled(true); listTypeSpinner.setFocusable(true); if (((String) listTypeSpinner.getSelectedItem()).equals("WIFI")) { wifiDetector.stopDectectLocation(); } else { gpsDetector.stopDectectLocation(); } break; default: break; } }
public void setRollMode(RollMode rollMode) { switch (rollMode) { case SINGLE: m_rollMode = RollMode.SINGLE; m_resetButton.setEnabled(false); m_dieQuantitySpinner.setEnabled(false); m_dieQuantityTv.setEnabled(false); m_rollSumTv.setVisibility(View.INVISIBLE); m_rollResultList.setVisibility(View.GONE); break; case XDY: m_rollMode = RollMode.XDY; m_resetButton.setEnabled(true); m_dieQuantitySpinner.setEnabled(true); m_dieQuantityTv.setEnabled(true); m_rollSumTv.setVisibility(View.INVISIBLE); m_rollResultList.setVisibility(View.VISIBLE); break; case CUMULATIVE: m_rollMode = RollMode.CUMULATIVE; m_resetButton.setEnabled(true); m_dieQuantitySpinner.setEnabled(true); m_dieQuantityTv.setEnabled(true); m_rollSumTv.setVisibility(View.VISIBLE); m_rollResultList.setVisibility(View.VISIBLE); break; } }
public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.munual_select_interpolation: FreqSpinner.setEnabled(false); et_bandwidth.setFocusable(true); et_bandwidth.setFocusableInTouchMode(true); et_bandwidth.requestFocus(); et_centerfreq.setFocusable(true); et_centerfreq.setFocusableInTouchMode(true); et_centerfreq.requestFocus(); Ishand = true; Ischoose = false; break; case R.id.straight_select_interpolation: et_bandwidth.setText(""); et_centerfreq.setText(""); et_bandwidth.setFocusableInTouchMode(false); et_centerfreq.setFocusableInTouchMode(false); et_bandwidth.setFocusable(false); et_centerfreq.setFocusable(false); FreqSpinner.setEnabled(true); Ishand = false; Ischoose = true; break; default: break; } }
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(); }
protected void onOff(boolean on) { // TODO Auto-generated method stub sp_pro.setPressed(on); sp_pro.setEnabled(!on); sp_city.setPressed(on); sp_city.setEnabled(!on); DataShare.save(context, Data.city_auto, String.valueOf(on)); }
protected View selectInterval(RecurInterval interval) { if (interval == RecurInterval.NO_RECUR) { sPeriod.setSelection(RecurPeriod.STOPS_ON_DATE.ordinal()); sPeriod.setEnabled(false); } else { sPeriod.setEnabled(true); } return selectInLayout(layoutInterval, interval); }
/** * Set views status * * @param state True if view need to set enabled */ private void setViewEnabled(boolean state) { mBtnGo.setEnabled(state); mBtnStop.setEnabled(!state); mChannelSpinner.setEnabled(state); mBandwidthSpinner.setEnabled(state); mSpBwAdvCbw.setEnabled(state); mSpBwAdvDbw.setEnabled(state); mSpBwAdvPrimCh.setEnabled(state); }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.evolveMonster: evolutionSpinner.setEnabled(true); break; default: evolutionSpinner.setEnabled(false); break; } }
public void disChangeAble() { ed_boSung.setEnabled(false); ed_giaPhong.setEnabled(false); ed_traLoi.setEnabled(false); spn_tinhTrang.setEnabled(false); spn_cauHoi.setEnabled(false); rb_danhGia.setEnabled(false); btn_roiPhong.setEnabled(true); btn_xoaPhong.setEnabled(true); }
@Override public View getPrototypeView(Context context) { prototypeView = View.inflate(context, R.layout.brick_phiro_rgb_light, null); TextView textValueRed = (TextView) prototypeView.findViewById(R.id.brick_phiro_rgb_led_red_prototype_text_view); textValueRed.setText(String.valueOf(BrickValues.PHIRO_VALUE_RED)); TextView textValueGreen = (TextView) prototypeView.findViewById(R.id.brick_phiro_rgb_led_green_prototype_text_view); textValueGreen.setText(String.valueOf(BrickValues.PHIRO_VALUE_GREEN)); TextView textValueBlue = (TextView) prototypeView.findViewById(R.id.brick_phiro_rgb_led_blue_prototype_text_view); textValueBlue.setText(String.valueOf(BrickValues.PHIRO_VALUE_BLUE)); Spinner eyeSpinner = (Spinner) prototypeView.findViewById(R.id.brick_phiro_rgb_light_spinner); eyeSpinner.setFocusableInTouchMode(false); eyeSpinner.setFocusable(false); eyeSpinner.setEnabled(false); ArrayAdapter<CharSequence> eyeAdapter = ArrayAdapter.createFromResource( context, R.array.brick_phiro_select_light_spinner, android.R.layout.simple_spinner_item); eyeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); eyeSpinner.setAdapter(eyeAdapter); eyeSpinner.setSelection(eyeEnum.ordinal()); return prototypeView; }
/** * Prepare this editor using the given {@link DataKind} for defining structure and {@link * ValuesDelta} describing the content to edit. */ @Override public void setValues( DataKind kind, ValuesDelta entry, RawContactDelta state, boolean readOnly, ViewIdGenerator vig) { mKind = kind; mEntry = entry; mState = state; mReadOnly = readOnly; mViewIdGenerator = vig; setId(vig.getId(state, kind, entry, ViewIdGenerator.NO_VIEW_INDEX)); if (!entry.isVisible()) { // Hide ourselves entirely if deleted setVisibility(View.GONE); return; } setVisibility(View.VISIBLE); // Display label selector if multiple types available final boolean hasTypes = RawContactModifier.hasEditTypes(kind); setupLabelButton(hasTypes); mLabel.setEnabled(!readOnly && isEnabled()); if (hasTypes) { mType = RawContactModifier.getCurrentType(entry, kind); rebuildLabel(); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { dataList = (ArrayList<HashMap<String, Object>>) savedInstanceState.getSerializable("dataList"); } fragmentIdUUId = UUID.randomUUID().toString(); DataHandler.setFragmentId(fragmentIdUUId); View view = inflater.inflate(R.layout.function_manager_add_m_p_type_layout, container, false); ManagerAddMPTitleControl.setTitleContent( view, R.string.add_m_p_type_title_text, R.string.add_m_p_intro_next_button_text, new nextButtonClick()); typeSpinner = (Spinner) view.findViewById(R.id.manager_add_m_p_type_list); typeSpinner.setOnItemSelectedListener(new typeSelectedListener()); typeSpinner.setEnabled(false); typeImage = (ImageView) view.findViewById(R.id.manager_add_m_p_type_image); if (typeAdapter == null) { typeAdapter = new ArrayAdapter<String>(activity, android.R.layout.simple_spinner_item); if (dataList != null) { setAdapterData(); } else { getMPTypeInfo(); } } else { setAdapter(); } return view; }
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { int buttonID = buttonView.getId(); if (buttonID == R.id.switchNotificationLO) { if (isChecked) { repeatSpinner.setEnabled(true); timepicker.setEnabled(true); datepicker.setEnabled(true); } else { repeatSpinner.setEnabled(false); timepicker.setEnabled(false); datepicker.setEnabled(false); } } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tvdisptimer = (TextView) findViewById(R.id.tvdisptimer); sptimer = (Spinner) findViewById(R.id.sptimer); sptimer.setOnItemSelectedListener(this); sptimer.setEnabled(false); btn_get_send_message = (Button) findViewById(R.id.btn_get_send_message); btn_get_send_message.setOnClickListener(this); btn_get_send_message.setEnabled(false); btn_start_stop = (ToggleButton) findViewById(R.id.btn_start_stop); btn_start_stop.setOnCheckedChangeListener(this); btn_start_stop.setEnabled(false); btn_update_credentials = (Button) findViewById(R.id.btn_update_credentials); btn_update_credentials.setOnClickListener(this); item = getResources().getStringArray(R.array.digit_array)[0]; getSavedDeviceId(); }
/** Configures the visibility of the type label button and enables or disables it properly. */ private void setupLabelButton(boolean shouldExist) { if (shouldExist) { mLabel.setEnabled(!mReadOnly && isEnabled()); mLabel.setVisibility(View.VISIBLE); } else { mLabel.setVisibility(View.GONE); } }
@Override public void readFromTask(Task task) { this.myTask = task; Metadata metadata = ProducteevDataService.getInstance().getTaskMetadata(myTask.getId()); if (metadata == null) metadata = ProducteevTask.newMetadata(); // Fill the dashboard-spinner and set the current dashboard long dashboardId = ProducteevUtilities.INSTANCE.getDefaultDashboard(); if (metadata.containsNonNullValue(ProducteevTask.DASHBOARD_ID)) dashboardId = metadata.getValue(ProducteevTask.DASHBOARD_ID); StoreObject[] dashboardsData = ProducteevDataService.getInstance().getDashboards(); dashboards = new ArrayList<ProducteevDashboard>(dashboardsData.length); ProducteevDashboard ownerDashboard = null; int dashboardSpinnerIndex = -1; int i = 0; for (i = 0; i < dashboardsData.length; i++) { ProducteevDashboard dashboard = new ProducteevDashboard(dashboardsData[i]); dashboards.add(dashboard); if (dashboard.getId() == dashboardId) { ownerDashboard = dashboard; dashboardSpinnerIndex = i; } } // dashboard to not sync as first spinner-entry dashboards.add( 0, new ProducteevDashboard( ProducteevUtilities.DASHBOARD_NO_SYNC, activity.getString(R.string.producteev_no_dashboard), null)); // dummy entry for adding a new dashboard dashboards.add( new ProducteevDashboard( ProducteevUtilities.DASHBOARD_CREATE, activity.getString(R.string.producteev_create_dashboard), null)); ArrayAdapter<ProducteevDashboard> dashAdapter = new ArrayAdapter<ProducteevDashboard>( activity, android.R.layout.simple_spinner_item, dashboards); dashAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dashboardSelector.setAdapter(dashAdapter); dashboardSelector.setSelection(dashboardSpinnerIndex + 1); if (ownerDashboard == null || ownerDashboard.getId() == ProducteevUtilities.DASHBOARD_NO_SYNC || ownerDashboard.getId() == ProducteevUtilities.DASHBOARD_CREATE) { responsibleSelector.setEnabled(false); responsibleSelector.setAdapter(null); view.findViewById(R.id.producteev_TEA_task_assign_label).setVisibility(View.GONE); return; } refreshResponsibleSpinner(ownerDashboard.getUsers()); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_tela_cadastro, container, false); etNome = (EditText) rootView.findViewById(R.id.etNomeCompleto); etEmail = (EditText) rootView.findViewById(R.id.etEmail); etSenha = (EditText) rootView.findViewById(R.id.etSenha); etConfSenha = (EditText) rootView.findViewById(R.id.etConfSenha); etCPF = (EditText) rootView.findViewById(R.id.etCPF); etTelefone = (EditText) rootView.findViewById(R.id.etTelefone); etNumCartao = (EditText) rootView.findViewById(R.id.etNumCartaoCadastro); spTipoSocio = (Spinner) rootView.findViewById(R.id.spTipoSocio); ArrayAdapter<CharSequence> ar = ArrayAdapter.createFromResource( getActivity(), R.array.tipo_socio, android.R.layout.simple_list_item_1); ar.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spTipoSocio.setAdapter(ar); spSexo = (Spinner) rootView.findViewById(R.id.spSexo); ArrayAdapter<CharSequence> ar2 = ArrayAdapter.createFromResource( getActivity(), R.array.sexo, android.R.layout.simple_list_item_1); ar.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spSexo.setAdapter(ar2); btnConfirmar = (Button) rootView.findViewById(R.id.btnConfirmar); btnConfirmar.setOnClickListener(this); if (TelaCadastro.isEditar()) { etNome.setText(Socio.getSocioLogado().getNome()); etEmail.setText(Socio.getSocioLogado().getEmail()); etSenha.setText(Socio.getSocioLogado().getSenha()); etCPF.setText(Socio.getSocioLogado().getCpf()); etTelefone.setText(Socio.getSocioLogado().getTelefone()); etCPF.setEnabled(false); int selection = 0; if (Socio.getSocioLogado().getTipoSocio().equals("Master")) { selection = 0; } if (Socio.getSocioLogado().getTipoSocio().equals("Ouro")) { selection = 1; } if (Socio.getSocioLogado().getTipoSocio().equals("Prata")) { selection = 2; } if (Socio.getSocioLogado().getTipoSocio().equals("Patrimonial")) { selection = 3; } spTipoSocio.setSelection(selection); spTipoSocio.setEnabled(false); } return rootView; }
@Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); // If on page & enabled: make other fields lose focus and simulate clicking with // onFocusChange: setFocusable(onPage && enabled); setFocusableInTouchMode(onPage && enabled); setOnFocusChangeListener(onPage && enabled ? this : null); }
private void setControlsEnabled(boolean enabled) { playButton.setEnabled(enabled); pauseButton.setEnabled(enabled); skipTo.setEnabled(enabled); videoChooser.setEnabled(enabled); for (int i = 0; i < styleRadioGroup.getChildCount(); i++) { styleRadioGroup.getChildAt(i).setEnabled(enabled); } }
public void setDataOptionsEnabled(boolean val) { mUnits.setEnabled(val); mPicker.setEnabled(val); mClearButton.setEnabled(val); if (val) { mRootView.findViewById(R.id.warning_view).setVisibility(View.GONE); } else { mRootView.findViewById(R.id.warning_view).setVisibility(View.VISIBLE); } }
public void initilizeForNewTask() { repeatAlarmInterval = -1; // disable the time picker on the oncreate // set the timepicker to view 24 hours format timepicker.setEnabled(false); datepicker.setEnabled(false); repeatSpinner.setEnabled(false); notifySwitch.setChecked(false); // button, add the task }
@Override public View getView(Context context, int brickId, BaseAdapter baseAdapter) { if (animationState) { return view; } if (view == null) { alphaValue = 255; } view = View.inflate(context, R.layout.brick_nxt_motor_stop, null); view = getViewWithAlpha(alphaValue); setCheckboxView(R.id.brick_nxt_motor_stop_checkbox); final Brick brickInstance = this; checkbox.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { checked = isChecked; adapter.handleCheck(brickInstance, isChecked); } }); ArrayAdapter<CharSequence> motorAdapter = ArrayAdapter.createFromResource( context, R.array.nxt_stop_motor_chooser, android.R.layout.simple_spinner_item); motorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner motorSpinner = (Spinner) view.findViewById(R.id.stop_motor_spinner); motorSpinner.setOnItemSelectedListener(this); if (!(checkbox.getVisibility() == View.VISIBLE)) { motorSpinner.setClickable(true); motorSpinner.setEnabled(true); } else { motorSpinner.setClickable(false); motorSpinner.setEnabled(false); } motorSpinner.setAdapter(motorAdapter); motorSpinner.setSelection(motorEnum.ordinal()); return view; }
private void disableEdit() { jobStatus.setEnabled(false); btn_startTimer.setEnabled(false); btn_startTimer.setVisibility(View.GONE); btn_cancelJob.setEnabled(false); btn_cancelJob.setTextColor(Color.GRAY); btn_photo.setEnabled(false); btn_photo.setTextColor(Color.GRAY); btn_postpone.setEnabled(false); btn_postpone.setTextColor(Color.GRAY); }
private void disableAll() { sb1.setEnabled(false); sb2.setEnabled(false); sb3.setEnabled(false); sb4.setEnabled(false); sb5.setEnabled(false); sk1.setEnabled(false); sk2.setEnabled(false); presetsSpinner.setEnabled(false); }
private void enableAll() { sb1.setEnabled(true); sb2.setEnabled(true); sb3.setEnabled(true); sb4.setEnabled(true); sb5.setEnabled(true); sk1.setEnabled(true); sk2.setEnabled(true); presetsSpinner.setEnabled(true); }
public void initSpinner(int position, View convertView) { Log.v(TAG, "[initSpinner]"); final int positionInt = position; int maxEa = cmsutil.str2int(hm.get("maxea[" + position + "]"), 0); int ea = cmsutil.str2int(hm.get("ea[" + positionInt + "]"), 0); final String eaText = "" + ea; String spinnerOptiona[]; spinnerOptiona = new String[maxEa + 1]; for (int i = 0; i <= maxEa; i++) { spinnerOptiona[i] = String.valueOf(i); } Spinner eaSpinner = (Spinner) convertView.findViewById(R.id.ea); if (maxEa <= 0) { spinnerOptiona = new String[1]; spinnerOptiona[0] = "0"; eaSpinner.setEnabled(false); } ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_item, spinnerOptiona); eaSpinner.setAdapter(adapter); eaSpinner.setSelection(adapter.getPosition(eaText)); eaSpinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapter, View v, int i, long lng) { if (!eaText.equals(adapter.getSelectedItem().toString())) { ((owllab) act.getApplication()).startLoading(act); Activity actNext = cmsutil.findAct(act, act.getPackageName() + ".mallCart"); if (actNext != null) { Intent intent = new Intent(act, actNext.getClass()); intent.putExtra("rowid", hm.get("rowid[" + positionInt + "]")); intent.putExtra("ea", cmsutil.str2int(adapter.getSelectedItem().toString(), 0)); intent.putExtra("mode", "edit"); act.startActivity(intent); } ((owllab) act.getApplication()).endLoading(); } } @Override public void onNothingSelected(AdapterView<?> arg0) {} }); }
private void disableFormFields() { if (mPropertiesMode == Mode.VIEW) { displayTextFieldAsReadOnly(mBeaconNameEditText); displayTextFieldAsReadOnly(mAdvertisedIdEditText); displayTextFieldAsReadOnly(mDescriptionEditText); displayTextFieldAsReadOnly(mLatitudeEditText); displayTextFieldAsReadOnly(mLongitudeEditText); displayTextFieldAsReadOnly(mPlaceIdEditText); mBeaconStatusSpinner.setEnabled(false); mBeaconTypeSpinner.setEnabled(false); mBeaconStabilitySpinner.setEnabled(false); mAdvertisedIdErrorMessage.setVisibility(View.GONE); mStatusErrorMessage.setVisibility(View.GONE); mLatitudeErrorMessage.setVisibility(View.GONE); mLongitudeErrorMessage.setVisibility(View.GONE); } if (mPropertiesMode == Mode.REGISTER) { mBeaconNameText.setVisibility(View.GONE); mBeaconNameEditText.setVisibility(View.GONE); } else if (mPropertiesMode == Mode.UPDATE) { displayTextFieldAsReadOnly(mBeaconNameEditText); displayTextFieldAsReadOnly(mAdvertisedIdEditText); } }
@Override public View getPrototypeView(Context context) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.brick_point_to, null); Spinner pointToSpinner = (Spinner) view.findViewById(R.id.brick_point_to_spinner); pointToSpinner.setFocusableInTouchMode(false); pointToSpinner.setFocusable(false); pointToSpinner.setEnabled(false); SpinnerAdapter pointToSpinnerAdapter = getArrayAdapterFromSpriteList(context); pointToSpinner.setAdapter(pointToSpinnerAdapter); setSpinnerSelection(pointToSpinner); return view; }
/** * Populates a {@code Spinner} with the values of an {@code enum} and binds it to the value set in * the mock service. */ private <T extends Enum<T>> void configureResponseSpinner( Spinner spinner, final Class<T> responseClass) { final EnumAdapter<T> adapter = new EnumAdapter<>(getContext(), responseClass); spinner.setEnabled(isMockMode); spinner.setAdapter(adapter); spinner.setSelection(mockGithubService.getResponse(responseClass).ordinal()); RxAdapterView.itemSelections(spinner) .map(adapter::getItem) .filter(item -> item != mockGithubService.getResponse(responseClass)) .subscribe( selected -> { Timber.d("Setting %s to %s", responseClass.getSimpleName(), selected); mockGithubService.setResponse(responseClass, selected); }); }