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

The following examples show how to use android.widget.SeekBar#setOnSeekBarChangeListener() . 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: ControlActivity.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
private void initView() {
	mNameTitle = (TextView) findViewById(R.id.media_tv_title);
	mAuthorName = (TextView) findViewById(R.id.media_tv_author);

	mPlayBtn = (ImageView) findViewById(R.id.media_iv_play);
	mVoicePlus = (ImageView) findViewById(R.id.media_iv_voc_plus);
	mVoiceCut = (ImageView) findViewById(R.id.media_iv_voc_cut);
	mVoiceMute = (ImageView) findViewById(R.id.media_iv_voc_mute);
	mPlayBtn.setOnClickListener(this);
	mVoicePlus.setOnClickListener(this);
	mVoiceCut.setOnClickListener(this);
	mVoiceMute.setOnClickListener(this);
	mPlayBtn.setBackgroundResource(R.drawable.icon_media_pause);
	mVoiceMute.setBackgroundResource(R.drawable.icon_voc_mute);

	mCurrentTime = (TextView) findViewById(R.id.media_tv_time);
	mTotalTime = (TextView) findViewById(R.id.media_tv_total_time);

	mSeekBar = (SeekBar) findViewById(R.id.media_seekBar);
	mSeekBar.setOnSeekBarChangeListener(new PlaySeekBarListener());
}
 
Example 2
Source File: DisplayTimePreference.java    From heads-up with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected View onCreateDialogView() {
    int value = getPersistedInt(mDefault);

    LayoutInflater inflater =
            (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.number_picker_dialog, null);

    mTextView = (TextView) view.findViewById(R.id.textView);
    mSeekBar = (SeekBar) view.findViewById(R.id.seekBar);
    mSeekBar.setOnSeekBarChangeListener(seekBarChangeListener);

    // Initialize state
    mSeekBar.setMax(mMax);
    mSeekBar.setProgress(value);
    if (value == mMax)
        mTextView.setText(resources.getString(R.string.pref_overlay_time_max));
    else
        mTextView.setText(resources.getString(R.string.pref_overlay_display_time_counter, String.valueOf(value / 1000) ));


    return view;
}
 
Example 3
Source File: DistilledPagePrefsView.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mRadioGroup = (RadioGroup) findViewById(R.id.radio_button_group);
    mColorModeButtons.put(Theme.LIGHT,
            initializeAndGetButton(R.id.light_mode, Theme.LIGHT));
    mColorModeButtons.put(Theme.DARK,
            initializeAndGetButton(R.id.dark_mode, Theme.DARK));
    mColorModeButtons.put(Theme.SEPIA,
            initializeAndGetButton(R.id.sepia_mode, Theme.SEPIA));
    mColorModeButtons.get(mDistilledPagePrefs.getTheme()).setChecked(true);

    mFontScaleSeekBar = (SeekBar) findViewById(R.id.font_size);
    mFontScaleTextView = (TextView) findViewById(R.id.font_size_percentage);

    mFontFamilySpinner = (Spinner) findViewById(R.id.font_family);
    initFontFamilySpinner();

    // Setting initial progress on font scale seekbar.
    onChangeFontScaling(mDistilledPagePrefs.getFontScaling());
    mFontScaleSeekBar.setOnSeekBarChangeListener(this);
}
 
Example 4
Source File: SeekBarArrows.java    From FaceRecognitionApp with GNU General Public License v2.0 6 votes vote down vote up
public SeekBarArrows(Context context, AttributeSet attrs) {
    super(context, attrs);

    inflate(context, R.layout.seek_bar_arrows, this); // Use custom layout

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.SeekBarArrows); // Read all attributes from xml

    String mSeekBarText = styledAttrs.getString(R.styleable.SeekBarArrows_text);
    min = styledAttrs.getInt(R.styleable.SeekBarArrows_min, 0);
    float max = styledAttrs.getFloat(R.styleable.SeekBarArrows_max, 0);
    nValues = styledAttrs.getInt(R.styleable.SeekBarArrows_n_values, 0);

    mSeekBar = (SeekBar) findViewById(R.id.seekBar);
    ((TextView) findViewById(R.id.text)).setText(mSeekBarText);
    mSeekBarValue = (TextView) findViewById(R.id.value);

    setMax(max); // Set maximum value
    mSeekBar.setOnSeekBarChangeListener(this); // Set listener
    mSeekBar.setProgress(mSeekBar.getMax() / 2); // Now center the SeekBar

    // Use custom OnArrowListener class to handle button click, button long click and if the button is held down
    new OnArrowListener(findViewById(R.id.rightArrow), mSeekBar, true);
    new OnArrowListener(findViewById(R.id.leftArrow), mSeekBar, false);

    styledAttrs.recycle();
}
 
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: SeekBarPreference.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(mMax);
    seekBar.setProgress(mProgress);
    seekBar.setEnabled(isEnabled());
}
 
