當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageButton.requestFocus方法代碼示例

本文整理匯總了Java中android.widget.ImageButton.requestFocus方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageButton.requestFocus方法的具體用法?Java ImageButton.requestFocus怎麽用?Java ImageButton.requestFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageButton的用法示例。


在下文中一共展示了ImageButton.requestFocus方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initControllerView

import android.widget.ImageButton; //導入方法依賴的package包/類
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);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:23,代碼來源:MediaController.java

示例2: initControllerView

import android.widget.ImageButton; //導入方法依賴的package包/類
private void initControllerView(View v) {

    mPauseButton = (ImageButton) v.findViewById(R.id.media_controller_play_pause);
    mTvPlay = (ImageView) v.findViewById(R.id.media_controller_tv_play);
    if (mPauseButton != null && mTvPlay != null) {
      mPauseButton.requestFocus();
      mPauseButton.setOnClickListener(mPauseListener);
      mTvPlay.requestFocus();
      mTvPlay.setOnClickListener(v13 -> {
        doPauseResume();
        show(sDefaultTimeout);
      });
    }

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

    mEndTime = (TextView) v.findViewById(R.id.media_controller_time_total);
    mCurrentTime = (TextView) v
        .findViewById(R.id.media_controller_time_current);
    mTitleView = (TextView) v.findViewById(R.id.media_controller_title);
    if (mTitleView != null) {
      mTitleView.setText(mTitle);
    }

    LinearLayout mDanmakuLayout = (LinearLayout) v.findViewById(
        R.id.media_controller_danmaku_layout);
    ImageView mDanmakuImage = (ImageView) v.findViewById(R.id.media_controller_danmaku_switch);
    TextView mDanmakuText = (TextView) v.findViewById(R.id.media_controller_danmaku_text);
    mDanmakuLayout.setOnClickListener(v1 -> {

      if (mDanmakuShow) {
        mDanmakuImage.setImageResource(R.drawable.bili_player_danmaku_is_open);
        mDanmakuText.setText("彈幕開");
        mDanmukuSwitchListener.setDanmakushow(true);
        mDanmakuShow = false;
      } else {
        mDanmakuImage.setImageResource(R.drawable.bili_player_danmaku_is_closed);
        mDanmakuText.setText("彈幕關");
        mDanmukuSwitchListener.setDanmakushow(false);
        mDanmakuShow = true;
      }
    });

    mBack = (ImageView) v.findViewById(R.id.media_controller_back);
    mBack.setOnClickListener(v12 -> mVideoBackListener.back());
  }
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:55,代碼來源:MediaController.java

示例3: initView

import android.widget.ImageButton; //導入方法依賴的package包/類
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();
    }
 
開發者ID:Evan-Galvin,項目名稱:FreeStreams-TVLauncher,代碼行數:31,代碼來源:LocalServiceFragment.java

示例4: initView

import android.widget.ImageButton; //導入方法依賴的package包/類
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);
}
 
開發者ID:TedaLIEz,項目名稱:ParsingPlayer,代碼行數:12,代碼來源:ControllerView.java

示例5: initControllerView

import android.widget.ImageButton; //導入方法依賴的package包/類
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);
}
 
開發者ID:pili-engineering,項目名稱:PLDroidShortVideo,代碼行數:47,代碼來源:MediaController.java

示例6: initControllerView

import android.widget.ImageButton; //導入方法依賴的package包/類
private void initControllerView(View view) {
    mIbPause = (ImageButton) view.findViewById(R.id.media_controller_play_pause);
    mTvPlay = (ImageView) view.findViewById(R.id.media_controller_tv_play);
    if (mIbPause != null && mTvPlay != null){
        mIbPause.requestFocus();
        mTvPlay.setOnClickListener(v -> {
            doPauseResume();
            show(sDefaultTimeout);
        });
    }

    mProgressBar = (SeekBar) view.findViewById(R.id.media_controller_seekbar);
    if (mProgressBar != null){
        if (mProgressBar instanceof SeekBar){
            SeekBar seekBar = (SeekBar) mProgressBar;
            seekBar.setOnSeekBarChangeListener(mSeekBarChangeListener);
            seekBar.setThumbOffset(1);
        }
        mProgressBar.setMax(1000);
    }

    mEndTime = (TextView) view.findViewById(R.id.media_controller_time_total);
    mCurrentTime = (TextView) view.findViewById(R.id.media_controller_time_current);
    mTitleView = (TextView) view.findViewById(R.id.media_controller_title);
    if (mTitleView != null)
        mTitleView.setText(mTitle);

    LinearLayout llDanmuku = (LinearLayout) view.findViewById(R.id.media_controller_danmaku_layout);
    ImageView ivDanmuku = (ImageView) view.findViewById(R.id.media_controller_danmaku_switch);
    TextView tvDanmuku = (TextView) view.findViewById(R.id.media_controller_danmaku_text);
    llDanmuku.setOnClickListener(v -> {
        if (mDanmakuShow){
            ivDanmuku.setImageResource(R.drawable.bili_player_danmaku_is_open);
            tvDanmuku.setText("彈幕開");
            mDanmakuSwitchListener.setDanmakuShow(true);
            mDanmakuShow = false;
        } else {
            ivDanmuku.setImageResource(R.drawable.bili_player_danmaku_is_closed);
            tvDanmuku.setText("彈幕關");
            mDanmakuSwitchListener.setDanmakuShow(false);
            mDanmakuShow = true;
        }
    });

    mIvBack = (ImageView) view.findViewById(R.id.media_controller_back);
    mIvBack.setOnClickListener(v -> mVideoBackListener.back());
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:48,代碼來源:MediaController.java

示例7: initControllerView

import android.widget.ImageButton; //導入方法依賴的package包/類
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();
}
 
開發者ID:Dreamxiaoxuan,項目名稱:AndroidTvDemo,代碼行數:60,代碼來源:CustomMediaController.java

示例8: initCtrlView

import android.widget.ImageButton; //導入方法依賴的package包/類
private void initCtrlView(View v) {

            mBtnPause = (ImageButton) v.findViewById(R.id.pause);
            if (mBtnPause != null) {
                mBtnPause.requestFocus();
                mBtnPause.setOnClickListener(mPauseListener);
            }

            mBtnFullscreen = (ImageButton) v.findViewById(R.id.fullscreen);
            if (mBtnFullscreen != null) {
                mBtnFullscreen.requestFocus();
                mBtnFullscreen.setOnClickListener(mFullscreenListener);
            }

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

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

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

            mBtnPrev = (ImageButton) v.findViewById(R.id.prev);
            if (mBtnPrev != null && !mFromXml && !mIsListenersSet) {
                mBtnPrev.setVisibility(View.GONE);
            }

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

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

            installPrevNextListeners();
        }
 
開發者ID:natjs,項目名稱:nat-media-video,代碼行數:55,代碼來源:Controller.java


注:本文中的android.widget.ImageButton.requestFocus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。