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

The following examples show how to use android.widget.SeekBar#setOnTouchListener() . 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: GroupItem.java    From snapdroid with GNU General Public License v3.0 6 votes vote down vote up
public GroupItem(Context context, ServerStatus server, Group group) {
        super(context);
        LayoutInflater vi = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        vi.inflate(R.layout.group_item, this);
//        title = (TextView) findViewById(R.id.title);
        volumeSeekBar = (SeekBar) findViewById(R.id.volumeSeekBar);
        ibMute = (ImageButton) findViewById(R.id.ibMute);
        ibMute.setImageResource(R.drawable.ic_speaker_icon);
        ibMute.setOnClickListener(this);
        ibSettings = (ImageButton) findViewById(R.id.ibSettings);
        ibSettings.setOnClickListener(this);
        llVolume = (LinearLayout) findViewById(R.id.llVolume);
        llVolume.setVisibility(GONE);
        llClient = (LinearLayout) findViewById(R.id.llClient);
        llClient.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
        tvStreamName = (TextView) findViewById(R.id.tvStreamName);
        volumeSeekBar.setOnSeekBarChangeListener(this);
        volumeSeekBar.setOnTouchListener(this);
        volumeSeekBar.setOnFocusChangeListener(this);
        this.server = server;
        clientItems = new Vector<>();
        clientVolumes = new Vector<>();
        setGroup(group);
    }
 
Example 2
Source File: JCVideoPlayer.java    From JieCaoVideoPlayer-develop with MIT License 6 votes vote down vote up
protected void init(Context context) {
    View.inflate(context, getLayoutId(), this);
    startButton = (ImageView) findViewById(R.id.start);
    fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
    progressBar = (SeekBar) findViewById(R.id.progress);
    currentTimeTextView = (TextView) findViewById(R.id.current);
    totalTimeTextView = (TextView) findViewById(R.id.total);
    bottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
    textureViewContainer = (RelativeLayout) findViewById(R.id.surface_container);
    topContainer = (ViewGroup) findViewById(R.id.layout_top);

    startButton.setOnClickListener(this);
    fullscreenButton.setOnClickListener(this);
    progressBar.setOnSeekBarChangeListener(this);
    bottomContainer.setOnClickListener(this);
    textureViewContainer.setOnClickListener(this);
    progressBar.setOnTouchListener(this);

    textureViewContainer.setOnTouchListener(this);
    mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
    mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}
 
Example 3
Source File: JCVideoPlayer.java    From SprintNBA with Apache License 2.0 6 votes vote down vote up
protected void init(Context context) {
    View.inflate(context, getLayoutId(), this);
    startButton = (ImageView) findViewById(R.id.start);
    fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
    progressBar = (SeekBar) findViewById(R.id.progress);
    currentTimeTextView = (TextView) findViewById(R.id.current);
    totalTimeTextView = (TextView) findViewById(R.id.total);
    bottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
    textureViewContainer = (RelativeLayout) findViewById(R.id.surface_container);
    topContainer = (ViewGroup) findViewById(R.id.layout_top);

    startButton.setOnClickListener(this);
    fullscreenButton.setOnClickListener(this);
    progressBar.setOnSeekBarChangeListener(this);
    bottomContainer.setOnClickListener(this);
    textureViewContainer.setOnClickListener(this);
    progressBar.setOnTouchListener(this);

    textureViewContainer.setOnTouchListener(this);
    mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
    mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}
 
Example 4
Source File: HeadsUpVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
protected void toggleSeekBar(final boolean shouldSeek) {
    // If we've got a SeekBar, handle seeking!
    if (seekBar instanceof SeekBar) {
        SeekBar seeker = (SeekBar) seekBar;
        seeker.setOnSeekBarChangeListener((shouldSeek) ? this : null);
        seeker.setOnTouchListener((shouldSeek) ? null : noTouchListener);
        Drawable thumb = null;
        if (shouldSeek) {
            thumb = getResources().getDrawable(R.drawable.scrubber_control_selector_mini);
            thumb.mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
            thumb.setBounds(0,0, thumb.getIntrinsicWidth(), thumb.getIntrinsicHeight());
        }
        seeker.setThumb(thumb);
        // NOTE: there's so weird issue with setting the thumb dynamically.
        // This seems to do the trick (fingers crossed).
        Utils.tap((View) seeker.getParent());
        seeker.invalidate();
    }
}
 
