bug fixes part 1

This commit is contained in:
cimenmus
2018-01-16 23:04:28 +03:00
parent a2c1208b64
commit 5e26f03a55
7 changed files with 71 additions and 38 deletions

View File

@@ -40,7 +40,7 @@ public class AddAddressActivity extends BaseActivity {
@BindView(R.id.address1PizzalinkEditText) PizzalinkEditText address1PizzalinkEditText;
@BindView(R.id.cityPizzalinkDropdown) PizzalinkDropdownView cityPizzalinkDropdown;
@BindView(R.id.postcodePizzalinkDrowpdown) PizzalinkDropdownView postcodePizzalinkDrowpdown;
@BindView(R.id.postcodePizzalinkEditText) PizzalinkEditText postcodePizzalinkEditText;
@BindView(R.id.countryPizzalinkDropdown) PizzalinkDropdownView countryPizzalinkDropdown;
@BindView(R.id.zonePizzalinkDropdown) PizzalinkDropdownView zonePizzalinkDropdown;
@@ -64,7 +64,7 @@ public class AddAddressActivity extends BaseActivity {
setContentView(R.layout.activity_add_address);
ButterKnife.bind(this);
getCityList();
getCountryList();
//getCountryList();
}
@OnClick({R.id.cityPizzalinkDropdown, R.id.countryPizzalinkDropdown,
@@ -95,6 +95,7 @@ public class AddAddressActivity extends BaseActivity {
private boolean checkFields(){
/*
if(address1PizzalinkEditText.isEmail() ||
selectedCityModel == null ||
selectedCountryModel == null ||
@@ -102,7 +103,14 @@ public class AddAddressActivity extends BaseActivity {
DialogHelper.showAlertDialog(this, fillAllFieldsText);
return false;
}
*/
if(address1PizzalinkEditText.isEmpty() ||
selectedCityModel == null ||
postcodePizzalinkEditText.isEmpty()){
DialogHelper.showAlertDialog(this, fillAllFieldsText);
return false;
}
return true;
}
@@ -239,7 +247,6 @@ public class AddAddressActivity extends BaseActivity {
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
selectedCityModel = cityList.get(position);
cityPizzalinkDropdown.setText(selectedCityModel.getCity());
postcodePizzalinkDrowpdown.setText(selectedCityModel.getPostcode());
}
});
}
@@ -319,9 +326,12 @@ public class AddAddressActivity extends BaseActivity {
params.put("address_1", address1PizzalinkEditText.getText());
params.put("address_2", "");
params.put("city", selectedCityModel.getCity());
params.put("postcode", selectedCityModel.getPostcode());
params.put("country_id", selectedCountryModel.getId());
params.put("zone_id", selectedZoneModel.getZoneId());
//params.put("postcode", selectedCityModel.getPostcode());
params.put("postcode", postcodePizzalinkEditText.getText());
//params.put("country_id", selectedCountryModel.getId());
//params.put("zone_id", selectedZoneModel.getZoneId());
params.put("country_id", "1");
params.put("zone_id", "1");
return params;
}

View File

@@ -40,17 +40,17 @@ public class RegisterActivity extends BaseActivity {
@BindViews({ R.id.firstnamePizzalinkEditText, R.id.lasstnamePizzalinkEditText,
R.id.telephonePizzalinkEditText, R.id.emailPizzalinkEditText,
R.id.passwordPizzalinkEditText, R.id.passwordAgainPizzalinkEditText,
R.id.address1PizzalinkEditText})
R.id.address1PizzalinkEditText, R.id.postcodePizzalinkEditText})
List<PizzalinkEditText> pizzalinkEditTextList;
@BindView(R.id.cityPizzalinkDropdown) PizzalinkDropdownView cityPizzalinkDropdown;
@BindView(R.id.postcodePizzalinkDrowpdown) PizzalinkDropdownView postcodePizzalinkDrowpdown;
@BindView(R.id.countryPizzalinkDropdown) PizzalinkDropdownView countryPizzalinkDropdown;
@BindView(R.id.zonePizzalinkDropdown) PizzalinkDropdownView zonePizzalinkDropdown;
@BindView(R.id.registerButton) Button registerButton;
@BindString(R.string.alert_fill_all_fields) String fillAllFieldsText;
@BindString(R.string.alert_invalid_email) String validEmailText;
@BindString(R.string.alert_invalid_post_code) String invalidPostcodeText;
@BindString(R.string.alert_passwords_not_matched) String passwordsNotMatchedText;
@BindString(R.string.alert_select_country_first) String selectCountryFirstText;
@@ -70,7 +70,7 @@ public class RegisterActivity extends BaseActivity {
setContentView(R.layout.activity_register);
ButterKnife.bind(this);
getCityList();
getCountryList();
//getCountryList();
//setTestFields();
}
@@ -127,10 +127,20 @@ public class RegisterActivity extends BaseActivity {
return false;
}
if(pizzalinkEditTextList.get(7).getText().length() != 4){
DialogHelper.showAlertDialog(this, invalidPostcodeText);
return false;
}
/*
if(selectedCityModel == null ||
selectedCountryModel == null ||
selectedZoneModel == null){
DialogHelper.showAlertDialog(this, fillAllFieldsText);
*/
if(selectedCityModel == null){
DialogHelper.showAlertDialog(this, fillAllFieldsText);
return false;
}
@@ -298,9 +308,11 @@ public class RegisterActivity extends BaseActivity {
params.put("address_1", pizzalinkEditTextList.get(6).getText());
params.put("address_2", "");
params.put("city", selectedCityModel.getCity());
params.put("postcode", selectedCityModel.getPostcode());
params.put("country_id", selectedCountryModel.getId());
params.put("zone_id", selectedZoneModel.getZoneId());
params.put("postcode", pizzalinkEditTextList.get(7).getText());
//params.put("country_id", selectedCountryModel.getId());
//params.put("zone_id", selectedZoneModel.getZoneId());
params.put("country_id", "1");
params.put("zone_id", "1");
return params;
}
@@ -316,7 +328,6 @@ public class RegisterActivity extends BaseActivity {
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
selectedCityModel = cityList.get(position);
cityPizzalinkDropdown.setText(selectedCityModel.getCity());
postcodePizzalinkDrowpdown.setText(selectedCityModel.getPostcode());
}
});
}
@@ -361,6 +372,7 @@ public class RegisterActivity extends BaseActivity {
pizzalinkEditTextList.get(4).getEditText().setText("test");
pizzalinkEditTextList.get(5).getEditText().setText("test");
pizzalinkEditTextList.get(6).getEditText().setText("test address 1");
pizzalinkEditTextList.get(7).getEditText().setText("test postcode");
}
private synchronized void increaseActiveRequestCount(){

View File

@@ -5,6 +5,7 @@ import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.support.v4.content.ContextCompat;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.AttributeSet;
@@ -105,6 +106,11 @@ public class PizzalinkEditText extends LinearLayout implements View.OnClickListe
case "number":
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_NUMBER);
break;
case "postcode":
int maxLength = 4;
editText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)});
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_NUMBER);
break;
case "address":
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_TEXT_FLAG_MULTI_LINE);

