private void setupUIElements() { setBadgeDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.banner_shadow)); setHeadersState(HEADERS_ENABLED); setHeadersTransitionOnBackEnabled(true); setBrandColor(ContextCompat.getColor(getActivity(), R.color.primary)); setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.accent)); setHeaderPresenterSelector( new PresenterSelector() { @Override public Presenter getPresenter(Object o) { return new IconHeaderItemPresenter(); } }); boolean shouldAutoLoop = mPreferencesHelper.getShouldAutoLoop(); String optionValue = shouldAutoLoop ? getString(R.string.text_auto_loop_enabled) : getString(R.string.text_auto_loop_disabled); mAutoLoopOption = new Option(getString(R.string.text_auto_loop_title), optionValue, R.drawable.lopp); HeaderItem gridHeader = new HeaderItem(mRowsAdapter.size(), getString(R.string.header_text_options)); mOptionsAdapter = new OptionsAdapter(getActivity()); mOptionsAdapter.addOption(mAutoLoopOption); mRowsAdapter.add(new ListRow(gridHeader, mOptionsAdapter)); }
@Subscribe public void onAutoLoopUpdated(BusEvent.AutoLoopUpdated event) { boolean isEnabled = mPreferencesHelper.getShouldAutoLoop(); mAutoLoopOption.value = isEnabled ? getString(R.string.text_auto_loop_enabled) : getString(R.string.text_auto_loop_disabled); mOptionsAdapter.updateOption(mAutoLoopOption); }