Example 5
Source File: UberVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
protected void toggleSeekBar(final boolean shouldSeek) {
    // If we've got a SeekBar, handle seeking!
    if (seekBar instanceof SeekBar) {
        SeekBar seeker = (SeekBar) seekBar;
        seeker.setOnSeekBarChangeListener((shouldSeek) ? this : null);
        seeker.setOnTouchListener((shouldSeek) ? null : noTouchListener);
        Drawable thumb = null;
        if (shouldSeek) {
            thumb = getResources().getDrawable(R.drawable.scrubber_control_selector_mini);
            thumb.mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
            thumb.setBounds(0,0, thumb.getIntrinsicWidth(), thumb.getIntrinsicHeight());
        }
        seeker.setThumb(thumb);
        // NOTE: there's so weird issue with setting the thumb dynamically.
        // This seems to do the trick (fingers crossed).
        Utils.tap((View) seeker.getParent());
        seeker.invalidate();
    }
}
 
Example 6
Source File: StatusBarVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
protected void toggleSeekBar(final boolean shouldSeek) {
    // If we've got a SeekBar, handle seeking!
    if (seekBar instanceof SeekBar) {
        SeekBar seeker = (SeekBar) seekBar;
        seeker.setOnSeekBarChangeListener((shouldSeek) ? this : null);
        seeker.setOnTouchListener((shouldSeek) ? null : noTouchListener);
        Drawable thumb = null;
        if (shouldSeek) {
            thumb = getResources().getDrawable(R.drawable.scrubber_control_selector_mini);
            thumb.mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
            thumb.setBounds(0, 0, thumb.getIntrinsicWidth(), thumb.getIntrinsicHeight());
        }
        seeker.setThumb(thumb);
        // NOTE: there's so weird issue with setting the thumb dynamically.
        // This seems to do the trick (fingers crossed).
        Utils.tap((View) seeker.getParent());
        seeker.invalidate();
    }
}
 
Example 7
Source File: HeadsUpVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
protected void toggleSeekBar(final boolean shouldSeek) {
    // If we've got a SeekBar, handle seeking!
    if (seekBar instanceof SeekBar) {
        SeekBar seeker = (SeekBar) seekBar;
        seeker.setOnSeekBarChangeListener((shouldSeek) ? this : null);
        seeker.setOnTouchListener((shouldSeek) ? null : noTouchListener);
        Drawable thumb = null;
        if (shouldSeek) {
            thumb = getResources().getDrawable(R.drawable.scrubber_control_selector_mini);
            thumb.mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
            thumb.setBounds(0,0, thumb.getIntrinsicWidth(), thumb.getIntrinsicHeight());
        }
        seeker.setThumb(thumb);
        // NOTE: there's so weird issue with setting the thumb dynamically.
        // This seems to do the trick (fingers crossed).
        Utils.tap((View) seeker.getParent());
        seeker.invalidate();
    }
}
 
Example 8
Source File: UberVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
protected void toggleSeekBar(final boolean shouldSeek) {
    // If we've got a SeekBar, handle seeking!
    if (seekBar instanceof SeekBar) {
        SeekBar seeker = (SeekBar) seekBar;
        seeker.setOnSeekBarChangeListener((shouldSeek) ? this : null);
        seeker.setOnTouchListener((shouldSeek) ? null : noTouchListener);
        Drawable thumb = null;
        if (shouldSeek) {
            thumb = getResources().getDrawable(R.drawable.scrubber_control_selector_mini);
            thumb.mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
            thumb.setBounds(0,0, thumb.getIntrinsicWidth(), thumb.getIntrinsicHeight());
        }
        seeker.setThumb(thumb);
        // NOTE: there's so weird issue with setting the thumb dynamically.
        // This seems to do the trick (fingers crossed).
        Utils.tap((View) seeker.getParent());
        seeker.invalidate();
    }
}
 
Example 9
Source File: StatusBarVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
protected void toggleSeekBar(final boolean shouldSeek) {
    // If we've got a SeekBar, handle seeking!
    if (seekBar instanceof SeekBar) {
        SeekBar seeker = (SeekBar) seekBar;
        seeker.setOnSeekBarChangeListener((shouldSeek) ? this : null);
        seeker.setOnTouchListener((shouldSeek) ? null : noTouchListener);
        Drawable thumb = null;
        if (shouldSeek) {
            thumb = getResources().getDrawable(R.drawable.scrubber_control_selector_mini);
            thumb.mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
            thumb.setBounds(0, 0, thumb.getIntrinsicWidth(), thumb.getIntrinsicHeight());
        }
        seeker.setThumb(thumb);
        // NOTE: there's so weird issue with setting the thumb dynamically.
        // This seems to do the trick (fingers crossed).
        Utils.tap((View) seeker.getParent());
        seeker.invalidate();
    }
}
 
