android.widget.SeekBar Java Examples

The following examples show how to use android.widget.SeekBar. 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: WorldMapDialog.java    From SuntimesWidget with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
    if (t_prevProgress == -1) {
        t_prevProgress = seek_now;
    }

    if (fromUser)
    {
        long offset = progress - t_prevProgress;
        boolean speed_1d = WorldMapWidgetSettings.loadWorldMapPref(getContext(), 0, WorldMapWidgetSettings.PREF_KEY_WORLDMAP_SPEED1D, WorldMapWidgetSettings.MAPTAG_3x2);
        long scaledOffset = (speed_1d ? ((offset * ((SEEK_TOTALMINUTES_1d) / seek_totalMinutes)) / SEEK_STEPSIZE_1d) * SEEK_STEPSIZE_1d : offset);
        worldmap.setOffsetMinutes(worldmap.getOffsetMinutes() + scaledOffset);
        updateTimeText();
    }

    t_prevProgress = progress;
}
 
Example #2
Source File: X8AiReturnConfirmUi.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void initViews(View rootView) {
    this.imgReturn = rootView.findViewById(R.id.img_ai_follow_return);
    this.btnOk = rootView.findViewById(R.id.btn_ai_follow_confirm_ok);
    this.prex = rootView.getContext().getString(R.string.x8_ai_fly_return_home_tip);
    this.prex2 = rootView.getContext().getString(R.string.x8_ai_fly_return_home_tip2);
    this.tvCuurentHeight = (TextView) rootView.findViewById(R.id.tv_ai_follow_confirm_title1);
    this.tvHeight = (TextView) rootView.findViewById(R.id.tv_limit_height);
    this.rlMinus = rootView.findViewById(R.id.rl_minus);
    this.rlPlus = rootView.findViewById(R.id.rl_plus);
    this.mSeekBar = (SeekBar) rootView.findViewById(R.id.sb_value);
    this.mSeekBar.setMax(this.MAX);
    this.imgFlag = (ImageView) rootView.findViewById(R.id.img_ai_return_flag);
    AutoFcSportState state = StateManager.getInstance().getX8Drone().getFcSportState();
    if (state != null) {
        showSportState(state);
    }
}
 
Example #3
Source File: SeekBarPreference.java    From document-viewer with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected View onCreateDialogView() {
    final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View view = inflater.inflate(R.layout.pref_seek_dialog, null);

    try {
        currentValue = Integer.parseInt(getPersistedString(Integer.toString(defaultValue)));
    } catch (NumberFormatException ex) {
        currentValue = minValue;
    }

    ((TextView) view.findViewById(R.id.pref_seek_min_value)).setText(Integer.toString(minValue));
    ((TextView) view.findViewById(R.id.pref_seek_max_value)).setText(Integer.toString(maxValue));

    seekBar = (SeekBar) view.findViewById(R.id.pref_seek_bar);
    seekBar.setMax(maxValue - minValue);
    seekBar.setProgress(currentValue - minValue);
    seekBar.setKeyProgressIncrement(1);
    seekBar.setOnSeekBarChangeListener(this);

    text = (TextView) view.findViewById(R.id.pref_seek_current_value);
    text.setText(Integer.toString(currentValue));

    handler.init(new IViewContainer.ViewBridge(view), seekBar, R.id.pref_seek_bar_minus, R.id.pref_seek_bar_plus);
    return view;
}
 
Example #4
Source File: CarouselPopUpWindow.java    From ViewPagerLayoutManager with Apache License 2.0 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.sb_item_space:
            int itemSpace = progress * 5;
            carouselLayoutManager.setItemSpace(itemSpace);
            itemSpaceValue.setText(String.valueOf(itemSpace));
            break;
        case R.id.sb_min_scale:
            final float scale = progress / 100f;
            carouselLayoutManager.setMinScale(scale);
            minScaleValue.setText(Util.formatFloat(scale));
            break;
        case R.id.sb_speed:
            final float speed = progress * 0.05f;
            carouselLayoutManager.setMoveSpeed(speed);
            speedValue.setText(Util.formatFloat(speed));
            break;
    }
}
 
Example #5
Source File: ChromecastControllerFragment.java    From SkyTube with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.fragment_chromecast_controller, container);
	ButterKnife.bind(this, view);
	videoDescriptionLayout = new VideoDescriptionLayout();
	ButterKnife.bind(videoDescriptionLayout, videoDescriptionInclude);

	// Set the background color of the video description layout since by default it doesn't match the background color of the Chromecast controller
	TypedValue typedValue = new TypedValue();
	getContext().getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true);
	videoDescriptionLayout.linearLayout.setBackgroundResource(typedValue.resourceId);

	Linker.configure(videoDescriptionLayout.videoDescription);

	((SeekBar)chromecastPlaybackProgressBar).setOnSeekBarChangeListener(this);
	if(savedInstanceState != null) {
		setupDescription();
	}
	return view;
}
 
