add to basket screen

This commit is contained in:
2017-10-11 00:44:47 +03:00
parent 5e2abed2dd
commit a239736c9a
26 changed files with 237 additions and 604 deletions

View File

@@ -1,10 +1,7 @@
package ch.pizzalink.android.activity;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
@@ -24,14 +21,11 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
import ch.pizzalink.android.adapter.recycler.NavigationMenuRecyclerAdapter;
import ch.pizzalink.android.api.ApiConstants;
import ch.pizzalink.android.dialog.ProductPropertiesBottomSheetDialog;
import ch.pizzalink.android.fragment.CartFragment;
import ch.pizzalink.android.fragment.InfoFragment;
import ch.pizzalink.android.fragment.HistoryFragment;
import ch.pizzalink.android.fragment.MenuFragment;
import ch.pizzalink.android.fragment.order.EkstraKebapFragment;
import ch.pizzalink.android.fragment.order.ProductFragment;
import ch.pizzalink.android.fragment.ProductFragment;
import ch.pizzalink.android.fragment.ProfileFragment;
import ch.pizzalink.android.helper.SharedPrefsHelper;
import ch.pizzalink.android.model.CategoryModel;

View File

@@ -1,8 +1,66 @@
package ch.pizzalink.android.adapter.recycler;
import android.support.v7.widget.AppCompatCheckBox;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
import ch.pizzalink.android.activity.BaseActivity;
import ch.pizzalink.android.interfaces.RecyclerItemClickListener;
import ch.pizzalink.android.model.menu.MenuProductOptionValueModel;
/**
* Created by cimenmus on 08/10/2017.
*/
public class ProductCheckboxOptionsRecyclerAdapter {
}
public class ProductCheckboxOptionsRecyclerAdapter extends RecyclerView.Adapter<ProductCheckboxOptionsRecyclerAdapter.ViewHolder> {
private ArrayList<MenuProductOptionValueModel> productOptionValueList;
private RecyclerItemClickListener recyclerItemClickListener;
public static class ViewHolder extends RecyclerView.ViewHolder{
@BindView(R.id.productOptionCheckBox) AppCompatCheckBox productOptionCheckBox;
public ViewHolder(final View view, final RecyclerItemClickListener recyclerItemClickListener) {
super(view);
ButterKnife.bind(this, view);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(recyclerItemClickListener != null)
recyclerItemClickListener.onItemClick(view, getAdapterPosition());
}
});
}
}
public ProductCheckboxOptionsRecyclerAdapter(ArrayList<MenuProductOptionValueModel> productOptionValueList, RecyclerItemClickListener recyclerItemClickListener){
this.productOptionValueList = productOptionValueList;
this.recyclerItemClickListener = recyclerItemClickListener;
}
@Override
public ProductCheckboxOptionsRecyclerAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View root = LayoutInflater.from(BaseActivity.currentActivity).inflate(R.layout.row_checkbox_option, viewGroup, false);
return new ProductCheckboxOptionsRecyclerAdapter.ViewHolder(root, recyclerItemClickListener);
}
@Override
public void onBindViewHolder(ProductCheckboxOptionsRecyclerAdapter.ViewHolder holder, int position) {
holder.productOptionCheckBox.setChecked(productOptionValueList.get(position).isSelected());
holder.productOptionCheckBox.setText(productOptionValueList.get(position).getName());
}
@Override
public int getItemCount() {
return productOptionValueList.size();
}
}

View File

