提交 4b808b11 编写于 作者: A Alexander Smorkalov

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.
上级 408e0dcb
...@@ -3,4 +3,6 @@ ...@@ -3,4 +3,6 @@
package="org.opencv" package="org.opencv"
android:versionCode="242" android:versionCode="242"
android:versionName="2.4.2"> android:versionName="2.4.2">
</manifest>
<uses-sdk android:minSdkVersion="8" />
</manifest>
...@@ -85,10 +85,8 @@ class AsyncServiceHelper ...@@ -85,10 +85,8 @@ class AsyncServiceHelper
if (result) if (result)
{ {
mServiceInstallationProgress = true; mServiceInstallationProgress = true;
int Status = LoaderCallbackInterface.RESTART_REQUIRED; Log.d(TAG, "Package installation started");
Log.d(TAG, "Init finished with status " + Status);
Log.d(TAG, "Calling using callback");
mUserAppCallback.onManagerConnected(Status);
} }
else else
{ {
...@@ -195,28 +193,34 @@ class AsyncServiceHelper ...@@ -195,28 +193,34 @@ class AsyncServiceHelper
} }
public void install() { public void install() {
Log.d(TAG, "Trying to install OpenCV lib via Google Play"); Log.d(TAG, "Trying to install OpenCV lib via Google Play");
boolean result;
try try
{ {
if (mEngineService.installVersion(mOpenCVersion)) if (mEngineService.installVersion(mOpenCVersion))
{ {
mLibraryInstallationProgress = true; mLibraryInstallationProgress = true;
mStatus = LoaderCallbackInterface.RESTART_REQUIRED; result = true;
Log.d(TAG, "Package installation statred");
} }
else else
{ {
result = false;
Log.d(TAG, "OpenCV package was not installed!"); Log.d(TAG, "OpenCV package was not installed!");
mStatus = LoaderCallbackInterface.MARKET_ERROR; mStatus = LoaderCallbackInterface.MARKET_ERROR;
} }
} catch (RemoteException e) { } catch (RemoteException e) {
e.printStackTrace(); e.printStackTrace();
result = false;
mStatus = LoaderCallbackInterface.INIT_FAILED; mStatus = LoaderCallbackInterface.INIT_FAILED;
} }
if (!result)
Log.d(TAG, "Init finished with status " + mStatus); {
Log.d(TAG, "Unbind from service"); Log.d(TAG, "Init finished with status " + mStatus);
mAppContext.unbindService(mServiceConnection); Log.d(TAG, "Unbind from service");
Log.d(TAG, "Calling using callback"); mAppContext.unbindService(mServiceConnection);
mUserAppCallback.onManagerConnected(mStatus); Log.d(TAG, "Calling using callback");
mUserAppCallback.onManagerConnected(mStatus);
}
} }
public void cancel() { public void cancel() {
Log.d(TAG, "OpenCV library installation was canceled"); Log.d(TAG, "OpenCV library installation was canceled");
...@@ -260,11 +264,7 @@ class AsyncServiceHelper ...@@ -260,11 +264,7 @@ class AsyncServiceHelper
Log.d(TAG, "Waiting for current installation"); Log.d(TAG, "Waiting for current installation");
try try
{ {
if (mEngineService.installVersion(mOpenCVersion)) if (!mEngineService.installVersion(mOpenCVersion))
{
mStatus = LoaderCallbackInterface.RESTART_REQUIRED;
}
else
{ {
Log.d(TAG, "OpenCV package was not installed!"); Log.d(TAG, "OpenCV package was not installed!");
mStatus = LoaderCallbackInterface.MARKET_ERROR; mStatus = LoaderCallbackInterface.MARKET_ERROR;
......
...@@ -24,11 +24,6 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface { ...@@ -24,11 +24,6 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface {
{ {
/** Application must override this method to handle successful library initialization. **/ /** Application must override this method to handle successful library initialization. **/
} break; } 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. **/ /** OpenCV loader can not start Google Play Market. **/
case LoaderCallbackInterface.MARKET_ERROR: case LoaderCallbackInterface.MARKET_ERROR:
{ {
......
...@@ -9,10 +9,6 @@ public interface LoaderCallbackInterface ...@@ -9,10 +9,6 @@ public interface LoaderCallbackInterface
* OpenCV initialization finished successfully. * OpenCV initialization finished successfully.
*/ */
static final int SUCCESS = 0; 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. * Google Play Market cannot be invoked.
*/ */
......
...@@ -15,7 +15,7 @@ class StaticHelper { ...@@ -15,7 +15,7 @@ class StaticHelper {
try try
{ {
System.loadLibrary("opencvinfo"); System.loadLibrary("opencv_info");
libs = getLibraryList(); libs = getLibraryList();
} }
catch(UnsatisfiedLinkError e) catch(UnsatisfiedLinkError e)
......
...@@ -99,10 +99,10 @@ public class Utils { ...@@ -99,10 +99,10 @@ public class Utils {
* @param mat is a valid output Mat object, it will be reallocated if needed, so Mat may be empty. * @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) { public static void bitmapToMat(Bitmap bmp, Mat mat) {
bitmapToMat(bmp, mat, false); bitmapToMat(bmp, mat, false);
} }
/** /**
* Converts OpenCV Mat to Android Bitmap. * Converts OpenCV Mat to Android Bitmap.
* <p> * <p>
...@@ -129,10 +129,10 @@ public class Utils { ...@@ -129,10 +129,10 @@ 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'. * @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) { public static void matToBitmap(Mat mat, Bitmap bmp) {
matToBitmap(mat, bmp, false); matToBitmap(mat, bmp, false);
} }
private static native void nBitmapToMat2(Bitmap b, long m_addr, boolean unPremultiplyAlpha); private static native void nBitmapToMat2(Bitmap b, long m_addr, boolean unPremultiplyAlpha);
private static native void nMatToBitmap2(long m_addr, Bitmap b, boolean premultiplyAlpha); private static native void nMatToBitmap2(long m_addr, Bitmap b, boolean premultiplyAlpha);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册