Java Code Examples for android.widget.ImageButton#requestFocus()

The following examples show how to use android.widget.ImageButton#requestFocus() . 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: VideoControllerView.java    From VideoOS-Android-SDK with GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("WrongViewCast")
protected void initControllerView(View v) {
    mPauseButton = (ImageButton) v.findViewById(R.id.pause);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

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

    mEndTime = (TextView) v.findViewById(R.id.time);
    mCurrentTime = (TextView) v.findViewById(R.id.time_current);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
}
 
Example 2
Source File: MediaController.java    From Vitamio with Apache License 2.0 6 votes vote down vote up
private void initControllerView(View v) {
  mPauseButton = (ImageButton) v.findViewById(getResources().getIdentifier("mediacontroller_play_pause", "id", mContext.getPackageName()));
  if (mPauseButton != null) {
    mPauseButton.requestFocus();
    mPauseButton.setOnClickListener(mPauseListener);
  }

  mProgress = (SeekBar) v.findViewById(getResources().getIdentifier("mediacontroller_seekbar", "id", mContext.getPackageName()));
  if (mProgress != null) {
    if (mProgress instanceof SeekBar) {
      SeekBar seeker = (SeekBar) mProgress;
      seeker.setOnSeekBarChangeListener(mSeekListener);
    }
    mProgress.setMax(1000);
  }

  mEndTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_total", "id", mContext.getPackageName()));
  mCurrentTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_current", "id", mContext.getPackageName()));
  mFileName = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_file_name", "id", mContext.getPackageName()));
  if (mFileName != null)
    mFileName.setText(mTitle);
}
 
Example 3
Source File: MediaController.java    From NetEasyNews with GNU General Public License v3.0 6 votes vote down vote up
private void initControllerView(View v) {
  mPauseButton = (ImageButton) v.findViewById(getResources().getIdentifier("mediacontroller_play_pause", "id", mContext.getPackageName()));
  if (mPauseButton != null) {
    mPauseButton.requestFocus();
    mPauseButton.setOnClickListener(mPauseListener);
  }

  mProgress = (SeekBar) v.findViewById(getResources().getIdentifier("mediacontroller_seekbar", "id", mContext.getPackageName()));
  if (mProgress != null) {
    if (mProgress instanceof SeekBar) {
      SeekBar seeker = (SeekBar) mProgress;
      seeker.setOnSeekBarChangeListener(mSeekListener);
    }
    mProgress.setMax(1000);
  }

  mEndTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_total", "id", mContext.getPackageName()));
  mCurrentTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_current", "id", mContext.getPackageName()));
  mFileName = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_file_name", "id", mContext.getPackageName()));
  if (mFileName != null)
    mFileName.setText(mTitle);
}
 
Example 4
Source File: MediaController.java    From HPlayer with Apache License 2.0 6 votes vote down vote up
private void initControllerView(View v) {
  mPauseButton = (ImageButton) v.findViewById(getResources().getIdentifier("mediacontroller_play_pause", "id", mContext.getPackageName()));
  if (mPauseButton != null) {
    mPauseButton.requestFocus();
    mPauseButton.setOnClickListener(mPauseListener);
  }

  mProgress = (SeekBar) v.findViewById(getResources().getIdentifier("mediacontroller_seekbar", "id", mContext.getPackageName()));
  if (mProgress != null) {
    if (mProgress instanceof SeekBar) {
      SeekBar seeker = (SeekBar) mProgress;
      seeker.setOnSeekBarChangeListener(mSeekListener);
    }
    mProgress.setMax(1000);
  }

  mEndTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_total", "id", mContext.getPackageName()));
  mCurrentTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_current", "id", mContext.getPackageName()));
  mFileName = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_file_name", "id", mContext.getPackageName()));
  if (mFileName != null)
    mFileName.setText(mTitle);
}
 