@@ -23,9 +23,11 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import ch.pizzalink.android.R;
import ch.pizzalink.android.activity.BaseActivity;
import ch.pizzalink.android.adapter.recycler.ProductCheckboxOptionsRecyclerAdapter;
import ch.pizzalink.android.adapter.recycler.ProductRadioOptionsRecyclerAdapter;
import ch.pizzalink.android.interfaces.RecyclerItemClickListener;
import ch.pizzalink.android.model.menu.MenuProductModel;
import ch.pizzalink.android.model.menu.MenuProductOptionModel;
import ch.pizzalink.android.model.menu.MenuProductOptionValueModel;
/**
@@ -36,7 +38,9 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
@BindView(R.id.productNameTextView) TextView productNameTextView;
@BindView(R.id.productPriceTextView) TextView productPriceTextView;
@BindView(R.id.radioRecyclerHeaderTextView) TextView radioRecyclerHeaderTextView;
@BindView(R.id.radioRecyclerView) RecyclerView radioRecyclerView;
@BindView(R.id.checkboxRecyclerHeaderTextView) TextView checkboxRecyclerHeaderTextView;
@BindView(R.id.checkboxRecyclerView) RecyclerView checkboxRecyclerView;
@BindView(R.id.increaseProductCountImageView) ImageView increaseProductCountImageView;
@BindView(R.id.deccreaseProductCountImageView) ImageView deccreaseProductCountImageView;
@@ -50,8 +54,10 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
private BottomSheetBehavior mBehavior;
private MenuProductModel menuProductModel;
private ArrayList<MenuProductOptionValueModel> menuProductOptionValueList = new ArrayList<>();
private ArrayList<MenuProductOptionValueModel> productRadioOptionValueList = new ArrayList<>();
private ArrayList<MenuProductOptionValueModel> productCheckboxOptionValueList = new ArrayList<>();
private ProductRadioOptionsRecyclerAdapter productRadioOptionsRecyclerAdapter;
private ProductCheckboxOptionsRecyclerAdapter productCheckboxOptionsRecyclerAdapter;
@NonNull
@Override
@@ -93,12 +99,31 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
private void initViews(){
setFields();
if(menuProductModel.getProductOptionType() == MenuProductModel.ProductOptionType.RADIO)
initRadioRecyclerView();
/*
else if(menuProductModel.getProductOptionType() == MenuProductModel.ProductOptionType.CHECKBOX)
initCheckboxRecyclerView();
*/
switch (menuProductModel.getProductOptionType()){
case RADIO_AND_CHECKBOX:
radioRecyclerView.setVisibility(View.VISIBLE);
checkboxRecyclerView.setVisibility(View.VISIBLE);
radioRecyclerHeaderTextView.setVisibility(View.VISIBLE);
checkboxRecyclerHeaderTextView.setVisibility(View.VISIBLE);
fillRadioAndCheckboxOptionLists();
initRadioRecyclerView();
initCheckboxRecyclerView();
break;
case RADIO:
radioRecyclerHeaderTextView.setVisibility(View.VISIBLE);
radioRecyclerView.setVisibility(View.VISIBLE);
checkboxRecyclerView.setVisibility(View.GONE);
checkboxRecyclerHeaderTextView.setVisibility(View.GONE);
initRadioRecyclerView();
break;
case CHECKBOX:
radioRecyclerHeaderTextView.setVisibility(View.GONE);
radioRecyclerView.setVisibility(View.GONE);
checkboxRecyclerHeaderTextView.setVisibility(View.VISIBLE);
checkboxRecyclerView.setVisibility(View.VISIBLE);
initCheckboxRecyclerView();
break;
}
}
public void setMenuProductModel(MenuProductModel menuProductModel){
@@ -106,30 +131,64 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
}
private void initRadioRecyclerView(){
menuProductOptionValueList.addAll(menuProductModel.getProductOptionList().get(0).getOptionValueModelList());
radioRecyclerView.setNestedScrollingEnabled(false);
radioRecyclerHeaderTextView.setText(menuProductModel.getProductOptionList().get(0).getName());
productRadioOptionValueList.addAll(menuProductModel.getProductOptionList().get(0).getOptionValueModelList());
GridLayoutManager gridLayoutManager = new GridLayoutManager(BaseActivity.currentActivity, 3);
radioRecyclerView.setLayoutManager(gridLayoutManager);
productRadioOptionsRecyclerAdapter = new ProductRadioOptionsRecyclerAdapter(menuProductOptionValueList, new RecyclerItemClickListener() {
productRadioOptionsRecyclerAdapter = new ProductRadioOptionsRecyclerAdapter(productRadioOptionValueList, new RecyclerItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if(!menuProductOptionValueList.get(position).isSelected()){
for(MenuProductOptionValueModel menuProductOptionValueModel : menuProductOptionValueList){
if(!productRadioOptionValueList.get(position).isSelected()){
for(MenuProductOptionValueModel menuProductOptionValueModel : productRadioOptionValueList){
menuProductOptionValueModel.setSelected(false);
}
menuProductOptionValueList.get(position).setSelected(true);
productRadioOptionValueList.get(position).setSelected(true);
productRadioOptionsRecyclerAdapter.notifyDataSetChanged();
productPriceTextView.setText(chfText + " " + menuProductOptionValueList.get(position).getPrice());
productPriceTextView.setText(chfText + " " + productRadioOptionValueList.get(position).getPrice());
}
}
});
radioRecyclerView.setAdapter(productRadioOptionsRecyclerAdapter);
}
private void initCheckboxRecyclerView(){
checkboxRecyclerView.setNestedScrollingEnabled(false);
checkboxRecyclerHeaderTextView.setText(menuProductModel.getProductOptionList().get(0).getName());
productCheckboxOptionValueList.addAll(menuProductModel.getProductOptionList().get(0).getOptionValueModelList());
GridLayoutManager gridLayoutManager = new GridLayoutManager(BaseActivity.currentActivity, 3);
checkboxRecyclerView.setLayoutManager(gridLayoutManager);
productCheckboxOptionsRecyclerAdapter = new ProductCheckboxOptionsRecyclerAdapter(productCheckboxOptionValueList, new RecyclerItemClickListener() {
@Override
public void onItemClick(View view, int position) {
productCheckboxOptionValueList.get(position).setSelected(
!productCheckboxOptionValueList.get(position).isSelected());
productCheckboxOptionsRecyclerAdapter.notifyItemChanged(position);
}
});
checkboxRecyclerView.setAdapter(productCheckboxOptionsRecyclerAdapter);
}
private void setFields(){
productNameTextView.setText(menuProductModel.getName());
productPriceTextView.setText(chfText + " " + menuProductModel.getPrice());
}
private void fillRadioAndCheckboxOptionLists(){
productRadioOptionValueList.addAll(menuProductModel.getProductOptionList().get(0).getOptionValueModelList());
for(MenuProductOptionModel menuProductOptionModel : menuProductModel.getProductOptionList()){
if(menuProductOptionModel.getType().toLowerCase().equals("radio") ||
menuProductOptionModel.getType().toLowerCase().equals("select")){
radioRecyclerHeaderTextView.setText(menuProductOptionModel.getName());
productRadioOptionValueList.addAll(menuProductOptionModel.getOptionValueModelList());
}
else{
checkboxRecyclerHeaderTextView.setText(menuProductOptionModel.getName());
productCheckboxOptionValueList.addAll(menuProductOptionModel.getOptionValueModelList());
}
}
}
/*
@Override
public void onItemClick(Item item) {

View File

@@ -1,8 +1,6 @@
package ch.pizzalink.android.fragment;
import android.os.Bundle;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
@@ -15,13 +13,11 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
import ch.pizzalink.android.activity.BaseActivity;
import ch.pizzalink.android.activity.MainActivity;
import ch.pizzalink.android.adapter.recycler.MenuProductRecyclerAdapter;
import ch.pizzalink.android.api.ApiErrorUtils;
import ch.pizzalink.android.api.ApiService;
import ch.pizzalink.android.api.ResponseArray;
import ch.pizzalink.android.dialog.ProductPropertiesBottomSheetDialog;
import ch.pizzalink.android.fragment.order.OrderBaseFragment;
import ch.pizzalink.android.helper.DialogHelper;
import ch.pizzalink.android.helper.DisplayHelper;
import ch.pizzalink.android.interfaces.RecyclerItemClickListener;
@@ -36,7 +32,7 @@ import retrofit2.Response;
* Created by cimenmus on 02/10/2017.
*/
public class MenuFragment extends OrderBaseFragment {
public class MenuFragment extends BaseFragment {
@BindView(R.id.menuProductRecyclerView) RecyclerView menuProductRecyclerView;

View File

@@ -1,24 +1,30 @@
package ch.pizzalink.android.fragment.order;
package ch.pizzalink.android.fragment;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.HashMap;
import butterknife.BindString;
import butterknife.BindView;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
import ch.pizzalink.android.activity.BaseActivity;
import ch.pizzalink.android.adapter.recycler.MenuProductRecyclerAdapter;
import ch.pizzalink.android.api.ApiConstants;
import ch.pizzalink.android.api.ApiErrorUtils;
import ch.pizzalink.android.api.ApiService;
import ch.pizzalink.android.api.ResponseArray;
import ch.pizzalink.android.api.ResponseObject;
import ch.pizzalink.android.dialog.ProductPropertiesBottomSheetDialog;
import ch.pizzalink.android.helper.DialogHelper;
import ch.pizzalink.android.helper.DisplayHelper;
import ch.pizzalink.android.interfaces.RecyclerItemClickListener;
import ch.pizzalink.android.model.CategoryModel;
import ch.pizzalink.android.model.menu.MenuProductModel;
import ch.pizzalink.android.view.GridSpacesItemDecoration;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -27,9 +33,13 @@ import retrofit2.Response;
* Created by cimenmus on 19/09/2017.
*/
public class ProductFragment extends OrderBaseFragment {
public class ProductFragment extends BaseFragment {
@BindView(R.id.customProductRecyclerView) RecyclerView customProductRecyclerView;
public static final java.lang.String FRAGMENT_NAME = "productFragment";
private ArrayList<MenuProductModel> productList = new ArrayList<>();
private MenuProductRecyclerAdapter menuProductRecyclerAdapter;
private CategoryModel categoryModel;
public ProductFragment() {}
@@ -63,6 +73,20 @@ public class ProductFragment extends OrderBaseFragment {
private void initViews(){
setPizzalinkToolbarFields(true, categoryModel.getName());
initRecyclerView();
}
private void initRecyclerView(){
GridLayoutManager layoutManager = new GridLayoutManager(BaseActivity.currentActivity, 2);
customProductRecyclerView.setLayoutManager(layoutManager);
menuProductRecyclerAdapter = new MenuProductRecyclerAdapter(productList, new RecyclerItemClickListener() {
@Override
public void onItemClick(View view, int position) {
showBottomsheetDialog(productList.get(position));
}
});
customProductRecyclerView.addItemDecoration(new GridSpacesItemDecoration(DisplayHelper.dpToPx(12)));
customProductRecyclerView.setAdapter(menuProductRecyclerAdapter);
}
private void getProductById(){
@@ -88,9 +112,13 @@ public class ProductFragment extends OrderBaseFragment {
});
}
private void setProductFields(ArrayList<MenuProductModel> menuProductList){
if(menuProductList == null || menuProductList.size() == 0)
private void setProductFields(ArrayList<MenuProductModel> prdctLst){
if(prdctLst == null || prdctLst.size() == 0)
return;
MenuProductModel.checkNull(prdctLst);
productList.clear();
productList.addAll(prdctLst);
menuProductRecyclerAdapter.notifyDataSetChanged();
}
@@ -100,4 +128,10 @@ public class ProductFragment extends OrderBaseFragment {
else
return ApiConstants.PRODUCT_ID_EKSTRA_KEBAP;
}
public void showBottomsheetDialog(MenuProductModel menuProductModel){
ProductPropertiesBottomSheetDialog productPropertiesBottomSheetDialog = new ProductPropertiesBottomSheetDialog();
productPropertiesBottomSheetDialog.setMenuProductModel(menuProductModel);
productPropertiesBottomSheetDialog.show(getChildFragmentManager(), "dialog");
}
}

View File

@@ -1,44 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindString;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
/**
* Created by cimenmus on 19/09/2017.
*/
public class ChickenFragment extends OrderBaseFragment {
@BindString(R.string.fragment_title_chicken) String fragmentTitle;
public static final java.lang.String FRAGMENT_NAME = "chickenFragment";
public ChickenFragment() {}
public static ChickenFragment newInstance() {
return new ChickenFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_chicken, container, false);
ButterKnife.bind(this, view);
initViews();
return view;
}
private void initViews(){
setPizzalinkToolbarFields(true, fragmentTitle);
}
}

View File

@@ -1,44 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindString;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
/**
* Created by cimenmus on 19/09/2017.
*/
public class DessertFragment extends OrderBaseFragment {
@BindString(R.string.fragment_title_dessert) String fragmentTitle;
public static final java.lang.String FRAGMENT_NAME = "dessertFragment";
public DessertFragment() {}
public static DessertFragment newInstance() {
return new DessertFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_dessert, container, false);
ButterKnife.bind(this, view);
initViews();
return view;
}
private void initViews(){
setPizzalinkToolbarFields(true, fragmentTitle);
}
}

View File

@@ -1,95 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import butterknife.BindString;
import butterknife.BindView;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
/**
* Created by cimenmus on 19/09/2017.
*/
public class DrinksFragment extends OrderBaseFragment {
@BindView(R.id.drinksTextView) TextView drinksTextView;
@BindString(R.string.fragment_title_drinks) String allDrinksFragmentTitle;
@BindString(R.string.fragment_title_rose_drinks) String roseDrinksFragmentTitle;
@BindString(R.string.fragment_title_item_rotwein_drinks) String rotweinDrinksFragmentTitle;
@BindString(R.string.fragment_title_item_spirituosen_drinks) String spirituosenDrinksFragmentTitle;
@BindString(R.string.fragment_title_item_weisswein_drinks) String weissweinDrinksFragmentTitle;
@BindString(R.string.fragment_title_item_beer_drinks) String beerDrinksFragmentTitle;
private int selectedDrinkCategoryId;
public static final java.lang.String FRAGMENT_NAME = "drinksFragment";
public DrinksFragment() {}
public static DrinksFragment newInstance(int selectedDrinkCategoryName) {
Bundle args = new Bundle();
args.putInt("selectedDrinkCategoryId", selectedDrinkCategoryName);
DrinksFragment fragment = new DrinksFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_drinks, container, false);
ButterKnife.bind(this, view);
getDataFromExtras();
initViews();
return view;
}
private void getDataFromExtras(){
selectedDrinkCategoryId = getArguments().getInt("selectedDrinkCategoryId", 0);
}
private void initViews(){
setPizzalinkToolbarFields(true, allDrinksFragmentTitle);
setText();
}
private void setText(){
switch (selectedDrinkCategoryId){
case R.id.drinksMenuItem:
drinksTextView.setText("All Drinks Fragment");
setPizzalinkToolbarFields(true, allDrinksFragmentTitle);
break;
case R.id.roseDrinksMenuItem:
drinksTextView.setText("Rose Drinks Fragment");
setPizzalinkToolbarFields(true, roseDrinksFragmentTitle);
break;
case R.id.rotweinDrinksMenuItem:
drinksTextView.setText("Rotwein Drinks Fragment");
setPizzalinkToolbarFields(true, rotweinDrinksFragmentTitle);
break;
case R.id.spirituosenDrinksMenuItem:
drinksTextView.setText("Spirituosen Drinks Fragment");
setPizzalinkToolbarFields(true, spirituosenDrinksFragmentTitle);
break;
case R.id.weissweinDrinksMenuItem:
drinksTextView.setText("Weisswein Drinks Fragment");
setPizzalinkToolbarFields(true, weissweinDrinksFragmentTitle);
break;
case R.id.beerDrinksMenuItem:
drinksTextView.setText("Beer Drinks Fragment");
setPizzalinkToolbarFields(true, beerDrinksFragmentTitle);
break;
}
}
}

View File

@@ -1,44 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindString;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
/**
* Created by cimenmus on 19/09/2017.
*/
public class EkstraKebapFragment extends OrderBaseFragment {
@BindString(R.string.fragment_title_ekstra_kebap) String fragmentTitle;
public static final java.lang.String FRAGMENT_NAME = "eksraKebapFragment";
public EkstraKebapFragment() {}
public static EkstraKebapFragment newInstance() {
return new EkstraKebapFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_ekstra_kebap, container, false);
ButterKnife.bind(this, view);
initViews();
return view;
}
private void initViews(){
setPizzalinkToolbarFields(true, fragmentTitle);
}
}

View File

@@ -1,44 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindString;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
/**
* Created by cimenmus on 19/09/2017.
*/
public class HaussFragment extends OrderBaseFragment {
@BindString(R.string.fragment_title_hauss) String fragmentTitle;
public static final java.lang.String FRAGMENT_NAME = "haussFragment";
public HaussFragment() {}
public static HaussFragment newInstance() {
return new HaussFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_hauss, container, false);
ButterKnife.bind(this, view);
initViews();
return view;
}
private void initViews(){
setPizzalinkToolbarFields(true, fragmentTitle);
}
}

View File

@@ -1,14 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.support.v4.app.Fragment;
import ch.pizzalink.android.activity.MainActivity;
import ch.pizzalink.android.fragment.BaseFragment;
/**
* Created by cimenmus on 18/09/2017.
*/
public class OrderBaseFragment extends BaseFragment {
}

View File

@@ -1,44 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindString;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
/**
* Created by cimenmus on 19/09/2017.
*/
public class PastaFragment extends OrderBaseFragment {
@BindString(R.string.fragment_title_pasta) String fragmentTitle;
public static final java.lang.String FRAGMENT_NAME = "pastaFragment";
public PastaFragment() {}
public static PastaFragment newInstance() {
return new PastaFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_pasta, container, false);
ButterKnife.bind(this, view);
initViews();
return view;
}
private void initViews(){
setPizzalinkToolbarFields(true, fragmentTitle);
}
}

