androidx.appcompat.widget.AppCompatSeekBar Java Examples
The following examples show how to use
androidx.appcompat.widget.AppCompatSeekBar.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AudioControlManager.java From onpc with GNU General Public License v3.0 | 6 votes |
private void updateVolumeGroup(@NonNull final State state, @NonNull final LinearLayout group) { final AppCompatSeekBar progressBar = group.findViewWithTag("tone_progress_bar"); final ReceiverInformationMsg.Zone zone = state.getActiveZoneInfo(); final int maxVolume = Math.min(getVolumeMax(state, zone), activity.getConfiguration().audioControl.getMasterVolumeMax()); updateProgressLabel(group, R.string.master_volume, State.getVolumeLevelStr(state.volumeLevel, zone)); final TextView minValue = group.findViewWithTag("tone_min_value"); minValue.setText("0"); final TextView maxValue = group.findViewWithTag("tone_max_value"); maxValue.setText(State.getVolumeLevelStr(maxVolume, zone)); progressBar.setMax(maxVolume); progressBar.setProgress(Math.max(0, state.volumeLevel)); }
Example #2
Source File: MonitorFragment.java From onpc with GNU General Public License v3.0 | 5 votes |
@Override public void onMasterVolumeMaxUpdate(@NonNull final State state) { // This callback is called if mater volume maximum is changed. // We shall re-scale master volume slider if it is visible for (View view : deviceSoundButtons) { if (view instanceof AppCompatSeekBar && audioControlManager.isVolumeLevel(view)) { updateVolumeLevel(view, state); } } }
Example #3
Source File: AudioControlManager.java From onpc with GNU General Public License v3.0 | 5 votes |
@SuppressLint("SetTextI18n") private void updateToneGroup(@NonNull final State state, @NonNull final String toneKey, @NonNull final LinearLayout group, @StringRes final int labelId, int toneLevel, final int noLevel, final int maxZone) { final AppCompatSeekBar progressBar = group.findViewWithTag("tone_progress_bar"); final ReceiverInformationMsg.ToneControl toneControl = state.getToneControl(toneKey, forceAudioControl); final boolean isTone = toneControl != null && toneLevel != noLevel && state.getActiveZone() < maxZone; group.setVisibility(isTone ? View.VISIBLE : View.GONE); if (isTone) { updateProgressLabel(group, labelId, Integer.toString(toneLevel)); final TextView minText = group.findViewWithTag("tone_min_value"); if (minText != null) { minText.setText(Integer.toString(toneControl.getMin())); } final TextView maxText = group.findViewWithTag("tone_max_value"); if (maxText != null) { maxText.setText(Integer.toString(toneControl.getMax())); } final float step = toneControl.getStep() == 0 ? 0.5f : toneControl.getStep(); final int max = (int) ((float) (toneControl.getMax() - toneControl.getMin()) / step); final int progress = (int) ((float) (toneLevel - toneControl.getMin()) / step); progressBar.setMax(max); progressBar.setProgress(progress); } }
Example #4
Source File: SettingsActivity.java From TwistyTimer with GNU General Public License v3.0 | 5 votes |
private MaterialDialog createAverageSeekDialog(@StringRes int prefKeyResID, int minValue, int maxValue, @IntegerRes int defaultValueRes) { final View dialogView = LayoutInflater.from( getActivity()).inflate(R.layout.dialog_settings_progress, null); final AppCompatSeekBar seekBar = dialogView.findViewById(R.id.seekbar); int defaultValue = getContext().getResources().getInteger(defaultValueRes); seekBar.setMax(maxValue); seekBar.setProgress(Prefs.getInt(prefKeyResID, defaultValue)); return ThemeUtils.roundDialog(mContext, new MaterialDialog.Builder(mContext) .customView(dialogView, true) .positiveText(R.string.action_done) .negativeText(R.string.action_cancel) .onPositive((dialog, which) -> { final int seekProgress = seekBar.getProgress(); Prefs.edit() .putInt(prefKeyResID, seekProgress > minValue ? seekProgress : minValue) .apply(); }) .neutralText(R.string.action_default) .onNeutral((dialog, which) -> Prefs.edit().putInt(prefKeyResID, defaultValue).apply()) .build()); }
Example #5
Source File: SeekBarPreference.java From MaxLock with GNU General Public License v3.0 | 5 votes |
private void initPreference(Context context, AttributeSet attrs) { setValuesFromXml(attrs); mSeekBar = new AppCompatSeekBar(context, attrs); mSeekBar.setPadding(0,0,0,0); mSeekBar.setMax(mMaxValue - mMinValue); mSeekBar.setOnSeekBarChangeListener(this); setWidgetLayoutResource(R.layout.seek_bar_preference); }
Example #6
Source File: AlgDialog.java From TwistyTimer with GNU General Public License v3.0 | 4 votes |
@Override public void onClick(View view) { final DatabaseHandler dbHandler = TwistyTimer.getDBHandler(); switch (view.getId()) { case R.id.editButton: MaterialDialog dialog = ThemeUtils.roundDialog(mContext, new MaterialDialog.Builder(mContext) .title(R.string.edit_algorithm) .input("", algorithm.getAlgs(), (dialog1, input) -> { algorithm.setAlgs(input.toString()); dbHandler.updateAlgorithmAlg(mId, input.toString()); algText.setText(input.toString()); updateList(); }) .inputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE) .positiveText(R.string.action_done) .negativeText(R.string.action_cancel) .build()); EditText editText = dialog.getInputEditText(); if (editText != null) { editText.setSingleLine(false); editText.setLines(5); editText.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION); editText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); } dialog.show(); break; case R.id.progressButton: final AppCompatSeekBar seekBar = (AppCompatSeekBar) LayoutInflater.from(mContext).inflate(R.layout.dialog_progress, null); seekBar.setProgress(algorithm.getProgress()); ThemeUtils.roundAndShowDialog(mContext, new MaterialDialog.Builder(mContext) .title(R.string.dialog_set_progress) .customView(seekBar, false) .positiveText(R.string.action_update) .negativeText(R.string.action_cancel) .onPositive((dialog12, which) -> { int seekProgress = seekBar.getProgress(); algorithm.setProgress(seekProgress); dbHandler.updateAlgorithmProgress(mId, seekProgress); progressBar.setProgress(seekProgress); updateList(); }) .build()); break; case R.id.revertButton: ThemeUtils.roundAndShowDialog(mContext, new MaterialDialog.Builder(mContext) .title(R.string.dialog_revert_title_confirmation) .content(R.string.dialog_revert_content_confirmation) .positiveText(R.string.action_reset) .negativeText(R.string.action_cancel) .onPositive((dialog13, which) -> { algorithm.setAlgs(AlgUtils.getDefaultAlgs(algorithm.getSubset(), algorithm.getName())); dbHandler.updateAlgorithmAlg(mId, algorithm.getAlgs()); algText.setText(algorithm.getAlgs()); }) .build()); break; } }
Example #7
Source File: QiscusBaseAudioMessageViewHolder.java From qiscus-sdk-android with Apache License 2.0 | 4 votes |
@NonNull protected abstract AppCompatSeekBar getSeekBar(View itemView);
Example #8
Source File: QiscusAudioViewHolder.java From qiscus-sdk-android with Apache License 2.0 | 4 votes |
@NonNull @Override protected AppCompatSeekBar getSeekBar(View itemView) { return (AppCompatSeekBar) itemView.findViewById(R.id.seekbar); }
Example #9
Source File: DynamicSeekBarPreference.java From dynamic-support with Apache License 2.0 | 2 votes |
/** * Get the seek bar to display and modify the preference value. * * @return The seek bar to display and modify the preference value. */ public AppCompatSeekBar getSeekBar() { return mSeekBar; }