Browse Source

Recipient view fixes

master
preyearegmi 6 years ago
parent
commit
bf5b6760b0
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 10
      .idea/inspectionProfiles/Project_Default.xml
  3. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/view/ExchangeMethodV2Activity.java
  4. 6
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV2/adapter/RecipientListingRvAdapter.java
  5. 126
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV2/presenter/recipientadd/RecipientAddV2Presenter.java
  6. 18
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV2/presenter/recipientadd/RecipientAddV2PresenterInterface.java
  7. 64
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV2/view/recipientadd/RecipientAddV2Activity.java
  8. 80
      app/src/main/res/layout/activity_recipient_v2.xml
  9. 2
      app/src/main/res/layout/fragment_kyc_view1_v2.xml

BIN
.idea/caches/build_file_checksums.ser

10
.idea/inspectionProfiles/Project_Default.xml

@ -0,0 +1,10 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="UnusedAssignment" enabled="false" level="WARNING" enabled_by_default="false">
<option name="REPORT_PREFIX_EXPRESSIONS" value="false" />
<option name="REPORT_POSTFIX_EXPRESSIONS" value="true" />
<option name="REPORT_REDUNDANT_INITIALIZER" value="true" />
</inspection_tool>
</profile>
</component>

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/view/ExchangeMethodV2Activity.java

@ -208,7 +208,6 @@ public class ExchangeMethodV2Activity extends BaseActivity implements PaymentMod
public boolean dispatchTouchEvent(MotionEvent ev) {
if(sendMoneyEditText.hasFocus()||recieveMoneyEditText.hasFocus())
{
View currentViewWithFocus=getCurrentFocus();
if(currentViewWithFocus!=null)
currentViewWithFocus.clearFocus();

6
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV2/adapter/RecipientListingRvAdapter.java

@ -49,8 +49,10 @@ public class RecipientListingRvAdapter extends RecyclerView.Adapter<RecipientLis
return true;
}
});
String middlName=recipientInfo.getMiddleName()==null||recipientInfo.getMiddleName().equalsIgnoreCase(" ")?"":recipientInfo.getMiddleName()+" ";
holder.setUserName(recipientInfo.getFirstName()+" "+middlName+recipientInfo.getLastName());
// String middlName=recipientInfo.getMiddleName()==null||recipientInfo.getMiddleName().equalsIgnoreCase(" ")?"":recipientInfo.getMiddleName()+" ";
// holder.setUserName(recipientInfo.getFirstName()+" "+middlName+recipientInfo.getLastName());
holder.setUserName(recipientInfo.getFirstName());
holder.setUserInitial(Utils.capitalizeFirstLetterFromWord(recipientInfo.getFirstName())+Utils.capitalizeFirstLetterFromWord(recipientInfo.getLastName()));
}

126
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV2/presenter/recipientadd/RecipientAddV2Presenter.java

