RESTART_REQUIRED status removed from OpenCV Manager API;

OpenCV info library name fixed;
Minimum API level for OpenCV library project increased up to 3 for using message dialogs.
This commit is contained in:
Alexander Smorkalov 2012-10-08 15:31:56 +04:00
parent 408e0dcbd0
commit 4b808b1199
6 changed files with 25 additions and 32 deletions

View File

@ -3,4 +3,6 @@
package="org.opencv"
android:versionCode="242"
android:versionName="2.4.2">
<uses-sdk android:minSdkVersion="8" />
</manifest>

View File

@ -85,10 +85,8 @@ class AsyncServiceHelper
if (result)
{
mServiceInstallationProgress = true;
int Status = LoaderCallbackInterface.RESTART_REQUIRED;
Log.d(TAG, "Init finished with status " + Status);
Log.d(TAG, "Calling using callback");
mUserAppCallback.onManagerConnected(Status);
Log.d(TAG, "Package installation started");
}
else
{
@ -195,28 +193,34 @@ class AsyncServiceHelper
}
public void install() {
Log.d(TAG, "Trying to install OpenCV lib via Google Play");
boolean result;
try
{
if (mEngineService.installVersion(mOpenCVersion))
{
mLibraryInstallationProgress = true;
mStatus = LoaderCallbackInterface.RESTART_REQUIRED;
result = true;
Log.d(TAG, "Package installation statred");
}
else
{
result = false;
Log.d(TAG, "OpenCV package was not installed!");
mStatus = LoaderCallbackInterface.MARKET_ERROR;
}
} catch (RemoteException e) {
e.printStackTrace();
result = false;
mStatus = LoaderCallbackInterface.INIT_FAILED;
}
Log.d(TAG, "Init finished with status " + mStatus);
Log.d(TAG, "Unbind from service");
mAppContext.unbindService(mServiceConnection);
Log.d(TAG, "Calling using callback");
mUserAppCallback.onManagerConnected(mStatus);
if (!result)
{
Log.d(TAG, "Init finished with status " + mStatus);
Log.d(TAG, "Unbind from service");
mAppContext.unbindService(mServiceConnection);
Log.d(TAG, "Calling using callback");
mUserAppCallback.onManagerConnected(mStatus);
}
}
public void cancel() {
Log.d(TAG, "OpenCV library installation was canceled");
@ -260,11 +264,7 @@ class AsyncServiceHelper
Log.d(TAG, "Waiting for current installation");
try
{
if (mEngineService.installVersion(mOpenCVersion))
{
mStatus = LoaderCallbackInterface.RESTART_REQUIRED;
}
else
if (!mEngineService.installVersion(mOpenCVersion))
{
Log.d(TAG, "OpenCV package was not installed!");
mStatus = LoaderCallbackInterface.MARKET_ERROR;

View File

@ -24,11 +24,6 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface {
{
/** Application must override this method to handle successful library initialization. **/
} break;
/** OpenCV Manager or library package installation is in progress. Restart the application. **/
case LoaderCallbackInterface.RESTART_REQUIRED:
{
Log.d(TAG, "OpenCV downloading. App restart is needed!");
} break;
/** OpenCV loader can not start Google Play Market. **/
case LoaderCallbackInterface.MARKET_ERROR:
{

View File

@ -9,10 +9,6 @@ public interface LoaderCallbackInterface
* OpenCV initialization finished successfully.
*/
static final int SUCCESS = 0;
/**
* OpenCV library installation via Google Play service has been initialized. Restart the application.
*/
static final int RESTART_REQUIRED = 1;
/**
* Google Play Market cannot be invoked.
*/

View File

@ -15,7 +15,7 @@ class StaticHelper {
try
{
System.loadLibrary("opencvinfo");
System.loadLibrary("opencv_info");
libs = getLibraryList();
}
catch(UnsatisfiedLinkError e)

View File

@ -99,7 +99,7 @@ public class Utils {
* @param mat is a valid output Mat object, it will be reallocated if needed, so Mat may be empty.
*/
public static void bitmapToMat(Bitmap bmp, Mat mat) {
bitmapToMat(bmp, mat, false);
bitmapToMat(bmp, mat, false);
}
@ -129,7 +129,7 @@ public class Utils {
* @param bmp is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.
*/
public static void matToBitmap(Mat mat, Bitmap bmp) {
matToBitmap(mat, bmp, false);
matToBitmap(mat, bmp, false);
}