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

The following examples show how to use android.widget.SeekBar#setThumbOffset() . 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: ColorPickerAdvancedComponent.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the views.
 *
 * @param rootView View that contains all the content, such as the label, gradient view, etc.
 * @param textResourceId The resource ID of the text to show on the label.
 * @param seekBarMax The range of the seek bar.
 * @param seekBarListener The listener for when the seek bar value changes.
 */
ColorPickerAdvancedComponent(final View rootView,
        final int textResourceId,
        final int seekBarMax,
        final OnSeekBarChangeListener seekBarListener) {
    mGradientView = rootView.findViewById(R.id.gradient);
    mText = (TextView) rootView.findViewById(R.id.text);
    mText.setText(textResourceId);
    mGradientDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, null);
    mSeekBar = (SeekBar) rootView.findViewById(R.id.seek_bar);
    mSeekBar.setOnSeekBarChangeListener(seekBarListener);
    mSeekBar.setMax(seekBarMax);
    // Setting the thumb offset means the seek bar thumb can move all the way to each end
    // of the gradient view.
    Context context = rootView.getContext();
    int offset = ApiCompatibilityUtils.getDrawable(context.getResources(),
            R.drawable.color_picker_advanced_select_handle).getIntrinsicWidth();
    mSeekBar.setThumbOffset(offset / 2);
}
 
Example 2
Source File: ColorPickerAdvancedComponent.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Initializes the views.
 *
 * @param rootView View that contains all the content, such as the label, gradient view, etc.
 * @param textResourceId The resource ID of the text to show on the label.
 * @param seekBarMax The range of the seek bar.
 * @param seekBarListener The listener for when the seek bar value changes.
 */
ColorPickerAdvancedComponent(final View rootView,
        final int textResourceId,
        final int seekBarMax,
        final OnSeekBarChangeListener seekBarListener) {
    mGradientView = rootView.findViewById(R.id.gradient);
    mText = (TextView) rootView.findViewById(R.id.text);
    mText.setText(textResourceId);
    mGradientDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, null);
    mSeekBar = (SeekBar) rootView.findViewById(R.id.seek_bar);
    mSeekBar.setOnSeekBarChangeListener(seekBarListener);
    mSeekBar.setMax(seekBarMax);
    // Setting the thumb offset means the seek bar thumb can move all the way to each end
    // of the gradient view.
    Context context = rootView.getContext();
    int offset = context.getResources()
                        .getDrawable(R.drawable.color_picker_advanced_select_handle)
                        .getIntrinsicWidth();
    mSeekBar.setThumbOffset(offset / 2);
}
 
Example 3
Source File: ColorPickerAdvancedComponent.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Initializes the views.
 *
 * @param rootView View that contains all the content, such as the label, gradient view, etc.
 * @param textResourceId The resource ID of the text to show on the label.
 * @param seekBarMax The range of the seek bar.
 * @param seekBarListener The listener for when the seek bar value changes.
 */
ColorPickerAdvancedComponent(final View rootView,
        final int textResourceId,
        final int seekBarMax,
        final OnSeekBarChangeListener seekBarListener) {
    mGradientView = rootView.findViewById(R.id.gradient);
    mText = (TextView) rootView.findViewById(R.id.text);
    mText.setText(textResourceId);
    mGradientDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, null);
    mSeekBar = (SeekBar) rootView.findViewById(R.id.seek_bar);
    mSeekBar.setOnSeekBarChangeListener(seekBarListener);
    mSeekBar.setMax(seekBarMax);
    // Setting the thumb offset means the seek bar thumb can move all the way to each end
    // of the gradient view.
    Context context = rootView.getContext();
    int offset = context.getResources()
                        .getDrawable(R.drawable.color_picker_advanced_select_handle)
                        .getIntrinsicWidth();
    mSeekBar.setThumbOffset(offset / 2);
}
 
Example 4
Source File: MediaController.java    From FlutterQiniucloudLivePlugin with Apache License 2.0 4 votes vote down vote up
private void initControllerView(View v) {
    // By default these are hidden.
    mPrevButton = (ImageButton) v.findViewById(PRV_BUTTON_ID);
    if (mPrevButton != null) {
        mPrevButton.setVisibility(View.GONE);
    }
    mNextButton = (ImageButton) v.findViewById(NEXT_BUTTON_ID);
    if (mNextButton != null) {
        mNextButton.setVisibility(View.GONE);
    }

    mFfwdButton = (ImageButton) v.findViewById(FFWD_BUTTON_ID);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(mFfwdListener);
        if (!mFromXml) {
            mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    mRewButton = (ImageButton) v.findViewById(REW_BUTTON_ID);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(mRewListener);
        if (!mFromXml) {
            mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }
    mPauseButton = (ImageButton) v.findViewById(PAUSE_BUTTON_ID);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

    mProgress = (ProgressBar) v.findViewById(MEDIACONTROLLER_PROGRESS_ID);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
            seeker.setThumbOffset(1);
        }
        mProgress.setMax(1000);
        mProgress.setEnabled(!mDisableProgress);
    }

    mEndTime = (TextView) v.findViewById(END_TIME_ID);
    mCurrentTime = (TextView) v.findViewById(CURRENT_TIME_ID);
}
 
