bug fixes
This commit is contained in:
@@ -33,7 +33,8 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.CreateOrderActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan"/>
|
||||
<activity
|
||||
android:name=".activity.ForgotPasswordActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
@@ -31,6 +31,7 @@ public class CreateOrderActivity extends BaseActivity {
|
||||
private ShippingMethodModel selectedShippingMethod;
|
||||
private AddressModel selectedShippingAddress;
|
||||
private PaymentMethodModel selectedPaymentMethod;
|
||||
private Boolean slicePizza;
|
||||
private String orderNote;
|
||||
|
||||
@Override
|
||||
@@ -185,4 +186,12 @@ public class CreateOrderActivity extends BaseActivity {
|
||||
public void setOrderNote(String orderNote){
|
||||
this.orderNote = orderNote;
|
||||
}
|
||||
|
||||
public Boolean getSlicePizza() {
|
||||
return slicePizza;
|
||||
}
|
||||
|
||||
public void setSlicePizza(Boolean slicePizza) {
|
||||
this.slicePizza = slicePizza;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class SplashActivity extends BaseActivity {
|
||||
response.body().isSuccess()){
|
||||
CategoryModel.checkNull(response.body().getData());
|
||||
SharedPrefsHelper.saveCategoryList(response.body().getData());
|
||||
getIgnoredCategoryIds();
|
||||
getPizzaCategoryIds();
|
||||
}
|
||||
else
|
||||
ApiErrorUtils.parseError(response);
|
||||
@@ -115,6 +115,29 @@ public class SplashActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void getPizzaCategoryIds(){
|
||||
Call<ResponseArray<Integer>> call = ApiService.apiInterface.getPizzaCategoryIds();
|
||||
call.enqueue(new Callback<ResponseArray<Integer>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseArray<Integer>> call, Response<ResponseArray<Integer>> response) {
|
||||
if(response.isSuccessful() &&
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()){
|
||||
SharedPrefsHelper.savePizzaCategoryIdList(response.body().getData());
|
||||
getIgnoredCategoryIds();
|
||||
}
|
||||
else {
|
||||
ApiErrorUtils.parseError(response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseArray<Integer>> call, Throwable t) {
|
||||
DialogHelper.showFailedDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getIgnoredCategoryIds(){
|
||||
Call<ResponseArray<Integer>> call = ApiService.apiInterface.getIgnoredCategoryIds();
|
||||
call.enqueue(new Callback<ResponseArray<Integer>>() {
|
||||
|
||||
@@ -6,7 +6,8 @@ public class ApiEndPoints {
|
||||
private static final String SUFFIX = "&is_mobile=1";
|
||||
|
||||
public static final String API_GET_ALL_CATEGORIES = PREFIX + "getAllCategories" + SUFFIX;
|
||||
public static final String API_GET_IGNORED_CATEGORI_IDS= PREFIX + "getIgnoredCategory" + SUFFIX;
|
||||
public static final String API_GET_IGNORED_CATEGORY_IDS= PREFIX + "getIgnoredCategory" + SUFFIX;
|
||||
public static final String API_GET_PIZZA_CATEGORY_IDS= PREFIX + "getPizzaCategories" + SUFFIX;
|
||||
public static final String API_REGISTER = PREFIX + "signUp" + SUFFIX;
|
||||
public static final String API_LOGIN = PREFIX + "login" + SUFFIX;
|
||||
public static final String API_LOGOUT = PREFIX + "logout" + SUFFIX;
|
||||
|
||||
@@ -40,9 +40,12 @@ public interface ApiInterface {
|
||||
@GET(ApiEndPoints.API_GET_ALL_CATEGORIES)
|
||||
Call<ResponseArray<CategoryModel>> getAllCategories();
|
||||
|
||||
@GET(ApiEndPoints.API_GET_IGNORED_CATEGORI_IDS)
|
||||
@GET(ApiEndPoints.API_GET_IGNORED_CATEGORY_IDS)
|
||||
Call<ResponseArray<Integer>> getIgnoredCategoryIds();
|
||||
|
||||
@GET(ApiEndPoints.API_GET_PIZZA_CATEGORY_IDS)
|
||||
Call<ResponseArray<Integer>> getPizzaCategoryIds();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_REGISTER)
|
||||
Call<ResponseObject<UserModel>> register(@FieldMap HashMap<String, Object> body);
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package ch.pizzalink.android.fragment.createOrder;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.AppCompatRadioButton;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -22,9 +25,11 @@ import ch.pizzalink.android.api.ApiService;
|
||||
import ch.pizzalink.android.api.ResponseObject;
|
||||
import ch.pizzalink.android.helper.DialogHelper;
|
||||
import ch.pizzalink.android.helper.SessionHelper;
|
||||
import ch.pizzalink.android.helper.SharedPrefsHelper;
|
||||
import ch.pizzalink.android.interfaces.RecyclerItemClickListener;
|
||||
import ch.pizzalink.android.model.PaymentMethodModel;
|
||||
import ch.pizzalink.android.model.PaymentMethodsResponseModel;
|
||||
import ch.pizzalink.android.model.cart.CartProductModel;
|
||||
import ch.pizzalink.android.view.PizzalinkEditText;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -37,6 +42,9 @@ import retrofit2.Response;
|
||||
public class CreateOrderNoteFragment extends CreateOrderBaseFragment {
|
||||
|
||||
@BindView(R.id.orderNotePizzalinkEditText) PizzalinkEditText orderNotePizzalinkEditText;
|
||||
@BindView(R.id.slicePizzaLayout) LinearLayout slicePizzaLayout;
|
||||
@BindView(R.id.yesRadioButton) AppCompatRadioButton yesRadioButton;
|
||||
@BindView(R.id.noRadioButton) AppCompatRadioButton noRadioButton;
|
||||
|
||||
public static final java.lang.String FRAGMENT_NAME = "createOrderNoteFragment";
|
||||
private CreateOrderActivity createOrderActivity;
|
||||
@@ -60,13 +68,30 @@ public class CreateOrderNoteFragment extends CreateOrderBaseFragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
@OnClick({R.id.previousTextView, R.id.nextTextView})
|
||||
@OnClick({R.id.yesLayout, R.id.noLayout,
|
||||
R.id.previousTextView, R.id.nextTextView})
|
||||
protected void onClick(View view){
|
||||
switch (view.getId()){
|
||||
case R.id.yesLayout:
|
||||
yesRadioButton.setChecked(true);
|
||||
noRadioButton.setChecked(false);
|
||||
break;
|
||||
case R.id.noLayout:
|
||||
noRadioButton.setChecked(true);
|
||||
yesRadioButton.setChecked(false);
|
||||
break;
|
||||
case R.id.previousTextView:
|
||||
createOrderActivity.onPreviousClicked(FRAGMENT_NAME);
|
||||
break;
|
||||
case R.id.nextTextView:
|
||||
if(isCartContainsAnyPizza(createOrderActivity.getCartInfo().getProducts())){
|
||||
if(yesRadioButton.isChecked()){
|
||||
createOrderActivity.setSlicePizza(true);
|
||||
}
|
||||
else {
|
||||
createOrderActivity.setSlicePizza(false);
|
||||
}
|
||||
}
|
||||
createOrderActivity.setOrderNote(orderNotePizzalinkEditText.getText());
|
||||
createOrderActivity.onNextClicked(FRAGMENT_NAME);
|
||||
break;
|
||||
@@ -75,8 +100,53 @@ public class CreateOrderNoteFragment extends CreateOrderBaseFragment {
|
||||
|
||||
private void initViews(){
|
||||
createOrderActivity = (CreateOrderActivity) getActivity();
|
||||
if(isCartContainsAnyPizza(createOrderActivity.getCartInfo().getProducts())){
|
||||
slicePizzaLayout.setVisibility(View.VISIBLE);
|
||||
if(createOrderActivity.getSlicePizza() != null){
|
||||
if(createOrderActivity.getSlicePizza()){
|
||||
yesRadioButton.setChecked(true);
|
||||
}
|
||||
else {
|
||||
noRadioButton.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(createOrderActivity.getOrderNote() != null){
|
||||
orderNotePizzalinkEditText.setText(createOrderActivity.getOrderNote());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCartContainsAnyPizza(ArrayList<CartProductModel> cartProductList){
|
||||
boolean containsAnyPizza = false;
|
||||
outerloop:
|
||||
for(CartProductModel cartProductModel : cartProductList){
|
||||
if(SharedPrefsHelper.readPizzaCategoryIdList().contains(Integer.valueOf(cartProductModel.getProductId()))){
|
||||
containsAnyPizza = true;
|
||||
break;
|
||||
}
|
||||
for(String categoryId : cartProductModel.getCategoryList()){
|
||||
if(SharedPrefsHelper.readPizzaCategoryIdList().contains(Integer.valueOf(categoryId))){
|
||||
containsAnyPizza = true;
|
||||
break outerloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
return containsAnyPizza;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if(SharedPrefsHelper.isCartContainsAnyPizza()){
|
||||
stringBuilder.append(slicePizzaText).append(" : ");
|
||||
if(yesRadioButton.isChecked()){
|
||||
stringBuilder.append(yesText);
|
||||
}
|
||||
else {
|
||||
stringBuilder.append(noText);
|
||||
}
|
||||
stringBuilder.append("<br/>");
|
||||
}
|
||||
stringBuilder.append(orderNotePizzalinkEditText.getText());
|
||||
createOrderActivity.setOrderNote(stringBuilder.toString());
|
||||
*/
|
||||
@@ -5,6 +5,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import butterknife.BindString;
|
||||
@@ -20,6 +21,8 @@ import ch.pizzalink.android.api.ResponseObject;
|
||||
import ch.pizzalink.android.helper.DialogHelper;
|
||||
import ch.pizzalink.android.helper.PriceHelper;
|
||||
import ch.pizzalink.android.helper.SessionHelper;
|
||||
import ch.pizzalink.android.helper.SharedPrefsHelper;
|
||||
import ch.pizzalink.android.model.cart.CartProductModel;
|
||||
import ch.pizzalink.android.view.PizzalinkInfoView;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -39,6 +42,9 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
@BindView(R.id.orderNotePizzalinkInfoLayout) PizzalinkInfoView orderNotePizzalinkInfoLayout;
|
||||
|
||||
@BindString(R.string.confirm_order) String confirmOrderText;
|
||||
@BindString(R.string.slice_pizza) String slicePizzaText;
|
||||
@BindString(R.string.yes) String yesText;
|
||||
@BindString(R.string.no) String noText;
|
||||
|
||||
public static final java.lang.String FRAGMENT_NAME = "orderSummaryFragment";
|
||||
private CreateOrderActivity createOrderActivity;
|
||||
@@ -127,7 +133,42 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
params.put("address_id", createOrderActivity.getSelectedShippingAddress().getId());
|
||||
params.put("payment_method_title", createOrderActivity.getSelectedPaymentMethod().getTitle());
|
||||
params.put("payment_method_code", createOrderActivity.getSelectedPaymentMethod().getCode());
|
||||
params.put("comment", createOrderActivity.getOrderNote());
|
||||
params.put("comment", createOrderNote());
|
||||
return params;
|
||||
}
|
||||
|
||||
private String createOrderNote(){
|
||||
CreateOrderActivity createOrderActivity = (CreateOrderActivity) getActivity();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if(isCartContainsAnyPizza(createOrderActivity.getCartInfo().getProducts())){
|
||||
stringBuilder.append(slicePizzaText).append(" : ");
|
||||
if(createOrderActivity.getSlicePizza()){
|
||||
stringBuilder.append(yesText);
|
||||
}
|
||||
else {
|
||||
stringBuilder.append(noText);
|
||||
}
|
||||
stringBuilder.append("<br/>");
|
||||
}
|
||||
stringBuilder.append(createOrderActivity.getOrderNote());
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
private boolean isCartContainsAnyPizza(ArrayList<CartProductModel> cartProductList){
|
||||
boolean containsAnyPizza = false;
|
||||
outerloop:
|
||||
for(CartProductModel cartProductModel : cartProductList){
|
||||
if(SharedPrefsHelper.readPizzaCategoryIdList().contains(Integer.valueOf(cartProductModel.getProductId()))){
|
||||
containsAnyPizza = true;
|
||||
break;
|
||||
}
|
||||
for(String categoryId : cartProductModel.getCategoryList()){
|
||||
if(SharedPrefsHelper.readPizzaCategoryIdList().contains(Integer.valueOf(categoryId))){
|
||||
containsAnyPizza = true;
|
||||
break outerloop;
|
||||
}
|
||||
}
|
||||
}
|
||||
return containsAnyPizza;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class SharedPrefsHelper {
|
||||
|
||||
private static final String PREF_KEY_CATEGORY_LIST = SHARED_PREFS_NAME + "categoryList";
|
||||
private static final String PREF_KEY_IGNORED_CATEGORY_ID_LIST = SHARED_PREFS_NAME + "ignoredCategoryIdList";
|
||||
private static final String PREF_KEY_PIZZA_CATEGORY_ID_LIST = SHARED_PREFS_NAME + "pizzaCategoryIdList";
|
||||
private static final String PREF_KEY_USER = SHARED_PREFS_NAME + "user";
|
||||
private static final String PREF_KEY_CUSTOMER_TOKEN = SHARED_PREFS_NAME + "customerToken";
|
||||
private static final String PREF_KEY_USER_LOG_IN_STATUS = SHARED_PREFS_NAME + "userLoginStatus";
|
||||
@@ -63,6 +64,16 @@ public class SharedPrefsHelper {
|
||||
return gson.fromJson(sharedPreferences.getString(PREF_KEY_IGNORED_CATEGORY_ID_LIST, ""), ignoredCategoryIdListType);
|
||||
}
|
||||
|
||||
public static void savePizzaCategoryIdList(ArrayList<Integer> pizzaCategoryIdList){
|
||||
String ignoredCategoryIdsJsonString = gson.toJson(pizzaCategoryIdList, new TypeToken<ArrayList<Integer>>() {}.getType());
|
||||
editor.putString(PREF_KEY_PIZZA_CATEGORY_ID_LIST, ignoredCategoryIdsJsonString);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static ArrayList<Integer> readPizzaCategoryIdList(){
|
||||
Type pizzaCategoryIdList = new TypeToken<ArrayList<Integer>>(){}.getType();
|
||||
return gson.fromJson(sharedPreferences.getString(PREF_KEY_PIZZA_CATEGORY_ID_LIST, ""), pizzaCategoryIdList);
|
||||
}
|
||||
|
||||
public static void saveUser(UserModel user){
|
||||
editor.putString(PREF_KEY_USER, gson.toJson(user));
|
||||
|
||||
@@ -14,6 +14,7 @@ public class CartProductModel implements Serializable {
|
||||
|
||||
@Expose @SerializedName("cart_id") private String cartId;
|
||||
@Expose @SerializedName("product_id") private String productId;
|
||||
@Expose @SerializedName("categories") private ArrayList<String> categoryList;
|
||||
|
||||
private String name;
|
||||
private String model;
|
||||
@@ -56,6 +57,10 @@ public class CartProductModel implements Serializable {
|
||||
cartProductOptionModel.checkNull();
|
||||
}
|
||||
}
|
||||
|
||||
if(categoryList == null){
|
||||
categoryList = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNull(ArrayList<CartProductModel> cartProductList){
|
||||
@@ -151,4 +156,12 @@ public class CartProductModel implements Serializable {
|
||||
public void setOption(ArrayList<CartProductOptionModel> option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public ArrayList<String> getCategoryList() {
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
public void setCategoryList(ArrayList<String> categoryList) {
|
||||
this.categoryList = categoryList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="MissingPrefix"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -16,6 +19,68 @@
|
||||
app:hint="@string/order_note"
|
||||
app:inputType="multiline"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/slicePizzaLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:layout_below="@+id/orderNotePizzalinkEditText"
|
||||
android:layout_marginTop="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
fontPath="fonts/Quicksand-Bold.ttf"
|
||||
android:textColor="@color/navy"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/slice_pizza"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/yesLayout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:padding="12dp">
|
||||
|
||||
<android.support.v7.widget.AppCompatRadioButton
|
||||
android:id="@+id/yesRadioButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/yes"
|
||||
android:clickable="false"
|
||||
android:textColor="@color/navy"
|
||||
android:checked="true"
|
||||
fontPath="fonts/Quicksand-Bold.ttf"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/noLayout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:padding="12dp">
|
||||
|
||||
<android.support.v7.widget.AppCompatRadioButton
|
||||
android:id="@+id/noRadioButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no"
|
||||
android:clickable="false"
|
||||
android:textColor="@color/navy"
|
||||
fontPath="fonts/Quicksand-Bold.ttf"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/layout_orders_bottom"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -144,6 +144,9 @@
|
||||
|
||||
<!-- CreateOrderNoteFragment-->
|
||||
<string name="order_note">Nachricht (Optional)</string>
|
||||
<string name="slice_pizza">Pizzanızın dilimlenmesini ister misiniz?</string>
|
||||
<string name="yes">Ja</string>
|
||||
<string name="no">Nein</string>
|
||||
<!-- CreateOrderNoteFragment-->
|
||||
|
||||
<!-- CreateOrderSummaryFragment-->
|
||||
|
||||
Reference in New Issue
Block a user