add to cart and other fixes
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package ch.pizzalink.android.activity;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ch.pizzalink.android.R;
|
||||
import ch.pizzalink.android.view.PizzalinkEditText;
|
||||
import ch.pizzalink.android.view.PizzalinkToolbar;
|
||||
|
||||
public class ForgotPasswordActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.forgotPasswordPizzalinkToolbar) PizzalinkToolbar forgotPasswordPizzalinkToolbar;
|
||||
@BindView(R.id.forgotPasswordEmailPizzalinkEditText) PizzalinkEditText forgotPasswordEmailPizzalinkEditText;
|
||||
@BindView(R.id.resetPasswordButton) Button resetPasswordButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_forgot_password);
|
||||
ButterKnife.bind(this);
|
||||
initViews();
|
||||
}
|
||||
|
||||
private void initViews(){
|
||||
forgotPasswordPizzalinkToolbar.setBackIconClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,12 @@ public class LoginActivity extends BaseActivity {
|
||||
@BindView(R.id.emailPizzalinkEditText) PizzalinkEditText emailPizzalinkEditText;
|
||||
@BindView(R.id.passwordPizzalinkEditText) PizzalinkEditText passwordPizzalinkEditText;
|
||||
@BindView(R.id.loginButton) Button loginButton;
|
||||
@BindView(R.id.forgotPasswordTextView) TextView forgotPasswordTextView;
|
||||
@BindView(R.id.registerTextView) TextView registerTextView;
|
||||
|
||||
@BindString(R.string.forgot_password_hint) String forgotPasswordHintText;
|
||||
@BindString(R.string.reset_password) String resetPasswordText;
|
||||
|
||||
@BindString(R.string.not_have_an_accaount) String notHaveAnAccountText;
|
||||
@BindString(R.string.register_text) String registerText;
|
||||
@BindString(R.string.alert_fill_all_fields) String fillAllFieldsText;
|
||||
@@ -48,13 +52,16 @@ public class LoginActivity extends BaseActivity {
|
||||
initViews();
|
||||
}
|
||||
|
||||
@OnClick({R.id.loginButton, R.id.registerTextView})
|
||||
@OnClick({R.id.loginButton, R.id.forgotPasswordTextView, R.id.registerTextView})
|
||||
protected void onClick(View view){
|
||||
switch (view.getId()){
|
||||
case R.id.loginButton:
|
||||
if(checkFields())
|
||||
login();
|
||||
break;
|
||||
case R.id.forgotPasswordTextView:
|
||||
startActivity(new Intent(LoginActivity.this, ForgotPasswordActivity.class));
|
||||
break;
|
||||
case R.id.registerTextView:
|
||||
startActivity(new Intent(LoginActivity.this, RegisterActivity.class));
|
||||
break;
|
||||
@@ -63,6 +70,7 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
private void initViews(){
|
||||
initRegisterTextView();
|
||||
initForgotPasswordTextView();
|
||||
/*
|
||||
emailPizzalinkEditText.getEditText().setText("aytaccici@gmail.com");
|
||||
passwordPizzalinkEditText.getEditText().setText("3522625");
|
||||
@@ -75,6 +83,12 @@ public class LoginActivity extends BaseActivity {
|
||||
registerTextView.setText(wordtoSpan);
|
||||
}
|
||||
|
||||
private void initForgotPasswordTextView(){
|
||||
Spannable wordtoSpan = new SpannableString(forgotPasswordHintText + " " + resetPasswordText);
|
||||
wordtoSpan.setSpan(new ForegroundColorSpan(Color.RED), 20, wordtoSpan.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
forgotPasswordTextView.setText(wordtoSpan);
|
||||
}
|
||||
|
||||
private boolean checkFields(){
|
||||
|
||||
if(emailPizzalinkEditText.isEmpty() || passwordPizzalinkEditText.isEmpty()){
|
||||
|
||||
@@ -29,8 +29,8 @@ public class OrderHistoryRecyclerAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
|
||||
public static class OrderViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@BindView(R.id.orderTotalTextView) TextView orderTotalTextView;
|
||||
@BindView(R.id.orderDateTextView) TextView orderDateTextView;
|
||||
@BindView(R.id.orderTotalTextView) TextView orderTotalTextView;
|
||||
@BindView(R.id.orderStatusTextView) TextView orderStatusTextView;
|
||||
@BindView(R.id.cancelOrderImageView) ImageView cancelOrderImageView;
|
||||
|
||||
@@ -104,8 +104,8 @@ public class OrderHistoryRecyclerAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
switch (holder.getItemViewType()){
|
||||
case HOLDER_ORDER :
|
||||
OrderViewHolder orderViewHolder = (OrderViewHolder) holder;
|
||||
orderViewHolder.orderTotalTextView.setText(orderHistoryList.get(position).getTotalString());
|
||||
orderViewHolder.orderDateTextView.setText(orderHistoryList.get(position).getFormattedCreateDate());
|
||||
orderViewHolder.orderTotalTextView.setText(orderHistoryList.get(position).getTotalString());
|
||||
orderViewHolder.orderStatusTextView.setText(orderHistoryList.get(position).getStatus());
|
||||
break;
|
||||
|
||||
@@ -121,4 +121,12 @@ public class OrderHistoryRecyclerAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
return orderHistoryList.size() + 1 ;
|
||||
}
|
||||
|
||||
private String createOrderInfoText(OrderModel orderModel){
|
||||
return new StringBuilder()
|
||||
.append(orderModel.getFormattedCreateDate())
|
||||
.append("\n\n")
|
||||
.append(orderModel.getStatus())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,6 +119,37 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
for(MenuProductOptionModel menuProductOptionModel : menuProductModel.getProductOptionList()){
|
||||
for(MenuProductOptionValueModel menuProductOptionValueModel : menuProductOptionModel.getOptionValueModelList()){
|
||||
menuProductOptionValueModel.setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
for(MenuProductOptionModel menuProductOptionModel : menuProductModel.getProductOptionList()){
|
||||
for(MenuProductOptionValueModel menuProductOptionValueModel : menuProductOptionModel.getOptionValueModelList()){
|
||||
if(menuProductOptionValueModel.getPrice().equals("0") || menuProductOptionValueModel.getPrice().equals("0.00")){
|
||||
|
||||
//checkbox
|
||||
if(!(menuProductOptionModel.getType().toLowerCase().equals("radio") ||
|
||||
menuProductOptionModel.getType().toLowerCase().equals("select"))){
|
||||
menuProductOptionValueModel.setSelected(true);
|
||||
}
|
||||
|
||||
//radio
|
||||
else if(!isAnyOptionValueSelected(menuProductOptionModel.getOptionValueModelList())){
|
||||
menuProductOptionValueModel.setSelected(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initViews(){
|
||||
setFields();
|
||||
fillRadioAndCheckboxOptionLists();
|
||||
@@ -200,7 +231,8 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
|
||||
|
||||
private void fillRadioAndCheckboxOptionLists(){
|
||||
for(MenuProductOptionModel menuProductOptionModel : menuProductModel.getProductOptionList()){
|
||||
setSelectedPriceShowingOptions(menuProductOptionModel.getOptionValueModelList());
|
||||
setSelectedPriceShowingOptions(menuProductOptionModel);
|
||||
|
||||
if(menuProductOptionModel.getType().toLowerCase().equals("radio") ||
|
||||
menuProductOptionModel.getType().toLowerCase().equals("select")){
|
||||
radioRecyclerHeaderTextView.setText(menuProductOptionModel.getName());
|
||||
@@ -213,10 +245,21 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
|
||||
}
|
||||
}
|
||||
|
||||
private void setSelectedPriceShowingOptions(ArrayList<MenuProductOptionValueModel> menuProductOptionValueList){
|
||||
for(MenuProductOptionValueModel menuProductOptionValueModel : menuProductOptionValueList){
|
||||
if(menuProductOptionValueModel.getPrice().equals("0") || menuProductOptionValueModel.getPrice().equals("0.00"))
|
||||
menuProductOptionValueModel.setSelected(true);
|
||||
private void setSelectedPriceShowingOptions(MenuProductOptionModel menuProductOptionModel){
|
||||
for(MenuProductOptionValueModel menuProductOptionValueModel : menuProductOptionModel.getOptionValueModelList()){
|
||||
if(menuProductOptionValueModel.getPrice().equals("0") || menuProductOptionValueModel.getPrice().equals("0.00")){
|
||||
|
||||
//checkbox
|
||||
if(!(menuProductOptionModel.getType().toLowerCase().equals("radio") ||
|
||||
menuProductOptionModel.getType().toLowerCase().equals("select"))){
|
||||
menuProductOptionValueModel.setSelected(true);
|
||||
}
|
||||
|
||||
//radio
|
||||
else if(!isAnyOptionValueSelected(menuProductOptionModel.getOptionValueModelList())){
|
||||
menuProductOptionValueModel.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,4 +358,13 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isAnyOptionValueSelected(ArrayList<MenuProductOptionValueModel> menuProductOptionValueModels){
|
||||
for (MenuProductOptionValueModel menuProductOptionValueModel : menuProductOptionValueModels){
|
||||
if(menuProductOptionValueModel.isSelected()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,6 +95,9 @@ public class PaymentMethodFragment extends BaseFragment {
|
||||
PaymentMethodModel.checkNull(paymentMethodModels);
|
||||
paymentMethodList.clear();
|
||||
paymentMethodList.addAll(paymentMethodModels);
|
||||
if(paymentMethodList.size() != 0){
|
||||
paymentMethodList.get(0).setSelected(true);
|
||||
}
|
||||
paymentMethodsRecyclerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -119,6 +122,7 @@ public class PaymentMethodFragment extends BaseFragment {
|
||||
paymentMethodList.add(new PaymentMethodModel("Havale"));
|
||||
paymentMethodList.add(new PaymentMethodModel("Kredi Kartı"));
|
||||
paymentMethodList.add(new PaymentMethodModel("Banka kartı"));
|
||||
paymentMethodList.get(0).setSelected(true);
|
||||
paymentMethodsRecyclerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,9 @@ public class ShippingAddressFragment extends BaseFragment {
|
||||
AddressModel.checkNull(addressModels);
|
||||
addressList.clear();
|
||||
addressList.addAll(addressModels);
|
||||
if(addressList.size() != 0){
|
||||
addressList.get(0).setSelected(true);
|
||||
}
|
||||
shippingAddressesRecyclerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,9 @@ public class ShippingMethodFragment extends BaseFragment {
|
||||
ShippingMethodModel.checkNull(shippingMethodModels);
|
||||
shippingMethodList.clear();
|
||||
shippingMethodList.addAll(shippingMethodModels);
|
||||
if(shippingMethodList.size() != 0){
|
||||
shippingMethodList.get(0).setSelected(true);
|
||||
}
|
||||
shippingMethodsRecyclerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -117,6 +120,7 @@ public class ShippingMethodFragment extends BaseFragment {
|
||||
private void createSampleShippingMethods(){
|
||||
shippingMethodList.add(new ShippingMethodModel("Gel al", "CHF 0.00"));
|
||||
shippingMethodList.add(new ShippingMethodModel("Kapına gelsin", "CHF 5.00"));
|
||||
shippingMethodList.get(0).setSelected(true);
|
||||
shippingMethodsRecyclerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user