Example 7
Source File: SeekBarDialogPreference.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    final View view = super.onCreateDialogView();
    mSeekBar = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar);
    mSeekBar.setMax(mMaxValue - mMinValue);
    mSeekBar.setOnSeekBarChangeListener(this);
    mValueView = (TextView)view.findViewById(R.id.seek_bar_dialog_value);
    return view;
}
 
Example 8
Source File: SeekBarPreference.java    From DesignOverlay-Android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(mMax);
    seekBar.setProgress(mProgress);
    seekBar.setEnabled(isEnabled());
}
 
Example 9
Source File: MediaController.java    From talk-android with MIT License 5 votes vote down vote up
private void initControllerView(View v) {
    mControlLayout = v.findViewById(R.id.control_layout);
    loadingLayout = (ViewGroup) v.findViewById(R.id.loading_layout);
    mTurnButton = (ImageButton) v.findViewById(R.id.turn_button);
    mScaleButton = (ImageButton) v.findViewById(R.id.scale_button);
    mCenterPlayButton = v.findViewById(R.id.center_play_btn);

    if (mTurnButton != null) {
        mTurnButton.requestFocus();
        mTurnButton.setOnClickListener(mPauseListener);
    }
    mScaleButton.setOnClickListener(mScaleListener);

    if (mCenterPlayButton != null) {//重新开始播放
        mCenterPlayButton.setOnClickListener(mCenterPlayListener);
    }

    View bar = v.findViewById(R.id.seekbar);
    mProgress = (ProgressBar) bar;
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
        }
        mProgress.setMax(1000);
    }

    mEndTime = (TextView) v.findViewById(R.id.duration);
    mCurrentTime = (TextView) v.findViewById(R.id.has_played);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
}
 
Example 10
Source File: FifthActivity.java    From TextPathView with MIT License 5 votes vote down vote up
private void initView() {
    atpv = (AsyncTextPathView) findViewById(R.id.atpv);
    stpv = (SyncTextPathView) findViewById(R.id.stpv);
    spv = (SyncPathView) findViewById(R.id.spv);
    aspv = (AsyncPathView) findViewById(R.id.aspv);
    btnStart = (Button) findViewById(R.id.btn_start);
    btnStop = (Button) findViewById(R.id.btn_stop);
    sbStart = (SeekBar) findViewById(R.id.sb_start);
    sbStop = (SeekBar) findViewById(R.id.sb_stop);

    btnStart.setOnClickListener(this);
    btnStop.setOnClickListener(this);

    atpv.setCalculator(new BlinkCalculator());
    stpv.setCalculator(new AroundCalculator());
    stpv.setFillColor(true);

    aspv.setPath(new TestPath());

    spv.setPath(new TestPath());
    spv.setPathPainter(new FireworksPainter());

    sbStart.setMax(1000);
    sbStop.setMax(1000);
    sbStart.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    sbStop.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
}
 
Example 11
Source File: VideoControllerView.java    From TigerVideo with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化底部控制条各个控件
 */
protected void initWidgetView() {

    mVideoControllerInternalView = findViewById(R.id.vp_video_bottom_controller_view);
    mVideoPlayTimeView = (TextView) findViewById(R.id.vp_video_play_time);
    mVideoTotalTimeView = (TextView) findViewById(R.id.vp_video_total_time);
    mVideoPlaySeekBar = (SeekBar) findViewById(R.id.vp_video_seek_progress);
    mVideoFullScreenButton = (ImageView) findViewById(R.id.vp_video_fullscreen);
    mBottomProgressBar = (ProgressBar) findViewById(R.id.vp_video_bottom_progress);

    mVideoFullScreenButton.setOnClickListener(this);
    mVideoPlaySeekBar.setOnSeekBarChangeListener(this);
}
 