View File

@@ -1,44 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindString;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
/**
* Created by cimenmus on 19/09/2017.
*/
public class SalatFragment extends OrderBaseFragment {
@BindString(R.string.fragment_title_salat) String fragmentTitle;
public static final java.lang.String FRAGMENT_NAME = "salatFragment";
public SalatFragment() {}
public static SalatFragment newInstance() {
return new SalatFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_salat, container, false);
ButterKnife.bind(this, view);
initViews();
return view;
}
private void initViews(){
setPizzalinkToolbarFields(true, fragmentTitle);
}
}

View File

@@ -1,44 +0,0 @@
package ch.pizzalink.android.fragment.order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindString;
import butterknife.ButterKnife;
import ch.pizzalink.android.R;
/**
* Created by cimenmus on 19/09/2017.
*/
public class VorspeisenFragment extends OrderBaseFragment {
@BindString(R.string.fragment_title_vorspeisen) String fragmentTitle;
public static final java.lang.String FRAGMENT_NAME = "vorspeisenFragment";
public VorspeisenFragment() {}
public static VorspeisenFragment newInstance() {
return new VorspeisenFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_vorspeisen, container, false);
ButterKnife.bind(this, view);
initViews();
return view;
}
private void initViews(){
setPizzalinkToolbarFields(true, fragmentTitle);
}
}

