Java Code Examples for android.widget.SeekBar#getProgress()

The following examples show how to use android.widget.SeekBar#getProgress() . 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: SlideUpPanelTests.java    From Kore with Apache License 2.0 6 votes vote down vote up
/**
 * Kodi resumes playback when progression changes.
 * Test if changing progression when player is paused caused
 * progression to start updating again
 *
 * UI interaction flow tested:
 *   1. Start playing a music item
 *   2. Expand panel
 *   3. Pause playback
 *   4. Set progression
 *   5. Start playback at server (that's what Kodi does)
 *   6. Result: Playback should start at paused position
 */
@Test
public void pauseSetProgressionPlay() {
    expandPanel();

    onView(withId(R.id.npp_play)).perform(click()); //Pause playback
    onView(withId(R.id.mpi_seek_bar)).perform(ViewActions.slideSeekBar(16));
    getPlayerHandler().startPlay();

    SeekBar seekBar = (SeekBar) getActivity().findViewById(R.id.mpi_seek_bar);
    final int progress = seekBar.getProgress();
    onView(isRoot()).perform(ViewActions.waitForView(
            R.id.mpi_seek_bar, new ViewActions.CheckStatus() {
                @Override
                public boolean check(View v) {
                    return ((SeekBar) v).getProgress() > progress;
                }
            }, 10000));
}
 
Example 2
Source File: SeekBarPreference.java    From EhViewer 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 3
Source File: ColorPickerFragment.java    From ColorBox-library with GNU General Public License v3.0 5 votes vote down vote up
private static int getColorARGB(int which, SeekBar alphaSeekBar, SeekBar RSeekBar, SeekBar GSeekBar, SeekBar BSeekBar) {

        final int A = alphaSeekBar.getProgress();
        final int R = RSeekBar.getProgress();
        final int G = GSeekBar.getProgress();
        final int B = BSeekBar.getProgress();

        int returned;

        switch (which) {

            default:
            case 1:
                returned = R;
                break;

            case 2:
                returned = G;
                break;
            case 3:
                returned = B;
                break;

            case 4:
                returned = Color.argb(A, R, G, B);
                break;
        }

        return returned;
    }
 
Example 4
Source File: PluginSimplePlayer.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
/**
 * 搜索进度
 * 
 * @param seekBar
 */
protected void seekChange(SeekBar seekBar) {
	if (null == mMediaPlayerDelegate)
		return;
	if (null != seekBar && seekBar.getProgress() == seekBar.getMax()
			&& seekBar.getMax() > 0) {
		if (null != mMediaPlayerDelegate.videoInfo)
			mMediaPlayerDelegate.videoInfo
					.setProgress(mMediaPlayerDelegate.videoInfo
							.getDurationMills());
		// complete = true;
		mMediaPlayerDelegate.onComplete();

		// if (null != playHandler) {
		// playHandler.removeCallbacksAndMessages(null);
		// playHandler.sendEmptyMessage(MSG_COMPLETE);
		// }
	} else if (mMediaPlayerDelegate != null) {
		if (null != mMediaPlayerDelegate.videoInfo)
			mMediaPlayerDelegate.videoInfo.setProgress(seekBar
					.getProgress());
		if (!mMediaPlayerDelegate.isPlaying()) {
			startPlay();
		}
		mMediaPlayerDelegate.seekTo(seekBar.getProgress());
		isLoading = true;
		videoBar.setEnabled(false);
		Logger.e("PlayFlow", "小播放器拖动seekto" + seekBar.getProgress());
	}
}
 
Example 5
Source File: NowPlayingActivity.java    From Rey-MusicPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    int seekBarPosition = seekBar.getProgress();
    if (mApp.isServiceRunning())
        mApp.getService().getMediaPlayer().seekTo(seekBarPosition * 1000);
    //Re-initiate the handler.
    //Fade out the indicator after 1000ms.
    mHandler.postDelayed(fadeOutSeekbarIndicator, 1000);

}
 
Example 6
Source File: StorageLimitsDialog.java    From revolution-irc with GNU General Public License v3.0 5 votes vote down vote up
public static void updateLabel(SeekBar seekBar, TextView label) {
    if (seekBar.getProgress() >= SIZES.length) {
        label.setText(R.string.pref_storage_no_limit);
        return;
    }
    label.setText(SIZES[seekBar.getProgress()] + " MB");
}
 
Example 7
Source File: MySeekBarPreference.java    From Float-Bar with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
	if (mListener != null) {
		mListener.onStopTrackingTouch(getKey(), seekBar);
	}
	mTrackingTouch = false;
	if (seekBar.getProgress() != mProgress) {
		syncProgress(seekBar);
	}
	notifyHierarchyChanged();
}
 
Example 8
Source File: PipTestActivity.java    From dttv-android with GNU General Public License v3.0 5 votes vote down vote up
public void onStopTrackingTouch(SeekBar seekBar) {
    int position = seekBar.getProgress();
    if (mSeeking == 1) {
        mSeekCurPosition = position;
        return;
    } else {
        mSeeking = 1;
        mSeekCurPosition = mSeekPosition = position;
    }
    mMediaPlayer.seekTo(mSeekPosition);
    Log.i(TAG, "Seekto " + mSeekPosition);
}
 
Example 9
Source File: NeihanVideoPlayerController.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    if (mNiceVideoPlayer.isBufferingPaused() || mNiceVideoPlayer.isPaused()) {
        mNiceVideoPlayer.restart();
    }
    long position = (long) (mNiceVideoPlayer.getDuration() * seekBar.getProgress() / 100f);
    mNiceVideoPlayer.seekTo(position);
    startDismissTopBottomTimer();
}
 