Example 12
Source File: SeekBarDialogPreference.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    final View view = super.onCreateDialogView();
    mSeekBar = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar);
    mSeekBar.setMax(mMaxValue - mMinValue);
    mSeekBar.setOnSeekBarChangeListener(this);
    mValueView = (TextView)view.findViewById(R.id.seek_bar_dialog_value);
    return view;
}
 
Example 13
Source File: SeekBarDialogPreference.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    final View view = super.onCreateDialogView();
    mSeekBar = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar);
    mSeekBar.setMax(mMaxValue - mMinValue);
    mSeekBar.setOnSeekBarChangeListener(this);
    mValueView = (TextView)view.findViewById(R.id.seek_bar_dialog_value);
    return view;
}
 
Example 14
Source File: SeekBarPreference.java    From Lucid-Browser with Apache License 2.0 5 votes vote down vote up
private void initPreference(Context context, AttributeSet attrs) {
    setValuesFromXml(attrs);
    mSeekBar = new SeekBar(context, attrs);
    mSeekBar.setMax(mMaxValue - mMinValue);
    mSeekBar.setOnSeekBarChangeListener(this);
    
    setWidgetLayoutResource(R.layout.seek_bar_preference);
}
 
Example 15
Source File: MNViderPlayer.java    From MNVideoPlayer with GNU General Public License v3.0 4 votes vote down vote up
private void init() {
    View inflate = View.inflate(context, R.layout.mn_player_view, this);
    mn_rl_bottom_menu = (RelativeLayout) inflate.findViewById(R.id.mn_rl_bottom_menu);
    mn_palyer_surfaceView = (SurfaceView) inflate.findViewById(R.id.mn_palyer_surfaceView);
    mn_iv_play_pause = (ImageView) inflate.findViewById(R.id.mn_iv_play_pause);
    mn_iv_fullScreen = (ImageView) inflate.findViewById(R.id.mn_iv_fullScreen);
    mn_tv_time = (TextView) inflate.findViewById(R.id.mn_tv_time);
    mn_tv_system_time = (TextView) inflate.findViewById(R.id.mn_tv_system_time);
    mn_seekBar = (SeekBar) inflate.findViewById(R.id.mn_seekBar);
    mn_iv_back = (ImageView) inflate.findViewById(R.id.mn_iv_back);
    mn_tv_title = (TextView) inflate.findViewById(R.id.mn_tv_title);
    mn_rl_top_menu = (RelativeLayout) inflate.findViewById(R.id.mn_rl_top_menu);
    mn_player_rl_progress = (RelativeLayout) inflate.findViewById(R.id.mn_player_rl_progress);
    mn_player_iv_lock = (ImageView) inflate.findViewById(R.id.mn_player_iv_lock);
    mn_player_ll_error = (LinearLayout) inflate.findViewById(R.id.mn_player_ll_error);
    tv_error_content = (TextView) inflate.findViewById(R.id.tv_error_content);
    mn_player_ll_net = (LinearLayout) inflate.findViewById(R.id.mn_player_ll_net);
    mn_player_progressBar = (ProgressWheel) inflate.findViewById(R.id.mn_player_progressBar);
    mn_iv_battery = (ImageView) inflate.findViewById(R.id.mn_iv_battery);
    mn_player_iv_play_center = (ImageView) inflate.findViewById(R.id.mn_player_iv_play_center);
    mn_player_surface_bg = (LinearLayout) inflate.findViewById(R.id.mn_player_surface_bg);
    iv_video_thumbnail = (ImageView) inflate.findViewById(R.id.iv_video_thumbnail);

    mn_seekBar.setOnSeekBarChangeListener(this);
    mn_iv_play_pause.setOnClickListener(this);
    mn_iv_fullScreen.setOnClickListener(this);
    mn_iv_back.setOnClickListener(this);
    mn_player_iv_lock.setOnClickListener(this);
    mn_player_ll_error.setOnClickListener(this);
    mn_player_ll_net.setOnClickListener(this);
    mn_player_iv_play_center.setOnClickListener(this);

    //初始化
    initViews();

    if (!isFirstPlay) {
        mn_player_iv_play_center.setVisibility(View.VISIBLE);
        mn_player_progressBar.setVisibility(View.GONE);
    }

    //初始化SurfaceView
    initSurfaceView();

    //初始化手势
    initGesture();

    //存储控件的位置信息
    getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            if (playerViewW == 0) {
                mediaPlayerX = getX();
                mediaPlayerY = getY();
                playerViewW = getWidth();
                playerViewH = getHeight();
            }
        }
    });
}
 