View File

@@ -63,18 +63,29 @@ public class MenuProductModel implements Serializable {
}
public ProductOptionType getProductOptionType(){
if(productOptionList == null || productOptionList.size() == 0)
if(productOptionList == null)
return ProductOptionType.NO_TYPE;
else if(productOptionList.get(0).getType().toLowerCase().equals("radio"))
return ProductOptionType.RADIO;
else
return ProductOptionType.CHECKBOX;
switch (productOptionList.size()){
case 0:
return ProductOptionType.NO_TYPE;
case 1:
if(productOptionList.get(0).getType().toLowerCase().equals("radio") ||
productOptionList.get(0).getType().toLowerCase().equals("select"))
return ProductOptionType.RADIO;
else
return ProductOptionType.CHECKBOX;
case 2:
return ProductOptionType.RADIO_AND_CHECKBOX;
default:
return ProductOptionType.NO_TYPE;
}
}
public enum ProductOptionType{
NO_TYPE,
RADIO,
CHECKBOX
CHECKBOX,
RADIO_AND_CHECKBOX
}
public String getId() {

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chicken Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dessert Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/drinksTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Drinks Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ekstra Kebap Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hauss Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pasta Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>

View File

@@ -1,15 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/customProductRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Own Pizza Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>
android:layout_height="match_parent"
android:background="@color/actvity_default_background_color_1"
android:scrollbars="vertical"/>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Salat Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Vorspeisen Fragment"
android:layout_centerInParent="true"
android:textColor="@color/black"/>
</RelativeLayout>

View File

@@ -11,7 +11,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textSize="18sp"
android:text="Pizza Formaggio"
android:padding="16dp"
android:textStyle="bold"
@@ -39,31 +39,30 @@
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/radioRecyclerView"
android:layout_width="match_parent"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/checkboxRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
android:textStyle="bold"
android:text="@string/count"
android:paddingTop="12dp"
android:paddingLeft="12dp"
android:paddingStart="12dp"
android:paddingRight="12dp"
android:paddingEnd="12dp"/>
<LinearLayout
android:id="@+id/ProductCountLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_margin="12dp">
<ImageView
@@ -99,6 +98,33 @@
</LinearLayout>
<TextView
android:id="@+id/radioRecyclerHeaderTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:padding="12dp"
android:visibility="gone"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/radioRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
<TextView
android:id="@+id/checkboxRecyclerHeaderTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:padding="12dp"
android:visibility="gone"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/checkboxRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
</LinearLayout>
@@ -111,7 +137,6 @@
android:id="@+id/addToCartButtonLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:padding="16dp">
<Button

View File

@@ -113,6 +113,7 @@
<string name="chf">CHF</string>
<string name="empty_description">..</string>
<string name="add_to_cart">SEPETE EKLE</string>
<string name="count">Count</string>
</resources>