Java 类com.google.android.exoplayer.text.SubtitleView 实例源码

项目:android_packages_apps_tv    文件:CaptionWindowLayout.java   
public CaptionWindowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    // Add a subtitle view to the layout.
    mSubtitleView = new SubtitleView(context);
    LayoutParams params = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    addView(mSubtitleView, params);

    // Set the system wide cc preferences to the subtitle view.
    CaptioningManager captioningManager =
            (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE);
    mFontScale = captioningManager.getFontScale();
    mCaptionStyleCompat =
            CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle());
    mSubtitleView.setStyle(mCaptionStyleCompat);
    mSubtitleView.setText("");
    captioningManager.addCaptioningChangeListener(new SystemWideCaptioningChangeListener());
    updateWidestChar();
}
项目:android-exoplayer    文件:FullPlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  Intent intent = getIntent();
  contentUri = intent.getData();
  contentType = intent.getIntExtra(DemoUtil.CONTENT_TYPE_EXTRA, DemoUtil.TYPE_OTHER);
  contentId = intent.getStringExtra(DemoUtil.CONTENT_ID_EXTRA);

  setContentView(R.layout.player_activity_full);
  View root = findViewById(R.id.root);
  root.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View arg0, MotionEvent arg1) {
      if (arg1.getAction() == MotionEvent.ACTION_DOWN) {
        toggleControlsVisibility();
      }
      return true;
    }
  });

  shutterView = findViewById(R.id.shutter);
  debugRootView = findViewById(R.id.controls_root);

  surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
  surfaceView.getHolder().addCallback(this);
  debugTextView = (TextView) findViewById(R.id.debug_text_view);

  playerStateTextView = (TextView) findViewById(R.id.player_state_view);
  subtitleView = (SubtitleView) findViewById(R.id.subtitles);

  mediaController = new MediaController(this);
  mediaController.setAnchorView(root);
  retryButton = (Button) findViewById(R.id.retry_button);
  retryButton.setOnClickListener(this);
  videoButton = (Button) findViewById(R.id.video_controls);
  audioButton = (Button) findViewById(R.id.audio_controls);
  textButton = (Button) findViewById(R.id.text_controls);

  DemoUtil.setDefaultCookieManager();
}
项目:Exoplayer_VLC    文件:PlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  Intent intent = getIntent();
  contentUri = intent.getData();
  contentType = intent.getIntExtra(CONTENT_TYPE_EXTRA, DemoUtil.TYPE_OTHER);
  contentId = intent.getStringExtra(CONTENT_ID_EXTRA);

  setContentView(R.layout.player_activity);
  View root = findViewById(R.id.root);
  root.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
        toggleControlsVisibility();
      } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
        view.performClick();
      }
      return true;
    }
  });

  shutterView = findViewById(R.id.shutter);
  debugRootView = findViewById(R.id.controls_root);

  surfaceView = ( SurfaceView) findViewById(R.id.surface_view);
  surfaceView.getHolder().addCallback(this);
  debugTextView = (TextView) findViewById(R.id.debug_text_view);

  playerStateTextView = (TextView) findViewById(R.id.player_state_view);
  subtitleView = (SubtitleView) findViewById(R.id.subtitles);

  mediaController = new MediaController(this);
  mediaController.setAnchorView(root);
  retryButton = (Button) findViewById(R.id.retry_button);
  retryButton.setOnClickListener(this);
  videoButton = (Button) findViewById(R.id.video_controls);
  audioButton = (Button) findViewById(R.id.audio_controls);
  textButton = (Button) findViewById(R.id.text_controls);

  DemoUtil.setDefaultCookieManager();

}