@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == VIEW_REQUEST_CODE && resultCode == RESULT_OK) { // Note note = (Note) data.getSerializableExtra("request_note"); mNote = (Note) data.getSerializableExtra("request_note"); tvTitle.setText(mNote.getTitle()); tvContent.setText(mNote.getContent()); tvViewCategory.setText(mNote.getCategory()); String imagePath = mNote.getImagePath(); // System.out.println("imagePath: " + imagePath); if (!TextUtils.isEmpty(imagePath)) { BitmapUtils bitmapUtils = new BitmapUtils(this); bitmapUtils.display(ivShowPhoto, imagePath); ivShowPhoto.setVisibility(View.VISIBLE); } String videoPath = mNote.getVideoPath(); if (!TextUtils.isEmpty(videoPath)) { vvViewVideo.setVideoURI(Uri.parse(videoPath)); vvViewVideo.setVisibility(View.VISIBLE); if (!vvViewVideo.isPlaying()) { vvViewVideo.start(); } } } }
private void initViews() { tvTitle = (TextView) findViewById(R.id.tvTitle); tvTitle.setText(mNote.getTitle()); tvViewCategory = (TextView) findViewById(R.id.tvViewCategory); tvViewCategory.setText(mNote.getCategory()); tvContent = (TextView) findViewById(R.id.tvContent); tvContent.setText(mNote.getContent()); ivShowPhoto = (ImageView) findViewById(R.id.ivShowPhoto); String imagePath = mNote.getImagePath(); if (!TextUtils.isEmpty(imagePath)) { BitmapUtils bitmapUtils = new BitmapUtils(this); bitmapUtils.display(ivShowPhoto, imagePath); ivShowPhoto.setVisibility(View.VISIBLE); } vvViewVideo = (VideoView) findViewById(R.id.vvViewVideo); String videoPath = mNote.getVideoPath(); if (!TextUtils.isEmpty(videoPath)) { vvViewVideo.setVideoURI(Uri.parse(videoPath)); vvViewVideo.setVisibility(View.VISIBLE); if (!vvViewVideo.isPlaying()) { vvViewVideo.start(); } } }
@Override public void onPlayPause() { if (mVideoView.isPlaying()) { pauseVideo(); } else { playVideo(); } }
void stopAll() { if (videoView.isPlaying()) { videoView.stopPlayback(); } if (voiceDispatcher != null) voiceDispatcher.stop(); if (sourceDispatcher != null) sourceDispatcher.stop(); }
@Override public void onPause() { super.onPause(); if (mVideoView.isPlaying()) { if (!requestVisibleBehind(true)) { // Try to play behind launcher, but if it fails, stop playback. stopPlayback(); } } else { requestVisibleBehind(false); } }
@Override public void handleMessage(Message msg) { if (mVideoView == null) return; try { if (mVideoView.isPlaying()) { mPlayProgressBar.setProgress(mVideoView.getCurrentPosition()); mProgressHandler2.sendEmptyMessageDelayed(0, 100); } } catch (IllegalStateException e) { } catch (Exception e) { } }
public void run() { if (seekBar != null) { int percents = (int) (1000 * (float) videoView.getCurrentPosition() / (float) videoView.getDuration()); seekBar.setProgress(percents); setTimeText(); } if (videoView.isPlaying()) { seekBar.postDelayed(onEveryHalfSecond, 500); } }
// SeekBar의 터치 종료 @Override public void onStopTrackingTouch(SeekBar seekBar) { try { if (mStat == 0) { if (mMediaPlayer.isPlaying()) { mMediaPlayer.start(); } } else { if (mVideoView.isPlaying()) { mVideoView.start(); } } // Toast.makeText(getApplicationContext(), "터치종료", Toast.LENGTH_SHORT).show(); } catch (Exception e) { } }