register fixes

This commit is contained in:
2017-10-12 22:05:13 +03:00
parent a239736c9a
commit 50d9dd8ed8
11 changed files with 129 additions and 80 deletions

View File

@@ -21,7 +21,6 @@ import ch.pizzalink.android.api.ResponseObject;
import ch.pizzalink.android.helper.DialogHelper;
import ch.pizzalink.android.helper.SharedPrefsHelper;
import ch.pizzalink.android.model.UserModel;
import ch.pizzalink.android.view.PizzalinkButton;
import ch.pizzalink.android.view.PizzalinkEditText;
import retrofit2.Call;
import retrofit2.Callback;
@@ -37,7 +36,7 @@ public class LoginActivity extends BaseActivity {
@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;
@BindString(R.string.alert_valid_email) String validEmailText;
@BindString(R.string.alert_invalid_email) String validEmailText;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -62,8 +61,10 @@ public class LoginActivity extends BaseActivity {
private void initViews(){
initRegisterTextView();
/*
emailPizzalinkEditText.getEditText().setText("aytaccici@gmail.com");
passwordPizzalinkEditText.getEditText().setText("3522625");
*/
}
private void initRegisterTextView(){

View File

@@ -19,7 +19,6 @@ import ch.pizzalink.android.api.ResponseObject;
import ch.pizzalink.android.helper.DialogHelper;
import ch.pizzalink.android.helper.SharedPrefsHelper;
import ch.pizzalink.android.model.UserModel;
import ch.pizzalink.android.view.PizzalinkButton;
import ch.pizzalink.android.view.PizzalinkEditText;
import ch.pizzalink.android.view.PizzalinkToolbar;
import retrofit2.Call;
@@ -33,14 +32,14 @@ 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.address2PizzalinkEditText,
R.id.cityPizzalinkEditText, R.id.postcodePizzalinkEditText,
R.id.zonePizzalinkEditText, R.id.countryPizzalinkEditText})
R.id.address1PizzalinkEditText, R.id.cityPizzalinkEditText,
R.id.postcodePizzalinkEditText})
List<PizzalinkEditText> pizzalinkEditTextList;
@BindString(R.string.alert_fill_all_fields) String fillAllFieldsText;
@BindString(R.string.alert_valid_email) String validEmailText;
@BindString(R.string.alert_invalid_email) String validEmailText;
@BindString(R.string.alert_passwords_not_matched) String passwordsNotMatchedText;
@BindString(R.string.alert_invalid_post_code) String invalidPostCodeText;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -48,7 +47,7 @@ public class RegisterActivity extends BaseActivity {
setContentView(R.layout.activity_register);
ButterKnife.bind(this);
initViews();
setTestFields();
//setTestFields();
}
@OnClick(R.id.registerButton)
@@ -93,6 +92,11 @@ public class RegisterActivity extends BaseActivity {
return false;
}
if(pizzalinkEditTextList.get(8).getText().length() != 4){
DialogHelper.showAlertDialog(this, invalidPostCodeText);
return false;
}
return true;
}
@@ -102,9 +106,8 @@ public class RegisterActivity extends BaseActivity {
pizzalinkEditTextList.get(0).getText(), pizzalinkEditTextList.get(1).getText(),
pizzalinkEditTextList.get(2).getText(), pizzalinkEditTextList.get(3).getText(),
pizzalinkEditTextList.get(4).getText(), pizzalinkEditTextList.get(5).getText(),
pizzalinkEditTextList.get(6).getText(), pizzalinkEditTextList.get(7).getText(),
pizzalinkEditTextList.get(8).getText(), pizzalinkEditTextList.get(9).getText(),
pizzalinkEditTextList.get(10).getText(),pizzalinkEditTextList.get(11).getText());
pizzalinkEditTextList.get(6).getText(), "",
pizzalinkEditTextList.get(7).getText(), pizzalinkEditTextList.get(8).getText(), "1","1");
call.enqueue(new Callback<ResponseObject<UserModel>>() {
@Override
public void onResponse(Call<ResponseObject<UserModel>> call, Response<ResponseObject<UserModel>> response) {
@@ -138,10 +141,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 address 2");
pizzalinkEditTextList.get(8).getEditText().setText("test");
pizzalinkEditTextList.get(9).getEditText().setText("1234");
pizzalinkEditTextList.get(10).getEditText().setText("1");
pizzalinkEditTextList.get(11).getEditText().setText("1");
pizzalinkEditTextList.get(7).getEditText().setText("test");
pizzalinkEditTextList.get(8).getEditText().setText("1234");
}
}

View File

@@ -4,7 +4,9 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.support.v4.content.ContextCompat;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
@@ -77,6 +79,10 @@ public class PizzalinkEditText extends LinearLayout implements View.OnClickListe
if (inputType == null)
inputType = "text";
switch (inputType){
case "name":
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS |
InputType.TYPE_TEXT_FLAG_CAP_WORDS);
break;
case "password":
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
break;
@@ -86,8 +92,32 @@ public class PizzalinkEditText extends LinearLayout implements View.OnClickListe
case "email":
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
break;
case "number":
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);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
@Override
public void afterTextChanged(Editable editable) {
// if edittext has 10chars & this is not called yet, add new line
if(editText.getText().length() == 40 * editText.getLineCount()) {
editText.append("\n");
}
}
});
break;
default:
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_TEXT);
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
break;
}
}

