Skip to content

Commit

Permalink
Merge pull request #78 from tachang/release/0.3.0b
Browse files Browse the repository at this point in the history
Make preview work and add onClickVideoFrame callback
  • Loading branch information
afollestad authored Dec 27, 2016
2 parents 8931c2c + 90850c7 commit 1feac5e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ public interface EasyVideoCallback {
void onRetry(EasyVideoPlayer player, Uri source);

void onSubmit(EasyVideoPlayer player, Uri source);

void onClickVideoFrame(EasyVideoPlayer player);
}
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,15 @@ public boolean onError(MediaPlayer mediaPlayer, int what, int extra) {
protected void onFinishInflate() {
super.onFinishInflate();

if(isInEditMode()) {
return;
}

setKeepScreenOn(true);

mHandler = new Handler();
mPlayer = new MediaPlayer();

mPlayer.setOnPreparedListener(this);
mPlayer.setOnBufferingUpdateListener(this);
mPlayer.setOnCompletionListener(this);
Expand Down Expand Up @@ -814,6 +819,9 @@ protected void onFinishInflate() {
ViewGroup.LayoutParams.WRAP_CONTENT);
controlsLp.gravity = Gravity.BOTTOM;
addView(mControlsFrame, controlsLp);

final EasyVideoPlayer easyVideoPlayer = this;

if (mControlsDisabled) {
mClickFrame.setOnClickListener(null);
mControlsFrame.setVisibility(View.GONE);
Expand All @@ -822,6 +830,7 @@ protected void onFinishInflate() {
@Override
public void onClick(View view) {
toggleControls();
mCallback.onClickVideoFrame(easyVideoPlayer);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,10 @@ public void onRetry(EasyVideoPlayer player, Uri source) {
public void onSubmit(EasyVideoPlayer player, Uri source) {
Toast.makeText(this, "Submit", Toast.LENGTH_SHORT).show();
}

@Override
public void onClickVideoFrame(EasyVideoPlayer player) {
Toast.makeText(this, "Click video frame.", Toast.LENGTH_SHORT).show();

}
}

0 comments on commit 1feac5e

Please sign in to comment.