当前位置: 首页>>代码示例>>Java>>正文


Java DiscreteSeekBar.setProgress方法代码示例

本文整理汇总了Java中org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.setProgress方法的典型用法代码示例。如果您正苦于以下问题:Java DiscreteSeekBar.setProgress方法的具体用法?Java DiscreteSeekBar.setProgress怎么用?Java DiscreteSeekBar.setProgress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.adw.library.widgets.discreteseekbar.DiscreteSeekBar的用法示例。


在下文中一共展示了DiscreteSeekBar.setProgress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindToModel

import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
@BindingAdapter("model")
public static void bindToModel(DiscreteSeekBar seekBar, final SeekBarModel model) {
    DiscreteSeekBar.NumericTransformer transformer = seekBar.getNumericTransformer();

    if (!(transformer instanceof NumericTransformer)) {
        transformer = new NumericTransformer();
        seekBar.setNumericTransformer(transformer);
    }

    final NumericTransformer customTransformer = (NumericTransformer) transformer;
    customTransformer.setValues(model.getMinValue(), model.getMaxValue());

    seekBar.setMin(0);
    seekBar.setMax(100);

    final int percentage = (int) customTransformer.transformToPercentage(model.getValue().get());
    // Bug in the library
    seekBar.setProgress(1);
    seekBar.setProgress(percentage);

    seekBar.setOnProgressChangeListener(
            SimpleOnProgressChangeListener.forStopTrackingTouch(seekBar1 -> {
                model.getValue().set(customTransformer.transformFromPercentage(seekBar.getProgress()));
            }));
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:26,代码来源:BindingAdapters.java

示例2: onBindView

import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
public void onBindView(@NonNull View view) {

        mSeekBar = (DiscreteSeekBar) view.findViewById(com.pavelsikun.seekbarpreference.R.id.seekbar);

        mSeekBar.setMin(mMinValue);
        mSeekBar.setMax(mMaxValue);
        mSeekBar.setOnProgressChangeListener(this);

        mSeekBarValue = (EditText) view.findViewById(com.pavelsikun.seekbarpreference.R.id.seekbar_value);
        mSeekBarValue.setText(String.valueOf(mCurrentValue));
        mSeekBarValue.addTextChangedListener(this);
        setValueTextSize(mValueTextSize);
        setMaxTextLength();

        mMeasurementUnitView = (TextView) view.findViewById(com.pavelsikun.seekbarpreference.R.id.measurement_unit);
        mMeasurementUnitView.setText(mMeasurementUnit);

        // Don't move this line
        mSeekBar.setProgress(mCurrentValue);

        if (!view.isEnabled()) {
            mSeekBar.setEnabled(false);
            mSeekBarValue.setEnabled(false);
        }

        mTitleTxt = (TextView) view.findViewById(android.R.id.title);
        mSummaryTxt = (TextView) view.findViewById(android.R.id.summary);

        if(mTitle != null || mSummary != null) {
            if(mTitle != null) mTitleTxt.setText(mTitle);
            if(mSummary != null) mSummaryTxt.setText(mSummary);
        }
    }
 
开发者ID:dmytroKarataiev,项目名称:EarthquakeSurvival,代码行数:34,代码来源:MaterialSeekBarController.java

示例3: configureSettings

import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
@Override
public void configureSettings(int id, DiscreteSeekBar seekBar) {
    Effects.Settings settings = getEffectForId(id).mSettings;
    seekBar.setMax(settings.mMax);
    seekBar.setMin(settings.mMin);
    seekBar.setProgress(General.Effects.getEffectSettings(getActivity(), id, settings.mDef));
}
 
开发者ID:jruesga,项目名称:PhotoPhase,代码行数:8,代码来源:LiveEffectsPreviewFragment.java

示例4: syncProgress

import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
/**
 * Persist the seekBar's progress value if callChangeListener
 *
 * returns boolean True, otherwise set the seekBar's progress to the stored value
 */
@SuppressWarnings("boxing")
private void syncProgress(DiscreteSeekBar seekBar) {
    int progress = seekBar.getProgress();
    if (progress != mProgress) {
        if (callChangeListener(progress)) {
            setProgress(progress, false);
        } else {
            seekBar.setProgress(mProgress);
        }
    }
}
 
开发者ID:jruesga,项目名称:PhotoPhase,代码行数:17,代码来源:DiscreteSeekBarPreference.java

示例5: onProgressChanged

import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int progress, boolean fromUser) {
    // find out which SeekBar triggered the event so we can retrieve its saved current
    // progress
    int which = whichIsIt(seekBar.getId());
    // the stored progress for this SeekBar
    int storedProgress = mAllProgress[which];
    // we basically have two cases, the user either goes to the left or to
    // the right with the thumb. If he goes to the right we must check to
    // see how much he's allowed to go in that direction(based on the other
    // SeekBar values) and stop him if he the available progress was used. If
    // he goes to the left use that progress as going back
    // and freeing the track isn't a problem.
    if (progress > storedProgress) {
        // how much is currently available based on all SeekBar progress
        int remaining = remaining();
        // if there's no progress remaining then simply set the progress at
        // the stored progress(so the user can't move the thumb further)
        if (remaining == 0) {
            seekBar.setProgress(storedProgress);
            return;
        } else {
            // we still have some progress available so check that available
            // progress and let the user move the thumb as long as the
            // progress is at most as the sum between the stored progress
            // and the maximum still available progress
            if (storedProgress + remaining >= progress) {
                mAllProgress[which] = progress;
            } else {
                // the current progress is bigger then the available
                // progress so restrict the value
                mAllProgress[which] = storedProgress + remaining;
            }
        }
    } else if (progress <= storedProgress) {
        // the user goes left so simply save the new progress(space will be
        // available to other SeekBars)
        mAllProgress[which] = progress;
    }
    Log.d("Switches", String.valueOf(mAllProgress));
}
 
开发者ID:fllodrab,项目名称:MeasureAppS,代码行数:42,代码来源:Parameters.java


注:本文中的org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.setProgress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。