android.widget.SeekBar.getMax()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(257)

本文整理了Java中android.widget.SeekBar.getMax()方法的一些代码示例,展示了SeekBar.getMax()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SeekBar.getMax()方法的具体详情如下:
包路径:android.widget.SeekBar
类名称:SeekBar
方法名:getMax

SeekBar.getMax介绍

暂无

代码示例

代码示例来源:origin: jiajunhui/PlayerBase

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  if(fromUser)
    updateUI(progress, seekBar.getMax());
}
@Override

代码示例来源:origin: jiajunhui/PlayerBase

@Override
public void onTimerUpdate(int curr, int duration, int bufferPercentage) {
  if(!mTimerUpdateProgressEnable)
    return;
  if(mTimeFormat==null || duration != mSeekBar.getMax()){
    mTimeFormat = TimeUtil.getFormat(duration);
  }
  mBufferPercentage = bufferPercentage;
  updateUI(curr, duration);
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) {
  if (!isPrepared()) return;
  if (duration != playbackSeekBar.getMax()) {
    playbackEndTime.setText(getTimeString(duration));
    playbackSeekBar.setMax(duration);
  }
  if (currentState != STATE_PAUSED) {
    if (currentState != STATE_PAUSED_SEEK) playbackSeekBar.setProgress(currentProgress);
    playbackCurrentTime.setText(getTimeString(currentProgress));
  }
  if (simpleExoPlayer.isLoading() || bufferPercent > 90) {
    playbackSeekBar.setSecondaryProgress((int) (playbackSeekBar.getMax() * ((float) bufferPercent / 100)));
  }
  if (DEBUG && bufferPercent % 20 == 0) { //Limit log
    Log.d(TAG, "updateProgress() called with: isVisible = " + isControlsVisible() + ", currentProgress = [" + currentProgress + "], duration = [" + duration + "], bufferPercent = [" + bufferPercent + "]");
  }
  playbackLiveSync.setClickable(!isLiveEdge());
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

@Override
  public void run() {
    if (mCurrentState != CURRENT_STATE_NORMAL && mCurrentState != CURRENT_STATE_PREPAREING) {
      if (percent != 0) {
        setTextAndProgress(percent);
        mBufferPoint = percent;
        Debuger.printfLog("Net speed: " + getNetSpeedText() + " percent " + percent);
      }
      if (mProgressBar == null) {
        return;
      }
      //循环清除进度
      if (mLooping && mHadPlay && percent == 0 && mProgressBar.getProgress() >= (mProgressBar.getMax() - 1)) {
        loopSetProgressAndTime();
      }
    }
  }
});

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onProgressUpdate(int currentProgress, int duration, int bufferPercent) {
  // Set buffer progress
  progressSeekBar.setSecondaryProgress((int) (progressSeekBar.getMax() * ((float) bufferPercent / 100)));
  // Set Duration
  progressSeekBar.setMax(duration);
  progressEndTime.setText(Localization.getDurationString(duration / 1000));
  // Set current time if not seeking
  if (!seeking) {
    progressSeekBar.setProgress(currentProgress);
    progressCurrentTime.setText(Localization.getDurationString(currentProgress / 1000));
  }
  if (player != null) {
    progressLiveSync.setClickable(!player.isLiveEdge());
  }
  // this will make shure progressCurrentTime has the same width as progressEndTime
  final ViewGroup.LayoutParams endTimeParams = progressEndTime.getLayoutParams();
  final ViewGroup.LayoutParams currentTimeParams = progressCurrentTime.getLayoutParams();
  currentTimeParams.width = progressEndTime.getWidth();
  progressCurrentTime.setLayoutParams(currentTimeParams);
}

代码示例来源:origin: renaudcerrato/ToggleDrawable

public ToggleAnimationSet(boolean isFaded) {
  mAlphaStart = (int) (mSeekBar.getProgress() * 1f / mSeekBar.getMax() * 128);
  mAlphaRemaining = isFaded ? 128 - mAlphaStart : -mAlphaStart;
  mProgressStart = mSeekBar.getProgress();
  mProgressRemaining = isFaded ? mSeekBar.getMax() - mProgressStart : -mProgressStart;
}

代码示例来源:origin: brianwernick/ExoMedia

@Override
public void setDuration(@IntRange(from = 0) long duration) {
  if (duration != seekBar.getMax()) {
    endTimeTextView.setText(TimeFormatUtil.formatMs(duration));
    seekBar.setMax((int) duration);
  }
}

代码示例来源:origin: renaudcerrato/ToggleDrawable

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  for(ToggleDrawable drawable : mToggleDrawables)
    drawable.setProgress(progress / (float) seekBar.getMax());
}

代码示例来源:origin: brianwernick/ExoMedia