Example #6
Source File: SeekbarFragment.java    From My-MVP with Apache License 2.0 6 votes vote down vote up
private void subscribe() {
    mSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeAdapterListener(){
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            super.onProgressChanged(seekBar, progress, fromUser);
            if (fromUser) {
                mSeekbarViewModel.seekbarValue.setValue(progress);
            }
        }
    });

    mSeekbarViewModel.seekbarValue.observe(this, new Observer<Integer>() {
        @Override
        public void onChanged(@Nullable Integer integer) {
            if (integer != null) {
                mSeekBar.setProgress(integer);
            }
        }
    });
}
 
Example #7
Source File: FifthActivity.java    From TextPathView with MIT License 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (seekBar.getId() == R.id.sb_start) {
        start = progress;
        if (start > stop) {
            stop = start;
            sbStop.setProgress(stop);
        }
    } else {
        stop = progress;
        if (stop < start) {
            start = stop;
            sbStart.setProgress(start);
        }
    }

    float startF = start / 1000f;
    float stopF = stop / 1000f;
    atpv.drawPath(startF, stopF);
    stpv.drawPath(startF, stopF);
    spv.drawPath(startF, stopF);
    aspv.drawPath(startF, stopF);
}
 
Example #8
Source File: PolylineColorControlFragment.java    From android-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (polyline == null || !fromUser) {
        return;
    }

    if (seekBar == hueBar) {
        polyline.setColor(
            Color.HSVToColor(Color.alpha(polyline.getColor()), new float[] {progress, 1, 1}));
    } else if (seekBar == alphaBar) {
        float[] prevHSV = new float[3];
        Color.colorToHSV(polyline.getColor(), prevHSV);
        polyline.setColor(Color.HSVToColor(progress, prevHSV));
    }

    argbTextView.setText(String.format("0x%08X", polyline.getColor()));
}
 
Example #9
Source File: ColorStrokeDialogFragment.java    From geopaparazzi with GNU General Public License v3.0 6 votes vote down vote up
@Override
                public void onProgressChanged(SeekBar seekBar, int progress,
                                              boolean fromUser) {
                    if (progress == 0) progress = 1;
                    mCurrentColorStrokeObject.strokeWidth = progress;

                    int tmpColor = Color.BLACK;
//                    if (mCurrentColorStrokeObject.hasStroke)
//                        tmpColor = mCurrentColorStrokeObject.strokeColor;
                    // configure a Paint object for the current SeekBar value
                    Paint p = new Paint();
                    p.setColor(tmpColor);
                    p.setStrokeCap(Paint.Cap.ROUND);
                    p.setStrokeWidth(progress);

                    // erase the bitmap and redraw the line
                    bitmap.eraseColor(Compat.getColor(getContext(), android.R.color.transparent));
                    canvas.drawLine(30, 50, 370, 50, p);
                    mWidthImageView.setImageBitmap(bitmap);
                    mWidthTextView.setText(String.valueOf(progress));
                }
 
Example #10
Source File: SeekBarPreference.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (!fromUser) return;

    progress = Math.round(((float) progress) / mInterval) * mInterval + mMinimum;
    if (mTracking) {
        setMonitorBoxText(progress);
    } else {
        setValue(progress);
    }
}
 
Example #11
Source File: CustomVideoView.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (fromUser) {
        LogUtil.i(TAG, "onProgressChanged:" + this.isUpdateProgressed);
        this.isUpdateProgressed = true;
        this.showTopBottomBarTime = 0;
        this.mCurrentTimeTv.setText(setTimeFormatter(seekBar.getProgress()));
    }
}
 
Example #12
Source File: SeekBarPreference.java    From DesignOverlay-Android with Apache License 2.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    mTrackingTouch = false;
    if (seekBar.getProgress() != mProgress) {
        syncProgress(seekBar);
    }
}
 
Example #13
Source File: FlatPlayerPlaybackControlsFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
private void setUpProgressSlider() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    progressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    progressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);

    progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                MusicPlayerRemote.seekTo(progress);
                onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(), MusicPlayerRemote.getSongDurationMillis());
            }
        }
    });
}
 
Example #14
Source File: PlayerActivity.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
    if (mPlayer != null) {
        mHandler.removeMessages(MSG_UPDATE_PROGRESS);
    }
    LogUtils.d("onStartTrackingTouch progress="+mProgressView.getProgress());
}
 
Example #15
Source File: PlayerControlFragment.java    From android-openslmediaplayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    switch (seekBar.getId()) {
        case R.id.seekbar_player_position:
            controlPeriodicSeekBarUpdating();
            break;
    }
}
 
