add to cart and other fixes
This commit is contained in:
@@ -23,7 +23,8 @@
|
||||
<activity android:name=".activity.LoginActivity" />
|
||||
<activity android:name=".activity.RegisterActivity" />
|
||||
<activity android:name=".activity.MainActivity" />
|
||||
<activity android:name=".activity.OrderActivity"></activity>
|
||||
<activity android:name=".activity.OrderActivity" />
|
||||
<activity android:name=".activity.ForgotPasswordActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
54
app/src/main/res/layout/activity_forgot_password.xml
Normal file
54
app/src/main/res/layout/activity_forgot_password.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
tools:context="ch.pizzalink.android.activity.ForgotPasswordActivity">
|
||||
|
||||
<ch.pizzalink.android.view.PizzalinkToolbar
|
||||
android:id="@+id/forgotPasswordPizzalinkToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
app:title="@string/activity_title_forgot_password"
|
||||
app:showBackIcon="true"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/registerTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/reset_password_hint"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:padding="24dp" />
|
||||
|
||||
<ch.pizzalink.android.view.PizzalinkEditText
|
||||
android:id="@+id/forgotPasswordEmailPizzalinkEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hint="@string/email"
|
||||
app:inputType="email"/>
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/resetPasswordButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/reset_password_button"
|
||||
style="@style/PizzalinkButton" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -73,7 +73,7 @@
|
||||
style="@style/PizzalinkButton" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/registerTextView"
|
||||
android:id="@+id/forgotPasswordTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/register_text"
|
||||
@@ -81,6 +81,19 @@
|
||||
android:textColor="@color/black"
|
||||
android:padding="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/registerTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/register_text"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/black"
|
||||
android:paddingBottom="24dp"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingEnd="24dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -1,3 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
app:cardCornerRadius="4dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginEnd="12dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderDateTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5 Oct. 2017 "
|
||||
android:textColor="@color/black"
|
||||
android:padding="8dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="16sp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toLeftOf="@+id/cancelOrderImageView"
|
||||
android:layout_toStartOf="@+id/cancelOrderImageView"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cancelOrderImageView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_cancel_2"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderTotalTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="CHF 25.00"
|
||||
android:textColor="@color/black"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:textStyle="italic"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingEnd="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderStatusTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Pending"
|
||||
android:textColor="@color/black"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:textStyle="italic"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingEnd="12dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<!--
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
@@ -101,13 +189,8 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
-->
|
||||
@@ -123,6 +123,13 @@
|
||||
|
||||
<string name="activity_title_create_order">Sipariş Ver</string>
|
||||
|
||||
<string name="activity_title_forgot_password">Şifremi Unuttum</string>
|
||||
<string name="reset_password_hint">Kayıt olurken mail adresini giriniz ve gelen maildeki yönergeleri takip ediniz.</string>
|
||||
<string name="reset_password_button">GÖNDER</string>
|
||||
|
||||
<string name="forgot_password_hint">Şifreni mi unuttun?</string>
|
||||
<string name="reset_password">ŞİFRENİ SIFIRLA</string>
|
||||
|
||||
<string name="next">NEXT</string>
|
||||
<string name="previous">PREVIOUS</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user