android.widget.SeekBar#setOnTouchListener ( )源码实例Demo

下面列出了android.widget.SeekBar#setOnTouchListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: snapdroid   文件: GroupItem.java
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);
    }
 
源代码2 项目: JieCaoVideoPlayer-develop   文件: JCVideoPlayer.java
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);
}
 
源代码3 项目: SprintNBA   文件: JCVideoPlayer.java
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);
}
 
源代码4 项目: Noyze   文件: HeadsUpVolumePanel.java
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();
    }
}
 
源代码5 项目: Noyze   文件: UberVolumePanel.java
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();
    }
}
 
源代码6 项目: Noyze   文件: StatusBarVolumePanel.java
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();
    }
}
 
源代码7 项目: Noyze   文件: HeadsUpVolumePanel.java
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();
    }
}
 
源代码8 项目: Noyze   文件: UberVolumePanel.java
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();
    }
}
 
源代码9 项目: Noyze   文件: StatusBarVolumePanel.java
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();
    }
}
 
源代码10 项目: GSYVideoPlayer   文件: GSYVideoControlView.java
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);
    }
}
 
源代码11 项目: EditableSeekBar   文件: EditableSeekBar.java
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;
        }
    });
}