Example #16
Source File: VideoControllerView.java    From fullscreen-video-view with Apache License 2.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    setIsDragging(false);
    setProgress();
    updatePausePlay();
    show(DEFAULT_CONTROLLER_TIMEOUT);

    // Ensure that progress is properly updated in the future,
    // the call to show() does not guarantee this because it is a
    // no-op if we are already showing.
    refreshProgress();
}
 
Example #17
Source File: ControllerView.java    From ParsingPlayer with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void initView() {
    mPauseButton = (ImageButton) findViewById(R.id.pause);
    mProgress = (SeekBar) findViewById(R.id.mediacontroller_progress);
    mEndTime = (TextView) findViewById(R.id.time);
    mCurrentTime = (TextView) findViewById(R.id.time_current);
    mFullscreenButton = (ImageButton) findViewById(R.id.fullscreen);
    mPauseButton.requestFocus();
    mPauseButton.setOnClickListener(mPauseListener);
    mProgress.setOnSeekBarChangeListener(mSeekListener);
    mProgress.setMax(1000);
}
 
Example #18
Source File: SimpleMediaController.java    From ShareBox with Apache License 2.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar bar) {
    mDragging = false;
    mPlayer.seekTo((int) position);
    setProgress();
    updatePausePlay();
    show(sDefaultTimeout);

    // Ensure that progress is properly updated in the future,
    // the call to show() does not guarantee this because it is a
    // no-op if we are already showing.
    mHandler.sendEmptyMessage(SHOW_PROGRESS);
}
 
Example #19
Source File: AudioView.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public synchronized void onStartTrackingTouch(SeekBar seekBar) {
  wasPlaying = isPlaying;
  if (audioSlidePlayer != null && isPlaying) {
    audioSlidePlayer.stop();
  }
}
 
Example #20
Source File: ExVpCompleteFragment.java    From ExVidPlayer with Apache License 2.0 5 votes vote down vote up
private void initViews() {
  progressBar = (ProgressBar) mView.findViewById(R.id.pbar);
  surfaceView = (SurfaceView) mView.findViewById(R.id.surface_view);
  //controls
  root = (LinearLayout) mView.findViewById(R.id.root);
  ivLock = (ImageButton) mView.findViewById(R.id.btn_lock);
  ivRev = (ImageButton) mView.findViewById(R.id.btn_rev);
  ivForword = (ImageButton) mView.findViewById(R.id.btn_fwd);
  ivNext = (ImageButton) mView.findViewById(R.id.btn_next);
  ivPrev = (ImageButton) mView.findViewById(R.id.btn_prev);
  ivPlayPause = (ImageButton) mView.findViewById(R.id.btn_pause);
  ivSetting = (ImageButton) mView.findViewById(R.id.btn_settings);
  mProgress = (SeekBar) mView.findViewById(R.id.seekbar);
  tvCurrent = (TextView) mView.findViewById(R.id.txt_currentTime);
  tvTotal = (TextView) mView.findViewById(R.id.txt_totalDuration);
  prgCenterText = (LinearLayout) mView.findViewById(R.id.seekbar_center_text);
  tvCenterCurrent = (TextView) mView.findViewById(R.id.txt_seek_currTime);
  tvCenterProg = (TextView) mView.findViewById(R.id.txt_seek_secs);
  //brightness
  brightnessSlider = (LinearLayout) getView(R.id.brightness_slider_container);
  ivBrightness = (ImageView) getView(R.id.brightness_image);
  ivBrightnessImage = (ImageView) getView(R.id.brightnessIcon);
  pBarBrighness = (ProgressBar) getView(R.id.brightness_slider);
  tvBrightnessPercent = (TextView) getView(R.id.brigtness_perc_center_text);
  brightnessCenterText = (LinearLayout) getView(R.id.brightness_center_text);
  //volume
  volumeSlider = (LinearLayout) getView(R.id.volume_slider_container);
  ivVolume = (ImageView) getView(R.id.vol_image);
  ivVolumeImage = (ImageView) getView(R.id.volIcon);
  pBarVolume = (VolBar) getView(R.id.volume_slider);
  tvVolumePercent = (TextView) getView(R.id.vol_perc_center_text);
  volumeCenterText = (LinearLayout) getView(R.id.vol_center_text);

  aspectRatioFrameLayout=(AspectRatioFrameLayout)getView(R.id.video_frame);
}
 
Example #21
Source File: ControllerView.java    From ParsingPlayer with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (!fromUser) {
        // We're not interested in programmatically generated changes to
        // the progress bar's position.
        return;
    }

    long duration = mPlayer.getDuration();
    long newPosition = (duration * progress) / 1000L;
    mPlayer.seekTo((int) newPosition);
    if (mCurrentTime != null)
        mCurrentTime.setText(Util.stringForTime((int) newPosition));
}
 