@Override
public void updateProgress(@IntRange(from = 0) long position, @IntRange(from = 0) long duration, @IntRange(from = 0, to = 100) int bufferPercent) {
  if (!userInteracting) {
    seekBar.setSecondaryProgress((int) (seekBar.getMax() * ((float)bufferPercent / 100)));
    seekBar.setProgress((int) position);
    updateCurrentTime(position);
  }
}

代码示例来源:origin: dkim0419/SoundRecorder

private void stopPlaying() {
  mPlayButton.setImageResource(R.drawable.ic_media_play);
  mHandler.removeCallbacks(mRunnable);
  mMediaPlayer.stop();
  mMediaPlayer.reset();
  mMediaPlayer.release();
  mMediaPlayer = null;
  mSeekBar.setProgress(mSeekBar.getMax());
  isPlaying = !isPlaying;
  mCurrentProgressTextView.setText(mFileLengthTextView.getText());
  mSeekBar.setProgress(mSeekBar.getMax());
  //allow the screen to turn off again once audio is finished playing
  getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}

代码示例来源:origin: renaudcerrato/ToggleDrawable

private void toggle() {
  isFaded = !isFaded;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    AnimatorSet set = new AnimatorSet();
    ObjectAnimator backgroundAnim = ObjectAnimator.ofInt(mContainer.getBackground(), "alpha", isFaded ? 128 : 0);
    ObjectAnimator drawableAnim = ObjectAnimator.ofInt(mSeekBar, "progress", isFaded ? mSeekBar.getMax() : 0);
    set.setDuration(700);
    set.setInterpolator(new DecelerateInterpolator(3f));
    set.playTogether(backgroundAnim, drawableAnim);
    set.start();
  } else {
    Animation set = new ToggleAnimationSet(isFaded);
    set.setDuration(700);
    set.setInterpolator(new DecelerateInterpolator(3f));
    mContainer.startAnimation(set);
  }
}

代码示例来源:origin: stackoverflow.com

final SeekBar seekBar = findViewById(R.id.seekBar);
ValueAnimator anim = ValueAnimator.ofInt(0,seekBar.getMax());
anim.setDuration(1000);
anim.addUpdateListener(new AnimatorUpdateListener() {

    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      int animProgress = (Integer) animation.getAnimatedValue();
      seekBar.setProgress(animProgress);
    }
  });

代码示例来源:origin: google-ar/sceneform-android-sdk

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
 float ratio = (float) progress / (float) rotationSpeedBar.getMax();
 solarSettings.setRotationSpeedMultiplier(ratio * 10.0f);
}

代码示例来源:origin: wallabag/android-app

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  if (fromUser) {
    audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, 0);
    textViewTTSVolume.setText(percentFormat.format((1.0 * progress) / seekBar.getMax()));
  }
}

代码示例来源:origin: wallabag/android-app

private void updateVolumeDisplay() {
  if (seekBarTTSVolume != null && textViewTTSVolume != null && audioManager != null) {
    int progress = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
    seekBarTTSVolume.setProgress(progress);
    textViewTTSVolume.setText(percentFormat.format((1.0 * progress) / seekBarTTSVolume.getMax()));
  }
}

代码示例来源:origin: google-ar/sceneform-android-sdk

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
 float ratio = (float) progress / (float) orbitSpeedBar.getMax();
 solarSettings.setOrbitSpeedMultiplier(ratio * 10.0f);
}

代码示例来源:origin: alexjlockwood/kyrie

@Override
 public void onAnimationUpdate(@NonNull KyrieDrawable drawable) {
  final float playTime = drawable.getCurrentPlayTime();
  final float totalDuration = drawable.getTotalDuration();
  final float fraction = playTime / totalDuration;
  seekBar.setProgress(Math.round(fraction * seekBar.getMax()));
 }
}

代码示例来源:origin: codeka/wwmmo

public void onFocusMinusClick(View view) {
 for (int i = 0; i < 4; i++) {
  if (view == focusMinusButtons[i]) {
   float newValue = Math.max(0.0f, focusValues[i] - 0.01f);
   focusSeekBars[i].setProgress(Math.round(newValue * focusSeekBars[i].getMax()));
   redistribute(i, newValue);
   break;
  }
 }
 refreshFocus();
}

代码示例来源:origin: dalong982242260/LoopRotarySwitch

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  mLoopRotarySwitchView.setLoopRotationX(progress - seekBar.getMax() / 2);
  mLoopRotarySwitchView.initView();
}

代码示例来源:origin: dalong982242260/LoopRotarySwitch

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  mLoopRotarySwitchView.setLoopRotationZ(progress - seekBar.getMax() / 2);
  mLoopRotarySwitchView.initView();
}

相关文章

SeekBar类方法