Java Code Examples for android.widget.SeekBar#OnSeekBarChangeListener

The following examples show how to use android.widget.SeekBar#OnSeekBarChangeListener . 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: PercentTraitLayout.java    From Field-Book with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    // Progress bar
    seekBar = findViewById(R.id.seekbar);
    seekBar.setMax(100);

    seekListener = new SeekBar.OnSeekBarChangeListener() {

        public void onProgressChanged(SeekBar sb, int progress, boolean arg2) {
            if (sb.getProgress() < Integer.parseInt(getCurrentTrait().getMinimum()))
                sb.setProgress(Integer.parseInt(getCurrentTrait().getMinimum()));

            setCurrentValueText(sb.getProgress(), Color.parseColor(getDisplayColor()));
        }

        public void onStartTrackingTouch(SeekBar arg0) {
        }

        public void onStopTrackingTouch(SeekBar arg0) {
            updateTrait(getCurrentTrait().getTrait(), "percent", String.valueOf(seekBar.getProgress()));
        }
    };

    seekBar.setOnSeekBarChangeListener(seekListener);
}
 
Example 2
Source File: SeekbarSetting.java    From GreatFit with MIT License 5 votes vote down vote up
public SeekbarSetting(Drawable icon, String title,  String subtitle, SeekBar.OnSeekBarChangeListener onChangeListener, Integer current, Integer max) {
    this.onChangeListener = onChangeListener;
    this.title = title;
    this.subtitle = (subtitle==null)?"Current: "+current+" (Max: "+max+")":subtitle;
    this.icon = icon;
    this.current = current;
    this.max = max;
}
 
Example 3
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa, SeekBar.OnSeekBarChangeListener seekBarChangeListener) {
    this.title = title;
    this.desc = desc;
    this.color = color;
    this.unit = unit;
    this.prop = prop;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.fa = fa;
    this.listener = seekBarChangeListener;
}
 
Example 4
Source File: CommonItemSeekBar.java    From AndroidUtilCode with Apache License 2.0 5 votes vote down vote up
public CommonItemSeekBar(@NonNull CharSequence title, int maxProgress, int curProgress, @NonNull SeekBar.OnSeekBarChangeListener itemClickListener) {
    super(R.layout.common_item_title_seekbar);
    mTitle = title;
    mMaxProgress = maxProgress;
    mCurProgress = curProgress;
    mOnSeekBarChangeListener = itemClickListener;
    mContent = String.valueOf(mCurProgress);
}
 
Example 5
Source File: VideoControlViewTest.java    From twitter-kit-android with Apache License 2.0 5 votes vote down vote up
public void testCreateProgressChangeListener() {
    final VideoControlView.MediaPlayerControl player =
            mock(VideoControlView.MediaPlayerControl.class);
    videoControlView.setMediaPlayer(player);

    final SeekBar.OnSeekBarChangeListener listener =
            videoControlView.createProgressChangeListener();

    when(player.getDuration()).thenReturn(MINUTE_IN_MS);
    listener.onProgressChanged(null, 500, true);
    verify(player).seekTo(30000);
    assertEquals("0:30", videoControlView.currentTime.getText());
}
 
Example 6
Source File: VideoControlViewTest.java    From twitter-kit-android with Apache License 2.0 5 votes vote down vote up
public void testCreateProgressChangeListener_fromUserFalse() {
    final VideoControlView.MediaPlayerControl player =
            mock(VideoControlView.MediaPlayerControl.class);
    videoControlView.setMediaPlayer(player);

    final SeekBar.OnSeekBarChangeListener listener =
            videoControlView.createProgressChangeListener();

    when(player.getDuration()).thenReturn(MINUTE_IN_MS);
    listener.onProgressChanged(null, 500, false);
    verifyNoMoreInteractions(player);
}
 
Example 7
Source File: CardSeekBarGeneric.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public CardSeekBarGeneric(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa, SeekBar.OnSeekBarChangeListener listener) {
    super(title, desc, color, unit, prop, seekBarMax, seekBarProgress, fa, listener);
}
 
Example 8
Source File: VoicePlayerView.java    From ChatVoicePlayer with MIT License 4 votes vote down vote up
public SeekBar.OnSeekBarChangeListener getSeekBarListener() {
    return seekBarListener;
}
 
