Skip to content

Commit

Permalink
Redesign: Signup page
Browse files Browse the repository at this point in the history
  • Loading branch information
rchtgpt committed Aug 10, 2023
1 parent 59f53d3 commit c573334
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ public class SignupActivity extends BaseActivity implements RegistrationContract
SignupPresenter mPresenter;

RegistrationContract.SignupPresenter mSignupPresenter;
@BindView(R.id.et_first_name)
TextInputEditText mEtFirstName;
@BindView(R.id.et_last_name)
TextInputEditText mEtLastName;
@BindView(R.id.et_email)
TextInputEditText mEtEmail;
@BindView(R.id.et_business_shop_name)
TextInputEditText mEtBusinessShopName;
@BindView(R.id.et_business_shop_layout)
TextInputLayout mEtBusinessShopLayout;
@BindView(R.id.et_address_line_1)
TextInputEditText mEtAddressLine1;
@BindView(R.id.et_address_line_2)
TextInputEditText mEtAddressLine2;
@BindView(R.id.et_pin_code)
TextInputEditText mEtPinCode;
@BindView(R.id.et_state)
TextInputEditText mEtCity;
// @BindView(R.id.et_first_name)
// TextInputEditText mEtFirstName;
// @BindView(R.id.et_last_name)
// TextInputEditText mEtLastName;
// @BindView(R.id.et_email)
// TextInputEditText mEtEmail;
// @BindView(R.id.et_business_shop_name)
// TextInputEditText mEtBusinessShopName;
// @BindView(R.id.et_business_shop_layout)
// TextInputLayout mEtBusinessShopLayout;
// @BindView(R.id.et_address_line_1)
// TextInputEditText mEtAddressLine1;
// @BindView(R.id.et_address_line_2)
// TextInputEditText mEtAddressLine2;
// @BindView(R.id.et_pin_code)
// TextInputEditText mEtPinCode;
// @BindView(R.id.et_state)
// TextInputEditText mEtCity;
@BindView(R.id.fab_next)
FloatingActionButton mFabNext;