@ -51,14 +51,16 @@ public class RecipientAddV2Presenter extends BasePresenter implements RecipientA
public void addRecipient(String firstName, String middleName, String lastName, CountryDetailModel selectedCountry,
ProvinceDetailModel selectedProvince, DistrictDetailModel selectedDistrict,
String address, RelationDetailModel selectedRelation, String mobileNo, String email, TransferDetailModel selectedTransfer, String selectedRecipientId) {
if (checkStringNotEmpty(firstName) &&
checkStringNotEmpty(lastName) &&
checkStringNotEmpty(address) &&
// Utils.isValidEmail(email)&&
checkStringNotEmpty(mobileNo) &&
validateLocation(selectedCountry, selectedProvince, selectedDistrict) &&
selectedRelation != null && selectedTransfer != null) {
// if (checkStringNotEmpty(firstName) &&
//// checkStringNotEmpty(lastName) &&
// checkStringNotEmpty(address) &&
//// Utils.isValidEmail(email)&&
// checkStringNotEmpty(mobileNo) &&
// validateLocation(selectedCountry, selectedProvince, selectedDistrict) &&
// selectedRelation != null && selectedTransfer != null) {
if(validateData(firstName,middleName,lastName,selectedCountry,selectedProvince,selectedDistrict,address,selectedRelation,mobileNo,email,selectedTransfer))
{
this.compositeDisposable.add(this.gateway.addRecipientAndSendToServer(gateway.getAuth(),
gateway.getUserID(),
firstName, middleName, lastName,
@ -77,11 +79,86 @@ public class RecipientAddV2Presenter extends BasePresenter implements RecipientA
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new AddRecipientObserver())
);
} else
this.view.showToastMessage("Please fill up all required details correctly.");
}
private boolean validateData(String firstName, String middleName, String lastName, CountryDetailModel selectedCountry,
ProvinceDetailModel selectedProvince, DistrictDetailModel selectedDistrict,
String address, RelationDetailModel selectedRelation, String mobileNo, String email, TransferDetailModel selectedTransfer)
{
boolean isValid= true;
if(!validateFirstName(firstName))
isValid=false;
if(!validateAddress(address))
isValid=false;
if(!validateMobile(mobileNo))
isValid=false;
if(!validateLocation(selectedCountry,selectedProvince,selectedDistrict))
isValid=false;
if(!validatRelation(selectedRelation))
isValid=false;
if(!validatTransfer(selectedTransfer))
isValid=false;
return isValid;
}
private boolean validateFirstName(String firstName)
{
if(!checkStringNotEmpty(firstName))
{
view.setErrorOnFirstName("Name cannot be empty");
return false;
}
view.setErrorOnFirstName(null);
return true;
}
private boolean validateAddress(String address)
{
if(!checkStringNotEmpty(address))
{
view.setErrorOnAddress("Address cannot be empty");
return false;
}
view.setErrorOnAddress(null);
return true;
}
private boolean validateMobile(String mobile)
{
if(!checkStringNotEmpty(mobile))
{
view.setErrorOnMobileNumber("Mobile number cannot be empty");
return false;
}
view.setErrorOnMobileNumber(null);
return true;
}
private boolean validatRelation(RelationDetailModel selectedRelation)
{
if(selectedRelation==null)
{
view.setErrorOnRelation("Please select a relation");
return false;
}
view.setErrorOnRelation(null);
return true;
}
private boolean validatTransfer(TransferDetailModel selectedTransferReason)
{
if(selectedTransferReason==null)
{
view.setErrorOnTransferReason("Please select a transfer reason");
return false;
}
view.setErrorOnTransferReason(null);
return true;
}
@Override
@ -100,14 +177,35 @@ public class RecipientAddV2Presenter extends BasePresenter implements RecipientA
private boolean validateLocation(CountryDetailModel country, ProvinceDetailModel province, DistrictDetailModel district) {
if (country != null) {
view.setErrorOnCountry(null);
if (country.getIsProvienceReq().equalsIgnoreCase(Constants.TRUE_STRING)) {
if (province == null || district == null) {
return false;
} else
return true;
} else
boolean hasState;
boolean hasDistrict;
if (province != null ) {
view.setErrorOnProvince(null);
hasState=true;
} else {
view.setErrorOnProvince("Please select a state/province");
hasState= false;
}
if(district!=null) {
view.setErrorOnDistrict(null);
hasDistrict= true;
}
else
{
view.setErrorOnDistrict("Please select a district");
hasDistrict= false;
}
return hasState&&hasDistrict;
} else {
view.setErrorOnProvince(null);
view.setErrorOnDistrict(null);
return true;
}
} else {
view.setErrorOnCountry("Please select a country");
return false;
}
}

18
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV2/presenter/recipientadd/RecipientAddV2PresenterInterface.java

@ -34,5 +34,21 @@ public interface RecipientAddV2PresenterInterface extends BasePresenterInterface
TransferDetailModel selectedTransfer);
void returnToCallingActivityForSucess();
}
void setErrorOnFirstName(String message);
void setErrorOnCountry(String message);
void setErrorOnProvince(String message);
void setErrorOnTransferReason(String message);
void setErrorOnRelation(String message);
void setErrorOnMobileNumber(String message);
void setErrorOnAddress(String message);
void setErrorOnDistrict(String message);
}
}

64
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV2/view/recipientadd/RecipientAddV2Activity.java