Example 10
Source File: GSYVideoControlView.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
protected void init(Context context) {
    super.init(context);

    mStartButton = findViewById(R.id.start);
    mTitleTextView = (TextView) findViewById(R.id.title);
    mBackButton = (ImageView) findViewById(R.id.back);
    mFullscreenButton = (ImageView) findViewById(R.id.fullscreen);
    mProgressBar = (SeekBar) findViewById(R.id.progress);
    mCurrentTimeTextView = (TextView) findViewById(R.id.current);
    mTotalTimeTextView = (TextView) findViewById(R.id.total);
    mBottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
    mTopContainer = (ViewGroup) findViewById(R.id.layout_top);
    mBottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar);
    mThumbImageViewLayout = (RelativeLayout) findViewById(R.id.thumb);
    mLockScreen = (ImageView) findViewById(R.id.lock_screen);

    mLoadingProgressBar = findViewById(R.id.loading);


    if (isInEditMode())
        return;

    if (mStartButton != null) {
        mStartButton.setOnClickListener(this);
    }

    if (mFullscreenButton != null) {
        mFullscreenButton.setOnClickListener(this);
        mFullscreenButton.setOnTouchListener(this);
    }

    if (mProgressBar != null) {
        mProgressBar.setOnSeekBarChangeListener(this);
    }

    if (mBottomContainer != null) {
        mBottomContainer.setOnClickListener(this);
    }

    if (mTextureViewContainer != null) {
        mTextureViewContainer.setOnClickListener(this);
        mTextureViewContainer.setOnTouchListener(this);
    }

    if (mProgressBar != null) {
        mProgressBar.setOnTouchListener(this);
    }

    if (mThumbImageViewLayout != null) {
        mThumbImageViewLayout.setVisibility(GONE);
        mThumbImageViewLayout.setOnClickListener(this);
    }
    if (mThumbImageView != null && !mIfCurrentIsFullscreen && mThumbImageViewLayout != null) {
        mThumbImageViewLayout.removeAllViews();
        resolveThumbImage(mThumbImageView);
    }

    if (mBackButton != null)
        mBackButton.setOnClickListener(this);

    if (mLockScreen != null) {
        mLockScreen.setVisibility(GONE);
        mLockScreen.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mCurrentState == CURRENT_STATE_AUTO_COMPLETE ||
                        mCurrentState == CURRENT_STATE_ERROR) {
                    return;
                }
                lockTouchLogic();
                if (mLockClickListener != null) {
                    mLockClickListener.onClick(v, mLockCurScreen);
                }
            }
        });
    }

    if (getActivityContext() != null) {
        mSeekEndOffset = CommonUtil.dip2px(getActivityContext(), 50);
    }
}
 
Example 11
Source File: EditableSeekBar.java    From EditableSeekBar with MIT License 4 votes vote down vote up
public EditableSeekBar(Context context, AttributeSet attrs) {
    super(context, attrs);

    inflate(getContext(), R.layout.editable_seekbar, this);

    setSaveEnabled(true);

    esbTitle = (TextView)findViewById(R.id.esbTitle);
    esbSeekBar = (SeekBar)findViewById(R.id.esbSeekBar);
    esbEditText = (ESB_EditText)findViewById(R.id.esbEditText);




    float defaultEditTextWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, EDITTEXT_DEFAULT_WIDTH, getResources().getDisplayMetrics());
    int defaultEditTextFontSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, EDITTEXT_DEFAULT_FONT_SIZE, getResources().getDisplayMetrics());

    TypedArray a = context.getTheme().obtainStyledAttributes(
                                        attrs,
                                        R.styleable.EditableSeekBar,
                                        0, 0);

    try {
        setTitle(a.getString(R.styleable.EditableSeekBar_esbTitle));
        esbTitle.setTextAppearance(getContext(), a.getResourceId(R.styleable.EditableSeekBar_esbTitleAppearance, 0));
        selectOnFocus = a.getBoolean(R.styleable.EditableSeekBar_esbSelectAllOnFocus, true);
        animateChanges = a.getBoolean(R.styleable.EditableSeekBar_esbAnimateSeekBar, true);
        esbEditText.setSelectAllOnFocus(selectOnFocus);
        esbEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, a.getDimensionPixelSize(R.styleable.EditableSeekBar_esbEditTextFontSize, defaultEditTextFontSize));

        int min = a.getInteger(R.styleable.EditableSeekBar_esbMin, SEEKBAR_DEFAULT_MIN);
        int max = a.getInteger(R.styleable.EditableSeekBar_esbMax, SEEKBAR_DEFAULT_MAX);

        setRange(min, max);

        setValue(a.getInteger(R.styleable.EditableSeekBar_esbValue, translateToRealValue(getRange()/2)));
        setEditTextWidth(a.getDimension(R.styleable.EditableSeekBar_esbEditTextWidth, defaultEditTextWidth));
    } finally {
        a.recycle();
    }

    esbSeekBar.setOnSeekBarChangeListener(this);
    esbEditText.addTextChangedListener(this);
    esbEditText.setOnFocusChangeListener(this);
    esbEditText.setOnKeyboardDismissedListener(this);

    esbSeekBar.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            hideKeyboard();
            return false;
        }
    });
}