add to cart dialog fix
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -37,7 +37,7 @@
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.widget.TextView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import butterknife.BindString;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
@@ -59,6 +60,8 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
|
||||
@BindView(R.id.deccreaseProductCountImageView) ImageView deccreaseProductCountImageView;
|
||||
@BindView(R.id.productCountTextView) TextView productCountTextView;
|
||||
|
||||
@BindString(R.string.no_options_selected_part) String noOptionsSelectedText;
|
||||
|
||||
private int productCount = 1;
|
||||
|
||||
private BottomSheetBehavior mBehavior;
|
||||
@@ -109,7 +112,8 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
|
||||
productPriceTextView.getText().toString(), productCount + 1, productCount));
|
||||
break;
|
||||
case R.id.addToCartButton:
|
||||
addProductToCart();
|
||||
if(checkFields())
|
||||
addProductToCart();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -273,6 +277,36 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
|
||||
return params;
|
||||
}
|
||||
|
||||
private boolean checkFields(){
|
||||
|
||||
if(radioRecyclerView.getVisibility() == View.VISIBLE &&
|
||||
!isSelectedAtLeastOne(productRadioOptionValueList)){
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity,
|
||||
radioRecyclerHeaderTextView.getText().toString() + " " + noOptionsSelectedText);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(checkboxRecyclerView.getVisibility() == View.VISIBLE &&
|
||||
!isSelectedAtLeastOne(productCheckboxOptionValueList)){
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity,
|
||||
checkboxRecyclerHeaderTextView.getText().toString() + " " + noOptionsSelectedText);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isSelectedAtLeastOne(ArrayList<MenuProductOptionValueModel> menuProductOptionValueModels){
|
||||
for(MenuProductOptionValueModel menuProductOptionValueModel : menuProductOptionValueModels){
|
||||
if(menuProductOptionValueModel.isSelected()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void onItemClick(Item item) {
|
||||
|
||||
@@ -116,5 +116,7 @@
|
||||
<string name="add_to_cart">SEPETE EKLE</string>
|
||||
<string name="count">Count</string>
|
||||
|
||||
<string name="no_options_selected_part">is not selected.</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user