diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/panorama/Mosaic.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/panorama/MosaicFrameProcessor.java | 4 | ||||
-rw-r--r-- | src/com/android/camera/panorama/PanoramaActivity.java | 34 |
3 files changed, 45 insertions, 2 deletions
diff --git a/src/com/android/camera/panorama/Mosaic.java b/src/com/android/camera/panorama/Mosaic.java index 80e8263..ef9d367 100644 --- a/src/com/android/camera/panorama/Mosaic.java +++ b/src/com/android/camera/panorama/Mosaic.java @@ -156,4 +156,13 @@ public class Mosaic { * Also re-initializes the native mosaic object to make it ready for capturing a new mosaic. */ public native void reset(); + + /** + * Get the progress status of the mosaic computation process. + * @param hires Boolean flag to select whether to report progress of the + * low-res or high-res mosaicer. + * @return Returns a number from 0-100 where 50 denotes that the mosaic + * computation is 50% done. + */ + public native int reportProgress(boolean hires); } diff --git a/src/com/android/camera/panorama/MosaicFrameProcessor.java b/src/com/android/camera/panorama/MosaicFrameProcessor.java index bc7a5a2..2e077fa 100644 --- a/src/com/android/camera/panorama/MosaicFrameProcessor.java +++ b/src/com/android/camera/panorama/MosaicFrameProcessor.java @@ -78,6 +78,10 @@ public class MosaicFrameProcessor { mProgressListener = listener; } + public int reportProgress(boolean hires) { + return mMosaicer.reportProgress(hires); + } + public void initialize() { setupMosaicer(mPreviewWidth, mPreviewHeight, mPreviewBufferSize); reset(); diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index a36ebc5..4edccd9 100644 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -36,12 +36,12 @@ import android.graphics.Rect; import android.graphics.SurfaceTexture; import android.graphics.YuvImage; import android.hardware.Camera; -import android.hardware.Camera.Parameters; -import android.hardware.Camera.Size; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; +import android.hardware.Camera.Parameters; +import android.hardware.Camera.Size; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -52,6 +52,7 @@ import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.ImageView; +import android.widget.ProgressBar; import android.widget.TextView; import java.io.ByteArrayOutputStream; @@ -379,6 +380,7 @@ public class PanoramaActivity extends Activity implements MSG_FINAL_MOSAIC_READY, bitmap)); } }); + reportProgress(false); } } @@ -442,6 +444,33 @@ public class PanoramaActivity extends Activity implements stopCapture(); } + public void reportProgress(final boolean highRes) { + Thread t = new Thread() { + @Override + public void run() { + while(true) + { + final int progress = mMosaicFrameProcessor.reportProgress(highRes); + + try{ + Thread.sleep(50); + }catch(Exception e) {} + + // Update the progress bar + runOnUiThread(new Runnable() { + public void run() { + //TODO: Set the the progress-bar progress update here... + } + }); + + if(progress>=100) + break; + } + } + }; + t.start(); + } + @OnClickAttr public void onOkButtonClicked(View v) { if (mPausing || mThreadRunning || mSurfaceTexture == null) return; @@ -453,6 +482,7 @@ public class PanoramaActivity extends Activity implements mMainHandler.sendMessage(mMainHandler.obtainMessage(MSG_RESET_TO_PREVIEW)); } }); + reportProgress(true); } private void runBackgroundThread(String str, Thread thread) { |