Back to project page NativeVideoPlayerComponent.
The source code is released under:
MIT License
If you think the Android project NativeVideoPlayerComponent listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.anchorer.videoplayer; /*from w w w . j a v a2s . c om*/ import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.SeekBar; import android.widget.TextView; import java.util.ArrayList; import java.util.List; /** * VideoView???????????????????????????UI??????????? * ??????????????? * {@link #pauseButton} ??/?????? * {@link #startResId} ??ICON???ID * {@link #pauseButton} ????ICON???ID * {@link #stopButton} ???????? * {@link #totalTimeView} ????? * {@link #currentTimeView} ??????? * {@link #seekbar} ????? * {@link #titleView} ???? * {@link #fullScreenButton} ????? * {@link #fullscreenResId} ???ICON???ID * {@link #unfullscreenResId} ???????ICON???ID * {@link #nextButton} ????? * {@link #preButton} ????? * * Created by Anchorer on 2014/8/12. */ public class BaseMediaControllerHolder { public View parentLayout; //??? public ImageButton pauseButton; //??/?????? public ImageButton stopButton; //?????? public TextView totalTimeView; //????? public TextView currentTimeView; //??????? public SeekBar seekbar; //????? public TextView titleView; //???? public ImageButton fullScreenButton; //????? public ImageButton nextButton; //????? public ImageButton preButton; //????? public ImageButton forwardButton; //???? public ImageButton backwardButton; //?????? public ImageButton likeButton ; // ??? public ImageView imageViewBack ; //?????? public ImageView imageViewShare ;// ?? public int startResId; //?????????ID public int pauseResId; //???????????ID public int fullscreenResId; //??????????ID public int unfullscreenResId; //??????????????ID private boolean hasStopped; //???????????????????????????????????? private List<View> views; //??????????????????????????? public BaseMediaControllerHolder() {} /** * ?????????? * @param visibility ???????? */ public void setVisibility(int visibility) { if(parentLayout != null) parentLayout.setVisibility(visibility); if(pauseButton != null) pauseButton.setVisibility(visibility); if(totalTimeView != null) totalTimeView.setVisibility(visibility); if(currentTimeView != null) currentTimeView.setVisibility(visibility); if(seekbar != null) seekbar.setVisibility(visibility); if(titleView != null) titleView.setVisibility(visibility); if(fullScreenButton != null) fullScreenButton.setVisibility(visibility); if(stopButton != null) stopButton.setVisibility(visibility); if(nextButton != null) nextButton.setVisibility(visibility); if(preButton != null) preButton.setVisibility(visibility); if(views != null) { for (View view : views) { if (view != null) view.setVisibility(visibility); } } } public void setPauseButton(ImageButton pauseButton) { this.pauseButton = pauseButton; } public void setTotalTimeView(TextView totalTimeView) { this.totalTimeView = totalTimeView; } public void setCurrentTimeView(TextView currentTimeView) { this.currentTimeView = currentTimeView; } public void setProgress(SeekBar seekbar) { this.seekbar = seekbar; } public void setTitleView(TextView titleView) { this.titleView = titleView; } public void setFullScreenButton(ImageButton fullScreenButton) { this.fullScreenButton = fullScreenButton; } public void setParentLayout(View parentLayout) { this.parentLayout = parentLayout; } public void setStopButton(ImageButton stopButton) { this.stopButton = stopButton; } public void setNextButton(ImageButton nextButton) { this.nextButton = nextButton; } public void setPreButton(ImageButton preButton) { this.preButton = preButton; } public void setStartResId(int startResId) { this.startResId = startResId; } public void setSeekbar(SeekBar seekbar) { this.seekbar = seekbar; } public void setPauseResId(int pauseResId) { this.pauseResId = pauseResId; } public void setHasStopped(boolean hasStopped) { this.hasStopped = hasStopped; } public boolean isHasStopped() { return hasStopped; } public void addCustomView(View view) { if(views == null) views = new ArrayList<View>(); views.add(view); } public void setFileNameText(String title) { if(titleView != null) titleView.setText(title); } public void setEndTimeText(String totalTime) { if (totalTimeView != null) totalTimeView.setText(totalTime); } public void setCurrentTimeText(String currentTime) { if(currentTimeView != null) currentTimeView.setText(currentTime); } public void pauseButtonRequestFocus() { if (pauseButton != null) pauseButton.requestFocus(); } public void setProgress(int progress) { if (seekbar != null) seekbar.setProgress(progress); } public void setSecondaryProgress(int secondaryProgress) { if (seekbar != null) seekbar.setSecondaryProgress(secondaryProgress); } /** * ???/????????ICON?? * @param isPlaying ???????? */ public void setPauseButtonImage(boolean isPlaying) { if(pauseButton != null) { if(isPlaying) pauseButton.setImageResource(pauseResId); else pauseButton.setImageResource(startResId); } } public void setPauseButtonEnabled(boolean enabled) { if(pauseButton != null) pauseButton.setEnabled(enabled); } public void setSeekbarEnabled(boolean enabled) { if(seekbar != null) seekbar.setEnabled(enabled); } public void setOnFullScreenListener(View.OnClickListener l) { if(fullScreenButton != null) fullScreenButton.setOnClickListener(l); } public void setOnPauseListener(View.OnClickListener l) { if(pauseButton != null) pauseButton.setOnClickListener(l); } public void setOnStopListener(View.OnClickListener l) { if(stopButton != null) stopButton.setOnClickListener(l); } public void setOnPreListener(View.OnClickListener l) { if(preButton != null) preButton.setOnClickListener(l); } public void setOnNextListener(View.OnClickListener l) { if(nextButton != null) nextButton.setOnClickListener(l); } }