diff --git a/library/.gitignore b/library/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/library/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/library/build.gradle b/library/build.gradle index 08821f3..df76707 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -2,40 +2,38 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 30 - buildToolsVersion "29.0.3" - - // Needed for jitpack builds + compileSdkVersion 24 + buildToolsVersion '26.0.2' + packagingOptions { doNotStrip '*/mips/*.so' doNotStrip '*/mips64/*.so' } defaultConfig { - minSdkVersion 19 - targetSdkVersion 30 + minSdkVersion 16 + targetSdkVersion 24 versionCode 1 versionName "1.0" - ndk - { - moduleName "Scanner" - } + ndk { + moduleName "Scanner" + } + sourceSets.main { + jni.srcDirs = [] + jniLibs.srcDirs 'src/main/libs' + } } - sourceSets.main - { - jni.srcDirs = [] - jniLibs.srcDirs 'src/main/libs' - } + buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - + } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'com.android.support:support-v4:24.2.1' } diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro index eb07bf8..f1b4245 100644 --- a/library/proguard-rules.pro +++ b/library/proguard-rules.pro @@ -1,14 +1,10 @@ # Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/jhansi/softwares/adt-bundle-mac-x86_64-20130729/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html -# Add any project specific keep options here: - # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: diff --git a/library/src/androidTest/java/com/scanlibrary/ApplicationTest.java b/library/src/androidTest/java/com/scanlibrary/ApplicationTest.java deleted file mode 100644 index 7494900..0000000 --- a/library/src/androidTest/java/com/scanlibrary/ApplicationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.scanlibrary; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index 0b46ec4..b2bcbe0 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -21,7 +21,7 @@ diff --git a/library/src/main/java/com/scanlibrary/CustomFileProvider.java b/library/src/main/java/com/scanlibrary/CustomFileProvider.java index b168bf5..117a7b2 100644 --- a/library/src/main/java/com/scanlibrary/CustomFileProvider.java +++ b/library/src/main/java/com/scanlibrary/CustomFileProvider.java @@ -1,6 +1,6 @@ package com.scanlibrary; -import androidx.core.content.FileProvider; +import android.support.v4.content.FileProvider; /** * Created by sekar on 21/2/18. diff --git a/library/src/main/java/com/scanlibrary/IScanner.java b/library/src/main/java/com/scanlibrary/IScanner.java index 51c6add..c760a9c 100644 --- a/library/src/main/java/com/scanlibrary/IScanner.java +++ b/library/src/main/java/com/scanlibrary/IScanner.java @@ -10,4 +10,4 @@ public interface IScanner { void onBitmapSelect(Uri uri); void onScanFinish(Uri uri); -} +} \ No newline at end of file diff --git a/library/src/main/java/com/scanlibrary/PickImageFragment.java b/library/src/main/java/com/scanlibrary/PickImageFragment.java index fe6b068..1c72d4a 100644 --- a/library/src/main/java/com/scanlibrary/PickImageFragment.java +++ b/library/src/main/java/com/scanlibrary/PickImageFragment.java @@ -1,28 +1,33 @@ package com.scanlibrary; import android.Manifest; +import android.annotation.TargetApi; import android.app.Activity; +import android.app.AlertDialog; import android.app.Fragment; +import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.AssetFileDescriptor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; + import android.media.ExifInterface; + import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; -import androidx.annotation.NonNull; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; -import androidx.core.content.FileProvider; +import android.provider.Settings; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.FileProvider; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; -import android.widget.Toast; import java.io.File; import java.io.IOException; @@ -32,15 +37,31 @@ /** * Created by jhansi on 04/04/15. */ -public class PickImageFragment extends Fragment { +public class PickImageFragment extends Fragment implements OnDialogButtonClickListener { + + public final int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 1; int camorgal = 0; - private String imagePath = ""; + + // for security permissions + private static final String CAMERA_PERMISSION = Manifest.permission.CAMERA; + private static final String READ_EXTERNAL_STORAGE_PERMISSION = Manifest.permission.READ_EXTERNAL_STORAGE; + private static final String WRITE_EXTERNAL_STORAGE_PERMISSION = Manifest.permission.WRITE_EXTERNAL_STORAGE; + private View view; private ImageButton cameraButton; private ImageButton galleryButton; private Uri fileUri; private IScanner scanner; - private static final int MY_CAMERA_REQUEST_CODE = 100; + + + // for security permissions + @ValueConstants.DialogType + private int mDialogType; + private String mRequestPermissions = "We are requesting the camera and Gallery permission as it is absolutely necessary for the app to perform it\'s functionality.\nPlease select \"Grant Permission\" to try again and \"Cancel \" to exit the application."; + private String mRequsetSettings = "You have rejected the camera and Gallery permission for the application. As it is absolutely necessary for the app to perform you need to enable it in the settings of your device.\nPlease select \"Go to settings\" to go to application settings in your device and \"Cancel \" to exit the application."; + private String mGrantPermissions = "Grant Permissions"; + private String mCancel = "Cancel"; + private String mGoToSettings = "Go To Settings"; @Override public void onAttach(Activity activity) { @@ -63,17 +84,139 @@ private void init() { cameraButton.setOnClickListener(new CameraButtonClickListener()); galleryButton = (ImageButton) view.findViewById(R.id.selectButton); galleryButton.setOnClickListener(new GalleryClickListener()); - imagePath = getActivity().getApplicationContext().getExternalCacheDir().getPath() + "/scanSample"; - if (isIntentPreferenceSet()) { - handleIntentPreference(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + checkMultiplePermissions(REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS, getActivity()); } else { - getActivity().finish(); + // Open your camera here. + if (isIntentPreferenceSet()) { + handleIntentPreference(); + } else { + getActivity().finish(); + } + } + } + + public static void openAlertDialog(String message, String positiveBtnText, String negativeBtnText, + final OnDialogButtonClickListener listener,Context mContext) { + + AlertDialog.Builder builder = new AlertDialog.Builder(mContext, R.style.AlertDialogCustom); + builder.setPositiveButton(positiveBtnText, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + dialogInterface.dismiss(); + listener.onPositiveButtonClicked(); + } + }); + builder.setPositiveButton(positiveBtnText, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + dialogInterface.dismiss(); + listener.onNegativeButtonClicked(); + } + }); + + builder.setTitle(mContext.getResources().getString(R.string.app_name)); + builder.setMessage(message); + builder.setIcon(android.R.drawable.ic_dialog_alert); + builder.setCancelable(false); + builder.create().show(); + } + + @Override + public void onPositiveButtonClicked() { + switch (mDialogType) { + case ValueConstants.DialogType.DIALOG_DENY: + checkMultiplePermissions(REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS, getActivity()); + break; + case ValueConstants.DialogType.DIALOG_NEVER_ASK: + redirectToAppSettings(getActivity()); + break; + } + } + + @Override + public void onNegativeButtonClicked() { + + } + + @TargetApi(Build.VERSION_CODES.M) + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + + switch (requestCode) { + case REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS: + if (grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED && grantResults[2] == PackageManager.PERMISSION_GRANTED) { + // Call your camera here. + if (isIntentPreferenceSet()) { + handleIntentPreference(); + } else { + getActivity().finish(); + } + } else { + boolean showRationale1 = shouldShowRequestPermissionRationale(CAMERA_PERMISSION); + boolean showRationale2 = shouldShowRequestPermissionRationale(READ_EXTERNAL_STORAGE_PERMISSION); + boolean showRationale3 = shouldShowRequestPermissionRationale(WRITE_EXTERNAL_STORAGE_PERMISSION); + if (showRationale1 && showRationale2 && showRationale3) { + //explain to user why we need the permissions + mDialogType = ValueConstants.DialogType.DIALOG_DENY; + // Show dialog with + openAlertDialog(mRequestPermissions, mGrantPermissions, mCancel, this, getActivity()); + } else { + //explain to user why we need the permissions and ask him to go to settings to enable it + mDialogType = ValueConstants.DialogType.DIALOG_NEVER_ASK; + openAlertDialog(mRequsetSettings, mGoToSettings, mCancel, this, getActivity()); + } + } + break; + default: + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + } + } + + //check for camera and storage access permissions + @TargetApi(Build.VERSION_CODES.M) + private void checkMultiplePermissions(int permissionCode, Context context) { + + String[] PERMISSIONS = {CAMERA_PERMISSION, READ_EXTERNAL_STORAGE_PERMISSION, WRITE_EXTERNAL_STORAGE_PERMISSION}; + if (!hasPermissions(context, PERMISSIONS)) { + requestPermissions(PERMISSIONS, permissionCode); + } else { + // Open your camera here. + if (isIntentPreferenceSet()) { + handleIntentPreference(); + } else { + getActivity().finish(); + } + } + } + + private boolean hasPermissions(Context context, String... permissions) { + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) { + for (String permission : permissions) { + if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) { + return false; + } + } + } + return true; + } + + private void redirectToAppSettings(Context context) { + String packageName = context.getPackageName(); + Intent intent = new Intent(); + intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + Uri uri = Uri.fromParts("package", packageName, null); + intent.setData(uri); + try { + context.startActivity(intent); + }catch (Exception e) { + e.printStackTrace(); } } private void clearTempImages() { try { - File tempFolder = new File(imagePath); + File tempFolder = new File(ScanConstants.IMAGE_PATH); for (File f : tempFolder.listFiles()) f.delete(); } catch (Exception e) { @@ -104,14 +247,24 @@ private int getIntentPreference() { private class CameraButtonClickListener implements View.OnClickListener { @Override public void onClick(View v) { - openCamera(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + checkMultiplePermissions(REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS, getActivity()); + } else { + // Open your camera here. + openCamera(); + } } } private class GalleryClickListener implements View.OnClickListener { @Override public void onClick(View view) { - openMediaContent(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + checkMultiplePermissions(REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS, getActivity()); + } else { + // Open your media here. + openMediaContent(); + } } } @@ -125,32 +278,27 @@ public void openMediaContent() { public void openCamera() { camorgal = 0; - if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { - Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); - File file = createImageFile(); - boolean isDirectoryCreated = file.getParentFile().mkdirs(); - Log.d("", "openCamera: isDirectoryCreated: " + isDirectoryCreated); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); + File file = createImageFile(); + boolean isDirectoryCreated = file.getParentFile().mkdirs(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { String aut = getActivity().getApplicationContext().getPackageName() + ".com.scanlibrary.provider"; // As defined in Manifest - Uri tempFileUri = FileProvider.getUriForFile(getActivity().getApplicationContext(), - aut, // As defined in Manifest - file); - cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri); - } else { - Uri tempFileUri = Uri.fromFile(file); - cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri); - } - startActivityForResult(cameraIntent, ScanConstants.START_CAMERA_REQUEST_CODE); + Uri tempFileUri = FileProvider.getUriForFile(getActivity().getApplicationContext(), + aut, // As defined in Manifest + file); + cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri); } else { - ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.CAMERA}, MY_CAMERA_REQUEST_CODE); + Uri tempFileUri = Uri.fromFile(file); + cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri); } + startActivityForResult(cameraIntent, ScanConstants.START_CAMERA_REQUEST_CODE); } private File createImageFile() { - clearTempImages(); + // clearTempImages(); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); - File file = new File(imagePath, "IMG_" + timeStamp + + File file = new File(ScanConstants.IMAGE_PATH, "IMG_" + timeStamp + ".jpg"); fileUri = Uri.fromFile(file); return file; @@ -243,17 +391,4 @@ private Bitmap getBitmap(Uri selectedimg) throws IOException { fileDescriptor.getFileDescriptor(), null, options); return original; } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - if (requestCode == MY_CAMERA_REQUEST_CODE) { - if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { - openCamera(); - } else { - Toast.makeText(getActivity(), "camera permission denied", Toast.LENGTH_LONG).show(); - } - - } - } -} \ No newline at end of file +} diff --git a/library/src/main/java/com/scanlibrary/PolygonView.java b/library/src/main/java/com/scanlibrary/PolygonView.java index 362e4c7..2a04c74 100644 --- a/library/src/main/java/com/scanlibrary/PolygonView.java +++ b/library/src/main/java/com/scanlibrary/PolygonView.java @@ -293,4 +293,4 @@ public boolean onTouch(View v, MotionEvent event) { } -} +} \ No newline at end of file diff --git a/library/src/main/java/com/scanlibrary/ProgressDialogFragment.java b/library/src/main/java/com/scanlibrary/ProgressDialogFragment.java index 710d1d7..d364ba8 100644 --- a/library/src/main/java/com/scanlibrary/ProgressDialogFragment.java +++ b/library/src/main/java/com/scanlibrary/ProgressDialogFragment.java @@ -12,34 +12,34 @@ @SuppressLint("ValidFragment") public class ProgressDialogFragment extends DialogFragment { - public String message; - - public ProgressDialogFragment(String message) { - this.message = message; - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - final ProgressDialog dialog = new ProgressDialog(getActivity()); - dialog.setIndeterminate(true); - dialog.setMessage(message); - dialog.setCancelable(false); - dialog.setCanceledOnTouchOutside(false); - // Disable the back button - OnKeyListener keyListener = new OnKeyListener() { - - @Override - public boolean onKey(DialogInterface dialog, int keyCode, - KeyEvent event) { - - if (keyCode == KeyEvent.KEYCODE_BACK) { - return true; - } - return false; - } - - }; - dialog.setOnKeyListener(keyListener); - return dialog; - } + public String message; + + public ProgressDialogFragment(String message) { + this.message = message; + } + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final ProgressDialog dialog = new ProgressDialog(getActivity()); + dialog.setIndeterminate(true); + dialog.setMessage(message); + dialog.setCancelable(false); + dialog.setCanceledOnTouchOutside(false); + // Disable the back button + OnKeyListener keyListener = new OnKeyListener() { + + @Override + public boolean onKey(DialogInterface dialog, int keyCode, + KeyEvent event) { + + if (keyCode == KeyEvent.KEYCODE_BACK) { + return true; + } + return false; + } + + }; + dialog.setOnKeyListener(keyListener); + return dialog; + } } \ No newline at end of file diff --git a/library/src/main/java/com/scanlibrary/ResultFragment.java b/library/src/main/java/com/scanlibrary/ResultFragment.java index 6cd6be0..e4aab2a 100644 --- a/library/src/main/java/com/scanlibrary/ResultFragment.java +++ b/library/src/main/java/com/scanlibrary/ResultFragment.java @@ -13,7 +13,6 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; -import android.widget.Toast; import java.io.IOException; @@ -65,6 +64,8 @@ private void init() { Bitmap bitmap = getBitmap(); transformed = bitmap; rotoriginal = bitmap; + + //Bitmap bitmap = getBitmap(); setScannedImage(bitmap); doneButton = (Button) view.findViewById(R.id.doneButton); doneButton.setOnClickListener(new DoneButtonClickListener()); @@ -196,6 +197,7 @@ public void onClick(View v) { try { showProgressDialog(getResources().getString(R.string.applying_filter)); transformed = rotoriginal; + scannedImageView.setImageBitmap(rotoriginal); dismissDialog(); } catch (OutOfMemoryError e) { @@ -238,6 +240,7 @@ public void run() { } } + private class RotanticlockButtonClickListener implements View.OnClickListener { @Override public void onClick(final View v) { @@ -322,28 +325,8 @@ public void run() { } } - protected synchronized void disableButtons() { - doneButton.setEnabled(false); - originalButton.setEnabled(false); - MagicColorButton.setEnabled(false); - grayModeButton.setEnabled(false); - bwButton.setEnabled(false); - rotanticButton.setEnabled(false); - rotcButton.setEnabled(false); - } - - protected synchronized void enableButtons() { - doneButton.setEnabled(true); - originalButton.setEnabled(true); - MagicColorButton.setEnabled(true); - grayModeButton.setEnabled(true); - bwButton.setEnabled(true); - rotanticButton.setEnabled(true); - rotcButton.setEnabled(true); - } protected synchronized void showProgressDialog(String message) { - disableButtons(); if (progressDialogFragment != null && progressDialogFragment.isVisible()) { // Before creating another loading dialog, close all opened loading dialogs (if any) progressDialogFragment.dismissAllowingStateLoss(); @@ -356,6 +339,5 @@ protected synchronized void showProgressDialog(String message) { protected synchronized void dismissDialog() { progressDialogFragment.dismissAllowingStateLoss(); - enableButtons(); } -} \ No newline at end of file +} diff --git a/library/src/main/java/com/scanlibrary/ScanActivity.java b/library/src/main/java/com/scanlibrary/ScanActivity.java index ba6628d..5b18d3d 100644 --- a/library/src/main/java/com/scanlibrary/ScanActivity.java +++ b/library/src/main/java/com/scanlibrary/ScanActivity.java @@ -124,7 +124,6 @@ public void onTrimMemory(int level) { public native float[] getPoints(Bitmap bitmap); static { - System.loadLibrary("opencv_java3"); - System.loadLibrary("Scanner"); + Loader.load(); } -} \ No newline at end of file +} diff --git a/library/src/main/java/com/scanlibrary/ScanConstants.java b/library/src/main/java/com/scanlibrary/ScanConstants.java index 7d26624..43423f8 100644 --- a/library/src/main/java/com/scanlibrary/ScanConstants.java +++ b/library/src/main/java/com/scanlibrary/ScanConstants.java @@ -18,4 +18,4 @@ public class ScanConstants { .getExternalStorageDirectory().getPath() + "/scanSample"; public final static String SELECTED_BITMAP = "selectedBitmap"; -} +} \ No newline at end of file diff --git a/library/src/main/java/com/scanlibrary/Utils.java b/library/src/main/java/com/scanlibrary/Utils.java index 469d85f..df61149 100644 --- a/library/src/main/java/com/scanlibrary/Utils.java +++ b/library/src/main/java/com/scanlibrary/Utils.java @@ -4,18 +4,16 @@ import android.graphics.Bitmap; import android.net.Uri; import android.provider.MediaStore; -import android.util.Log; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Calendar; -import java.util.Date; /** * Created by jhansi on 05/04/15. */ public class Utils { - static Date currentTime; + private Utils() { } @@ -23,10 +21,8 @@ private Utils() { public static Uri getUri(Context context, Bitmap bitmap) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes); - Log.wtf("PATH", "before insertImage"); // String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, "Title", null); - String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, "Title" + " - " + (currentTime = Calendar.getInstance().getTime()), null); - Log.wtf("PATH", path); + String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, "Title" + " - " + Calendar.getInstance().getTime(), null); return Uri.parse(path); } @@ -34,4 +30,4 @@ public static Bitmap getBitmap(Context context, Uri uri) throws IOException { Bitmap bitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri); return bitmap; } -} \ No newline at end of file +} diff --git a/library/src/main/java/com/scanlibrary/ValueConstants.java b/library/src/main/java/com/scanlibrary/ValueConstants.java new file mode 100644 index 0000000..ea0fe24 --- /dev/null +++ b/library/src/main/java/com/scanlibrary/ValueConstants.java @@ -0,0 +1,20 @@ +package com.scanlibrary; + +import android.support.annotation.IntDef; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Created by sekar on 21/2/18. + */ + +public class ValueConstants { + + // type of dialog opened in MainActivity + @IntDef({DialogType.DIALOG_DENY, DialogType.DIALOG_NEVER_ASK}) + @Retention(RetentionPolicy.SOURCE) + @interface DialogType { + int DIALOG_DENY = 0, DIALOG_NEVER_ASK = 1; + } +} diff --git a/library/src/main/jni/Application.mk b/library/src/main/jni/Application.mk index 89d0254..4631a7b 100644 --- a/library/src/main/jni/Application.mk +++ b/library/src/main/jni/Application.mk @@ -1,4 +1,4 @@ -APP_STL := c++_static +APP_STL := stlport_static APP_CPPFLAGS := -frtti -fexceptions APP_ABI := all -APP_PLATFORM := android-19 +APP_PLATFORM := android-14 diff --git a/library/src/main/jni/sdk/java/AndroidManifest.xml b/library/src/main/jni/sdk/java/AndroidManifest.xml index 0113bbb..f6fcc8f 100644 --- a/library/src/main/jni/sdk/java/AndroidManifest.xml +++ b/library/src/main/jni/sdk/java/AndroidManifest.xml @@ -4,5 +4,5 @@ android:versionCode="3100" android:versionName="3.1.0"> - + diff --git a/library/src/main/jni/sdk/java/project.properties b/library/src/main/jni/sdk/java/project.properties index 61afc8f..1d35d2d 100644 --- a/library/src/main/jni/sdk/java/project.properties +++ b/library/src/main/jni/sdk/java/project.properties @@ -12,4 +12,4 @@ android.library=true # Project target. -target=android-19 +target=android-14 diff --git a/library/src/main/libs/arm64-v8a/libScanner.so b/library/src/main/libs/arm64-v8a/libScanner.so index f05c51c..afa6ebc 100644 Binary files a/library/src/main/libs/arm64-v8a/libScanner.so and b/library/src/main/libs/arm64-v8a/libScanner.so differ diff --git a/library/src/main/libs/arm64-v8a/libopencv_java3.so b/library/src/main/libs/arm64-v8a/libopencv_java3.so index 728fcf7..ee652ff 100644 Binary files a/library/src/main/libs/arm64-v8a/libopencv_java3.so and b/library/src/main/libs/arm64-v8a/libopencv_java3.so differ diff --git a/library/src/main/libs/armeabi-v7a/libScanner.so b/library/src/main/libs/armeabi-v7a/libScanner.so index 1374539..ec46e87 100755 Binary files a/library/src/main/libs/armeabi-v7a/libScanner.so and b/library/src/main/libs/armeabi-v7a/libScanner.so differ diff --git a/library/src/main/libs/armeabi-v7a/libopencv_java3.so b/library/src/main/libs/armeabi-v7a/libopencv_java3.so index 4f68f75..bc736b8 100755 Binary files a/library/src/main/libs/armeabi-v7a/libopencv_java3.so and b/library/src/main/libs/armeabi-v7a/libopencv_java3.so differ diff --git a/library/src/main/libs/x86/libScanner.so b/library/src/main/libs/x86/libScanner.so index 3dfeda6..37b97a5 100755 Binary files a/library/src/main/libs/x86/libScanner.so and b/library/src/main/libs/x86/libScanner.so differ diff --git a/library/src/main/libs/x86/libopencv_java3.so b/library/src/main/libs/x86/libopencv_java3.so index da805fb..2af1b78 100755 Binary files a/library/src/main/libs/x86/libopencv_java3.so and b/library/src/main/libs/x86/libopencv_java3.so differ diff --git a/library/src/main/libs/x86_64/libScanner.so b/library/src/main/libs/x86_64/libScanner.so index d5a2f05..a441b82 100644 Binary files a/library/src/main/libs/x86_64/libScanner.so and b/library/src/main/libs/x86_64/libScanner.so differ diff --git a/library/src/main/libs/x86_64/libopencv_java3.so b/library/src/main/libs/x86_64/libopencv_java3.so index 785b248..a9c7d27 100644 Binary files a/library/src/main/libs/x86_64/libopencv_java3.so and b/library/src/main/libs/x86_64/libopencv_java3.so differ diff --git a/library/src/main/res/layout/pick_image_fragment.xml b/library/src/main/res/layout/pick_image_fragment.xml index edb0e90..b88a6bb 100644 --- a/library/src/main/res/layout/pick_image_fragment.xml +++ b/library/src/main/res/layout/pick_image_fragment.xml @@ -1,4 +1,3 @@ - - \ No newline at end of file + diff --git a/library/src/main/res/layout/scan_fragment_layout.xml b/library/src/main/res/layout/scan_fragment_layout.xml index 71ff5e7..27f3cb9 100644 --- a/library/src/main/res/layout/scan_fragment_layout.xml +++ b/library/src/main/res/layout/scan_fragment_layout.xml @@ -1,4 +1,3 @@ - - - + \ No newline at end of file diff --git a/library/src/main/res/values/dimens.xml b/library/src/main/res/values/dimens.xml index c16671b..415350b 100644 --- a/library/src/main/res/values/dimens.xml +++ b/library/src/main/res/values/dimens.xml @@ -1,15 +1,15 @@ - - 16dp - 16dp + +16dp +16dp - 16dp - 32dp - 2dp - +16dp +32dp +2dp + - 15dp +15dp - + \ No newline at end of file diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml index ba0e97d..14b723e 100644 --- a/library/src/main/res/values/strings.xml +++ b/library/src/main/res/values/strings.xml @@ -1,4 +1,3 @@ - ScanLibrary @@ -13,4 +12,5 @@ Applying filter Low Memory Your phone is low on memory, you may feel some lags while editing images. - + + \ No newline at end of file diff --git a/library/src/main/res/xml/provider_paths.xml b/library/src/main/res/xml/provider_paths.xml index ffa74ab..4ff8931 100644 --- a/library/src/main/res/xml/provider_paths.xml +++ b/library/src/main/res/xml/provider_paths.xml @@ -1,4 +1,4 @@ - \ No newline at end of file +