Example 10
Source File: MySeekBarPreference.java    From Float-Bar with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
	if (mListener != null) {
		mListener.onStopTrackingTouch(getKey(), seekBar);
	}
	mTrackingTouch = false;
	if (seekBar.getProgress() != mProgress) {
		syncProgress(seekBar);
	}
	notifyHierarchyChanged();
}
 
Example 11
Source File: FontSizeActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    int process = seekBar.getProgress();
    if (process <= 25) {
        seekBar.setProgress(0);
        selectMode = 1;
    } else if (process > 25 && process <= 75) {
        seekBar.setProgress(50);
        selectMode = 2;
    } else {
        seekBar.setProgress(100);
        selectMode = 3;
    }
    int fontSize=this.getResources().getDimensionPixelSize(R.dimen.atom_ui_text_size_medium);
    switch (selectMode) {
        case 1:
            sbChangeFontSize.setProgress(0);
            fontSize-= ResourceUtils.getFontSizeIntervalPX(this);
            break;
        case 2:
            sbChangeFontSize.setProgress(50);
            break;
        case 3:
            sbChangeFontSize.setProgress(100);
            fontSize+=ResourceUtils.getFontSizeIntervalPX(this);
            break;
    }
    tvMessage1.setTextSize(TypedValue.COMPLEX_UNIT_PX,fontSize);
    tvMessage2.setTextSize(TypedValue.COMPLEX_UNIT_PX,fontSize);
    tvMessage3.setTextSize(TypedValue.COMPLEX_UNIT_PX,fontSize);
    if (CurrentPreference.getInstance().getFontSizeMode() != selectMode) {
        profilePresenter.changeFontSize();
    }
}
 
Example 12
Source File: StandardVideoController.java    From youqu_master with Apache License 2.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    long duration = mediaPlayer.getDuration();
    long newPosition = (duration * seekBar.getProgress()) / videoProgress.getMax();
    mediaPlayer.seekTo((int) newPosition);
    isDragging = false;
    post(mShowProgress);
    show();
}
 
Example 13
Source File: SeekBarPreference.java    From MaterialPreference with Apache License 2.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    mTrackingTouch = false;
    if (seekBar.getProgress() + mMin != mSeekBarValue) {
        syncValueInternal(seekBar);
    }
}
 
Example 14
Source File: SeekBarPreference.java    From MHViewer 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 15
Source File: SeekBarPreference.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
/**
 * Persist the seekBar's progress value if callChangeListener
 * returns true, otherwise set the seekBar's progress to the stored value
 */
void syncProgress(SeekBar seekBar) {
    int progress = seekBar.getProgress();
    if (progress != mProgress) {
        if (callChangeListener(progress)) {
            setProgress(progress, false);
        } else {
            seekBar.setProgress(mProgress);
        }
    }
}
 
Example 16
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 17
Source File: Utils.java    From TubiPlayer with MIT License 4 votes vote down vote up
public static long progressToMilli(long playerDurationMs, SeekBar seekBar) {
    long duration = playerDurationMs < 1 ? C.TIME_UNSET : playerDurationMs;
    return duration == C.TIME_UNSET ? 0 : ((duration * seekBar.getProgress()) / seekBar.getMax());
}
 
Example 18
Source File: SettingsActivity.java    From GlassActionBar with Apache License 2.0 4 votes vote down vote up
private static float transformSeekBarValue(SeekBar seekBar, int min, int max) {
    float value = seekBar.getProgress() / (float) seekBar.getMax();
    float span = max - min;
    return min + value * span;
}
 
Example 19
Source File: MainActivity.java    From bounce-button-animation-android with MIT License 4 votes vote down vote up
double getSeekBarValue(SeekBar seekBar, double step) {
    return ((double)seekBar.getProgress() + 1.0) / ( 1.0 / step);
}
 
Example 20
Source File: ExampleActivity.java    From android-sliderview with MIT License 4 votes vote down vote up
@Override
public void onPlayGroundItemInteract(View playground, View clickedView) {
    int red     = -1,
        green   = -1,
        blue    = -1;
    switch (clickedView.getId()) {
        case R.id.customTabView:
            setCustomTabView();
            break;
        case R.id.defaultTabView:
            setDefaultTabView();
            break;
        case R.id.hideBarOnScroll:
            CheckBox checkBox = (CheckBox) clickedView;
            hideBarOnScroll = checkBox.isChecked();
            if (!hideBarOnScroll) bar.show();
            Toast.makeText(this, "Test this on the \"List\" tab", Toast.LENGTH_SHORT).show();
            break;
        case R.id.randomColor:
            Random random = new Random();
            red     = random.nextInt(200 - 100) + 100;
            green   = random.nextInt(200 - 100) + 100;
            blue    = random.nextInt(200 - 100) + 100;
        case R.id.redBar:
        case R.id.greenBar:
        case R.id.blueBar:
            SeekBar redbar      = (SeekBar) playground.findViewById(R.id.redBar);
            SeekBar greenbar    = (SeekBar) playground.findViewById(R.id.greenBar);
            SeekBar bluebar     = (SeekBar) playground.findViewById(R.id.blueBar);

            if (red   == -1) red    = redbar.getProgress();
            if (green == -1) green  = greenbar.getProgress();
            if (blue  == -1) blue   = bluebar.getProgress();

            redbar.setProgress(red);
            greenbar.setProgress(green);
            bluebar.setProgress(blue);
            updateHeaderColor(
                    red,
                    green,
                    blue);
            break;
        case R.id.stripSizeBar:
            updateBorderIndicatorThickness(((SeekBar) clickedView).getProgress());
            break;
    }
}