Example 5
Source File: MediaController.java    From PLDroidShortVideo with Apache License 2.0 4 votes vote down vote up
private void initControllerView(View v) {
    // By default these are hidden.
    mPrevButton = (ImageButton) v.findViewById(PRV_BUTTON_ID);
    if (mPrevButton != null) {
        mPrevButton.setVisibility(View.GONE);
    }
    mNextButton = (ImageButton) v.findViewById(NEXT_BUTTON_ID);
    if (mNextButton != null) {
        mNextButton.setVisibility(View.GONE);
    }

    mFfwdButton = (ImageButton) v.findViewById(FFWD_BUTTON_ID);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(mFfwdListener);
        if (!mFromXml) {
            mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    mRewButton = (ImageButton) v.findViewById(REW_BUTTON_ID);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(mRewListener);
        if (!mFromXml) {
            mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }
    mPauseButton = (ImageButton) v.findViewById(PAUSE_BUTTON_ID);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

    mProgress = (ProgressBar) v.findViewById(MEDIACONTROLLER_PROGRESS_ID);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
            seeker.setThumbOffset(1);
        }
        mProgress.setMax(1000);
        mProgress.setEnabled(!mDisableProgress);
    }

    mEndTime = (TextView) v.findViewById(END_TIME_ID);
    mCurrentTime = (TextView) v.findViewById(CURRENT_TIME_ID);
}
 
Example 6
Source File: MediaController.java    From PLDroidShortVideo with Apache License 2.0 4 votes vote down vote up
private void initControllerView(View v) {
    // By default these are hidden.
    mPrevButton = (ImageButton) v.findViewById(PRV_BUTTON_ID);
    if (mPrevButton != null) {
        mPrevButton.setVisibility(View.GONE);
    }
    mNextButton = (ImageButton) v.findViewById(NEXT_BUTTON_ID);
    if (mNextButton != null) {
        mNextButton.setVisibility(View.GONE);
    }

    mFfwdButton = (ImageButton) v.findViewById(FFWD_BUTTON_ID);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(mFfwdListener);
        if (!mFromXml) {
            mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    mRewButton = (ImageButton) v.findViewById(REW_BUTTON_ID);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(mRewListener);
        if (!mFromXml) {
            mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }
    mPauseButton = (ImageButton) v.findViewById(PAUSE_BUTTON_ID);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

    mProgress = (ProgressBar) v.findViewById(MEDIACONTROLLER_PROGRESS_ID);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
            seeker.setThumbOffset(1);
        }
        mProgress.setMax(1000);
        mProgress.setEnabled(!mDisableProgress);
    }

    mEndTime = (TextView) v.findViewById(END_TIME_ID);
    mCurrentTime = (TextView) v.findViewById(CURRENT_TIME_ID);
}
 
Example 7
Source File: MediaController.java    From MeiZiNews with MIT License 4 votes vote down vote up
private void initControllerView(View v) {
    // By default these are hidden.
    mPrevButton = (ImageButton) v.findViewById(PRV_BUTTON_ID);
    if (mPrevButton != null) {
        mPrevButton.setVisibility(View.GONE);
    }
    mNextButton = (ImageButton) v.findViewById(NEXT_BUTTON_ID);
    if (mNextButton != null) {
        mNextButton.setVisibility(View.GONE);
    }

    mFfwdButton = (ImageButton) v.findViewById(FFWD_BUTTON_ID);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(mFfwdListener);
        if (!mFromXml) {
            mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    mRewButton = (ImageButton) v.findViewById(REW_BUTTON_ID);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(mRewListener);
        if (!mFromXml) {
            mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }
    mPauseButton = (ImageButton) v.findViewById(PAUSE_BUTTON_ID);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

    mProgress = (ProgressBar) v.findViewById(MEDIACONTROLLER_PROGRESS_ID);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
            seeker.setThumbOffset(1);
        }
        mProgress.setMax(1000);
        mProgress.setEnabled(!mDisableProgress);
    }

    mEndTime = (TextView) v.findViewById(END_TIME_ID);
    mCurrentTime = (TextView) v.findViewById(CURRENT_TIME_ID);
}
 
Example 8
Source File: MediaController.java    From qiniu-lab-android with MIT License 4 votes vote down vote up
private void initControllerView(View v) {
    // By default these are hidden.
    mPrevButton = (ImageButton) v.findViewById(PRV_BUTTON_ID);
    if (mPrevButton != null) {
        mPrevButton.setVisibility(View.GONE);
    }
    mNextButton = (ImageButton) v.findViewById(NEXT_BUTTON_ID);
    if (mNextButton != null) {
        mNextButton.setVisibility(View.GONE);
    }

    mFfwdButton = (ImageButton) v.findViewById(FFWD_BUTTON_ID);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(mFfwdListener);
        if (!mFromXml) {
            mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    mRewButton = (ImageButton) v.findViewById(REW_BUTTON_ID);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(mRewListener);
        if (!mFromXml) {
            mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }
    mPauseButton = (ImageButton) v.findViewById(PAUSE_BUTTON_ID);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

    mProgress = (ProgressBar) v.findViewById(MEDIACONTROLLER_PROGRESS_ID);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
            seeker.setThumbOffset(1);
        }
        mProgress.setMax(1000);
        mProgress.setEnabled(!mDisableProgress);
    }

    mEndTime = (TextView) v.findViewById(END_TIME_ID);
    mCurrentTime = (TextView) v.findViewById(CURRENT_TIME_ID);
}