@ -3,6 +3,7 @@ package com.gmeremit.online.gmeremittance_native.recipientV2.view.recipientadd;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TextInputLayout;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@ -67,6 +68,29 @@ public class RecipientAddV2Activity extends BaseActivity implements View.OnClick
@BindView(R.id.ed_transfer)
EditText ed_transfer;
@BindView(R.id.firstnameWrapper)
TextInputLayout firstnameWrapper;
@BindView(R.id.middlenameWrapper)
TextInputLayout middlenameWrapper;
@BindView(R.id.lastnameWrapper)
TextInputLayout lastnameWrapper;
@BindView(R.id.countryWrapper)
TextInputLayout countryWrapper;
@BindView(R.id.provinceWrapper)
TextInputLayout provinceWrapper;
@BindView(R.id.districtWrapper)
TextInputLayout districtWrapper;
@BindView(R.id.addressWrapper)
TextInputLayout addressWrapper;
@BindView(R.id.relationWrapper)
TextInputLayout relationWrapper;
@BindView(R.id.mobileWrapper)
TextInputLayout mobileWrapper;
@BindView(R.id.emailWrapper)
TextInputLayout emailWrapper;
@BindView(R.id.transferWrapper)
TextInputLayout transferWrapper;
@BindView(R.id.countryViewContainer)
ViewGroup countryViewContainer;
@BindView(R.id.provinceViewContainer)
@ -374,6 +398,46 @@ public class RecipientAddV2Activity extends BaseActivity implements View.OnClick
finish();
}
@Override
public void setErrorOnFirstName(String message) {
firstnameWrapper.setError(message);
}
@Override
public void setErrorOnCountry(String message) {
countryWrapper.setError(message);
}
@Override
public void setErrorOnProvince(String message) {
provinceWrapper.setError(message);
}
@Override
public void setErrorOnTransferReason(String message) {
transferWrapper.setError(message);
}
@Override
public void setErrorOnRelation(String message) {
relationWrapper.setError(message);
}
@Override
public void setErrorOnMobileNumber(String message) {
mobileWrapper.setError(message);
}
@Override
public void setErrorOnAddress(String message) {
addressWrapper.setError(message);
}
@Override
public void setErrorOnDistrict(String message) {
districtWrapper.setError(message);
}
@Override
public void onProvinceSelected(ProvinceDetailModel provinceDetailModel) {
this.selectedProvince = provinceDetailModel;

80
app/src/main/res/layout/activity_recipient_v2.xml

@ -3,11 +3,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context="com.gmeremit.online.gmeremittance_native.recipient.view.NewRecipientActivity">
<include layout="@layout/layout_sendmoney_toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -23,7 +26,8 @@
android:layout_height="60dp"
android:background="#e7edf2"
android:gravity="center"
android:padding="10dp"
android:paddingTop="9dp"
android:paddingBottom="10dp"
android:text="Who are you sending money to?"
android:textColor="@color/darkgray"
android:textSize="18sp" />
@ -33,15 +37,19 @@
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:padding="10dp">
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingStart="10dp"
android:paddingEnd="10dp">
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/firstnameWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First Name"
android:hint="Full Name"
android:textColorHint="@color/darkgray">
<com.gmeremit.online.gmeremittance_native.customwidgets.GmeEditText
@ -53,6 +61,7 @@
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:visibility="gone"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/middlenameWrapper"
@ -70,6 +79,7 @@
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:visibility="gone"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/lastnameWrapper"
@ -87,6 +97,8 @@
</android.support.design.widget.TextInputLayout>
<FrameLayout
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/countryViewContainer"
@ -95,6 +107,7 @@
android:orientation="horizontal"
>
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:id="@+id/countryWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -106,20 +119,28 @@
style="@style/editetxtsingleline"
android:enabled="true"
android:focusable="false"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
android:layout_width="match_parent"
android:singleLine="false"
android:layout_height="wrap_content"
/>
</android.support.design.widget.TextInputLayout>
<ImageView
android:layout_marginRight="12dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="8dp"
android:layout_gravity="center_vertical|end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_arrow_down"/>
android:background="@drawable/ic_arrow_down"
android:layout_marginEnd="5dp" />
</FrameLayout>
<FrameLayout
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/provinceViewContainer"
@ -130,6 +151,7 @@
android:visibility="gone"
>
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:id="@+id/provinceWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -142,20 +164,26 @@
android:focusable="false"
android:clickable="false"
android:singleLine="false"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.design.widget.TextInputLayout>
<ImageView
android:layout_marginRight="12dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="8dp"
android:layout_gravity="center_vertical|end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_arrow_down"/>
android:background="@drawable/ic_arrow_down"
android:layout_marginEnd="5dp" />
</FrameLayout>
<FrameLayout
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/districtViewContainer"
@ -165,6 +193,7 @@
android:visibility="gone"
>
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:id="@+id/districtWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -179,18 +208,23 @@
android:singleLine="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
/>
</android.support.design.widget.TextInputLayout>
<ImageView
android:layout_marginRight="12dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="8dp"
android:layout_gravity="center_vertical|end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_arrow_down"/>
android:background="@drawable/ic_arrow_down"
android:layout_marginEnd="5dp" />
</FrameLayout>
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/addressWrapper"
@ -208,6 +242,8 @@
</android.support.design.widget.TextInputLayout>
<FrameLayout
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/relationViewContainer"
@ -216,6 +252,7 @@
android:orientation="horizontal"
>
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:id="@+id/relationWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -228,20 +265,25 @@
android:focusable="false"
android:clickable="false"
android:singleLine="false"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.design.widget.TextInputLayout>
<ImageView
android:layout_marginRight="12dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="8dp"
android:layout_gravity="center_vertical|end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_arrow_down"/>
android:background="@drawable/ic_arrow_down"
android:layout_marginEnd="5dp" />
</FrameLayout>
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/mobileWrapper"
@ -279,6 +321,8 @@
</android.support.design.widget.TextInputLayout>
<FrameLayout
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:id="@+id/transferViewContainer"
@ -287,6 +331,7 @@
android:orientation="horizontal"
>
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:id="@+id/transferWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -301,14 +346,19 @@
android:singleLine="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
/>
</android.support.design.widget.TextInputLayout>
<ImageView
android:layout_marginRight="12dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="8dp"
android:layout_gravity="center_vertical|end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_arrow_down"/>
android:background="@drawable/ic_arrow_down"
android:layout_marginEnd="5dp" />
</FrameLayout>

2
app/src/main/res/layout/fragment_kyc_view1_v2.xml

@ -89,8 +89,6 @@
<android.support.design.widget.TextInputLayout
app:errorEnabled="true"
android:layout_marginTop="@dimen/kycTextUpperMargin"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:id="@+id/emailWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"

Loading…
Cancel
Save