Example 9
Source File: AbstractCard.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public void setListener(SeekBar.OnSeekBarChangeListener listener) {
    this.listener = listener;
}
 
Example 10
Source File: AbstractCard.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public SeekBar.OnSeekBarChangeListener getListener() {
    return listener;
}
 
Example 11
Source File: StaticBlurFragment.java    From BlurTestAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_staticblur, container, false);

    imageViewNormal = v.findViewById(R.id.normal_image);
    imageViewBlur = v.findViewById(R.id.blur_image);
    settingsController = new SettingsController(v, new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            reBlur();
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    }, new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            blurTemplate = null;
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            reBlur();
        }
    }, new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            reBlur();
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    }, new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            blurTemplate = null;
            startBlur();
        }
    });

    Bitmap originalBitmap = ((BitmapDrawable) imageViewNormal.getDrawable()).getBitmap();
    ((TextView) v.findViewById(R.id.tv_resolution_normal)).setText("Original: " + originalBitmap.getWidth() + "x" + originalBitmap.getHeight() + " / " + BenchmarkUtil.getScalingUnitByteSize(BitmapUtil.sizeOf(originalBitmap)));

    TranslucentLayoutUtil.setTranslucentThemeInsets(getActivity(), v.findViewById(R.id.contentWrapper));
    return v;
}
 
Example 12
Source File: CardSeekBarSysctl.java    From Pimp_my_Z1 with GNU General Public License v2.0 4 votes vote down vote up
public CardSeekBarSysctl(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa, SeekBar.OnSeekBarChangeListener listener) {
    super(title, desc, color, unit, prop, seekBarMax, seekBarProgress, fa, listener);
}
 
Example 13
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void onSeekBarChange(SeekBar.OnSeekBarChangeListener arg) {
  return BaseDSL.attr("onSeekBarChange", arg);
}
 
Example 14
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void onSeekBarChange(SeekBar.OnSeekBarChangeListener arg) {
  return BaseDSL.attr("onSeekBarChange", arg);
}
 
Example 15
Source File: CommonItemSeekBar.java    From AndroidUtilCode with Apache License 2.0 4 votes vote down vote up
public CommonItemSeekBar(@StringRes int title, int maxProgress, int curProgress, @NonNull SeekBar.OnSeekBarChangeListener itemClickListener) {
    this(StringUtils.getString(title), maxProgress, curProgress, itemClickListener);
}
 
Example 16
Source File: BottomBarView.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
public void setSeekCallBack(SeekBar.OnSeekBarChangeListener seekCallBack){
    mDanmakuPlayerSeek.setOnSeekBarChangeListener(seekCallBack);
}
 
Example 17
Source File: VoicePlayerView.java    From ChatVoicePlayer with MIT License 4 votes vote down vote up
public void setSeekBarListener(SeekBar.OnSeekBarChangeListener seekBarListener) {
    this.seekBarListener = seekBarListener;
}
 
Example 18
Source File: DynamicSeekBarPreference.java    From dynamic-support with Apache License 2.0 2 votes vote down vote up
/**
 * Set the seek bar change listener to get the callback for control events.
 *
 * @param onSeekBarControlListener The listener to be set.
 */
public void setOnSeekBarControlListener(
        @Nullable SeekBar.OnSeekBarChangeListener onSeekBarControlListener) {
    this.mOnSeekBarControlListener= onSeekBarControlListener;
}
 
Example 19
Source File: DynamicSeekBarPreference.java    From dynamic-support with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the seek bar change listener to get the callback for control events.
 *
 * @return The seek bar change listener to get the callback for control events.
 */
public @Nullable SeekBar.OnSeekBarChangeListener getOnSeekBarControlListener() {
    return mOnSeekBarControlListener;
}
 
Example 20
Source File: DynamicSeekBarPreference.java    From dynamic-support with Apache License 2.0 2 votes vote down vote up
/**
 * Set the seek bar change listener to get the callback for seek events.
 *
 * @param onSeekBarChangeListener The listener to be set.
 */
public void setOnSeekBarChangeListener(
        @Nullable SeekBar.OnSeekBarChangeListener onSeekBarChangeListener) {
    this.mOnSeekBarChangeListener = onSeekBarChangeListener;
}