diff --git a/app/build.gradle b/app/build.gradle index 28545b5..2bfe5b1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,11 +53,11 @@ android { productFlavors { production { applicationId "com.bentonow.bentonow" - versionName '1.22-rc01' + versionName '1.22-rc02' } stage { applicationId "com.bentonow.bentonow.stage" - versionName '1.22-rc01-dev' + versionName '1.22-rc02-dev' } } diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/adapter/AddOnListAdapter.java b/app/src/main/java/com/bentonow/bentonow/controllers/adapter/AddOnListAdapter.java index 175da3e..08eda60 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/adapter/AddOnListAdapter.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/adapter/AddOnListAdapter.java @@ -94,30 +94,15 @@ public void onClick(View view) { }); viewHolder.getTxtNumberAddOn().setText(String.valueOf(mDishDao.countItemsById(mDish.itemId))); + viewHolder.getImgGradient().setVisibility(iDishSelected == position ? View.VISIBLE : View.INVISIBLE); - - /* if (mDishDao.isSoldOut(mDish, true, bIsMenuOD)) { - viewHolder.getImgSoldOut().setVisibility(View.VISIBLE); - viewHolder.getImgGradient().setVisibility(View.VISIBLE); + if (mDish.is_oa_only == 1) { viewHolder.getImgAddDish().setImageResource(R.drawable.ic_action_content_add_circle_outline_gray); viewHolder.getImgRemoveDish().setImageResource(R.drawable.ic_action_content_remove_circle_outline_gray); viewHolder.getImgAddDish().setOnClickListener(null); viewHolder.getImgRemoveDish().setOnClickListener(null); - } else if (!mDishDao.canBeAdded(mDish)) { - viewHolder.getImgSoldOut().setVisibility(View.VISIBLE); - viewHolder.getImgGradient().setVisibility(View.VISIBLE); - viewHolder.getImgAddDish().setImageResource(R.drawable.ic_action_content_add_circle_outline_gray); - // viewHolder.getImgRemoveDish().setImageResource(R.drawable.ic_action_content_remove_circle_outline_gray); - viewHolder.getImgAddDish().setOnClickListener(null); - } else { - viewHolder.getImgSoldOut().setVisibility(View.INVISIBLE); - viewHolder.getImgGradient().setVisibility(iDishSelected == position ? View.VISIBLE : View.INVISIBLE); - viewHolder.getImgAddDish().setImageResource(R.drawable.ic_action_content_add_circle_outline); - viewHolder.getImgRemoveDish().setImageResource(R.drawable.ic_action_content_remove_circle_outline); - }*/ - - - if (!mDishDao.canBeAdded(mDish) || mDishDao.isSoldOut(mDish, true, bIsMenuOD)) { + viewHolder.getImgSoldOut().setVisibility(View.GONE); + } else if (!mDishDao.canBeAdded(mDish) || mDishDao.isSoldOut(mDish, true, bIsMenuOD)) { viewHolder.getImgSoldOut().setVisibility(View.VISIBLE); viewHolder.getImgGradient().setVisibility(View.VISIBLE); @@ -133,12 +118,12 @@ public void onClick(View view) { } else { viewHolder.getImgSoldOut().setVisibility(View.INVISIBLE); - viewHolder.getImgGradient().setVisibility(iDishSelected == position ? View.VISIBLE : View.INVISIBLE); viewHolder.getImgAddDish().setImageResource(R.drawable.ic_action_content_add_circle_outline); viewHolder.getImgRemoveDish().setImageResource(R.drawable.ic_action_content_remove_circle_outline); } viewHolder.getTxtDescription().setVisibility(iDishSelected == position ? View.VISIBLE : View.INVISIBLE); + viewHolder.getTxtOaLabel().setVisibility(mDish.is_oa_only == 0 || iDishSelected == position ? View.GONE : View.VISIBLE); } diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/adapter/CustomMainListAdapter.java b/app/src/main/java/com/bentonow/bentonow/controllers/adapter/CustomMainListAdapter.java index 308e833..3d2357a 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/adapter/CustomMainListAdapter.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/adapter/CustomMainListAdapter.java @@ -128,7 +128,7 @@ public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { viewHolder.getBtnAddToBento().setVisibility(!added ? View.VISIBLE : View.GONE); - viewHolder.getBtnAddToBento().setOnClickListener(new View.OnClickListener() { + viewHolder.getBtnAddToBento().setOnClickListener(mDish.is_oa_only == 1 ? null : new View.OnClickListener() { @Override public void onClick(View view) { mListener.onAddToBentoClick(position); @@ -136,7 +136,7 @@ public void onClick(View view) { } }); - viewHolder.getBtnAdded().setOnClickListener(new View.OnClickListener() { + viewHolder.getBtnAdded().setOnClickListener(mDish.is_oa_only == 1 ? null : new View.OnClickListener() { @Override public void onClick(View view) { mListener.onAddedClick(position); @@ -144,7 +144,11 @@ public void onClick(View view) { } }); - if (!mDishDao.canBeAdded(mDish)) { + if (mDish.is_oa_only == 1) { + viewHolder.getBtnAddToBento().setText(IosCopyDao.get("oa-only-od-btn")); + viewHolder.getImgSoldOut().setVisibility(View.GONE); + getItem(position).can_be_added = 0; + } else if (!mDishDao.canBeAdded(mDish)) { viewHolder.getBtnAddToBento().setText(IosCopyDao.get("reached-max-button")); viewHolder.getImgSoldOut().setVisibility(View.GONE); getItem(position).can_be_added = 0; @@ -158,6 +162,7 @@ public void onClick(View view) { getItem(position).can_be_added = 1; } + viewHolder.getTxtOaLabel().setVisibility(mDish.is_oa_only == 0 || selected ? View.GONE : View.VISIBLE); return convertView; } diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/adapter/CustomSideListAdapter.java b/app/src/main/java/com/bentonow/bentonow/controllers/adapter/CustomSideListAdapter.java index 42977a2..9c4d1ec 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/adapter/CustomSideListAdapter.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/adapter/CustomSideListAdapter.java @@ -131,7 +131,11 @@ public void onClick(View view) { } else viewHolder.getTxtDescription().setVisibility(View.GONE); - if (!dishDao.canBeAdded(mDish)) { + if (mDish.is_oa_only == 1) { + viewHolder.getBtnAddToBento().setText(IosCopyDao.get("oa-only-od-btn")); + viewHolder.getImgSoldOut().setVisibility(View.GONE); + getItem(position).can_be_added = 0; + } else if (!dishDao.canBeAdded(mDish)) { viewHolder.getBtnAddToBento().setText(IosCopyDao.get("reached-max-button")); viewHolder.getImgSoldOut().setVisibility(View.GONE); getItem(position).can_be_added = 0; @@ -145,6 +149,9 @@ public void onClick(View view) { getItem(position).can_be_added = 1; } + + viewHolder.getTxtOaLabel().setVisibility(mDish.is_oa_only == 0 || selected ? View.GONE : View.VISIBLE); + return convertView; } diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/dialog/ProgressDialog.java b/app/src/main/java/com/bentonow/bentonow/controllers/dialog/ProgressDialog.java index 47c2683..fa8f811 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/dialog/ProgressDialog.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/dialog/ProgressDialog.java @@ -87,6 +87,8 @@ public boolean onTouch(View v, MotionEvent event) { @Override public void show() { + + //TODO Dont show dialog if is in background super.show(); // set dialog enter animations view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_main_show_amination)); diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/errors/BummerActivity.java b/app/src/main/java/com/bentonow/bentonow/controllers/errors/BummerActivity.java index 09c8f18..5a7bdb2 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/errors/BummerActivity.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/errors/BummerActivity.java @@ -8,12 +8,12 @@ import com.bentonow.bentonow.R; import com.bentonow.bentonow.Utils.AndroidUtil; -import com.bentonow.bentonow.Utils.BentoNowUtils; import com.bentonow.bentonow.Utils.DebugUtils; import com.bentonow.bentonow.Utils.GoogleAnalyticsUtil; import com.bentonow.bentonow.Utils.MixpanelUtils; import com.bentonow.bentonow.controllers.BaseFragmentActivity; import com.bentonow.bentonow.controllers.dialog.ConfirmationDialog; +import com.bentonow.bentonow.model.user.CouponRequest; import com.bentonow.bentonow.ui.AutoFitTxtView; import com.bentonow.bentonow.ui.BackendEditText; import com.bentonow.bentonow.web.request.UserRequest; @@ -31,7 +31,7 @@ public class BummerActivity extends BaseFragmentActivity implements View.OnClick private EditText txt_email; private AutoFitTxtView txtAddress; - private String sCurrentLocation = ""; + private CouponRequest mCoupon; @Override @@ -41,22 +41,20 @@ protected void onCreate(Bundle savedInstanceState) { initActionbar(); - sCurrentLocation = getIntent().getExtras().getString(TAG_INVALID_ADDRESS); + mCoupon = getIntent().getExtras().getParcelable(CouponRequest.TAG); txt_email = (BackendEditText) findViewById(R.id.txt_email); - if (sCurrentLocation == null || sCurrentLocation.isEmpty()) - sCurrentLocation = BentoNowUtils.getFullAddress(); - - getTxtAddress().setText(sCurrentLocation); + getTxtAddress().setText(mCoupon.address); try { JSONObject params = new JSONObject(); - params.put("Address", sCurrentLocation); + params.put("Address", mCoupon.address); MixpanelUtils.track("Selected Address Outside of Service Area", params); } catch (Exception e) { DebugUtils.logError(TAG, e); } + } public void onChangePressed(View view) { @@ -69,7 +67,10 @@ public void onSubmitPressed(View view) { mDialog.addAcceptButton("OK", null); mDialog.show(); } else { - UserRequest.requestCoupon(txt_email.getText().toString(), "outside of delivery zone", new TextHttpResponseHandler() { + + mCoupon.email = txt_email.getText().toString(); + + UserRequest.requestCoupon(mCoupon, new TextHttpResponseHandler() { @SuppressWarnings("deprecation") @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { @@ -119,7 +120,6 @@ protected void onDestroy() { } - private AutoFitTxtView getTxtAddress() { if (txtAddress == null) txtAddress = (AutoFitTxtView) findViewById(R.id.txt_address); diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/errors/ErrorActivity.java b/app/src/main/java/com/bentonow/bentonow/controllers/errors/ErrorActivity.java index 501ff51..8949756 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/errors/ErrorActivity.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/errors/ErrorActivity.java @@ -22,9 +22,11 @@ import com.bentonow.bentonow.dao.MenuDao; import com.bentonow.bentonow.listener.InterfaceCustomerService; import com.bentonow.bentonow.model.Menu; +import com.bentonow.bentonow.model.user.CouponRequest; import com.bentonow.bentonow.service.BentoCustomerService; import com.bentonow.bentonow.ui.BackendTextView; import com.bentonow.bentonow.web.request.UserRequest; +import com.google.android.gms.maps.model.LatLng; import com.loopj.android.http.TextHttpResponseHandler; import org.apache.http.Header; @@ -171,7 +173,18 @@ public void onSubmitPressed() { mDialog.addAcceptButton("OK", null); mDialog.show(); } else { - UserRequest.requestCoupon(getEditTxtEmail().getText().toString(), sStatus, new TextHttpResponseHandler() { + CouponRequest mCoupon = new CouponRequest(); + mCoupon.reason = sStatus; + mCoupon.email = getEditTxtEmail().getText().toString(); + mCoupon.address = BentoNowUtils.getFullAddress(); + + LatLng mLocation = BentoNowUtils.getOrderLocation(); + if (mLocation != null) { + mCoupon.lat = String.valueOf(mLocation.latitude); + mCoupon.lng = String.valueOf(mLocation.longitude); + } + + UserRequest.requestCoupon(mCoupon, new TextHttpResponseHandler() { @SuppressWarnings("deprecation") @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/geolocation/DeliveryLocationActivity.java b/app/src/main/java/com/bentonow/bentonow/controllers/geolocation/DeliveryLocationActivity.java index eac570a..61d7ac1 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/geolocation/DeliveryLocationActivity.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/geolocation/DeliveryLocationActivity.java @@ -50,6 +50,7 @@ import com.bentonow.bentonow.listener.OnCustomDragListener; import com.bentonow.bentonow.model.AutoCompleteModel; import com.bentonow.bentonow.model.Order; +import com.bentonow.bentonow.model.user.CouponRequest; import com.bentonow.bentonow.parse.InitParse; import com.bentonow.bentonow.ui.BackendTextView; import com.bentonow.bentonow.web.BentoNowApi; @@ -420,8 +421,14 @@ private void getMenusByLocation(String responseString) { DebugUtils.logDebug(TAG, "onContinuePressed AppState " + MenuDao.gateKeeper.getAppState()); if (MenuDao.gateKeeper.getAppState().contains("map,no_service")) { + CouponRequest mCoupon = new CouponRequest(); + mCoupon.reason = "outside of delivery zone"; + mCoupon.address = getTxtAddress().getText().toString(); + mCoupon.lat = String.valueOf(mLastOrderLocation.latitude); + mCoupon.lng = String.valueOf(mLastOrderLocation.longitude); + Intent mIntentBummer = new Intent(DeliveryLocationActivity.this, BummerActivity.class); - mIntentBummer.putExtra(BummerActivity.TAG_INVALID_ADDRESS, getTxtAddress().getText().toString()); + mIntentBummer.putExtra(CouponRequest.TAG, mCoupon); startActivity(mIntentBummer); } else if (MenuDao.gateKeeper.getAppState().contains("build")) { switch (optOpenScreen) { @@ -903,6 +910,13 @@ protected FilterResults performFiltering(CharSequence constraint) { if (bAllowRequest) { bAllowRequest = false; resultList = autocomplete(constraint.toString()); + runOnUiThread(new Runnable() { + @Override + public void run() { + notifyDataSetChanged(); + } + }); + bAllowRequest = true; // Assign the data to the FilterResults diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/order/AddOnActivity.java b/app/src/main/java/com/bentonow/bentonow/controllers/order/AddOnActivity.java index c43e3f5..b30d4d1 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/order/AddOnActivity.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/order/AddOnActivity.java @@ -124,6 +124,14 @@ private void addAddOnDishes() { getListAdapter().aListDish.add(dishModel); } + for (DishModel dishModel : mMenu.oaItems) { + if (dishModel.type.equals("addon")) { + dishModel.is_oa_only = 1; + getListAdapter().aListDish.add(dishModel); + } + } + + getListAdapter().aListDish.addAll(aSoldDish); } diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/order/SelectMainCustomActivity.java b/app/src/main/java/com/bentonow/bentonow/controllers/order/SelectMainCustomActivity.java index 1da0df4..725fc82 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/order/SelectMainCustomActivity.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/order/SelectMainCustomActivity.java @@ -73,6 +73,13 @@ protected void onCreate(Bundle savedInstanceState) { } } + for (DishModel dishModel : mMenu.oaItems) { + if (dishModel.type.equals("main")) { + dishModel.is_oa_only = 1; + getListAdapter().add(dishModel); + } + } + getListAdapter().addAll(aSoldDish); } } diff --git a/app/src/main/java/com/bentonow/bentonow/controllers/order/SelectSideCustomActivity.java b/app/src/main/java/com/bentonow/bentonow/controllers/order/SelectSideCustomActivity.java index 57993c4..236a8b6 100644 --- a/app/src/main/java/com/bentonow/bentonow/controllers/order/SelectSideCustomActivity.java +++ b/app/src/main/java/com/bentonow/bentonow/controllers/order/SelectSideCustomActivity.java @@ -71,6 +71,13 @@ protected void onCreate(Bundle savedInstanceState) { getListAdapter().add(dishModel); } + for (DishModel dishModel : mMenu.oaItems) { + if (dishModel.type.equals("side")) { + dishModel.is_oa_only = 1; + getListAdapter().add(dishModel); + } + } + getListAdapter().addAll(aSoldDish); } } diff --git a/app/src/main/java/com/bentonow/bentonow/dao/StockDao.java b/app/src/main/java/com/bentonow/bentonow/dao/StockDao.java index 665c1d9..252cec5 100644 --- a/app/src/main/java/com/bentonow/bentonow/dao/StockDao.java +++ b/app/src/main/java/com/bentonow/bentonow/dao/StockDao.java @@ -39,9 +39,10 @@ public static boolean isSold(int itemId, boolean countCurrent) { } } catch (Exception ex) { DebugUtils.logError(TAG, ex); + return false; } } - return false; + return true; } diff --git a/app/src/main/java/com/bentonow/bentonow/model/DishModel.java b/app/src/main/java/com/bentonow/bentonow/model/DishModel.java index 6488af2..6ecd3c3 100644 --- a/app/src/main/java/com/bentonow/bentonow/model/DishModel.java +++ b/app/src/main/java/com/bentonow/bentonow/model/DishModel.java @@ -21,6 +21,7 @@ public class DishModel implements Parcelable { public String qty; public int count_max; public int can_be_added; + public int is_oa_only; public DishModel() { @@ -40,6 +41,7 @@ public DishModel(Parcel parcel) { qty = parcel.readString(); count_max = parcel.readInt(); can_be_added = parcel.readInt(); + is_oa_only = parcel.readInt(); } @Override @@ -57,6 +59,7 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(qty); dest.writeInt(count_max); dest.writeInt(can_be_added); + dest.writeInt(is_oa_only); } diff --git a/app/src/main/java/com/bentonow/bentonow/model/Menu.java b/app/src/main/java/com/bentonow/bentonow/model/Menu.java index 1f0c3da..8b5bf91 100644 --- a/app/src/main/java/com/bentonow/bentonow/model/Menu.java +++ b/app/src/main/java/com/bentonow/bentonow/model/Menu.java @@ -22,7 +22,8 @@ public class Menu implements Parcelable { public String day_text = ""; public String day_text2 = ""; public String displayStartTime = ""; - public List dishModels; + public List dishModels = new ArrayList<>(); + public List oaItems = new ArrayList<>(); public List listTimeModel = new ArrayList<>(); public Menu() { @@ -42,8 +43,10 @@ public Menu(Parcel parcel) { day_text2 = parcel.readString(); displayStartTime = parcel.readString(); dishModels = new ArrayList<>(); + oaItems = new ArrayList<>(); listTimeModel = new ArrayList<>(); parcel.readList(dishModels, DishModel.class.getClassLoader()); + parcel.readList(oaItems, DishModel.class.getClassLoader()); parcel.readList(listTimeModel, TimesModel.class.getClassLoader()); } @@ -61,6 +64,7 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(day_text2); dest.writeString(displayStartTime); dest.writeList(dishModels); + dest.writeList(oaItems); dest.writeList(listTimeModel); } diff --git a/app/src/main/java/com/bentonow/bentonow/model/user/CouponRequest.java b/app/src/main/java/com/bentonow/bentonow/model/user/CouponRequest.java index 356e841..0469dd5 100644 --- a/app/src/main/java/com/bentonow/bentonow/model/user/CouponRequest.java +++ b/app/src/main/java/com/bentonow/bentonow/model/user/CouponRequest.java @@ -1,7 +1,58 @@ package com.bentonow.bentonow.model.user; -public class CouponRequest { +import android.os.Parcel; +import android.os.Parcelable; + +public class CouponRequest implements Parcelable { + + public static final String TAG = "CouponRequest"; + public String reason; public String email; - public String api_token; + public String lat; + public String lng; + public String address; + public String platform = "Android"; + + public CouponRequest() { + + } + + public CouponRequest(Parcel parcel) { + reason = parcel.readString(); + email = parcel.readString(); + lat = parcel.readString(); + lng = parcel.readString(); + address = parcel.readString(); + platform = parcel.readString(); + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(reason); + dest.writeString(email); + dest.writeString(lat); + dest.writeString(lng); + dest.writeString(address); + dest.writeString(platform); + } + + + @Override + public int describeContents() { + return 0; + } + + public static final Creator CREATOR = new Creator() { + + @Override + public CouponRequest[] newArray(int size) { + return new CouponRequest[size]; + } + + @Override + public CouponRequest createFromParcel(Parcel source) { + return new CouponRequest(source); + } + }; } diff --git a/app/src/main/java/com/bentonow/bentonow/parse/InitParse.java b/app/src/main/java/com/bentonow/bentonow/parse/InitParse.java index 5893d22..896fadd 100644 --- a/app/src/main/java/com/bentonow/bentonow/parse/InitParse.java +++ b/app/src/main/java/com/bentonow/bentonow/parse/InitParse.java @@ -232,34 +232,42 @@ public static void parseMenu(String data, boolean bIsToday) { Gson gson = new Gson(); Menu row; - if (menu != null && menu.has("lunch")) { + if (parseSection(menu, "lunch")) { JSONObject mLunch = menu.getJSONObject("lunch"); if (mLunch != null && mLunch.has("Menu")) { row = gson.fromJson(mLunch.getString("Menu"), Menu.class); - if (mLunch.has("MenuItems")) { + + if (parseSection(mLunch, "MenuItems")) row.dishModels = gson.fromJson(mLunch.getString("MenuItems"), new TypeToken>() { }.getType()); - if (bIsToday) - MenuDao.mListToday.add(row); - else - MenuDao.mListNextDay.add(row); - } + if (parseSection(mLunch, "OAOnlyItems")) + row.oaItems = gson.fromJson(mLunch.getString("OAOnlyItems"), new TypeToken>() { + }.getType()); + + if (bIsToday) + MenuDao.mListToday.add(row); + else + MenuDao.mListNextDay.add(row); } } - if (menu != null && menu.has("dinner")) { - JSONObject mLunch = menu.getJSONObject("dinner"); - if (mLunch != null && mLunch.has("Menu")) { - row = gson.fromJson(mLunch.getString("Menu"), Menu.class); - if (mLunch.has("MenuItems")) { - row.dishModels = gson.fromJson(mLunch.getString("MenuItems"), new TypeToken>() { + if (parseSection(menu, "dinner")) { + JSONObject mDinner = menu.getJSONObject("dinner"); + if (parseSection(mDinner, "Menu")) { + row = gson.fromJson(mDinner.getString("Menu"), Menu.class); + if (parseSection(mDinner, "MenuItems")) + row.dishModels = gson.fromJson(mDinner.getString("MenuItems"), new TypeToken>() { }.getType()); - if (bIsToday) - MenuDao.mListToday.add(row); - else - MenuDao.mListNextDay.add(row); - } + + if (parseSection(mDinner, "OAOnlyItems")) + row.oaItems = gson.fromJson(mDinner.getString("OAOnlyItems"), new TypeToken>() { + }.getType()); + + if (bIsToday) + MenuDao.mListToday.add(row); + else + MenuDao.mListNextDay.add(row); } } diff --git a/app/src/main/java/com/bentonow/bentonow/ui/wrapper/AddOnWrapper.java b/app/src/main/java/com/bentonow/bentonow/ui/wrapper/AddOnWrapper.java index 9f855fc..c5c152a 100644 --- a/app/src/main/java/com/bentonow/bentonow/ui/wrapper/AddOnWrapper.java +++ b/app/src/main/java/com/bentonow/bentonow/ui/wrapper/AddOnWrapper.java @@ -11,6 +11,7 @@ import com.bentonow.bentonow.R; import com.bentonow.bentonow.ui.AutoFitTxtView; +import com.bentonow.bentonow.ui.BackendAutoFitTextView; public class AddOnWrapper extends RecyclerView.ViewHolder { @@ -24,10 +25,10 @@ public class AddOnWrapper extends RecyclerView.ViewHolder { private AutoFitTxtView txt_add_on_title = null; private AutoFitTxtView txt_add_on_price = null; private AutoFitTxtView txt_add_on_description = null; + private BackendAutoFitTextView txt_oa_label; private TextView txt_number_add_on = null; - public AddOnWrapper(View base) { super(base); this.view = base; @@ -75,12 +76,19 @@ public AutoFitTxtView getTxtPrice() { txt_add_on_price = (AutoFitTxtView) view.findViewById(R.id.txt_add_on_price); return txt_add_on_price; } + public AutoFitTxtView getTxtDescription() { if (txt_add_on_description == null) txt_add_on_description = (AutoFitTxtView) view.findViewById(R.id.txt_add_on_description); return txt_add_on_description; } + public BackendAutoFitTextView getTxtOaLabel() { + if (txt_oa_label == null) + txt_oa_label = (BackendAutoFitTextView) view.findViewById(R.id.txt_oa_label); + return txt_oa_label; + } + public TextView getTxtNumberAddOn() { if (txt_number_add_on == null) txt_number_add_on = (TextView) view.findViewById(R.id.txt_number_add_on); diff --git a/app/src/main/java/com/bentonow/bentonow/ui/wrapper/ItemMainCustomWrapper.java b/app/src/main/java/com/bentonow/bentonow/ui/wrapper/ItemMainCustomWrapper.java index dd0b068..8f8aa02 100644 --- a/app/src/main/java/com/bentonow/bentonow/ui/wrapper/ItemMainCustomWrapper.java +++ b/app/src/main/java/com/bentonow/bentonow/ui/wrapper/ItemMainCustomWrapper.java @@ -10,6 +10,7 @@ import com.bentonow.bentonow.R; import com.bentonow.bentonow.ui.AutoFitTxtView; +import com.bentonow.bentonow.ui.BackendAutoFitTextView; import com.bentonow.bentonow.ui.material.ProgressBarCircularIndeterminate; @@ -26,6 +27,7 @@ public class ItemMainCustomWrapper { private AutoFitTxtView btn_dish_price = null; private AutoFitTxtView btn_add_to_bento; private AutoFitTxtView btn_added; + private BackendAutoFitTextView txt_oa_label; private LinearLayout wrapper_add_price = null; private View view_line_divider = null; private ProgressBarCircularIndeterminate mProgressLoading; @@ -76,13 +78,18 @@ public AutoFitTxtView getTxtDishPrice() { return btn_dish_price; } - public AutoFitTxtView getBtnAddToBento() { if (btn_add_to_bento == null) btn_add_to_bento = (AutoFitTxtView) view.findViewById(R.id.btn_add_to_bento); return btn_add_to_bento; } + public BackendAutoFitTextView getTxtOaLabel() { + if (txt_oa_label == null) + txt_oa_label = (BackendAutoFitTextView) view.findViewById(R.id.txt_oa_label); + return txt_oa_label; + } + public AutoFitTxtView getBtnAdded() { if (btn_added == null) btn_added = (AutoFitTxtView) view.findViewById(R.id.btn_added); diff --git a/app/src/main/java/com/bentonow/bentonow/ui/wrapper/ItemSideCustomWrapper.java b/app/src/main/java/com/bentonow/bentonow/ui/wrapper/ItemSideCustomWrapper.java index 041b935..5ad4a0b 100644 --- a/app/src/main/java/com/bentonow/bentonow/ui/wrapper/ItemSideCustomWrapper.java +++ b/app/src/main/java/com/bentonow/bentonow/ui/wrapper/ItemSideCustomWrapper.java @@ -24,6 +24,7 @@ public class ItemSideCustomWrapper { private AutofitTextView txt_description = null; private BackendAutoFitTextView btn_add_to_bento; private BackendAutoFitTextView btn_added; + private BackendAutoFitTextView txt_oa_label; private ProgressBarCircularIndeterminate mProgressLoading; public ItemSideCustomWrapper(View base) { @@ -72,6 +73,12 @@ public BackendAutoFitTextView getBtnAdded() { return btn_added; } + public BackendAutoFitTextView getTxtOaLabel() { + if (txt_oa_label == null) + txt_oa_label = (BackendAutoFitTextView) view.findViewById(R.id.txt_oa_label); + return txt_oa_label; + } + public ProgressBarCircularIndeterminate getProgressLoading() { if (mProgressLoading == null) mProgressLoading = (ProgressBarCircularIndeterminate) view.findViewById(R.id.progress_loading); diff --git a/app/src/main/java/com/bentonow/bentonow/web/request/UserRequest.java b/app/src/main/java/com/bentonow/bentonow/web/request/UserRequest.java index 003cc48..ed415b1 100644 --- a/app/src/main/java/com/bentonow/bentonow/web/request/UserRequest.java +++ b/app/src/main/java/com/bentonow/bentonow/web/request/UserRequest.java @@ -1,10 +1,7 @@ package com.bentonow.bentonow.web.request; -import android.util.Log; - import com.bentonow.bentonow.Utils.BentoRestClient; import com.bentonow.bentonow.Utils.DebugUtils; -import com.bentonow.bentonow.dao.UserDao; import com.bentonow.bentonow.model.User; import com.bentonow.bentonow.model.user.CouponRequest; import com.google.gson.Gson; @@ -12,22 +9,15 @@ import com.loopj.android.http.TextHttpResponseHandler; /** - * Created by joseguadalupetorresfuentes on 11/11/15. + * Created by Kokusho Tores on 11/11/15. */ public class UserRequest { public static final String TAG = "UserRequest"; - public static void requestCoupon(String email, String reason, TextHttpResponseHandler response) { - UserDao userDao = new UserDao(); - User mCurrent = userDao.getCurrentUser(); - - CouponRequest couponRequest = new CouponRequest(); - couponRequest.email = email; - couponRequest.reason = reason; - couponRequest.api_token = mCurrent != null ? mCurrent.api_token : null; - - String data = new Gson().toJson(couponRequest); + public static void requestCoupon(CouponRequest mCoupon, TextHttpResponseHandler response) { + String data = new Gson().toJson(mCoupon); + data = data.replace("lng", "long"); RequestParams params = new RequestParams(); params.put("data", data); diff --git a/app/src/main/res/layout/list_item_add.xml b/app/src/main/res/layout/list_item_add.xml index 8146613..2b0cc3b 100644 --- a/app/src/main/res/layout/list_item_add.xml +++ b/app/src/main/res/layout/list_item_add.xml @@ -45,9 +45,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" + android:maxLines="2" android:paddingBottom="10dp" android:paddingLeft="7dp" - android:maxLines="2" android:paddingRight="7dp" android:paddingTop="10dp" android:text="@string/app_name" @@ -104,7 +104,7 @@ android:id="@+id/img_sold_out" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:contentDescription="@null" android:src="@drawable/banner_sold_out" /> diff --git a/app/src/main/res/layout/list_item_add_on.xml b/app/src/main/res/layout/list_item_add_on.xml index 44c5f5f..048f631 100644 --- a/app/src/main/res/layout/list_item_add_on.xml +++ b/app/src/main/res/layout/list_item_add_on.xml @@ -1,5 +1,7 @@ + + diff --git a/app/src/main/res/layout/list_item_dish_main_custom.xml b/app/src/main/res/layout/list_item_dish_main_custom.xml index ec6e1b3..e6d6e02 100644 --- a/app/src/main/res/layout/list_item_dish_main_custom.xml +++ b/app/src/main/res/layout/list_item_dish_main_custom.xml @@ -47,6 +47,18 @@ android:layout_centerVertical="true" android:orientation="vertical"> + + #323b5998 #4f5055 #e97200 + #7De97200 #66aaaaaa #e66633