Expand Down Expand Up @@ -101,12 +101,12 @@ protected void onCreate(Bundle savedInstanceState) {
setToolbarTitle("Registration");

mifosSavingProductId = getIntent().getIntExtra(Constants.MIFOS_SAVINGS_PRODUCT_ID, 0);
if (mifosSavingProductId
== org.mifos.mobilewallet.core.utils.Constants.MIFOS_MERCHANT_SAVINGS_PRODUCT_ID) {
mEtBusinessShopLayout.setVisibility(View.VISIBLE);
} else {
mEtBusinessShopLayout.setVisibility(View.GONE);
}
// if (mifosSavingProductId
// == org.mifos.mobilewallet.core.utils.Constants.MIFOS_MERCHANT_SAVINGS_PRODUCT_ID) {
// mEtBusinessShopLayout.setVisibility(View.VISIBLE);
// } else {
// mEtBusinessShopLayout.setVisibility(View.GONE);
// }
mobileNumber = getIntent().getStringExtra(Constants.MOBILE_NUMBER);
countryName = getIntent().getStringExtra(Constants.COUNTRY);

Expand All @@ -116,19 +116,19 @@ protected void onCreate(Bundle savedInstanceState) {
String lastName = getIntent().getStringExtra(Constants.GOOGLE_FAMILY_NAME);
Uri photoUri = getIntent().getParcelableExtra(Constants.GOOGLE_PHOTO_URI);

if (displayName != null) {
mEtBusinessShopName.setText(displayName);
}
if (email != null) {
mEtEmail.setText(email);
mEtUserName.setText(email.substring(0, email.indexOf('@')));
}
if (firstName != null) {
mEtFirstName.setText(firstName);
}
if (lastName != null) {
mEtLastName.setText(lastName);
}
// if (displayName != null) {
// mEtBusinessShopName.setText(displayName);
// }
// if (email != null) {
// mEtEmail.setText(email);
// mEtUserName.setText(email.substring(0, email.indexOf('@')));
// }
// if (firstName != null) {
// mEtFirstName.setText(firstName);
// }
// if (lastName != null) {
// mEtLastName.setText(lastName);
// }

mEtPassword.addTextChangedListener(new TextWatcher() {
@Override
Expand Down Expand Up @@ -179,19 +179,19 @@ private void initSearchableStateSpinner() {
spinnerDialog = new SpinnerDialog(SignupActivity.this, statesList,
"Select or Search State", R.style.DialogAnimations_SmileWindow, "Close");

spinnerDialog.bindOnSpinerListener(new OnSpinerItemClick() {
@Override
public void onClick(String item, int position) {
mEtCity.setText(item);
}
});
// spinnerDialog.bindOnSpinerListener(new OnSpinerItemClick() {
// @Override
// public void onClick(String item, int position) {
// mEtCity.setText(item);
// }
// });

mEtCity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
spinnerDialog.showSpinerDialog();
}
});
// mEtCity.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// spinnerDialog.showSpinerDialog();
// }
// });

hideProgressDialog();

Expand All @@ -205,58 +205,58 @@ public void setPresenter(RegistrationContract.SignupPresenter presenter) {
mSignupPresenter = presenter;
}

@OnClick(R.id.fab_next)
public void onNextClicked() {
showProgressDialog(Constants.PLEASE_WAIT);

if (mifosSavingProductId
== org.mifos.mobilewallet.core.utils.Constants.MIFOS_MERCHANT_SAVINGS_PRODUCT_ID
&& isEmpty(mEtBusinessShopName)) {
Toaster.showToast(this, "All fields are mandatory");
hideProgressDialog();
return;
}
if (isEmpty(mEtFirstName) || isEmpty(mEtLastName) || isEmpty(mEtEmail)
|| isEmpty(mEtAddressLine1) || isEmpty(mEtAddressLine2)
|| isEmpty(mEtPinCode) || isEmpty(mEtCity) || isEmpty(mEtUserName) || isEmpty(
mEtPassword) || isEmpty(mEtConfirmPassword)) {
Toaster.showToast(this, "All fields are mandatory");
hideProgressDialog();
return;
}
if (mEtPassword.getText().toString().length() < 6) {
showToast("Password should contain more than 6 characters");
return;
}

String firstName = mEtFirstName.getText().toString().trim();
String lastName = mEtLastName.getText().toString().trim();
String email = mEtEmail.getText().toString().trim();
String businessName = mEtBusinessShopName.getText().toString().trim();
String addressline1 = mEtAddressLine1.getText().toString().trim();
String addressline2 = mEtAddressLine2.getText().toString().trim();
String pincode = mEtPinCode.getText().toString().trim();
String city = mEtCity.getText().toString().trim();
String username = mEtUserName.getText().toString().trim();
String password = mEtPassword.getText().toString();
String confirmPassword = mEtConfirmPassword.getText().toString();

if (!ValidateUtil.INSTANCE.isValidEmail(email)) {
Snackbar.make(container, R.string.validate_email, Snackbar.LENGTH_SHORT).show();
hideProgressDialog();
return;
}

if (!password.equals(confirmPassword)) {
Toaster.showToast(this, "Password is not same as Confirm Password");
hideProgressDialog();
return;
}

mSignupPresenter.registerUser(firstName, lastName, mobileNumber, email, businessName,
addressline1, addressline2, pincode, city, countryName, username, password, stateId,
countryId, mifosSavingProductId);
}
// @OnClick(R.id.fab_next)
// public void onNextClicked() {
// showProgressDialog(Constants.PLEASE_WAIT);
//
// if (mifosSavingProductId
// == org.mifos.mobilewallet.core.utils.Constants.MIFOS_MERCHANT_SAVINGS_PRODUCT_ID
// && isEmpty(mEtBusinessShopName)) {
// Toaster.showToast(this, "All fields are mandatory");
// hideProgressDialog();
// return;
// }
// if (isEmpty(mEtFirstName) || isEmpty(mEtLastName) || isEmpty(mEtEmail)
// || isEmpty(mEtAddressLine1) || isEmpty(mEtAddressLine2)
// || isEmpty(mEtPinCode) || isEmpty(mEtCity) || isEmpty(mEtUserName) || isEmpty(
// mEtPassword) || isEmpty(mEtConfirmPassword)) {
// Toaster.showToast(this, "All fields are mandatory");
// hideProgressDialog();
// return;
// }
// if (mEtPassword.getText().toString().length() < 6) {
// showToast("Password should contain more than 6 characters");
// return;
// }
//
// String firstName = mEtFirstName.getText().toString().trim();
// String lastName = mEtLastName.getText().toString().trim();
// String email = mEtEmail.getText().toString().trim();
// String businessName = mEtBusinessShopName.getText().toString().trim();
// String addressline1 = mEtAddressLine1.getText().toString().trim();
// String addressline2 = mEtAddressLine2.getText().toString().trim();
// String pincode = mEtPinCode.getText().toString().trim();
// String city = mEtCity.getText().toString().trim();
// String username = mEtUserName.getText().toString().trim();
// String password = mEtPassword.getText().toString();
// String confirmPassword = mEtConfirmPassword.getText().toString();
//
// if (!ValidateUtil.INSTANCE.isValidEmail(email)) {
// Snackbar.make(container, R.string.validate_email, Snackbar.LENGTH_SHORT).show();
// hideProgressDialog();
// return;
// }
//
// if (!password.equals(confirmPassword)) {
// Toaster.showToast(this, "Password is not same as Confirm Password");
// hideProgressDialog();
// return;
// }
//
// mSignupPresenter.registerUser(firstName, lastName, mobileNumber, email, businessName,
// addressline1, addressline2, pincode, city, countryName, username, password, stateId,
// countryId, mifosSavingProductId);
// }

@Override
public void onRegisterSuccess(String s) {
Expand Down
41 changes: 38 additions & 3 deletions mifospay/src/main/res/layout/activity_signup.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/register_screen"
android:id="@+id/rr_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
Expand Down Expand Up @@ -66,7 +66,7 @@
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:id="@+id/til_vpa"
android:id="@+id/til_user_name"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -76,7 +76,7 @@
app:layout_constraintStart_toStartOf="parent">

<android.support.design.widget.TextInputEditText
android:id="@+id/et_vpa"
android:id="@+id/et_user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto"
Expand Down Expand Up @@ -123,6 +123,41 @@
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

<ProgressBar
android:layout_width="match_parent"
android:id="@+id/pb_password_strength"
android:visibility="gone"
style="?android:attr/progressBarStyleHorizontal"
android:padding="@dimen/value_8dp"
android:layout_height="match_parent" />
<TextView
android:layout_width="match_parent"
android:id="@+id/tv_password_strength"
android:gravity="center"
android:visibility="gone"
android:layout_marginBottom="@dimen/value_8dp"
android:layout_height="wrap_content" />

<android.support.design.widget.TextInputLayout
android:id="@+id/til_confirm_password"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/marginItemsInSectionLarge"
app:layout_constraintBottom_toTopOf="@+id/btn_login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:passwordToggleEnabled="true">

<android.support.design.widget.TextInputEditText
android:id="@+id/et_confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto"
android:hint="@string/confirm_password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

<Button
android:id="@+id/btn_register"
android:layout_width="match_parent"
Expand Down

0 comments on commit c573334

Please sign in to comment.