address on register
This commit is contained in:
@@ -2,10 +2,8 @@ package ch.pizzalink.android.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
@@ -27,12 +25,12 @@ import ch.pizzalink.android.api.ResponseObject;
|
||||
import ch.pizzalink.android.helper.DialogHelper;
|
||||
import ch.pizzalink.android.helper.SharedPrefsHelper;
|
||||
import ch.pizzalink.android.helper.ViewHelper;
|
||||
import ch.pizzalink.android.model.ZoneModel;
|
||||
import ch.pizzalink.android.model.CityModel;
|
||||
import ch.pizzalink.android.model.CountryModel;
|
||||
import ch.pizzalink.android.model.UserModel;
|
||||
import ch.pizzalink.android.view.PizzalinkDropdown;
|
||||
import ch.pizzalink.android.model.ZoneeModel;
|
||||
import ch.pizzalink.android.view.PizzalinkDropdownView;
|
||||
import ch.pizzalink.android.view.PizzalinkEditText;
|
||||
import ch.pizzalink.android.view.PizzalinkToolbar;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -43,22 +41,27 @@ 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.cityPizzalinkEditText})
|
||||
R.id.address1PizzalinkEditText})
|
||||
List<PizzalinkEditText> pizzalinkEditTextList;
|
||||
|
||||
@BindView(R.id.zonePizzalinkDropdown) PizzalinkDropdown zonePizzalinkDropdown;
|
||||
@BindView(R.id.postcodePizzalinkDrowpdown) PizzalinkDropdown postcodePizzalinkDrowpdown;
|
||||
@BindView(R.id.countryPizzalinkDropdown) PizzalinkDropdown countryPizzalinkDropdown;
|
||||
@BindView(R.id.cityPizzalinkDropdown) PizzalinkDropdownView cityPizzalinkDropdown;
|
||||
@BindView(R.id.postcodePizzalinkDrowpdown) PizzalinkDropdownView postcodePizzalinkDrowpdown;
|
||||
@BindView(R.id.countryPizzalinkDropdown) PizzalinkDropdownView countryPizzalinkDropdown;
|
||||
@BindView(R.id.zoneePizzalinkDropdown) PizzalinkDropdownView zoneePizzalinkDropdown;
|
||||
|
||||
@BindString(R.string.alert_fill_all_fields) String fillAllFieldsText;
|
||||
@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;
|
||||
@BindString(R.string.alert_select_country_first) String selectCountryFirstText;
|
||||
|
||||
private ArrayList<ZoneModel> zoneList = new ArrayList<>();
|
||||
|
||||
private ArrayList<CityModel> cityList = new ArrayList<>();
|
||||
private ArrayList<CountryModel> countryList = new ArrayList<>();
|
||||
private ZoneModel selectedZoneModel;
|
||||
private ArrayList<ZoneeModel> zoneeList = new ArrayList<>();
|
||||
private CityModel selectedCityModel;
|
||||
private CountryModel selectedCountryModel;
|
||||
private ZoneeModel selectedZoneeModel;
|
||||
|
||||
private int activeRequestCount = 0;
|
||||
private ReentrantLock lock = new ReentrantLock();
|
||||
@@ -68,16 +71,36 @@ public class RegisterActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_register);
|
||||
ButterKnife.bind(this);
|
||||
getZoneList();
|
||||
getCityList();
|
||||
getCountryList();
|
||||
//setTestFields();
|
||||
setTestFields();
|
||||
}
|
||||
|
||||
@OnClick(R.id.registerButton)
|
||||
protected void onClick(){
|
||||
ViewHelper.hideKeyboard();
|
||||
if(checkFields())
|
||||
registerUser();
|
||||
@OnClick({R.id.cityPizzalinkDropdown, R.id.postcodePizzalinkDrowpdown,
|
||||
R.id.countryPizzalinkDropdown, R.id.zoneePizzalinkDropdown,
|
||||
R.id.registerButton})
|
||||
protected void onClick(View view){
|
||||
switch (view.getId()){
|
||||
case R.id.cityPizzalinkDropdown:
|
||||
showCityDialog();
|
||||
break;
|
||||
case R.id.countryPizzalinkDropdown:
|
||||
showCountryDialog();
|
||||
break;
|
||||
case R.id.zoneePizzalinkDropdown:
|
||||
if(selectedCountryModel != null){
|
||||
getZoneeList();
|
||||
}
|
||||
else {
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, selectCountryFirstText);
|
||||
}
|
||||
break;
|
||||
case R.id.registerButton:
|
||||
ViewHelper.hideKeyboard();
|
||||
if(checkFields())
|
||||
registerUser();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkFields(){
|
||||
@@ -107,9 +130,18 @@ public class RegisterActivity extends BaseActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(zonePizzalinkDropdown.isEmpty() ||
|
||||
if(cityPizzalinkDropdown.isEmpty() ||
|
||||
postcodePizzalinkDrowpdown.isEmpty() ||
|
||||
countryPizzalinkDropdown.isEmpty()){
|
||||
countryPizzalinkDropdown.isEmpty() ||
|
||||
zoneePizzalinkDropdown.isEmpty()){
|
||||
DialogHelper.showAlertDialog(this, fillAllFieldsText);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(selectedCityModel == null ||
|
||||
selectedCountryModel == null ||
|
||||
selectedZoneeModel == null){
|
||||
DialogHelper.showAlertDialog(this, fillAllFieldsText);
|
||||
return false;
|
||||
}
|
||||
@@ -117,15 +149,15 @@ public class RegisterActivity extends BaseActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void getZoneList(){
|
||||
private void getCityList(){
|
||||
|
||||
if(activeRequestCount == 0)
|
||||
DialogHelper.showLoadingDialog();
|
||||
|
||||
Call<ResponseArray<ZoneModel>> call = ApiService.apiInterface.getZoneList();
|
||||
call.enqueue(new Callback<ResponseArray<ZoneModel>>() {
|
||||
Call<ResponseArray<CityModel>> call = ApiService.apiInterface.getCityList();
|
||||
call.enqueue(new Callback<ResponseArray<CityModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseArray<ZoneModel>> call, Response<ResponseArray<ZoneModel>> response) {
|
||||
public void onResponse(Call<ResponseArray<CityModel>> call, Response<ResponseArray<CityModel>> response) {
|
||||
|
||||
decreaseActiveRequestCount();
|
||||
|
||||
@@ -135,7 +167,7 @@ public class RegisterActivity extends BaseActivity {
|
||||
if(response.isSuccessful() &&
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()){
|
||||
fillAndNotifyZoneList(response.body().getData());
|
||||
fillAndNotifyCityList(response.body().getData());
|
||||
}
|
||||
else if(activeRequestCount == 0){
|
||||
ApiErrorUtils.parseError(response);
|
||||
@@ -143,7 +175,7 @@ public class RegisterActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseArray<ZoneModel>> call, Throwable t) {
|
||||
public void onFailure(Call<ResponseArray<CityModel>> call, Throwable t) {
|
||||
decreaseActiveRequestCount();
|
||||
if(activeRequestCount == 0){
|
||||
DialogHelper.hideLoadingDialog();
|
||||
@@ -194,10 +226,35 @@ public class RegisterActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void fillAndNotifyZoneList(ArrayList<ZoneModel> zones){
|
||||
ZoneModel.checkNull(zones);
|
||||
zoneList.clear();
|
||||
zoneList.addAll(zones);
|
||||
private void getZoneeList(){
|
||||
DialogHelper.showLoadingDialog();
|
||||
Call<ResponseArray<ZoneeModel>> call = ApiService.apiInterface.getZoneeList(selectedCountryModel.getId());
|
||||
call.enqueue(new Callback<ResponseArray<ZoneeModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseArray<ZoneeModel>> call, Response<ResponseArray<ZoneeModel>> response) {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
if(response.isSuccessful() &&
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()){
|
||||
fillAndNotifyZoneeList(response.body().getData());
|
||||
}
|
||||
else {
|
||||
ApiErrorUtils.parseError(response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseArray<ZoneeModel>> call, Throwable t) {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
DialogHelper.showFailedDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fillAndNotifyCityList(ArrayList<CityModel> cities){
|
||||
CityModel.checkNull(cities);
|
||||
cityList.clear();
|
||||
cityList.addAll(cities);
|
||||
}
|
||||
|
||||
private void fillAndNotifyCountryList(ArrayList<CountryModel> countries){
|
||||
@@ -206,6 +263,13 @@ public class RegisterActivity extends BaseActivity {
|
||||
countryList.addAll(countries);
|
||||
}
|
||||
|
||||
private void fillAndNotifyZoneeList(ArrayList<ZoneeModel> zonees){
|
||||
ZoneeModel.checkNull(zonees);
|
||||
zoneeList.clear();
|
||||
zoneeList.addAll(zonees);
|
||||
showZoneeDialog();
|
||||
}
|
||||
|
||||
private void registerUser(){
|
||||
DialogHelper.showLoadingDialog();
|
||||
Call<ResponseObject<UserModel>> call = ApiService.apiInterface.register(getRegisterParams());
|
||||
@@ -245,34 +309,26 @@ public class RegisterActivity extends BaseActivity {
|
||||
params.put("password1", pizzalinkEditTextList.get(5).getText());
|
||||
params.put("address_1", pizzalinkEditTextList.get(6).getText());
|
||||
params.put("address_2", "");
|
||||
params.put("city", pizzalinkEditTextList.get(7).getText());
|
||||
params.put("postcode", postcodePizzalinkDrowpdown.getText());
|
||||
params.put("zone_id", selectedZoneModel.getStoreId());
|
||||
params.put("city", selectedCityModel.getCity());
|
||||
params.put("postcode", selectedCityModel.getPostcode());
|
||||
params.put("country_id", selectedCountryModel.getId());
|
||||
params.put("zone_id", selectedZoneeModel.getZoneId());
|
||||
return params;
|
||||
}
|
||||
|
||||
private void onZoneDropdownClicked(View view){
|
||||
Log.i("vdknvkd", "vıjıwf");
|
||||
}
|
||||
|
||||
private void onCountryDropdownClicked(View view){
|
||||
Log.i("vdknvkd", "vıjıwf");
|
||||
}
|
||||
|
||||
private void showZoneDialog(){
|
||||
private void showCityDialog(){
|
||||
|
||||
final ArrayList<String> zoneNameList = new ArrayList<>();
|
||||
for(ZoneModel zone : zoneList){
|
||||
for(CityModel zone : cityList){
|
||||
zoneNameList.add(zone.getCity());
|
||||
}
|
||||
|
||||
DialogHelper.showListDialog(zoneNameList, new MaterialDialog.ListCallback() {
|
||||
@Override
|
||||
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
|
||||
selectedZoneModel = zoneList.get(position);
|
||||
zonePizzalinkDropdown.setText(selectedZoneModel.getCity());
|
||||
postcodePizzalinkDrowpdown.setText(selectedZoneModel.getPostcode());
|
||||
selectedCityModel = cityList.get(position);
|
||||
cityPizzalinkDropdown.setText(selectedCityModel.getCity());
|
||||
postcodePizzalinkDrowpdown.setText(selectedCityModel.getPostcode());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -293,16 +349,31 @@ public class RegisterActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void showZoneeDialog(){
|
||||
|
||||
final ArrayList<String> zoneeNameList = new ArrayList<>();
|
||||
for(ZoneeModel zonee : zoneeList){
|
||||
zoneeNameList.add(zonee.getName());
|
||||
}
|
||||
|
||||
DialogHelper.showListDialog(zoneeNameList, new MaterialDialog.ListCallback() {
|
||||
@Override
|
||||
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
|
||||
selectedZoneeModel = zoneeList.get(position);
|
||||
zoneePizzalinkDropdown.setText(selectedZoneeModel.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setTestFields(){
|
||||
pizzalinkEditTextList.get(0).getEditText().setText("testname");
|
||||
pizzalinkEditTextList.get(1).getEditText().setText("testsurname");
|
||||
pizzalinkEditTextList.get(2).getEditText().setText("1234567890");
|
||||
pizzalinkEditTextList.get(3).getEditText().setText("test3@test.com");
|
||||
pizzalinkEditTextList.get(2).getEditText().setText("1234567891");
|
||||
pizzalinkEditTextList.get(3).getEditText().setText("test4@test.com");
|
||||
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");
|
||||
postcodePizzalinkDrowpdown.setText("1234");
|
||||
//postcodePizzalinkDrowpdown.setText("1234");
|
||||
}
|
||||
|
||||
private synchronized void increaseActiveRequestCount(){
|
||||
|
||||
@@ -21,8 +21,9 @@ public class ApiEndPoints {
|
||||
public static final String API_CREATE_ORDER = PREFIX + "addOrder2" + SUFFIX + "&token=";
|
||||
public static final String API_CHECK_UPDATE = PREFIX + "checkUpdate" + SUFFIX;
|
||||
public static final String API_FORGOT_PASSWORD = PREFIX + "forgotPassword" + SUFFIX;
|
||||
public static final String API_GET_ZONE_LIST = PREFIX + "getCities" + SUFFIX;
|
||||
public static final String API_GET_CITY_LIST = PREFIX + "getCities" + SUFFIX;
|
||||
public static final String API_GET_COUNTRY_LIST = PREFIX + "getCountries" + SUFFIX;
|
||||
public static final String API_GET_ZONE_LIST = PREFIX + "getZones" + SUFFIX;
|
||||
public static final String API_GET_CUSTOMER_PROFILE = PREFIX + "getCustomerInfo" + SUFFIX;
|
||||
public static final String API_UPDATE_PASSWORD = PREFIX + "passwordUpdate" + SUFFIX + "&token=";
|
||||
public static final String API_DELETE_ADDRESS = PREFIX + "deleteAddress" + SUFFIX + "&token=";
|
||||
|
||||
@@ -7,13 +7,12 @@ import ch.pizzalink.android.model.AddressModel;
|
||||
import ch.pizzalink.android.model.AppVersionModel;
|
||||
import ch.pizzalink.android.model.CountryModel;
|
||||
import ch.pizzalink.android.model.DeleteAddressResponseModel;
|
||||
import ch.pizzalink.android.model.PaymentMethodModel;
|
||||
import ch.pizzalink.android.model.PaymentMethodsResponseModel;
|
||||
import ch.pizzalink.android.model.RemoveProductFromCartResponseModel;
|
||||
import ch.pizzalink.android.model.ShippingMethodModel;
|
||||
import ch.pizzalink.android.model.ShippingMethodsResponseModel;
|
||||
import ch.pizzalink.android.model.StoreInfoModel;
|
||||
import ch.pizzalink.android.model.ZoneModel;
|
||||
import ch.pizzalink.android.model.CityModel;
|
||||
import ch.pizzalink.android.model.ZoneeModel;
|
||||
import ch.pizzalink.android.model.cart.CartInfoModel;
|
||||
import ch.pizzalink.android.model.CategoryModel;
|
||||
import ch.pizzalink.android.model.OrderModel;
|
||||
@@ -109,12 +108,16 @@ public interface ApiInterface {
|
||||
@POST(ApiEndPoints.API_FORGOT_PASSWORD)
|
||||
Call<ResponseObject> forgotPassword(@Field("email") String emailAddress);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_ZONE_LIST)
|
||||
Call<ResponseArray<ZoneModel>> getZoneList();
|
||||
@GET(ApiEndPoints.API_GET_CITY_LIST)
|
||||
Call<ResponseArray<CityModel>> getCityList();
|
||||
|
||||
@GET(ApiEndPoints.API_GET_COUNTRY_LIST)
|
||||
Call<ResponseArray<CountryModel>> getCountryList();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_GET_ZONE_LIST)
|
||||
Call<ResponseArray<ZoneeModel>> getZoneeList(@Field("country_id") String countryId);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_CUSTOMER_PROFILE)
|
||||
Call<ResponseObject<UserModel>> getCustomerProfile(@Query("token") String token);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ch.pizzalink.android.helper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import ch.pizzalink.android.activity.BaseActivity;
|
||||
@@ -21,8 +23,12 @@ public class ViewHelper {
|
||||
}
|
||||
|
||||
public static void hideKeyboard() {
|
||||
InputMethodManager imm = (InputMethodManager) BaseActivity.currentActivity.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0); // hide
|
||||
View view = BaseActivity.currentActivity.getCurrentFocus();
|
||||
if (view != null) {
|
||||
InputMethodManager imm = (InputMethodManager) BaseActivity.currentActivity.
|
||||
getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showKeyboard() {
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.ArrayList;
|
||||
* Created by cimenmus on 23.10.2017.
|
||||
*/
|
||||
|
||||
public class ZoneModel {
|
||||
public class CityModel {
|
||||
|
||||
@Expose @SerializedName("shipping_point_id") private String shippingPointId;
|
||||
@Expose @SerializedName("store_id") private String storeId;
|
||||
@@ -47,9 +47,9 @@ public class ZoneModel {
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNull(ArrayList<ZoneModel> cityList){
|
||||
for (ZoneModel zoneModel : cityList){
|
||||
zoneModel.checkNull();
|
||||
public static void checkNull(ArrayList<CityModel> cityList){
|
||||
for (CityModel cityModel : cityList){
|
||||
cityModel.checkNull();
|
||||
}
|
||||
}
|
||||
|
||||
89
app/src/main/java/ch/pizzalink/android/model/ZoneeModel.java
Normal file
89
app/src/main/java/ch/pizzalink/android/model/ZoneeModel.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package ch.pizzalink.android.model;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by cimenmus on 26.10.2017.
|
||||
*/
|
||||
|
||||
public class ZoneeModel {
|
||||
|
||||
@Expose @SerializedName("zone_id") private String zoneId;
|
||||
@Expose @SerializedName("country_id") private String countryId;
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
private String status;
|
||||
|
||||
private void checkNull(){
|
||||
|
||||
if(zoneId == null){
|
||||
zoneId = "";
|
||||
}
|
||||
|
||||
if(countryId == null){
|
||||
countryId = "";
|
||||
}
|
||||
|
||||
if(name == null){
|
||||
name = "";
|
||||
}
|
||||
|
||||
if(code == null){
|
||||
code = "";
|
||||
}
|
||||
|
||||
if(status == null){
|
||||
status = "";
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNull(ArrayList<ZoneeModel> zoneeList){
|
||||
for(ZoneeModel zoneeModel : zoneeList){
|
||||
zoneeModel.checkNull();
|
||||
}
|
||||
}
|
||||
|
||||
public String getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getCountryId() {
|
||||
return countryId;
|
||||
}
|
||||
|
||||
public void setCountryId(String countryId) {
|
||||
this.countryId = countryId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package ch.pizzalink.android.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import ch.pizzalink.android.R;
|
||||
|
||||
/**
|
||||
* Created by cimenmus on 26.10.2017.
|
||||
*/
|
||||
|
||||
public class PizzalinkDropdownView extends LinearLayout {
|
||||
|
||||
private View rootView;
|
||||
private TextView hintTextView;
|
||||
private TextView textview;
|
||||
private String hint;
|
||||
|
||||
public PizzalinkDropdownView(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public PizzalinkDropdownView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.PizzalinkDropdownView, 0, 0);
|
||||
try {
|
||||
hint = a.getString(R.styleable.PizzalinkDropdownView_dropdownHintView);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
rootView = (View) inflate(context, R.layout.layout_pizzalink_drowdown_view, this);
|
||||
hintTextView = (TextView) rootView.findViewById(R.id.hintTextView);
|
||||
textview = (TextView) rootView.findViewById(R.id.textview);
|
||||
hintTextView.setText(hint);
|
||||
}
|
||||
|
||||
public boolean isEmpty(){
|
||||
return hintTextView.getText().toString().isEmpty();
|
||||
}
|
||||
|
||||
public String getText(){
|
||||
return hintTextView.getText().toString();
|
||||
}
|
||||
|
||||
public void setText(String text){
|
||||
textview.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -81,32 +81,29 @@
|
||||
app:inputType="address"
|
||||
app:hint="@string/addres_line_1"/>
|
||||
|
||||
<ch.pizzalink.android.view.PizzalinkEditText
|
||||
android:id="@+id/cityPizzalinkEditText"
|
||||
<ch.pizzalink.android.view.PizzalinkDropdownView
|
||||
android:id="@+id/cityPizzalinkDropdown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:inputType="address"
|
||||
app:hint="@string/city"/>
|
||||
app:dropdownHintView="@string/city"/>
|
||||
|
||||
<ch.pizzalink.android.view.PizzalinkDropdown
|
||||
android:id="@+id/zonePizzalinkDropdown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:dropdownHint="@string/zone"
|
||||
android:onClick="onZoneDropdownClicked"/>
|
||||
|
||||
<ch.pizzalink.android.view.PizzalinkDropdown
|
||||
<ch.pizzalink.android.view.PizzalinkDropdownView
|
||||
android:id="@+id/postcodePizzalinkDrowpdown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:dropdownHint="@string/postcode"/>
|
||||
app:dropdownHintView="@string/postcode"/>
|
||||
|
||||
<ch.pizzalink.android.view.PizzalinkDropdown
|
||||
<ch.pizzalink.android.view.PizzalinkDropdownView
|
||||
android:id="@+id/countryPizzalinkDropdown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:dropdownHint="@string/country"
|
||||
android:onClick="onCountryDropdownClicked"/>
|
||||
app:dropdownHintView="@string/country"/>
|
||||
|
||||
<ch.pizzalink.android.view.PizzalinkDropdownView
|
||||
android:id="@+id/zoneePizzalinkDropdown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:dropdownHintView="@string/zone"/>
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingRight="24dp"
|
||||
|
||||
43
app/src/main/res/layout/layout_pizzalink_drowdown_view.xml
Normal file
43
app/src/main/res/layout/layout_pizzalink_drowdown_view.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingEnd="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hintTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/venus"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="4dp"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:textColorHint="@color/row_product_ingredients_background"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/row_product_ingredients_background"
|
||||
android:layout_marginTop="2dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -28,4 +28,8 @@
|
||||
<attr name="infoText" format="string" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PizzalinkDropdownView">
|
||||
<attr name="dropdownHintView" format="string" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -62,6 +62,7 @@
|
||||
<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="alert_select_country_first">Lütfen önce ülke seçimini yapınız.</string>
|
||||
<string name="button_register">KAYIT OL</string>
|
||||
<!-- RegisterActivity-->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user