Example 16
Source File: AdvSettingsActivity.java    From Android-Car-duino with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.advanced_settings);

    shared = PreferenceManager.getDefaultSharedPreferences(this);

    detector = new GestureDetector(this);

    //SEEK BARS
    kp = (SeekBar)findViewById(R.id.kp);
    kp.setMax(50);
    ((TextView)findViewById(R.id.progress1)).setText("kp value set to " + shared.getFloat("kp", progressValue));
    kp.setProgress((int) (shared.getFloat("kp", progressValue) *10));
    kp.setOnSeekBarChangeListener(this);

    ki = (SeekBar)findViewById(R.id.ki);
    ki.setMax(50);
    ((TextView)findViewById(R.id.progress2)).setText("ki value set to " + shared.getFloat("ki", progressValue));
    ki.setProgress((int) (shared.getFloat("ki", progressValue) *10));
    ki.setOnSeekBarChangeListener(this);

    kd = (SeekBar)findViewById(R.id.kd);
    kd.setMax(50);
    ((TextView)findViewById(R.id.progress3)).setText("kd value set to " + shared.getFloat("kd", progressValue));
    kd.setProgress((int) (shared.getFloat("kd", progressValue) *10));
    kd.setOnSeekBarChangeListener(this);

    smoothening = (SeekBar)findViewById(R.id.smoothening);
    smoothening.setMax(8); // values 0-8
    ((TextView)findViewById(R.id.progress4)).setText("Smoothening value set to " + shared.getFloat("smoothening", progressValue));
    smoothening.setProgress((int) (shared.getFloat("smoothening", progressValue)));
    smoothening.setOnSeekBarChangeListener(this);

    fragment = (SeekBar)findViewById(R.id.fragment);
    fragment.setMax(60); // values 15-60
    ((TextView)findViewById(R.id.progress5)).setText("Fragment distance value set to " + shared.getFloat("fragment", progressValue));
    fragment.setProgress((int) (shared.getFloat("fragment", progressValue)));
    fragment.setOnSeekBarChangeListener(this);

    leftIteration = (SeekBar)findViewById(R.id.leftIteration);
    leftIteration.setMax(15); // values 1-15
    ((TextView)findViewById(R.id.progress6)).setText("Left Iteration value set to " + shared.getFloat("leftIteration", progressValue));
    leftIteration.setProgress((int) (shared.getFloat("leftIteration", progressValue)));
    leftIteration.setOnSeekBarChangeListener(this);

    rightIteration = (SeekBar)findViewById(R.id.rightIteration);
    rightIteration.setMax(15); // values 1-15
    ((TextView)findViewById(R.id.progress7)).setText("Right Iteration value set to " + shared.getFloat("rightIteration", progressValue));
    rightIteration.setProgress((int) (shared.getFloat("rightIteration", progressValue)));
    rightIteration.setOnSeekBarChangeListener(this);

    angle = (SeekBar)findViewById(R.id.angle);
    angle.setMax(14); // values 0.4-1.4
    ((TextView)findViewById(R.id.progress8)).setText("Max angle value set to " + shared.getFloat("angle", progressValue));
    angle.setProgress((int) (shared.getFloat("angle", progressValue) *10));
    angle.setOnSeekBarChangeListener(this);
}
 