Example 5
Source File: MediaController.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
private void initControllerView(View v) {
    mPauseButton = (ImageButton) v.findViewById(getResources().getIdentifier("mediacontroller_play_pause", "id", mContext.getPackageName()));
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

    mProgress = (SeekBar) v.findViewById(getResources().getIdentifier("mediacontroller_seekbar", "id", mContext.getPackageName()));
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
        }
        mProgress.setMax(1000);
    }

    mEndTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_total", "id", mContext.getPackageName()));
    mCurrentTime = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_time_current", "id", mContext.getPackageName()));
    mFileName = (TextView) v.findViewById(getResources().getIdentifier("mediacontroller_file_name", "id", mContext.getPackageName()));
    if (mFileName != null)
        mFileName.setText(mTitle);
}
 
Example 6
Source File: LocalServiceFragment.java    From android-tv-launcher with MIT License 5 votes vote down vote up
private void initView(View view) {

        tv = (ImageButton) view.findViewById(R.id.local_tv);
        tour = (ImageButton) view.findViewById(R.id.local_tour);
        ad1 = (ImageButton) view.findViewById(R.id.local_ad1);
        ad2 = (ImageButton) view.findViewById(R.id.local_ad2);
        cate = (ImageButton) view.findViewById(R.id.local_cate);
        weather = (ImageButton) view.findViewById(R.id.local_weather);
        news = (ImageButton) view.findViewById(R.id.local_news);
        appStore = (ImageButton) view.findViewById(R.id.local_app_store);
        video = (ImageButton) view.findViewById(R.id.local_video);

        tv.setOnFocusChangeListener(mFocusChangeListener);
        tour.setOnFocusChangeListener(mFocusChangeListener);
        ad1.setOnFocusChangeListener(mFocusChangeListener);
        ad2.setOnFocusChangeListener(mFocusChangeListener);
        cate.setOnFocusChangeListener(mFocusChangeListener);
        weather.setOnFocusChangeListener(mFocusChangeListener);
        news.setOnFocusChangeListener(mFocusChangeListener);
        appStore.setOnFocusChangeListener(mFocusChangeListener);
        video.setOnFocusChangeListener(mFocusChangeListener);

        tv.setOnClickListener(this);
        video.setOnClickListener(this);

        tv.setFocusable(true);
        tv.setFocusableInTouchMode(true);
        tv.requestFocus();
        tv.requestFocusFromTouch();
    }
 
Example 7
Source File: MediaControlView.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
private void initControllerView(View v) {
    mPauseButton = (ImageButton) v.findViewById(R.id.playBtn);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(this);
    }

    mFfwdButton = (ImageButton) v.findViewById(R.id.forwardBtn);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(this);
    }

    mRewButton = (ImageButton) v.findViewById(R.id.rewindBtn);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(this);
    }

    mProgress = (ProgressBar) v.findViewById(R.id.progressBar);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            DisplayUtils.colorPreLollipopHorizontalSeekBar(seeker);
            seeker.setOnSeekBarChangeListener(this);
        } else {
            DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgress);
        }
        mProgress.setMax(1000);
    }

    mEndTime = (TextView) v.findViewById(R.id.totalTimeText);
    mCurrentTime = (TextView) v.findViewById(R.id.currentTimeText);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());

}
 
Example 8
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 9
Source File: ControllerView.java    From ParsingPlayer with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void initView() {
    mPauseButton = (ImageButton) findViewById(R.id.pause);
    mProgress = (SeekBar) findViewById(R.id.mediacontroller_progress);
    mEndTime = (TextView) findViewById(R.id.time);
    mCurrentTime = (TextView) findViewById(R.id.time_current);
    mFullscreenButton = (ImageButton) findViewById(R.id.fullscreen);
    mPauseButton.requestFocus();
    mPauseButton.setOnClickListener(mPauseListener);
    mProgress.setOnSeekBarChangeListener(mSeekListener);
    mProgress.setMax(1000);
}
 
