summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormbansal <mayank.bansal@sri.com>2011-08-23 11:42:36 -0400
committerWei-Ta Chen <weita@google.com>2011-08-24 10:43:01 -0700
commit50b3c890986aadb3780b4da8c0b8dbb0f1422eba (patch)
tree963262c11e8a2e7afc301f9886e0d0d90430db21 /src
parentf26e1ab12cb3f359fe1d6efcbe65344a3a0bf276 (diff)
downloadpackages_apps_LegacyCamera-50b3c890986aadb3780b4da8c0b8dbb0f1422eba.zip
packages_apps_LegacyCamera-50b3c890986aadb3780b4da8c0b8dbb0f1422eba.tar.gz
packages_apps_LegacyCamera-50b3c890986aadb3780b4da8c0b8dbb0f1422eba.tar.bz2
Updates to allow the mosaic library to report the mosaic computation progress (both low-res and high-res).
1) Added a new method to the Mosaic class that reports the percent progress for both LR and HR mosaicers. 2) Added a test function to the activity that logs the reported progress. 3) [REMOVED] Added a test progress-bar to the UI for quick testing of the progress reporting UI. 4) Made minor updates in response to Wei-Ta's review. Change-Id: Iaf8ccf771579a40580a868743a6b53c6b05f14c6
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/panorama/Mosaic.java9
-rw-r--r--src/com/android/camera/panorama/MosaicFrameProcessor.java4
-rw-r--r--src/com/android/camera/panorama/PanoramaActivity.java34
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) {