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
{
}
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");
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;
* @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);
}
-
+
/**
* Converts OpenCV Mat to Android Bitmap.
* <p>
* @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);
}
-
-
+
+
private static native void nBitmapToMat2(Bitmap b, long m_addr, boolean unPremultiplyAlpha);
private static native void nMatToBitmap2(long m_addr, Bitmap b, boolean premultiplyAlpha);