View File

@@ -64,6 +64,14 @@
app:inputType="address"
app:hint="@string/addres_line_1"/>
<ch.pizzalink.android.view.PizzalinkEditText
android:id="@+id/postcodePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:edittextTheme="navy"
app:inputType="postcode"
app:hint="@string/postcode"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/cityPizzalinkDropdown"
android:layout_width="match_parent"
@@ -71,26 +79,21 @@
app:dropdownTheme="navy"
app:dropdownHintView="@string/city"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/postcodePizzalinkDrowpdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownTheme="navy"
app:dropdownHintView="@string/postcode"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/countryPizzalinkDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownTheme="navy"
app:dropdownHintView="@string/country"/>
app:dropdownHintView="@string/country"
android:visibility="gone"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/zonePizzalinkDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownTheme="navy"
app:dropdownHintView="@string/zone"/>
app:dropdownHintView="@string/zone"
android:visibility="gone"/>
<android.support.v4.widget.Space
android:layout_width="match_parent"

View File

@@ -43,7 +43,7 @@
android:id="@+id/cartTotalRelativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:background="@color/ghost_white"
android:layout_above="@+id/bottomNavigationView"
android:visibility="visible">

View File

@@ -90,29 +90,32 @@
app:inputType="address"
app:hint="@string/addres_line_1"/>
<ch.pizzalink.android.view.PizzalinkEditText
android:id="@+id/postcodePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:inputType="postcode"
app:hint="@string/postcode"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/cityPizzalinkDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownHintView="@string/city"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/postcodePizzalinkDrowpdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownHintView="@string/postcode"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/countryPizzalinkDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownHintView="@string/country"/>
app:dropdownHintView="@string/country"
android:visibility="gone"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/zonePizzalinkDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownHintView="@string/zone"/>
app:dropdownHintView="@string/zone"
android:visibility="gone"/>
<android.support.v4.widget.Space
android:layout_width="match_parent"

View File

@@ -41,25 +41,26 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:visibility="gone">
android:visibility="visible">
<View
android:id="@+id/cartDividerSpace"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@drawable/shadow" />
android:background="@drawable/shadow"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingBottom="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:paddingRight="24dp"
android:paddingEnd="24dp"
android:background="@color/white">
android:background="@color/ghost_white">
<TextView
android:id="@+id/cartTotalLabelTextView"
@@ -67,14 +68,12 @@
android:layout_height="wrap_content"
android:textColor="@color/navy"
fontPath="fonts/Quicksand-Bold.ttf"
android:layout_gravity="center_horizontal"
android:text="TOTAL"/>
android:layout_gravity="center_horizontal"/>
<TextView
android:id="@+id/cartProductTotalTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CHF 50.00"
android:textSize="18sp"
android:layout_marginTop="12dp"
android:textColor="@color/red"