Exemplo n.º 1
0
 @Override
 public void handleMessage(Message msg) {
   data = msg.getData();
   switch (msg.what) {
     case SUBTITLE_TEXT:
       if (oldType != SUBTITLE_TEXT) {
         mSubtitleImage.setVisibility(View.GONE);
         mSubtitleText.setVisibility(View.VISIBLE);
         oldType = SUBTITLE_TEXT;
       }
       text = data.getString(VP.SUB_TEXT_KEY);
       mSubtitleText.setText(text == null ? "" : text.trim());
       break;
     case SUBTITLE_BITMAP:
       if (oldType != SUBTITLE_BITMAP) {
         mSubtitleText.setVisibility(View.GONE);
         mSubtitleImage.setVisibility(View.VISIBLE);
         oldType = SUBTITLE_BITMAP;
       }
       pixels = data.getByteArray(VP.SUB_PIXELS_KEY);
       if (bm == null
           || width != data.getInt(VP.SUB_WIDTH_KEY)
           || height != data.getInt(VP.SUB_HEIGHT_KEY)) {
         width = data.getInt(VP.SUB_WIDTH_KEY);
         height = data.getInt(VP.SUB_HEIGHT_KEY);
         bm = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
       }
       if (pixels != null) bm.copyPixelsFromBuffer(ByteBuffer.wrap(pixels));
       mSubtitleImage.setImageBitmap(bm);
       break;
   }
 }
Exemplo n.º 2
0
 @Override
 public void onStartTrackingTouch(SeekBar bar) {
   mDragging = true;
   show(3600000);
   mHandler.removeMessages(SHOW_PROGRESS);
   if (mInstantSeeking) mAM.setStreamMute(AudioManager.STREAM_MUSIC, true);
   if (mInfoView != null) {
     mInfoView.setText("");
     mInfoView.setVisibility(View.VISIBLE);
   }
 }
Exemplo n.º 3
0
 @Override
 public void onStopTrackingTouch(SeekBar bar) {
   if (!mInstantSeeking) mPlayer.seekTo((mDuration * bar.getProgress()) / 1000);
   if (mInfoView != null) {
     mInfoView.setText("");
     mInfoView.setVisibility(View.GONE);
   }
   show(sDefaultTimeout);
   mHandler.removeMessages(SHOW_PROGRESS);
   mAM.setStreamMute(AudioManager.STREAM_MUSIC, false);
   mDragging = false;
   mHandler.sendEmptyMessageDelayed(SHOW_PROGRESS, 1000);
 }
Exemplo n.º 4
0
        @Override
        public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
          if (!fromuser) return;

          long newposition = (mDuration * progress) / 1000;
          String time = StringUtils.generateTime(newposition);
          if (mInstantSeeking) mPlayer.seekTo(newposition);
          if (mInfoView != null) mInfoView.setText(time);
          if (mCurrentTime != null) mCurrentTime.setText(time);
        }
Exemplo n.º 5
0
 private void setTextViewStyle(OutlineTextView v) {
   v.setTextColor(VP.DEFAULT_SUB_COLOR);
   v.setTypeface(VP.getTypeface(VP.DEFAULT_TYPEFACE_INT), VP.DEFAULT_SUB_STYLE);
   v.setShadowLayer(VP.DEFAULT_SUB_SHADOWRADIUS, 0, 0, VP.DEFAULT_SUB_SHADOWCOLOR);
 }