Aggiunto supporto ad Honeywell EDA51

This commit is contained in:
Giuseppe Scorrano 2019-07-25 09:46:03 +02:00
parent 6877cce9ad
commit 0c4a6d5eaf
3 changed files with 33 additions and 149 deletions

View File

@ -6,7 +6,7 @@
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic__base,dynamic_ime" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic_ime,dynamic_vgalimenti" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="true" />

View File

@ -9,11 +9,14 @@
android:background="@color/full_white"
tools:context=".gest.main.MainFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<net.cachapa.expandablelayout.ExpandableLayout
android:id="@+id/no_connection_top_layout"
android:layout_width="match_parent"
@ -55,12 +58,14 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal">
android:layout_margin="12dp"
app:cardElevation="4dp"
app:cardCornerRadius="8dp">
<RelativeLayout
android:layout_width="match_parent"
@ -184,136 +189,13 @@
</RelativeLayout>
</RelativeLayout>
<!--<androidx.constraintlayout.widget.ConstraintLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:padding="8dp">-->
<!--<androidx.constraintlayout.widget.Guideline-->
<!--android:id="@+id/guide_2"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical"-->
<!--app:layout_constraintGuide_percent="0.5"/>-->
<!--<TextView-->
<!--android:id="@+id/prod_dashboard_group_title"-->
<!--style="@style/AppTheme.NewMaterial.Text.TextBoxGroupTitleDashboard"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--app:layout_constraintTop_toTopOf="parent"-->
<!--android:text="@string/production" />-->
<!--<RelativeLayout-->
<!--android:id="@+id/fast_button_prod_versamento_materiale"-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="wrap_content"-->
<!--app:layout_constraintTop_toBottomOf="@id/prod_dashboard_group_title"-->
<!--app:layout_constraintStart_toStartOf="parent"-->
<!--app:layout_constraintEnd_toStartOf="@id/guide_2">-->
<!--<com.google.android.material.card.MaterialCardView-->
<!--style="@style/Widget.MaterialComponents.CardView"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_margin="8dp"-->
<!--app:cardBackgroundColor="@android:color/white"-->
<!--app:cardCornerRadius="4dp">-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:gravity="center_horizontal"-->
<!--android:orientation="vertical"-->
<!--android:padding="8dp">-->
<!--<ImageView-->
<!--android:layout_width="64sp"-->
<!--android:layout_height="wrap_content"-->
<!--android:adjustViewBounds="true"-->
<!--android:src="@drawable/ic_dashboard_prod_versamento_materiale" />-->
<!--<androidx.appcompat.widget.AppCompatTextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="16dp"-->
<!--android:gravity="center_horizontal"-->
<!--android:text="@string/prod_versamento_materiale_title_fragment"-->
<!--android:textAllCaps="true"-->
<!--android:textColor="@color/gray_700"-->
<!--android:textStyle="bold" />-->
<!--</LinearLayout>-->
<!--</com.google.android.material.card.MaterialCardView>-->
<!--</RelativeLayout>-->
<!--<RelativeLayout-->
<!--android:id="@+id/fast_button_prod_recupero_materiale"-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="wrap_content"-->
<!--app:layout_constraintTop_toBottomOf="@id/prod_dashboard_group_title"-->
<!--app:layout_constraintStart_toEndOf="@id/guide_2"-->
<!--app:layout_constraintEnd_toEndOf="parent">-->
<!--<com.google.android.material.card.MaterialCardView-->
<!--style="@style/Widget.MaterialComponents.CardView"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_margin="8dp"-->
<!--app:cardBackgroundColor="@android:color/white"-->
<!--app:cardCornerRadius="4dp">-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:gravity="center_horizontal"-->
<!--android:orientation="vertical"-->
<!--android:padding="8dp">-->
<!--<ImageView-->
<!--android:layout_width="64sp"-->
<!--android:layout_height="wrap_content"-->
<!--android:adjustViewBounds="true"-->
<!--android:src="@drawable/ic_dashboard_prod_recupero_materiale" />-->
<!--<androidx.appcompat.widget.AppCompatTextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="16dp"-->
<!--android:gravity="center_horizontal"-->
<!--android:text="@string/prod_recupero_materiale_title_fragment"-->
<!--android:textAllCaps="true"-->
<!--android:textColor="@color/gray_700"-->
<!--android:textStyle="bold" />-->
<!--</LinearLayout>-->
<!--</com.google.android.material.card.MaterialCardView>-->
<!--</RelativeLayout>-->
<!--</androidx.constraintlayout.widget.ConstraintLayout>-->
</androidx.cardview.widget.CardView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</FrameLayout>
</layout>

View File

@ -17,7 +17,9 @@ import com.honeywell.aidc.InvalidScannerNameException;
import com.honeywell.aidc.ScannerUnavailableException;
import com.honeywell.aidc.UnsupportedPropertyException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import it.integry.plugins.barcode_base_library.exception.BarcodeAdapterNotFoundException;
@ -43,7 +45,11 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
@Override
public boolean isRightAdapter() {
String model = Build.MODEL;
if(model.equalsIgnoreCase("EDA50")) {
List<String> compatibleModels = new ArrayList<String>();
compatibleModels.add("EDA50");
compatibleModels.add("EDA51");
if(compatibleModels.contains(model)) {
return true;
} else return false;
}
@ -52,27 +58,23 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
public void init(final Runnable onDeviceReady) throws BarcodeAdapterNotFoundException {
if(isRightAdapter()) {
AidcManager.create(mContext, new AidcManager.CreatedCallback() {
AidcManager.create(mContext, aidcManager -> {
@Override
public void onCreated(AidcManager aidcManager) {
manager = aidcManager;
manager = aidcManager;
try{
barcodeReader = manager.createBarcodeReader();
registerListenersInternal();
}
catch (InvalidScannerNameException e){
Toast.makeText(mContext, "Invalid Scanner Name Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
catch (Exception e){
Toast.makeText(mContext, "Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
onDeviceReady.run();
try{
barcodeReader = manager.createBarcodeReader();
registerListenersInternal();
}
catch (InvalidScannerNameException e){
Toast.makeText(mContext, "Invalid Scanner Name Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
catch (Exception e){
Toast.makeText(mContext, "Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
onDeviceReady.run();
});
} else {