View File

@@ -1,4 +1,4 @@
<vector android:height="20dp" android:viewportHeight="240.823"
android:viewportWidth="240.823" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ffffff" android:pathData="M57.63,129.01L165.93,237.27c4.75,4.74 12.45,4.74 17.22,0c4.75,-4.74 4.75,-12.44 0,-17.18l-99.71,-99.67l99.69,-99.67c4.75,-4.74 4.75,-12.44 0,-17.19c-4.75,-4.74 -12.46,-4.74 -17.22,0L57.62,111.82C52.94,116.51 52.94,124.33 57.63,129.01z"/>
<path android:fillColor="#EC1649" android:pathData="M57.63,129.01L165.93,237.27c4.75,4.74 12.45,4.74 17.22,0c4.75,-4.74 4.75,-12.44 0,-17.18l-99.71,-99.67l99.69,-99.67c4.75,-4.74 4.75,-12.44 0,-17.19c-4.75,-4.74 -12.46,-4.74 -17.22,0L57.62,111.82C52.94,116.51 52.94,124.33 57.63,129.01z"/>
</vector>

View File

@@ -1,6 +1,6 @@
<vector android:height="24dp" android:viewportHeight="53.0"
android:viewportWidth="53.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M2,13.5h49c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H2c-1.1,0 -2,0.9 -2,2S0.9,13.5 2,13.5z"/>
<path android:fillColor="#FFFFFF" android:pathData="M2,28.5h49c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H2c-1.1,0 -2,0.9 -2,2S0.9,28.5 2,28.5z"/>
<path android:fillColor="#FFFFFF" android:pathData="M2,43.5h49c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H2c-1.1,0 -2,0.9 -2,2S0.9,43.5 2,43.5z"/>
<path android:fillColor="#EC1649" android:pathData="M2,13.5h49c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H2c-1.1,0 -2,0.9 -2,2S0.9,13.5 2,13.5z"/>
<path android:fillColor="#EC1649" android:pathData="M2,28.5h49c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H2c-1.1,0 -2,0.9 -2,2S0.9,28.5 2,28.5z"/>
<path android:fillColor="#EC1649" android:pathData="M2,43.5h49c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H2c-1.1,0 -2,0.9 -2,2S0.9,43.5 2,43.5z"/>
</vector>

View File

