Commit 5d45288b authored by Vance Turnewitsch's avatar Vance Turnewitsch

Issue 258 -- FixFullScreenVideo -- Initial Commit

The use of onShow in the FullScreenVideoUtil
has been replaced with the  use of onStart. The exact code
called in the onShow method is now called in
onStart so that older versions of Android will not generate
errors when trying to access the classes associated with
onShow.

Change-Id: I3d8a607f7b8958d63e7319c0ca87f918f632049b
parent 6aea3bad
...@@ -11,8 +11,6 @@ import com.google.appinventor.components.runtime.util.SdkLevel; ...@@ -11,8 +11,6 @@ import com.google.appinventor.components.runtime.util.SdkLevel;
import android.R; import android.R;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnShowListener;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnPreparedListener; import android.media.MediaPlayer.OnPreparedListener;
...@@ -37,7 +35,7 @@ import java.io.IOException; ...@@ -37,7 +35,7 @@ import java.io.IOException;
* @author Vance Turnewitsch * @author Vance Turnewitsch
*/ */
public class FullScreenVideoUtil implements OnCompletionListener, public class FullScreenVideoUtil implements OnCompletionListener,
OnPreparedListener, OnShowListener { OnPreparedListener {
// Constants // Constants
public static final int FULLSCREEN_VIDEO_DIALOG_FLAG = 189; public static final int FULLSCREEN_VIDEO_DIALOG_FLAG = 189;
...@@ -118,6 +116,12 @@ public class FullScreenVideoUtil implements OnCompletionListener, ...@@ -118,6 +116,12 @@ public class FullScreenVideoUtil implements OnCompletionListener,
mFullScreenPlayer.fullScreenKilled(values); mFullScreenPlayer.fullScreenKilled(values);
super.onBackPressed(); super.onBackPressed();
} }
public void onStart() {
super.onStart();
// Prepare the Dialog media.
startDialog();
}
}; };
} else { } else {
mFullScreenVideoDialog = new Dialog(mForm, mFullScreenVideoDialog = new Dialog(mForm,
...@@ -133,6 +137,12 @@ public class FullScreenVideoUtil implements OnCompletionListener, ...@@ -133,6 +137,12 @@ public class FullScreenVideoUtil implements OnCompletionListener,
mFullScreenPlayer.fullScreenKilled(values); mFullScreenPlayer.fullScreenKilled(values);
super.onStop(); super.onStop();
} }
public void onStart() {
super.onStart();
// Prepare the Dialog media.
startDialog();
}
}; };
} }
} }
...@@ -350,7 +360,6 @@ public class FullScreenVideoUtil implements OnCompletionListener, ...@@ -350,7 +360,6 @@ public class FullScreenVideoUtil implements OnCompletionListener,
* The dialog that will display the video. * The dialog that will display the video.
*/ */
public void prepareFullScreenVideoDialog(Dialog dia) { public void prepareFullScreenVideoDialog(Dialog dia) {
dia.setOnShowListener(this);
mFullScreenVideoView.setOnPreparedListener(this); mFullScreenVideoView.setOnPreparedListener(this);
mFullScreenVideoView.setOnCompletionListener(this); mFullScreenVideoView.setOnCompletionListener(this);
} }
...@@ -444,8 +453,7 @@ public class FullScreenVideoUtil implements OnCompletionListener, ...@@ -444,8 +453,7 @@ public class FullScreenVideoUtil implements OnCompletionListener,
/** /**
* Called when the Dialog is about to be shown. * Called when the Dialog is about to be shown.
*/ */
@Override public void startDialog() {
public void onShow(DialogInterface arg0) {
try { try {
MediaUtil.loadVideoView(mFullScreenVideoView, mForm, MediaUtil.loadVideoView(mFullScreenVideoView, mForm,
mFullScreenVideoBundle mFullScreenVideoBundle
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment