- ui bugs fixed

main
saif 2024-09-26 12:20:20 +05:00
parent 76b4ddbc6f
commit 4668ef5259
11 changed files with 142 additions and 81 deletions

View File

@ -37,21 +37,21 @@
android:name=".ui.activities.MainActivity" android:name=".ui.activities.MainActivity"
android:exported="true" android:exported="true"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysVisible|adjustResize"> android:windowSoftInputMode="adjustResize">
</activity> </activity>
<activity <activity
android:name=".ui.activities.HomeActivity" android:name=".ui.activities.HomeActivity"
android:exported="true" android:exported="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysVisible|adjustResize"> android:windowSoftInputMode="adjustPan|adjustResize">
</activity> </activity>
<activity <activity
android:name=".ui.activities.LoginActivity" android:name=".ui.activities.LoginActivity"
android:exported="true" android:exported="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysVisible|adjustResize"> android:windowSoftInputMode="adjustPan|adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />

View File

@ -71,6 +71,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
* */ * */
public static final String CHECKPOINT_SKU_TABLE_NAME = "checkpoint_sku"; public static final String CHECKPOINT_SKU_TABLE_NAME = "checkpoint_sku";
public static final String CHECKPOINT_SKU_SKU = "sku"; public static final String CHECKPOINT_SKU_SKU = "sku";
public static final String CHECKPOINT_SKU_MARKETPLACE = "marketplace";
public static final String CHECKPOINT_SKU_CHECKPOINT_ID = "checkpoint_id"; public static final String CHECKPOINT_SKU_CHECKPOINT_ID = "checkpoint_id";
public static final String CHECKPOINT_SKU_STANDARD = "standard"; public static final String CHECKPOINT_SKU_STANDARD = "standard";
@ -130,9 +131,10 @@ public class DatabaseHelper extends SQLiteOpenHelper {
String CREATE_SKU_CHECKPOINT_TABLE = "CREATE TABLE " + CHECKPOINT_SKU_TABLE_NAME + " (" + String CREATE_SKU_CHECKPOINT_TABLE = "CREATE TABLE " + CHECKPOINT_SKU_TABLE_NAME + " (" +
CHECKPOINT_SKU_SKU + " TEXT NOT NULL," + CHECKPOINT_SKU_SKU + " TEXT NOT NULL," +
CHECKPOINT_SKU_MARKETPLACE + " TEXT NOT NULL," +
CHECKPOINT_SKU_CHECKPOINT_ID + " INTEGER NOT NULL," + CHECKPOINT_SKU_CHECKPOINT_ID + " INTEGER NOT NULL," +
CHECKPOINT_SKU_STANDARD + " TEXT," + CHECKPOINT_SKU_STANDARD + " TEXT," +
"PRIMARY KEY (" + CHECKPOINT_SKU_SKU + ", " + CHECKPOINT_SKU_CHECKPOINT_ID + "))"; "PRIMARY KEY (" + CHECKPOINT_SKU_SKU + ", " + CHECKPOINT_SKU_MARKETPLACE + ", " + CHECKPOINT_SKU_CHECKPOINT_ID + "))";
db.execSQL( CREATE_PRODUCT_TABLE ); db.execSQL( CREATE_PRODUCT_TABLE );
db.execSQL( CREATE_INSPECTION_DIMENSION_TABLE ); db.execSQL( CREATE_INSPECTION_DIMENSION_TABLE );

View File

@ -33,6 +33,7 @@ public class InspectionCheckpointSkuRepository {
for ( InspectionCheckpointSku checkPoint : checkPoints ) { for ( InspectionCheckpointSku checkPoint : checkPoints ) {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put(DatabaseHelper.CHECKPOINT_SKU_SKU, checkPoint.getSku() ); values.put(DatabaseHelper.CHECKPOINT_SKU_SKU, checkPoint.getSku() );
values.put(DatabaseHelper.CHECKPOINT_SKU_MARKETPLACE, checkPoint.getMarketplace() );
values.put(DatabaseHelper.CHECKPOINT_SKU_CHECKPOINT_ID, checkPoint.getCheckpointId() ); values.put(DatabaseHelper.CHECKPOINT_SKU_CHECKPOINT_ID, checkPoint.getCheckpointId() );
values.put(DatabaseHelper.CHECKPOINT_SKU_STANDARD, checkPoint.getStandard() ); values.put(DatabaseHelper.CHECKPOINT_SKU_STANDARD, checkPoint.getStandard() );
database.insertWithOnConflict(DatabaseHelper.CHECKPOINT_SKU_TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE); database.insertWithOnConflict(DatabaseHelper.CHECKPOINT_SKU_TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE);
@ -46,10 +47,10 @@ public class InspectionCheckpointSkuRepository {
} }
@SuppressLint("Range") @SuppressLint("Range")
public List<InspectionCheckpointSku> findBySku(String sku ){ public List<InspectionCheckpointSku> findBySkuAndMarketplace(String sku, String marketplace ){
String selection = DatabaseHelper.CHECKPOINT_SKU_SKU + "=?"; String selection = DatabaseHelper.CHECKPOINT_SKU_SKU + "=? AND " + DatabaseHelper.CHECKPOINT_SKU_MARKETPLACE + "=?";
String[] selectionArgs = {sku}; String[] selectionArgs = {sku,marketplace};
Cursor cursor = database.query( DatabaseHelper.CHECKPOINT_SKU_TABLE_NAME, Cursor cursor = database.query( DatabaseHelper.CHECKPOINT_SKU_TABLE_NAME,
null, null,
@ -64,6 +65,7 @@ public class InspectionCheckpointSkuRepository {
do { do {
InspectionCheckpointSku checkpointSku = new InspectionCheckpointSku(); InspectionCheckpointSku checkpointSku = new InspectionCheckpointSku();
checkpointSku.setSku( cursor.getString( cursor.getColumnIndex( DatabaseHelper.CHECKPOINT_SKU_SKU ))); checkpointSku.setSku( cursor.getString( cursor.getColumnIndex( DatabaseHelper.CHECKPOINT_SKU_SKU )));
checkpointSku.setMarketplace( cursor.getString( cursor.getColumnIndex( DatabaseHelper.CHECKPOINT_SKU_MARKETPLACE )));
checkpointSku.setCheckpointId( cursor.getLong(cursor.getColumnIndex( DatabaseHelper.CHECKPOINT_SKU_CHECKPOINT_ID ))); checkpointSku.setCheckpointId( cursor.getLong(cursor.getColumnIndex( DatabaseHelper.CHECKPOINT_SKU_CHECKPOINT_ID )));
checkpointSku.setStandard( cursor.getString(cursor.getColumnIndex(DatabaseHelper.CHECKPOINT_SKU_STANDARD ))); checkpointSku.setStandard( cursor.getString(cursor.getColumnIndex(DatabaseHelper.CHECKPOINT_SKU_STANDARD )));
checkpointSkus.add( checkpointSku ); checkpointSkus.add( checkpointSku );
@ -90,6 +92,7 @@ public class InspectionCheckpointSkuRepository {
do { do {
InspectionCheckpointSku checkPoint = new InspectionCheckpointSku(); InspectionCheckpointSku checkPoint = new InspectionCheckpointSku();
checkPoint.setSku(cursor.getString( cursor.getColumnIndex(DatabaseHelper.CHECKPOINT_SKU_SKU ))); checkPoint.setSku(cursor.getString( cursor.getColumnIndex(DatabaseHelper.CHECKPOINT_SKU_SKU )));
checkPoint.setMarketplace( cursor.getString( cursor.getColumnIndex( DatabaseHelper.CHECKPOINT_SKU_MARKETPLACE )));
checkPoint.setCheckpointId(cursor.getLong(cursor.getColumnIndex(DatabaseHelper.CHECKPOINT_SKU_CHECKPOINT_ID) )); checkPoint.setCheckpointId(cursor.getLong(cursor.getColumnIndex(DatabaseHelper.CHECKPOINT_SKU_CHECKPOINT_ID) ));
checkPoint.setStandard(cursor.getString(cursor.getColumnIndex(DatabaseHelper.CHECKPOINT_SKU_STANDARD ))); checkPoint.setStandard(cursor.getString(cursor.getColumnIndex(DatabaseHelper.CHECKPOINT_SKU_STANDARD )));
checkPoints.add( checkPoint ); checkPoints.add( checkPoint );

View File

@ -5,14 +5,16 @@ public class InspectionCheckpointSku {
private String sku; private String sku;
private long checkpointId; private long checkpointId;
private String standard; private String standard;
private String marketplace;
public InspectionCheckpointSku() { public InspectionCheckpointSku() {
} }
public InspectionCheckpointSku(String sku, long checkpointId, String standard) { public InspectionCheckpointSku(String sku, long checkpointId, String standard, String marketplace) {
this.sku = sku; this.sku = sku;
this.checkpointId = checkpointId; this.checkpointId = checkpointId;
this.standard = standard; this.standard = standard;
this.marketplace = marketplace;
} }
public String getSku() { public String getSku() {
@ -38,4 +40,22 @@ public class InspectionCheckpointSku {
public void setStandard(String standard) { public void setStandard(String standard) {
this.standard = standard; this.standard = standard;
} }
public String getMarketplace() {
return marketplace;
}
public void setMarketplace(String marketplace) {
this.marketplace = marketplace;
}
@Override
public String toString() {
return "InspectionCheckpointSku{" +
"sku='" + sku + '\'' +
", checkpointId=" + checkpointId +
", standard='" + standard + '\'' +
", marketplace='" + marketplace + '\'' +
'}';
}
} }

View File

@ -7,6 +7,7 @@ import android.content.SharedPreferences;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.Toast; import android.widget.Toast;
import androidx.activity.EdgeToEdge; import androidx.activity.EdgeToEdge;

View File

@ -13,6 +13,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
@ -74,7 +75,8 @@ public class CheckPointAdapter extends
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
InspectionItemCheckPoint checkPoint = checkPointList.get( position ); InspectionItemCheckPoint checkPoint = checkPointList.get( position );
holder.bind(checkPoints, defects, defectTypes, checkPoint, checkpointSkus, context ); holder.bind(checkPoints, defects, defectTypes, checkPoint, checkpointSkus, context );
holder.setIsRecyclable(false);
//holder.setIsRecyclable(false);
// spinner on change // spinner on change
{ {
holder.checkpointSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { holder.checkpointSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@ -96,21 +98,7 @@ public class CheckPointAdapter extends
} }
// checkboxes on change // checkboxes on change
{ {
holder.okCheckBox.setOnCheckedChangeListener((buttonView, isChecked) -> { holder.setUpCheckboxesListeners( checkPoint );
if (isChecked) {
holder.linearLayout.setVisibility(View.INVISIBLE);
}
checkPoint.setChecked ( false );
holder.noCheckBox.setChecked( !isChecked );
});
holder.noCheckBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) {
holder.linearLayout.setVisibility(View.VISIBLE);
}
checkPoint.setChecked( true );
holder.okCheckBox.setChecked( !isChecked );
});
} }
// remarks on change // remarks on change
{ {
@ -154,8 +142,11 @@ public class CheckPointAdapter extends
private final TextView selectedImage,standard; private final TextView selectedImage,standard;
private final ImageView imagePreview; private final ImageView imagePreview;
private final RecyclerView defectRecyclerView; private final RecyclerView defectRecyclerView;
private TextWatcher remarksTextWatcher;
private CompoundButton.OnCheckedChangeListener okCheckboxListener;
private CompoundButton.OnCheckedChangeListener noCheckboxListener;
public ViewHolder(@NonNull View itemView ) { public ViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
remarks = itemView.findViewById(R.id.check_point_remarks); remarks = itemView.findViewById(R.id.check_point_remarks);
checkpointSpinner = itemView.findViewById(R.id.check_point_spinner); checkpointSpinner = itemView.findViewById(R.id.check_point_spinner);
@ -178,8 +169,27 @@ public class CheckPointAdapter extends
InspectionItemCheckPoint data, InspectionItemCheckPoint data,
List<InspectionCheckpointSku> checkpointSkus, List<InspectionCheckpointSku> checkpointSkus,
Context context ) { Context context ) {
// initialize recyclerview
if ( remarksTextWatcher != null) {
remarks.removeTextChangedListener(remarksTextWatcher);
}
if( okCheckboxListener != null ){
okCheckBox.setOnCheckedChangeListener( null );
}
if( noCheckboxListener != null ){
noCheckBox.setOnCheckedChangeListener( null );
}
remarks.setText( data.getRemarks() );
imagePreview.setImageBitmap( null );
selectedImage.setText( "" );
if( data.getFile() != null && data.getFile().length > 0 && data.getImagePath() != null && ! data.getImagePath().isEmpty() ){
Bitmap bitmap = BitmapFactory.decodeByteArray( data.getFile(), 0 , data.getFile().length );
imagePreview.setImageBitmap( bitmap );
selectedImage.setText( data.getImagePath() );
}
// initialize recyclerview
List<String> checkPointsList = checkPoints.stream().map(InspectionCheckPoint::getTitle).collect(Collectors.toList()); List<String> checkPointsList = checkPoints.stream().map(InspectionCheckPoint::getTitle).collect(Collectors.toList());
// Populate checklist Spinner dropdown // Populate checklist Spinner dropdown
@ -188,13 +198,11 @@ public class CheckPointAdapter extends
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
checkpointSpinner.setAdapter(spinnerAdapter); checkpointSpinner.setAdapter(spinnerAdapter);
// Pre populate // Pre populate
String defaultSelectedItem = data.getTitle(); String defaultSelectedItem = data.getTitle();
int defaultPosition = checkPointsList.indexOf(defaultSelectedItem); int defaultPosition = checkPointsList.indexOf(defaultSelectedItem);
checkpointSpinner.setSelection(defaultPosition); checkpointSpinner.setSelection(defaultPosition);
remarks.setText( data.getRemarks() );
okCheckBox.setChecked( data.getChecked() ); okCheckBox.setChecked( data.getChecked() );
noCheckBox.setChecked( ! data.getChecked()); noCheckBox.setChecked( ! data.getChecked());
@ -204,12 +212,6 @@ public class CheckPointAdapter extends
linearLayout.setVisibility(View.VISIBLE); linearLayout.setVisibility(View.VISIBLE);
} }
selectedImage.setText( data.getImagePath() );
if( data.getFile() != null ){
Bitmap bitmap = BitmapFactory.decodeByteArray( data.getFile(), 0 , data.getFile().length );
imagePreview.setImageBitmap( bitmap );
}
InspectionCheckPoint cp = checkPoints.stream().filter(c -> c.getTitle().equalsIgnoreCase(defaultSelectedItem)).findFirst().orElse( new InspectionCheckPoint()); InspectionCheckPoint cp = checkPoints.stream().filter(c -> c.getTitle().equalsIgnoreCase(defaultSelectedItem)).findFirst().orElse( new InspectionCheckPoint());
// set standard // set standard
if( checkpointSkus != null ){ if( checkpointSkus != null ){
@ -220,7 +222,9 @@ public class CheckPointAdapter extends
if( cpSku.getStandard() != null && ! cpSku.getStandard().isEmpty() ){ if( cpSku.getStandard() != null && ! cpSku.getStandard().isEmpty() ){
standard.setText( cpSku.getStandard() ); standard.setText( cpSku.getStandard() );
} else { } else {
((ViewGroup) standard.getParent() ).removeView( standard ); if( standard.getParent() != null ){
((ViewGroup) standard.getParent() ).removeView( standard );
}
} }
} }
defectRecyclerView.setLayoutManager( new LinearLayoutManager( context ) ); defectRecyclerView.setLayoutManager( new LinearLayoutManager( context ) );
@ -235,20 +239,11 @@ public class CheckPointAdapter extends
.collect(Collectors.toList()); .collect(Collectors.toList());
List<String> defectList = filteredDefects.stream().map(InspectionDefect::getDefect).collect(Collectors.toList()); List<String> defectList = filteredDefects.stream().map(InspectionDefect::getDefect).collect(Collectors.toList());
// Populate defect Spinner dropdown
// ArrayAdapter<String> defectSpinnerAdapter = new ArrayAdapter<>(defectsSpinner.getContext(),
// android.R.layout.simple_spinner_item, defectList);
// defectSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// defectsSpinner.setAdapter(defectSpinnerAdapter);
//
// String defaultDefectSelectedItem = data.getDefectTitle();
// int defaultSelectedDefectPosition = defectList.indexOf(defaultDefectSelectedItem);
// defectsSpinner.setSelection(defaultSelectedDefectPosition);
} }
public void setupRemarksListener(InspectionItemCheckPoint checkPoint) { public void setupRemarksListener(InspectionItemCheckPoint checkPoint) {
// Remarks EditText listener // Remarks EditText listener
remarks.addTextChangedListener(new TextWatcher() { remarksTextWatcher = new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
} }
@ -261,7 +256,30 @@ public class CheckPointAdapter extends
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
} }
}); };
remarks.addTextChangedListener( remarksTextWatcher );
}
public void setUpCheckboxesListeners( InspectionItemCheckPoint checkPoint ){
okCheckboxListener = (buttonView, isChecked) -> {
if (isChecked) {
linearLayout.setVisibility(View.INVISIBLE);
}
checkPoint.setChecked ( false );
noCheckBox.setChecked( !isChecked );
};
noCheckboxListener = (buttonView, isChecked) -> {
if (isChecked) {
linearLayout.setVisibility(View.VISIBLE);
}
checkPoint.setChecked( true );
okCheckBox.setChecked( !isChecked );
};
okCheckBox.setOnCheckedChangeListener( okCheckboxListener );
noCheckBox.setOnCheckedChangeListener( noCheckboxListener );
} }
} }
} }

View File

@ -101,7 +101,6 @@ public class DefectsAdapter extends RecyclerView.Adapter<DefectsAdapter.DefectVi
populateDefectOptionsSpinner( holder ); populateDefectOptionsSpinner( holder );
populateQuantity( holder ); populateQuantity( holder );
// Populate defect type Spinner dropdown // Populate defect type Spinner dropdown
{ {
holder.defectTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { holder.defectTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
@ -133,28 +132,7 @@ public class DefectsAdapter extends RecyclerView.Adapter<DefectsAdapter.DefectVi
// } // }
// }); // });
holder.quantity.addTextChangedListener(new TextWatcher() { holder.setUpQuantityListener( checkPoint, position );
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if( s == null || s.toString().isEmpty() ){
checkPoint.getQuantities().set( position , 0F );
} else {
checkPoint.getQuantities().set( position , Float.parseFloat( s.toString() ));
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
holder.deleteBtn.setOnClickListener(v-> { holder.deleteBtn.setOnClickListener(v-> {
System.out.println( holder.getAdapterPosition() ); System.out.println( holder.getAdapterPosition() );
@ -185,6 +163,8 @@ public class DefectsAdapter extends RecyclerView.Adapter<DefectsAdapter.DefectVi
private ImageButton deleteBtn; private ImageButton deleteBtn;
private EditText quantity; private EditText quantity;
private TextWatcher quantityTextWatcher;
public DefectViewHolder(@NonNull View itemView) { public DefectViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
defectSpinner = itemView.findViewById( R.id.defect_spinner ); defectSpinner = itemView.findViewById( R.id.defect_spinner );
@ -193,5 +173,33 @@ public class DefectsAdapter extends RecyclerView.Adapter<DefectsAdapter.DefectVi
quantity = itemView.findViewById( R.id.defect_quantity ); quantity = itemView.findViewById( R.id.defect_quantity );
} }
public void setUpQuantityListener( InspectionItemCheckPoint checkPoint, int position ){
if ( quantityTextWatcher != null) {
quantity.removeTextChangedListener( quantityTextWatcher );
}
quantityTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if( s == null || s.toString().isEmpty() ){
checkPoint.getQuantities().set( position , 0F );
} else {
checkPoint.getQuantities().set( position , Float.parseFloat( s.toString() ));
}
}
};
quantity.addTextChangedListener( quantityTextWatcher );
}
} }
} }

View File

@ -119,6 +119,10 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
marketplaceOption, marketplaceOption,
false false
); );
populateSkuCheckpointsParams(
store.getReport().getItems().get(0).getSku(),
marketplaceOption
);
} }
} }
@ -293,7 +297,9 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
if( v.getId() == R.id.search_sku_btn ){ if( v.getId() == R.id.search_sku_btn ){
if( sku.getText() != null ){ if( sku.getText() != null ){
populateProductDataOnSelection( sku.getText().toString(), "", true ); populateProductDataOnSelection( sku.getText().toString(), "", true );
populateSkuCheckpointsParams( store.getReport().getItems().get(0).getSku() ); store.setCheckpointSkus( new ArrayList<>() );
populateSkuCheckpointsParams( store.getReport().getItems().get(0).getSku(),
store.getReport().getItems().get(0).getMarketplace());
} }
} }
if( v.getId() == R.id.scan_sku_btn ){ if( v.getId() == R.id.scan_sku_btn ){
@ -308,10 +314,10 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
} }
} }
private void populateSkuCheckpointsParams( String sku ){ private void populateSkuCheckpointsParams( String sku, String marketplace ){
if( sku != null && ! sku.isEmpty() ){ if( sku != null && ! sku.isEmpty() && marketplace != null && ! marketplace.isEmpty() ){
List<InspectionCheckpointSku> checkpointSkus = new InspectionCheckpointSkuRepository( getContext() ) List<InspectionCheckpointSku> checkpointSkus = new InspectionCheckpointSkuRepository( getContext() )
.findBySku( sku ); .findBySkuAndMarketplace( sku, marketplace );
System.out.println( checkpointSkus ); System.out.println( checkpointSkus );
store.setCheckpointSkus( checkpointSkus ); store.setCheckpointSkus( checkpointSkus );
} }
@ -341,7 +347,7 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
fri.setChecked( store.getReport().getFri() ); fri.setChecked( store.getReport().getFri() );
refri.setChecked( ! store.getReport().getFri() ); refri.setChecked( ! store.getReport().getFri() );
// sku // sku
sku.setText( store.getReport().getItems().get(0).getSku() ); sku.setText( store.getReport().getItems().get(0).getFnsku() );
System.out.println( products ); System.out.println( products );
System.out.println( store.getReport().getItems().get(0) ); System.out.println( store.getReport().getItems().get(0) );

View File

@ -7,12 +7,15 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -112,6 +115,7 @@ public class SecondStepFragment extends Fragment
public void onImagePickerResult(int requestCode, int resultCode, Intent data) { public void onImagePickerResult(int requestCode, int resultCode, Intent data) {
if ( resultCode == RESULT_OK && data != null ) { if ( resultCode == RESULT_OK && data != null ) {
try { try {
System.out.println( requestCode );
ImageProcessor imageProcessor = new ImageProcessor(); ImageProcessor imageProcessor = new ImageProcessor();
Uri selectedImageUri = data.getData(); Uri selectedImageUri = data.getData();
assert selectedImageUri != null; assert selectedImageUri != null;
@ -138,7 +142,7 @@ public class SecondStepFragment extends Fragment
int lastVisibleItemPosition = layoutManager.findLastCompletelyVisibleItemPosition(); int lastVisibleItemPosition = layoutManager.findLastCompletelyVisibleItemPosition();
int totalItemCount = layoutManager.getItemCount(); int totalItemCount = layoutManager.getItemCount();
if (lastVisibleItemPosition == totalItemCount - 1) { if ( lastVisibleItemPosition == totalItemCount - 1 ) {
navController.navigate( R.id.action_secondStepFragment_to_thirdStepFragment ); navController.navigate( R.id.action_secondStepFragment_to_thirdStepFragment );
} else { } else {
Toast.makeText( getContext(), "Please Scroll at the bottom to continue", Toast.LENGTH_SHORT ).show(); Toast.makeText( getContext(), "Please Scroll at the bottom to continue", Toast.LENGTH_SHORT ).show();

View File

@ -84,7 +84,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:textAlignment="center" android:textAlignment="center"
android:text="image"> android:text="">
</TextView> </TextView>
<ImageButton <ImageButton

View File

@ -131,12 +131,11 @@
app:layout_constraintTop_toBottomOf="@+id/guide_lne" app:layout_constraintTop_toBottomOf="@+id/guide_lne"
app:layout_constraintVertical_bias="0.008" /> app:layout_constraintVertical_bias="0.008" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="8dp" android:padding="8dp"
android:id="@+id/check_point_recycler_view"> android:id="@+id/check_point_recycler_view">
</androidx.recyclerview.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>
</LinearLayout> </LinearLayout>