Example 17
Source File: MediaController.java    From imsdk-android with MIT License 4 votes vote down vote up
private void initControllerView(View v) {
    mPauseButton = v.findViewById(R.id.pause);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

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

    mRewButton = v.findViewById(R.id.rew);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(mRewListener);
        if (!mFromXml) {
            mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    // By default these are hidden. They will be enabled when setPrevNextListeners() is called
    mNextButton = v.findViewById(R.id.next);
    if (mNextButton != null && !mFromXml && !mListenersSet) {
        mNextButton.setVisibility(View.GONE);
    }
    mPrevButton = v.findViewById(R.id.prev);
    if (mPrevButton != null && !mFromXml && !mListenersSet) {
        mPrevButton.setVisibility(View.GONE);
    }

    mProgress = (SeekBar) v.findViewById(R.id.mediacontroller_progress);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
        }
        mProgress.setMax(1000);
    }

    mEndTime = v.findViewById(R.id.time);
    mCurrentTime = v.findViewById(R.id.time_current);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
    installPrevNextListeners();
}
 
Example 18
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 19
Source File: VideoControllerView.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
protected void initControllerView(View v) {
    mPauseButton = (ImageButton) v.findViewById(R.id.layout_media_pause);
    mPauseButton.setOnClickListener(mPauseListener);

    mCurrentTime = (TextView) v.findViewById(R.id.tv_media_time_current);
    mEndTime = (TextView) v.findViewById(R.id.tv_media_time);

    mVerticalProgress = (SeekBar) v.findViewById(R.id.media_controller_progress);
    mVerticalProgress.setOnSeekBarChangeListener(mSeekListener);
    mVerticalProgress.setMax(1000);

    mScreenChangeView = v.findViewById(R.id.ib_media_change_screen);
    mScreenChangeView.setOnClickListener(this);

    mButtonMall = v.findViewById(R.id.bt_media_mall);
    mButtonHy = v.findViewById(R.id.bt_media_huyu);
    mImageChange = v.findViewById(R.id.iv_media_change_screen);
    mButtonMall.setOnClickListener(this);
    mButtonHy.setOnClickListener(this);
    mImageChange.setOnClickListener(this);

    Group osGroup = (Group) v.findViewById(R.id.group_os_controller);

    switch (mVideoType) {
        case VIDEO_LIVE:
            osGroup.setVisibility(GONE);
            mButtonHy.setVisibility(GONE);
            break;
        case VIDEO_OS:
            mButtonMall.setVisibility(GONE);
            mImageChange.setVisibility(GONE);
            mButtonHy.setVisibility(GONE);
            break;
        case VIDEO_HY:
            osGroup.setVisibility(GONE);
            mImageChange.setVisibility(GONE);
            mScreenChangeView.setVisibility(GONE);
            break;
    }

    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
}
 
Example 20
Source File: UniversalMediaController.java    From LLApp with Apache License 2.0 4 votes vote down vote up
private void initControllerView(View v) {
    mTitleLayout = v.findViewById(R.id.title_part);
    mControlLayout = v.findViewById(R.id.control_layout);
    loadingLayout = (ViewGroup) v.findViewById(R.id.loading_layout);
    errorLayout = (ViewGroup) v.findViewById(R.id.error_layout);
    mTurnButton = (ImageButton) v.findViewById(R.id.turn_button);
    mScaleButton = (ImageButton) v.findViewById(R.id.scale_button);
    mCenterPlayButton = v.findViewById(R.id.center_play_btn);
    mBackButton = v.findViewById(R.id.back_btn);

    if (mTurnButton != null) {
        mTurnButton.requestFocus();
        mTurnButton.setOnClickListener(mPauseListener);
    }

    if (mScalable) {
        if (mScaleButton != null) {
            mScaleButton.setVisibility(VISIBLE);
            mScaleButton.setOnClickListener(mScaleListener);
        }
    } else {
        if (mScaleButton != null) {
            mScaleButton.setVisibility(GONE);
        }
    }

    if (mCenterPlayButton != null) {//重新开始播放
        mCenterPlayButton.setOnClickListener(mCenterPlayListener);
    }

    if (mBackButton != null) {//返回按钮仅在全屏状态下可见
        mBackButton.setOnClickListener(mBackListener);
    }

    View bar = v.findViewById(R.id.seekbar);
    mProgress = (ProgressBar) bar;
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
        }
        mProgress.setMax(1000);
    }

    mEndTime = (TextView) v.findViewById(R.id.duration);
    mCurrentTime = (TextView) v.findViewById(R.id.has_played);
    mTitle = (TextView) v.findViewById(R.id.title);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
}