Example #22
Source File: PhotoOverlayActivity.java    From Chimee with MIT License 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (selectedView.getId()) {
        case R.id.fl_photo_overlay_border:
            updateStrokeWidthFromProgress(progress);
            break;
        case R.id.fl_photo_overlay_shadow:
            updateShadowXyFromProgress(progress);
            break;
        case R.id.fl_photo_overlay_background:
            updatePaddingFromProgress(progress);
            break;
    }

}
 
Example #23
Source File: SampleFragment.java    From preferencebinder with Apache License 2.0 5 votes vote down vote up
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.activity_main, container, false);
    booleanPreferenceDisplay = (CheckBox) view.findViewById(R.id.pref_boolean);
    integerPreferenceDisplay = (SeekBar) view.findViewById(R.id.pref_integer);
    PreferenceBinder.bind(this);

    startHandlerOnBackgroundThread();
    return view;
}
 
Example #24
Source File: PlaybackToolbar.java    From media-for-mobile with Apache License 2.0 5 votes vote down vote up
private void bindControls()
{
	mPlayButton = (ImageButton) findViewById(R.id.playButton);		
	mPlayButton.setOnClickListener(this);
	
	mPauseButton = (ImageButton) findViewById(R.id.pauseButton);		
	mPauseButton.setOnClickListener(this);

	mPlayTimeText = (TextView)findViewById(R.id.playTimeText);
	
	mPlayProgress = (SeekBar)findViewById(R.id.playProgress);
	mPlayProgress.setOnSeekBarChangeListener(this);
}
 
Example #25
Source File: SeekBarPreference.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(prefValueToSeekBarProgress(mMax));
    seekBar.setProgress(prefValueToSeekBarProgress(mValue));
    seekBar.setEnabled(isEnabled());
    mSummaryView = (TextView) view.findViewById(R.id.seekbar_amount);
    mSummaryView.setText(mSummary);
}
 
Example #26
Source File: LightAndVolumeController.java    From XposedNavigationBar with GNU General Public License v3.0 5 votes vote down vote up
private ViewGroup getPanel(Context context, int type) {
    final ViewGroup mViewGroup = new LinearLayout(context);
    LinearLayout.LayoutParams btnParam =
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    //   btnParam.weight = 1;
    btnParam.gravity = Gravity.CENTER_VERTICAL;
    LinearLayout.LayoutParams seekBarParam =
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    seekBarParam.weight = 1;
    seekBarParam.gravity = Gravity.CENTER;

    ImageButton btnBack = new ImageButton(context);
    btnBack.setImageBitmap(backBitmap);
    btnBack.setScaleType(ImageView.ScaleType.FIT_CENTER);
    btnBack.setBackgroundColor(Color.alpha(255));

    SeekBar seekBar = getSeekBar(context, type);

    ImageButton btnFunc = new ImageButton(context);
    btnFunc.setImageBitmap(funcBitmap);
    btnFunc.setScaleType(ImageView.ScaleType.FIT_CENTER);
    btnFunc.setBackgroundColor(Color.alpha(255));

    mViewGroup.addView(btnBack, btnParam);
    mViewGroup.addView(seekBar, seekBarParam);
    mViewGroup.addView(btnFunc, btnParam);

    final WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    mViewGroup.setBackgroundColor(Color.BLACK);
    btnBack.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            wm.removeView(mViewGroup);
        }
    });

    return mViewGroup;
}
 
Example #27
Source File: NowPlayingBottomBarFragment.java    From Rey-MusicPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (mApp.isServiceRunning()) {
        try {
            long currentSongDuration = mApp.getService().getMediaPlayer().getDuration();
            seekBar.setMax((int) currentSongDuration);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #28
Source File: AndroidControllerView.java    From no-player with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    LayoutInflater.from(getContext()).inflate(R.layout.merge_player_controls, this, true);

    playPauseButton = (ImageView) findViewById(R.id.player_controls_play_pause);
    elapsedTimeView = (TextView) findViewById(R.id.player_controls_elapsed_time);
    progressView = (SeekBar) findViewById(R.id.player_controls_progress);
    timeRemainingView = (TextView) findViewById(R.id.player_controls_time_remaining);
    volumeOnOffView = findViewById(R.id.player_controls_volume_on_off);
}
 
Example #29
Source File: SeekBarBindingAdapterUtils.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
@InverseBindingAdapter(attribute = "progressString")
public static String getProgressString(SeekBar view) {
    return "" + view.getProgress();
}
 
Example #30
Source File: GroundOverlayDemoActivity.java    From android-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}