diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/build.gradle b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/build.gradle index 8bcba067..b7c054c9 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/build.gradle +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/build.gradle @@ -12,8 +12,8 @@ android { vectorDrawables.useSupportLibrary = true minSdkVersion 21 targetSdkVersion 30 - versionCode 392 - versionName "33.0.0" + versionCode 398 + versionName "34.0.0" ndk { abiFilters "armeabi-v7a", "arm64-v8a" @@ -72,7 +72,7 @@ dependencies { // implementation project(':AnylineSdk') //include AnylineSDK from maven - implementation'io.anyline:anylinesdk:33.0.0' + implementation'io.anyline:anylinesdk:34.0.0' //Play core library implementation 'com.google.android.play:core-ktx:1.8.1' diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/AndroidManifest.xml b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/AndroidManifest.xml index b7ebddc3..9d629579 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/AndroidManifest.xml +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/AndroidManifest.xml @@ -321,12 +321,6 @@ android:label="Barcode Types" android:theme="@style/MainActivityTheme"/> - - getItems() { items.add(new BarcodeModel("Code 93", "1D Symbologies - Logistics & Inventory Usage")); items.add(new BarcodeModel("Interleaved 2 of 5", "1D Symbologies - Logistics & Inventory Usage")); items.add(new BarcodeModel("Matrix 2 of 5", "1D Symbologies - Logistics & Inventory Usage")); + items.add(new BarcodeModel("One D Inverse", "1D Symbologies - Logistics & Inventory Usage")); items.add(new BarcodeModel("Code 25", "1D Symbologies - Legacy")); items.add(new BarcodeModel("Codabar", "1D Symbologies - Legacy")); diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/barcode/BarcodePrefferences.java b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/barcode/BarcodePrefferences.java index b0860c86..6b074306 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/barcode/BarcodePrefferences.java +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/barcode/BarcodePrefferences.java @@ -12,8 +12,6 @@ import java.util.List; public class BarcodePrefferences { - - private static final String SHARED_PREFS_ANYLINE = "AnylinePreferences"; private static BarcodePrefferences instance; @@ -35,7 +33,6 @@ public static BarcodePrefferences getInstance(Context context) { } public ArrayList getDefault() { - ArrayList items = new ArrayList<>(); items.add(new BarcodeModel("UPC/EAN", "1D Symbologies - Retail Usages")); items.add(new BarcodeModel("Code 128", "1D Symbologies - Logistics / Inventory Usage")); @@ -47,18 +44,8 @@ public ArrayList getDefault() { return items; } - public void setDefault() { - - ArrayList items = getDefault(); //new ArrayList<>(); -// items.add(new BarcodeModel("UPC/EAN", "1D Symbologies - Retail Usages")); -// items.add(new BarcodeModel("Code 128", "1D Symbologies - Logistics / Inventory Usage")); -// items.add(new BarcodeModel("Code 39", "1D Symbologies - Logistics / Inventory Usage")); -// items.add(new BarcodeModel("Interleaved 2 of 5", "1D Symbologies - Logistics / Inventory Usage")); -// items.add(new BarcodeModel("Data Matrix", "2D Symbologies")); -// items.add(new BarcodeModel("PDF417", "2D Symbologies")); -// items.add(new BarcodeModel("QR Code", "2D Symbologies")); - + ArrayList items = getDefault(); Gson gson = new Gson(); String json = gson.toJson(items); editor.putString("BarcodeList", json); diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/barcode/ScanBarcodeActivity.java b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/barcode/ScanBarcodeActivity.java index e5918690..5a9f6ace 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/barcode/ScanBarcodeActivity.java +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/barcode/ScanBarcodeActivity.java @@ -221,7 +221,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { setBarcodeTypes(preselectedItems); } barcodeScanView.start(); - } } @@ -261,9 +260,11 @@ private void setBarcodeTypes(ArrayList preselectedItems) { BarcodeFormat barcodeFormatGS1 = preselectedItems.contains("GS1 QR Code") ? BarcodeFormat.GS1_QR_CODE : BarcodeFormat.UNKNOWN; BarcodeFormat barcodeFormatAZTEC = preselectedItems.contains("Aztec") ? BarcodeFormat.AZTEC : BarcodeFormat.UNKNOWN; BarcodeFormat barcodeFormatMaxiCode = preselectedItems.contains("MaxiCode") ? BarcodeFormat.MAXICODE : BarcodeFormat.UNKNOWN; + BarcodeFormat barcodeFormatOneDInversed = preselectedItems.contains("One D Inverse") ? BarcodeFormat.ONE_D_INVERSE : BarcodeFormat.UNKNOWN; scanPlugin.setBarcodeFormats(barcodeFormatDiscrete, barcodeFormatAZTEC, barcodeFormatPDF, barcodeFormatCodabar, barcodeFormatCode39, barcodeFormatCode93, barcodeFormatCode128, barcodeFormatDataMatrix, barcodeFormatEAN8, barcodeFormatEAN13, barcodeFormatQR, barcodeFormatUPCA, barcodeFormatUPCE, barcodeFormatGS1_128, barcodeFormatISTB_128, barcodeFormatTRIOPTIC, barcodeFormatCode32, barcodeFormatITF, barcodeFormatMatrix, barcodeFormatMSI, barcodeFormatCode11, - barcodeFormatUSPostnet, barcodeFormatUSPlanet, barcodeFormatUKPostal, barcodeFormatUSPS, barcodeFormatMicroPDF417, barcodeFormatMicroQR, barcodeFormatGS1, barcodeFormatGS1_Databar, barcodeFormatComposite, barcodeFormatMaxiCode); + barcodeFormatUSPostnet, barcodeFormatUSPlanet, barcodeFormatUKPostal, barcodeFormatUSPS, barcodeFormatMicroPDF417, barcodeFormatMicroQR, barcodeFormatGS1, barcodeFormatGS1_Databar, barcodeFormatComposite, barcodeFormatMaxiCode, + barcodeFormatOneDInversed); } @Override diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/baseadapters/BaseGridAdapter.java b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/baseadapters/BaseGridAdapter.java index 996a8931..1bf73a74 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/baseadapters/BaseGridAdapter.java +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/baseadapters/BaseGridAdapter.java @@ -121,15 +121,14 @@ private void bindGridItem(Holder holder, final int position) { dataFieldTitleResult = s.replace("side2 ", ""); } - dataFieldTitleResultTextView.setText(replaceArabicSuffix(String.valueOf(dataFieldTitleResult))); + dataFieldTitleResultTextView.setText(replaceSuffixes(String.valueOf(dataFieldTitleResult))); resultScanDataTextView.setText(String.valueOf(scanDataResult)); } - private String replaceArabicSuffix(String field) { - if (field.contains("@ara")) { - return field.replace("@ara", " Arabic"); - } - return field; + private String replaceSuffixes(String field) { + return field.replace("@ara", " Arabic") + .replace("@zho", " Chinese") + .replace("@cyr", " Cyrillic"); } private Object handleBarcodeField(Pattern pattern, Object dataFieldTitleResult) { diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/id/RadioButtonListViewActivity.java b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/id/RadioButtonListViewActivity.java deleted file mode 100644 index b619826b..00000000 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/id/RadioButtonListViewActivity.java +++ /dev/null @@ -1,269 +0,0 @@ -package io.anyline.examples.id; - -import android.app.Activity; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.graphics.Color; -import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.text.Layout; -import android.text.SpannableString; -import android.text.style.AlignmentSpan; -import android.text.style.ForegroundColorSpan; -import android.text.style.StyleSpan; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.RadioButton; -import android.widget.TextView; - -import androidx.appcompat.app.AlertDialog; -import androidx.core.content.ContextCompat; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Objects; - -import io.anyline.examples.R; -import io.anyline.examples.barcode.BarcodeModel; -import io.anyline.examples.baseactivities.BaseToolbarActivity; - -import static android.graphics.Typeface.BOLD; - -public class RadioButtonListViewActivity extends BaseToolbarActivity { - final static String PREFERENCE_TYPE_STATES = "STATES_COUNTRIES"; - - private RadioButtonPreferences radioButtonPreferences; - BarcodeModel preselectedItem; - BarcodeModel preselectedItemUponStart; // save the selection at the beginning - to check if changes occurred - ArrayList itemsList; - ListView listView; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.barcode_list_view_activity); - - radioButtonPreferences = RadioButtonPreferences.getInstance(this, PREFERENCE_TYPE_STATES); - preselectedItem = radioButtonPreferences.get(); - if (preselectedItem == null) { - radioButtonPreferences.setDefault(); - preselectedItem = radioButtonPreferences.get(); - } - preselectedItemUponStart = radioButtonPreferences.get(); - - itemsList = new ArrayList<>(); - try { - JSONObject typeRegionJO = new JSONObject(Objects.requireNonNull(loadTypeRegionJSONFromAsset(this))); - loopThroughJson(typeRegionJO, 0, ""); - } catch (JSONException e) { - e.printStackTrace(); - } - - listView = findViewById(R.id.listview); - ListAdapter adapter = new ListAdapter(this, itemsList); - listView.setAdapter(adapter); - } - - - private void loopThroughJson(Object input, int level, String header) throws JSONException { - - if (input instanceof JSONObject) { - Iterator keys = ((JSONObject) input).keys(); - while (keys.hasNext()) { - String key = (String) keys.next(); - if (level == 0) {// header - BarcodeModel sectionCell = new BarcodeModel(null, key); - sectionCell.setToSectionHeader(); - itemsList.add(sectionCell); - } else if (level == 1) { - itemsList.add(new BarcodeModel(key, header)); - itemsList.get(itemsList.size() - 1).setSelected(itemsList.get(itemsList.size() - 1).equals(preselectedItem)); - } - - if (!(((JSONObject) input).get(key) instanceof JSONArray)) { - if (((JSONObject) input).get(key) instanceof JSONObject) { - loopThroughJson(((JSONObject) input).get(key), level + 1, key); - } - } - } - } - } - - - static String loadTypeRegionJSONFromAsset(Context context) { - String json; - try { - InputStream is = context.getAssets().open("template_type_and_region_mapping.json"); - int size = is.available(); - byte[] buffer = new byte[size]; - is.read(buffer); - is.close(); - json = new String(buffer, StandardCharsets.UTF_8); - } catch (IOException ex) { - ex.printStackTrace(); - return null; - } - return json; - } - - @Override - protected void onPostCreate(Bundle savedInstanceState) { - super.onPostCreate(savedInstanceState); - SpannableString s = new SpannableString("Select Countries / States"); - s.setSpan((new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER)), 0, s.length(), 0); - mToolbar.setTitle(s); - - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - - Drawable backIcon = ContextCompat.getDrawable(this, R.drawable.ic_baseline_arrow_back_24).mutate(); - backIcon.setColorFilter(ContextCompat.getColor(this, R.color.black_100), PorterDuff.Mode.SRC_ATOP); - getSupportActionBar().setHomeAsUpIndicator(backIcon); - } - - - public class ListAdapter extends ArrayAdapter { - - LayoutInflater inflater; - ArrayList itemList; - - public ListAdapter(Context context, ArrayList items) { - super(context, 0, items); - itemList = items; - inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - BarcodeModel cell = (BarcodeModel) getItem(position); - - //If the cell is a section header we inflate the header layout - if (cell.isSectionHeader()) { - convertView = inflater.inflate(R.layout.raw_header, null); - convertView.setClickable(true); - View section_header_divider = convertView.findViewById(R.id.section_header_divider); - // no not show a divider line above the first header: - if (position == 0) { - section_header_divider.setVisibility(View.GONE); - } - TextView header = (TextView) convertView.findViewById(R.id.section_header); - header.setText(cell.getBarcodeCategory()); - } else { - convertView = inflater.inflate(R.layout.row_item_radio_button, null); - RadioButton radioButton = convertView.findViewById(R.id.list_item_text_child); - radioButton.setSelected(cell.isSelected()); - - if (cell.isSelected()) { - radioButton.setTextColor(Color.BLACK); - } else { - radioButton.setTextColor(Color.GRAY); - } - radioButton.setText(cell.getBarcodeType()); - radioButton.setChecked(cell.isSelected()); - - radioButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - if (radioButton.isChecked()) { - preselectedItem = cell; - // de-select all elements in the list: - for (int i = 0; i < itemsList.size(); i++) { - BarcodeModel listElement = (BarcodeModel) getItem(i); - listElement.setSelected(false); - } - // select the currently checked element in the list: - cell.setSelected(true); - } - // redraw the listview to make changes visible: - listView.invalidateViews(); - } - }); - } - return convertView; - } - } - - - private Boolean selectionChanged() { - return !preselectedItemUponStart.equals(preselectedItem); - } - - - private void finishActivity() { - Intent intent = new Intent(); - setResult(Activity.RESULT_CANCELED, intent); - finish(); - } - - - private void handleBackButton() { - // user pushed the android back button or the home button - if (selectionChanged()) { // user changed barcode selection. ask if discard changes - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(getString(R.string.go_back)). - setMessage(getString(R.string.barcode_back_message)) - .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - finishActivity(); - } - }) - .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } - }); - AlertDialog alert = builder.create(); - alert.show(); - } else { - Intent intent = new Intent(); - setResult(Activity.RESULT_CANCELED, intent); - finishActivity(); - } - } - - - @Override - public void onBackPressed() { - handleBackButton(); - } - - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - SpannableString s = new SpannableString("SAVE"); - s.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorPrimary)), 0, s.length(), 0); - s.setSpan(new StyleSpan(BOLD), 0, s.length(), 0); - MenuItem edit_item = menu.add(0, 0, 0, s); - - edit_item.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS); - return true; - } - - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - handleBackButton(); - return false; - } else if (item.getItemId() == 0) { //Save - radioButtonPreferences.setBarcodeType(preselectedItem); - Intent intent = new Intent(); - setResult(2, intent); - finish(); - } - return super.onOptionsItemSelected(item); - } - -} diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ChooseLicensePlateRegionActivity.kt b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ChooseLicensePlateRegionActivity.kt index cdb8ce49..9a690d73 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ChooseLicensePlateRegionActivity.kt +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ChooseLicensePlateRegionActivity.kt @@ -58,7 +58,6 @@ class ChooseLicensePlateRegionActivity : AppCompatActivity() { inner class ChooseLicensePlateItemDecoration : RecyclerView.ItemDecoration() { override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { - val position = parent.getChildAdapterPosition(view) if (position % 2 == 0) { @@ -66,6 +65,7 @@ class ChooseLicensePlateRegionActivity : AppCompatActivity() { } else { outRect.left = 2.px(parent.context) } + outRect.bottom = 4.px(parent.context) } } } diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ChooseLicensePlateRegionViewModel.kt b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ChooseLicensePlateRegionViewModel.kt index dc038a43..2e6603cc 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ChooseLicensePlateRegionViewModel.kt +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ChooseLicensePlateRegionViewModel.kt @@ -12,11 +12,12 @@ class ChooseLicensePlateRegionViewModel : ViewModel() { init { regions.postValue(listOf( Region.Europe, - Region.US + Region.US, + Region.Africa )) } } enum class Region { - Europe, US + Europe, US, Africa } diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/LicensePlateRegionAdapter.kt b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/LicensePlateRegionAdapter.kt index 4f354fed..f25edf4d 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/LicensePlateRegionAdapter.kt +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/LicensePlateRegionAdapter.kt @@ -38,6 +38,7 @@ class LicensePlateRegionAdapter( val imageResource = when (region) { Region.Europe -> R.drawable.tile_licenseplate_eu Region.US -> R.drawable.tile_licenseplate_us + Region.Africa -> R.drawable.tile_licenseplate_af } binding.tileImage.setImageResource(imageResource) binding.root.setOnClickListener { diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ScanLicensePlateActivity.java b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ScanLicensePlateActivity.java index a50125f2..2100262d 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ScanLicensePlateActivity.java +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/licenseplate/ScanLicensePlateActivity.java @@ -66,13 +66,9 @@ void init() { scanView.getCameraView().getCameraController().setZoomGestureEnabled(true); scanViewPlugin.addScanResultListener((ScanResultListener) result -> { - setFeedbackViewActive(false); - String path = setupImagePath(result.getCutoutImage()); - startScanResultIntent(getResources().getString(R.string.title_license_plate), getLicensePlateResult(result), path); - setupScanProcessView(ScanLicensePlateActivity.this, result, getScanModule()); }); scanViewPlugin.setDebugListener(this); @@ -87,6 +83,8 @@ private LicensePlateScanMode getLicensePlateScanModeFromIntent() { switch (region) { case US: return LicensePlateScanMode.UnitedStates; + case Africa: + return LicensePlateScanMode.Africa; default: return LicensePlateScanMode.Auto; } @@ -110,7 +108,9 @@ public HashMap getLicensePlateResult(LicensePlateScanResult lice HashMap licensePlateResultData = new HashMap<>(); - licensePlateResultData.put(getResources().getString(R.string.license_plate_country), (licensePlateResult.getCountry() == null || licensePlateResult.getCountry().isEmpty()) ? getResources().getString(R.string.not_available) : licensePlateResult.getCountry()); + if (getLicensePlateScanModeFromIntent() != LicensePlateScanMode.Africa) { + licensePlateResultData.put(getResources().getString(R.string.license_plate_country), (licensePlateResult.getCountry() == null || licensePlateResult.getCountry().isEmpty()) ? getResources().getString(R.string.not_available) : licensePlateResult.getCountry()); + } licensePlateResultData.put(getResources().getString(R.string.license_plate_result), (licensePlateResult.getResult() == null || licensePlateResult.getResult().isEmpty()) ? getResources().getString(R.string.not_available) : licensePlateResult.getResult()); return licensePlateResultData; diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/ocr/ScanBottlecapActivity.java b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/ocr/ScanBottlecapActivity.java new file mode 100644 index 00000000..4738d858 --- /dev/null +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/java/io/anyline/examples/ocr/ScanBottlecapActivity.java @@ -0,0 +1,136 @@ + +package io.anyline.examples.ocr; +import android.graphics.Color; +import android.os.Bundle; +import android.view.ViewGroup; + +import androidx.appcompat.widget.Toolbar; + +import java.util.HashMap; + +import io.anyline.AnylineDebugListener; +import at.nineyards.anyline.core.RunFailure; +import io.anyline.examples.R; +import io.anyline.examples.ScanActivity; +import io.anyline.examples.ScanModuleEnum; +import io.anyline.examples.ocr.feedback.FeedbackType; +import io.anyline.plugin.ScanResultListener; +import io.anyline.plugin.ocr.AnylineOcrConfig; +import io.anyline.plugin.ocr.OcrScanResult; +import io.anyline.plugin.ocr.OcrScanViewPlugin; +import io.anyline.view.BaseScanViewConfig; +import io.anyline.view.ScanView; +import io.anyline.view.ScanViewPluginConfig; + + +public class ScanBottlecapActivity extends ScanActivity implements AnylineDebugListener { + + private static final String TAG = ScanBottlecapActivity.class.getSimpleName(); + private ScanView scanView; + + @Override + protected ScanView getScanView() { + return null; + } +@Override + protected ScanModuleEnum.ScanModule getScanModule() { + return ScanModuleEnum.ScanModule.BOTTLECAP; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + getLayoutInflater().inflate(R.layout.activity_anyline_scan_view, (ViewGroup) findViewById(R.id + .scan_view_placeholder)); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + toolbar.setTitle("Pepsi code"); + toolbar.setTitleTextColor(Color.WHITE); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + init(); + } + // see ScanIbanActivity for a more detailed description + + void init() { + scanView = (ScanView) findViewById(R.id.scan_view); + + final AnylineOcrConfig anylineOcrConfig = new AnylineOcrConfig(this, "bottlecap_view_config.json"); + + + //init the scanViewPlugin config + ScanViewPluginConfig ocrScanViewPluginConfig = new ScanViewPluginConfig(getApplicationContext(), "bottlecap_view_config.json"); + //init the scan view + OcrScanViewPlugin scanViewPlugin = new OcrScanViewPlugin(getApplicationContext(), anylineOcrConfig, ocrScanViewPluginConfig, "OCR"); + //init the base config used for camera and flash + BaseScanViewConfig ocrBaseScanViewConfig = new BaseScanViewConfig(getApplicationContext(), "bottlecap_view_config.json"); + //set the scan Base config + scanView.setScanViewConfig(ocrBaseScanViewConfig); + //set the scan view plugin to the scan view + scanView.setScanViewPlugin(scanViewPlugin); + //add the scan result listener + scanViewPlugin.addScanResultListener(new ScanResultListener() { + @Override + public void onResult(OcrScanResult result) { + String path = setupImagePath(result.getCutoutImage()); + startScanResultIntent(getResources().getString(R.string.title_bottlecap), getSerialNumberResult(result.getResult().toString()), path); + setupScanProcessView(ScanBottlecapActivity.this, result, getScanModule()); + } + + }); + //set the debug listener + scanViewPlugin.setDebugListener(this); + + } + + @Override + protected void onResume() { + super.onResume(); + scanView.start(); + createFeedbackView(scanView); + } + + @Override + protected void onPause() { + super.onPause(); + scanView.stop(); + scanView.releaseCameraInBackground(); + + } + + protected HashMap getSerialNumberResult (String result) { + + HashMap serialNumberResult = new HashMap(); + + serialNumberResult.put(getResources().getString(R.string.bottlecap_reading_result), (result.isEmpty() || result ==null) ? getResources().getString(R.string.not_available) : result ); + + return serialNumberResult; + } + + @Override + public void onRunSkipped(RunFailure runFailure) { + } + + @Override + public void onDebug(String name, Object value) { + if (AnylineDebugListener.BRIGHTNESS_VARIABLE_NAME.equals(name) && + (AnylineDebugListener.BRIGHTNESS_VARIABLE_CLASS.equals(value.getClass()) || + AnylineDebugListener.BRIGHTNESS_VARIABLE_CLASS.isAssignableFrom(value.getClass()))) { + switch (scanView.getBrightnessFeedBack()) { + case TOO_BRIGHT: + handleFeedback(FeedbackType.TOO_BRIGHT); + break; + case TOO_DARK: + handleFeedback(FeedbackType.TOO_DARK); + break; + case OK: + handleFeedback(FeedbackType.PERFECT); + break; + } + } else if(AnylineDebugListener.DEVICE_SHAKE_WARNING_VARIABLE_NAME.equals(name)){ + handleFeedback(FeedbackType.SHAKY); + } + } + +} \ No newline at end of file diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable-xxhdpi/tile_licenseplate_af.png b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable-xxhdpi/tile_licenseplate_af.png new file mode 100644 index 00000000..090648e5 Binary files /dev/null and b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable-xxhdpi/tile_licenseplate_af.png differ diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable/ic_checkmark.xml b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable/ic_checkmark.xml new file mode 100644 index 00000000..4d77daa0 --- /dev/null +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable/ic_checkmark.xml @@ -0,0 +1,4 @@ + + + diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable/ic_clear.xml b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable/ic_clear.xml new file mode 100644 index 00000000..9fc0a95d --- /dev/null +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/drawable/ic_clear.xml @@ -0,0 +1,4 @@ + + + diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/layout/activity_result_id_scan_view.xml b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/layout/activity_result_id_scan_view.xml deleted file mode 100644 index ee953021..00000000 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/layout/activity_result_id_scan_view.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/layout/row_item_radio_button.xml b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/layout/row_item_radio_button.xml deleted file mode 100755 index 289105ba..00000000 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/layout/row_item_radio_button.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_drivers_license.xml b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_change_script.xml similarity index 67% rename from AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_drivers_license.xml rename to AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_change_script.xml index eb0d2600..9b95a096 100644 --- a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_drivers_license.xml +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_change_script.xml @@ -7,10 +7,4 @@ android:icon="@drawable/ic_info_white_24dp" android:title="@null" app:showAsAction="always" /> - - \ No newline at end of file diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_change_script_face_auth.xml b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_change_script_face_auth.xml new file mode 100644 index 00000000..9b95a096 --- /dev/null +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/menu/menu_scan_change_script_face_auth.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/xml/paths.xml b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/xml/paths.xml new file mode 100644 index 00000000..e2704179 --- /dev/null +++ b/AnylineSDK-Examples/AnylineSDK-Examples-Source/app/src/main/res/xml/paths.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/AnylineSDK/anylinesdk-34.0.0.aar b/AnylineSDK/anylinesdk-34.0.0.aar new file mode 100644 index 00000000..e20c329a --- /dev/null +++ b/AnylineSDK/anylinesdk-34.0.0.aar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c440b022c690373b1e8d512220e28f5086481f939343aa97c085d8e6c70be1e2 +size 75502974 diff --git a/AnylineSDK/anylinesdk-release-32.0.0.aar b/AnylineSDK/anylinesdk-release-32.0.0.aar deleted file mode 100644 index d1ead622..00000000 --- a/AnylineSDK/anylinesdk-release-32.0.0.aar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f37d13bc6af757939e3265d735be4aad9e694f60091e7e89880cd602cdbdd784 -size 65460104 diff --git a/Documentation/javadoc/allclasses-frame.html b/Documentation/javadoc/allclasses-frame.html index 4a27feab..20f3bc3e 100644 --- a/Documentation/javadoc/allclasses-frame.html +++ b/Documentation/javadoc/allclasses-frame.html @@ -16,6 +16,8 @@

All Classes

  • AbstractScanViewPlugin
  • AbstractScanViewPluginComposite
  • AbstractWebView
  • +
  • Alphabet
  • +
  • AlphabetMapper
  • AnylineCattleTagConfig
  • AnylineContainerConfig
  • AnylineContainerConfig.ContainerScanMode
  • @@ -46,6 +48,7 @@

    All Classes

  • CutoutConfig.CutoutStyle
  • CutoutConfigChangedListener
  • CutoutRect
  • +
  • CyrillicIdConfig
  • DataObject
  • DebugUtil
  • DocumentNotifierListener
  • @@ -117,7 +120,6 @@

    All Classes

  • ScanViewPluginConfig
  • ScanViewRefactor
  • ScanViewUtil
  • -
  • Script
  • SerialScanViewComposite
  • TemplateConfig
  • TemplateFieldConfidences
  • diff --git a/Documentation/javadoc/allclasses-noframe.html b/Documentation/javadoc/allclasses-noframe.html index 902a511b..57aeccb3 100644 --- a/Documentation/javadoc/allclasses-noframe.html +++ b/Documentation/javadoc/allclasses-noframe.html @@ -16,6 +16,8 @@

    All Classes

  • AbstractScanViewPlugin
  • AbstractScanViewPluginComposite
  • AbstractWebView
  • +
  • Alphabet
  • +
  • AlphabetMapper
  • AnylineCattleTagConfig
  • AnylineContainerConfig
  • AnylineContainerConfig.ContainerScanMode
  • @@ -46,6 +48,7 @@

    All Classes

  • CutoutConfig.CutoutStyle
  • CutoutConfigChangedListener
  • CutoutRect
  • +
  • CyrillicIdConfig
  • DataObject
  • DebugUtil
  • DocumentNotifierListener
  • @@ -117,7 +120,6 @@

    All Classes

  • ScanViewPluginConfig
  • ScanViewRefactor
  • ScanViewUtil
  • -
  • Script
  • SerialScanViewComposite
  • TemplateConfig
  • TemplateFieldConfidences
  • diff --git a/Documentation/javadoc/index-all.html b/Documentation/javadoc/index-all.html index ca7de5a3..e71d9cd4 100644 --- a/Documentation/javadoc/index-all.html +++ b/Documentation/javadoc/index-all.html @@ -150,6 +150,12 @@

    A

     
    addUIConfigChangedListener(UIChangeListener) - Method in class io.anyline.view.AbstractScanViewPluginComposite
     
    +
    Alphabet - Enum in io.anyline.plugin.id
    +
     
    +
    AlphabetMapper - Class in io.anyline.plugin.id
    +
     
    +
    AlphabetMapper() - Constructor for class io.anyline.plugin.id.AlphabetMapper
    +
     
    ANYLINE_LICENSE_PLATE_BUNDLE_PATH - Static variable in class io.anyline.plugin.licenseplate.LicensePlateScanPlugin
     
    AnylineCattleTagConfig - Class in io.anyline.plugin.ocr
    @@ -333,6 +339,10 @@

    C

     
    CutoutRect(Context, CutoutConfig) - Constructor for class io.anyline.view.CutoutRect
     
    +
    CyrillicIdConfig - Class in io.anyline.plugin.id
    +
     
    +
    CyrillicIdConfig(JSONObject) - Constructor for class io.anyline.plugin.id.CyrillicIdConfig
    +
     
    @@ -510,6 +520,8 @@

    F

     
    fromInt(int) - Static method in enum io.anyline.view.FlashViewConfig.FlashMode
     
    +
    fromString(String) - Static method in enum io.anyline.plugin.id.Alphabet
    +
     
    fromString(String) - Static method in enum io.anyline.view.CutoutConfig.CutoutAlignment
     
    fromString(String) - Static method in enum io.anyline.view.CutoutConfig.CutoutStyle
    @@ -600,6 +612,8 @@

    G

     
    getAllScanViewPlugins() - Method in class io.anyline.view.AbstractScanViewPluginComposite
     
    +
    getAlphabet() - Method in class io.anyline.plugin.id.IdConfig
    +
     
    getAlphaFactor() - Method in class io.anyline.view.CutoutConfig
     
    getAlphaString() - Method in class io.anyline.view.CutoutConfig
    @@ -1824,6 +1838,8 @@

    L

    M

    +
    map(JSONObject) - Method in class io.anyline.plugin.id.AlphabetMapper
    +
     
    mapToStartVariableString(Map<LicensePlateScanMode, String>, String, String) - Static method in class io.anyline.plugin.licenseplate.LicensePlateScanPlugin
     
    MeterScanMode - Enum in io.anyline.plugin.meter
    @@ -2182,8 +2198,6 @@

    S

     
    ScanViewUtil() - Constructor for class io.anyline.view.ScanViewUtil
     
    -
    Script - Enum in io.anyline.plugin.id
    -
     
    SerialScanViewComposite - Class in io.anyline.view
     
    SerialScanViewComposite(String) - Constructor for class io.anyline.view.SerialScanViewComposite
    @@ -2210,6 +2224,8 @@

    S

    setAllCheckDigitsValid(boolean) - Method in class io.anyline.plugin.id.MrzIdentification
     
    +
    setAlphabet(Alphabet) - Method in class io.anyline.plugin.id.IdConfig
    +
     
    setAmbientLightThreshold(int, int, int) - Method in class io.anyline.view.LightLevelHelper
     
    setAnimationStyle(CutoutConfig.AnimationStyle) - Method in class io.anyline.view.CutoutConfig
    @@ -3474,16 +3490,16 @@

    V

    Returns the enum constant of this type with the specified name.
    -
    valueOf(String) - Static method in enum io.anyline.plugin.id.DrivingLicenseConfig.DrivingLicenseCountry
    +
    valueOf(String) - Static method in enum io.anyline.plugin.id.Alphabet
    -
    Deprecated.
    Returns the enum constant of this type with the specified name.
    -
    valueOf(String) - Static method in enum io.anyline.plugin.id.IDFieldScanOptions.FieldScanOption
    +
    valueOf(String) - Static method in enum io.anyline.plugin.id.DrivingLicenseConfig.DrivingLicenseCountry
    +
    Deprecated.
    Returns the enum constant of this type with the specified name.
    -
    valueOf(String) - Static method in enum io.anyline.plugin.id.Script
    +
    valueOf(String) - Static method in enum io.anyline.plugin.id.IDFieldScanOptions.FieldScanOption
    Returns the enum constant of this type with the specified name.
    @@ -3567,18 +3583,18 @@

    V

    Returns an array containing the constants of this enum type, in the order they are declared.
    -
    values() - Static method in enum io.anyline.plugin.id.DrivingLicenseConfig.DrivingLicenseCountry
    +
    values() - Static method in enum io.anyline.plugin.id.Alphabet
    -
    Deprecated.
    Returns an array containing the constants of this enum type, in the order they are declared.
    -
    values() - Static method in enum io.anyline.plugin.id.IDFieldScanOptions.FieldScanOption
    +
    values() - Static method in enum io.anyline.plugin.id.DrivingLicenseConfig.DrivingLicenseCountry
    +
    Deprecated.
    Returns an array containing the constants of this enum type, in the order they are declared.
    -
    values() - Static method in enum io.anyline.plugin.id.Script
    +
    values() - Static method in enum io.anyline.plugin.id.IDFieldScanOptions.FieldScanOption
    Returns an array containing the constants of this enum type, in the order they are declared.
    diff --git a/Documentation/javadoc/io/anyline/plugin/document/package-tree.html b/Documentation/javadoc/io/anyline/plugin/document/package-tree.html index 77bdf8e9..2682410f 100644 --- a/Documentation/javadoc/io/anyline/plugin/document/package-tree.html +++ b/Documentation/javadoc/io/anyline/plugin/document/package-tree.html @@ -111,8 +111,8 @@

    Enum Hierarchy

    + + + +
      +
    • +

      setAlphabet

      +
      public void setAlphabet(Alphabet alphabet)
      +
    • +
    + + + +
      +
    • +

      getAlphabet

      +
      public Alphabet getAlphabet()
      +
    • +
    diff --git a/Documentation/javadoc/io/anyline/plugin/id/JapaneseLandingPermissionConfig.html b/Documentation/javadoc/io/anyline/plugin/id/JapaneseLandingPermissionConfig.html index cbdf1383..962245e8 100644 --- a/Documentation/javadoc/io/anyline/plugin/id/JapaneseLandingPermissionConfig.html +++ b/Documentation/javadoc/io/anyline/plugin/id/JapaneseLandingPermissionConfig.html @@ -169,7 +169,7 @@

    Methods inherited from class io.anyline.plugin.id.IdConfig

    -enableFaceDetection, getIdFieldScanOptions, getIdMinFieldConfidences, getMinConfidence, isFaceDetectionEnabled, setIdFieldScanOptions, setIdMinFieldConfidences, setMinConfidence +enableFaceDetection, getAlphabet, getIdFieldScanOptions, getIdMinFieldConfidences, getMinConfidence, isFaceDetectionEnabled, setAlphabet, setIdFieldScanOptions, setIdMinFieldConfidences, setMinConfidence