From 249aa372b752412b442a82b0b7e9d592044445cf Mon Sep 17 00:00:00 2001 From: Thetutlage Date: Sun, 13 Jan 2013 00:37:16 +0530 Subject: [PATCH 1/2] Update README.rst Added little more description about what's changed in the source code and now the activity will support loading video dialog box as well --- README.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.rst b/README.rst index 786c612..c998723 100644 --- a/README.rst +++ b/README.rst @@ -3,6 +3,21 @@ Android video stream rotation ============================= :author: Grzegorz Adam Hankiewicz +:edited: Aman Virk + +============================= +Added Support For Loading Video Dialog +============================= + +Since Adam did the nice job by setting up an video player which takes care of screen orientation , i thought of adding +support of loading video dialog which shows the user a dialog saying "Loading video" instead of a blank screen. + +What's Changed +============== + + Changes are only inside "HelloInterruptVideoStream.java" file. +======= + .. contents:: From ac9afd9a8db02800a99104df023f54ae5a7eea54 Mon Sep 17 00:00:00 2001 From: Thetutlage Date: Sun, 13 Jan 2013 00:38:58 +0530 Subject: [PATCH 2/2] Update src/com/elhaso/tutinterruptvideostream/HelloInterruptVideoStream.java Updated activity to show a dialog while we are busy loading video instead of showing a blank screen. --- .../HelloInterruptVideoStream.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/com/elhaso/tutinterruptvideostream/HelloInterruptVideoStream.java b/src/com/elhaso/tutinterruptvideostream/HelloInterruptVideoStream.java index d219d68..56a26d8 100644 --- a/src/com/elhaso/tutinterruptvideostream/HelloInterruptVideoStream.java +++ b/src/com/elhaso/tutinterruptvideostream/HelloInterruptVideoStream.java @@ -1,11 +1,13 @@ package com.elhaso.tutinterruptvideostream; import android.app.Activity; +import android.app.ProgressDialog; import android.content.res.Configuration; import android.media.MediaPlayer; import android.media.MediaPlayer.OnPreparedListener; import android.media.MediaPlayer.OnVideoSizeChangedListener; import android.net.Uri; +import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.Display; @@ -23,30 +25,35 @@ public class HelloInterruptVideoStream extends Activity private int screen_width, screen_height; private int media_width, media_height; private boolean landscape; - + ProgressDialog progressDialog; + /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); - + setOnLoadVideo(); + } + + public void setOnLoadVideo(){ getWindow().clearFlags(WindowManager .LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); - + // Get the size of the device, will be our maximum. + progressDialog = ProgressDialog.show(HelloInterruptVideoStream.this, "Loading","Loading video .... ", true); Display display = getWindowManager().getDefaultDisplay(); screen_width = display.getWidth(); screen_height = display.getHeight(); - + video_view = (VideoViewCustom)findViewById(R.id.surface_view); - video_view.setOnPreparedListener(this); + video_view.setOnPreparedListener(HelloInterruptVideoStream.this); resize(); - + video_view.setVideoURI(Uri.parse(path)); - video_view.setMediaController(new MediaController(this)); + video_view.setMediaController(new MediaController(HelloInterruptVideoStream.this)); video_view.requestFocus(); } @@ -59,7 +66,6 @@ public void onCreate(Bundle savedInstanceState) public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - landscape = (Configuration.ORIENTATION_LANDSCAPE == newConfig.orientation); resize(); @@ -119,6 +125,7 @@ public void onPrepared(MediaPlayer mp) // Yuck, no sizes yet? Register a callback. mp.setOnVideoSizeChangedListener(this); } + progressDialog.dismiss(); } /** Called when the media player knows the video size.