@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;
   }
 }
Beispiel #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);
   }
 }
Beispiel #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);
 }