@@ -20,7 +20,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/pizzalinkToolbar"
android:layout_above="@+id/bottomNavigationView">
android:layout_above="@+id/bottomNavigationViewLayout">
<FrameLayout
android:id="@+id/fragmentContainer"
@@ -38,16 +38,30 @@
</android.support.v4.widget.DrawerLayout>
<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
android:id="@+id/bottomNavigationView"
<LinearLayout
android:id="@+id/bottomNavigationViewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemIconTint="@drawable/selector_bottom_navigation_item"
app:itemTextColor="@drawable/selector_bottom_navigation_item"
android:background="@color/white"
app:menu="@menu/menu_bottom_navigation"
app:itemBackground="@color/white"/>
android:orientation="vertical"
android:layout_alignParentBottom="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@drawable/shadow" />
<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemIconTint="@drawable/selector_bottom_navigation_item"
app:itemTextColor="@drawable/selector_bottom_navigation_item"
android:background="@color/white"
app:menu="@menu/menu_bottom_navigation"
app:itemBackground="@color/white"
app:elevation="0dp"/>
</LinearLayout>
</RelativeLayout>

View File

@@ -23,7 +23,6 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:layout_below="@+id/registerToolbar"
android:layout_above="@+id/registerButton">
@@ -38,12 +37,14 @@
android:id="@+id/firstnamePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:inputType="name"
app:hint="@string/firstname"/>
<ch.pizzalink.android.view.PizzalinkEditText
android:id="@+id/lasstnamePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:inputType="name"
app:hint="@string/lastname"/>
<ch.pizzalink.android.view.PizzalinkEditText
@@ -78,37 +79,22 @@
android:id="@+id/address1PizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:inputType="address"
app:hint="@string/addres_line_1"/>
<ch.pizzalink.android.view.PizzalinkEditText
android:id="@+id/address2PizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/addres_line_2"/>
<ch.pizzalink.android.view.PizzalinkEditText
android:id="@+id/cityPizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:inputType="address"
app:hint="@string/city"/>
<ch.pizzalink.android.view.PizzalinkEditText
android:id="@+id/postcodePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:inputType="number"
app:hint="@string/postcode"/>
<ch.pizzalink.android.view.PizzalinkEditText
android:id="@+id/zonePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/zone"/>
<ch.pizzalink.android.view.PizzalinkEditText
android:id="@+id/countryPizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/county"/>
<android.support.v4.widget.Space
android:layout_width="match_parent"

View File

@@ -0,0 +1,6 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/shadow" />

View File

@@ -24,7 +24,7 @@
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="16sp"
android:textColorHint="@color/row_product_ingredients_background"

View File

@@ -15,41 +15,52 @@
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp"
android:background="@color/red">
android:background="@color/white">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<ImageView
android:id="@+id/hamburgerIcon"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:padding="20dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_hamburger_menu"
android:visibility="gone"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/backIcon"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:padding="20dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_back"
android:visibility="gone"/>
<ImageView
android:id="@+id/hamburgerIcon"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:padding="20dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_hamburger_menu"
android:visibility="gone"/>
<TextView
android:id="@+id/toolbarTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/white"
fontPath="fonts/AvenirNextLTProDemi.otf"
android:visibility="gone"/>
<ImageView
android:id="@+id/backIcon"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:padding="20dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_back"
android:visibility="gone"/>
<TextView
android:id="@+id/toolbarTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/red"
fontPath="fonts/AvenirNextLTProDemi.otf"
android:visibility="gone"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/shadow"
android:layout_alignParentBottom="true"/>
</RelativeLayout>

View File

@@ -52,15 +52,16 @@
<string name="email">Email</string>
<string name="password">Şifre</string>
<string name="password_again">Şifre (Tekrar)</string>
<string name="addres_line_1">Adres 1</string>
<string name="addres_line_1">Adres</string>
<string name="addres_line_2">Adres 2</string>
<string name="city">Şehir</string>
<string name="postcode">Posta Kodu</string>
<string name="county">Ülke</string>
<string name="zone">Bölge</string>
<string name="alert_fill_all_fields">Lütfen istenen tüm bigileri doldurunuz.</string>
<string name="alert_valid_email">Lütfen geçerli bir mail adresi giriniz.</string>
<string name="alert_invalid_email">Lütfen geçerli bir mail adresi giriniz.</string>
<string name="alert_passwords_not_matched">Şifreler uyuşmuyor..</string>
<string name="alert_invalid_post_code">Lütfen geçerli bir posta kodu giriniz.</string>
<string name="button_register">KAYIT OL</string>
<!-- RegisterActivity-->