Example 10
Source File: SimpleMediaController.java    From ShareBox with Apache License 2.0 5 votes vote down vote up
private void initControllerView(View v) {
    mPauseButton = (ImageButton) v.findViewById(R.id.pause);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

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

    mEndTime = (TextView) v.findViewById(R.id.time);
    mCurrentTime = (TextView) v.findViewById(R.id.time_current);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());

    mDirectionView = (ImageButton) v.findViewById(R.id.sdk_media_controller_direction);
    mDirectionView.setOnClickListener(mDirectionListener);


    mControlsLayout = v.findViewById(R.id.sdk_media_controller_control);
    mSystemInfoLayout = v.findViewById(R.id.sdk_media_controller_panel);
}
 
Example 11
Source File: MainActivity.java    From ExoplayerExample with The Unlicense 5 votes vote down vote up
private void initPlayButton() {
    btnPlay = (ImageButton) findViewById(R.id.btnPlay);
    btnPlay.requestFocus();
    btnPlay.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setPlayPause(!isPlaying);
        }
    });
}
 
Example 12
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 13
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());
}
 
Example 14
Source File: CustomMediaController.java    From AndroidTvDemo with Apache License 2.0 4 votes vote down vote up
private void initControllerView(View v)
{
    mPauseButton = (ImageButton)v.findViewById(R.id.pause);
    if (mPauseButton != null)
    {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }
    
    mFfwdButton = (ImageButton)v.findViewById(R.id.ffwd);
    if (mFfwdButton != null)
    {
        mFfwdButton.setOnClickListener(mFfwdListener);
        if (!mFromXml)
        {
            mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }
    
    mRewButton = (ImageButton)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 = (ImageButton)v.findViewById(R.id.next);
    if (mNextButton != null && !mFromXml && !mListenersSet)
    {
        mNextButton.setVisibility(View.GONE);
    }
    mPrevButton = (ImageButton)v.findViewById(R.id.prev);
    if (mPrevButton != null && !mFromXml && !mListenersSet)
    {
        mPrevButton.setVisibility(View.GONE);
    }
    
    mSeekBar = (SeekBar)v.findViewById(R.id.mediacontroller_progress);
    if (mSeekBar != null)
    {
        if (mSeekBar instanceof SeekBar)
        {
            SeekBar seeker = (SeekBar)mSeekBar;
            seeker.setOnSeekBarChangeListener(mSeekListener);
        }
        mSeekBar.setMax(1000);
    }
    
    mEndTime = (TextView)v.findViewById(R.id.time);
    mCurrentTime = (TextView)v.findViewById(R.id.time_current);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
    
    installPrevNextListeners();
}
 
Example 15
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);
}
 
Example 16
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 17
Source File: MediaController.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
private void initControllerView() {
    mPauseButton = (ImageButton) findViewById(R.id.pause);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

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

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

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

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

    mEndTime = (TextView) findViewById(R.id.time);
    mCurrentTime = (TextView) findViewById(R.id.time_current);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());

    installPrevNextListeners();
}
 
Example 18
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 19
Source File: MediaController.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void initControllerView() {
    mPauseButton = (ImageButton) findViewById(R.id.pause);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();
        mPauseButton.setOnClickListener(mPauseListener);
    }

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

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

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

    mProgressGroup = (ViewGroup) findViewById(R.id.mediacontroller_progress_container);

    if (mProgressGroup != null) {
        mProgressBar = (SeekBar) mProgressGroup.findViewById(R.id.mediacontroller_progress_bar);
        if (mProgressBar != null) {
            mProgressBar.setOnSeekBarChangeListener(mSeekListener);
            mProgressBar.setMax(1000);
        }
    }

    mEndTime = (TextView) findViewById(R.id.time);
    mCurrentTime = (TextView) findViewById(R.id.time_current);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());

    installPrevNextListeners();
}
 
Example 20
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);
}