|
|
@ -25,6 +25,7 @@ import android.widget.ProgressBar; |
|
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
import com.gmeremit.online.gmeremittance_native.R; |
|
|
|
import com.gmeremit.online.gmeremittance_native.base.UIStateHandler; |
|
|
|
import com.gmeremit.online.gmeremittance_native.customwidgets.LineDividerItemDecoration; |
|
|
|
import com.gmeremit.online.gmeremittance_native.sendmoneyV2.adapter.PayoutModeBranchListingRvAdapter; |
|
|
|
import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.BranchListApiResponse; |
|
|
@ -55,6 +56,9 @@ public class PayoutModeBranchListingDialog extends DialogFragment implements Vie |
|
|
|
private CompositeDisposable compositeDisposable; |
|
|
|
private ProgressBar progressBar; |
|
|
|
private Interpolator interpolator; |
|
|
|
private boolean isUIReady=false; |
|
|
|
UIStateHandler uiStateHandler; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Dialog onCreateDialog(Bundle savedInstanceState) { |
|
|
@ -74,9 +78,26 @@ public class PayoutModeBranchListingDialog extends DialogFragment implements Vie |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void onPause() { |
|
|
|
super.onPause(); |
|
|
|
isUIReady=false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onResume() { |
|
|
|
super.onResume(); |
|
|
|
isUIReady=true; |
|
|
|
if(uiStateHandler!=null) |
|
|
|
uiStateHandler.performPendingUITask(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initialize() { |
|
|
|
dialogTitle.setText("Select Branch"); |
|
|
|
|
|
|
|
uiStateHandler=new UIStateHandler(); |
|
|
|
cancelButton.setOnClickListener(this); |
|
|
|
searchEditTextView.addTextChangedListener(this); |
|
|
|
payoutModeBranchListingRvAdapter = new PayoutModeBranchListingRvAdapter(this.listener); |
|
|
@ -127,6 +148,8 @@ public class PayoutModeBranchListingDialog extends DialogFragment implements Vie |
|
|
|
@Override |
|
|
|
public void onDismiss(DialogInterface dialog) { |
|
|
|
super.onDismiss(dialog); |
|
|
|
uiStateHandler.clearPendingTask(); |
|
|
|
uiStateHandler=null; |
|
|
|
cancelButton.setOnClickListener(null); |
|
|
|
searchEditTextView.removeTextChangedListener(this); |
|
|
|
compositeDisposable.dispose(); |
|
|
@ -188,14 +211,11 @@ public class PayoutModeBranchListingDialog extends DialogFragment implements Vie |
|
|
|
if(noCountryFoundView.getVisibility()!=View.VISIBLE) |
|
|
|
noCountryFoundView.setVisibility(View.VISIBLE); |
|
|
|
noCountryFoundView.setHint(message); |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
if(noCountryFoundView.getVisibility()==View.VISIBLE) |
|
|
|
noCountryFoundView.setVisibility(View.INVISIBLE); |
|
|
|
noCountryFoundView.setHint(""); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -255,44 +275,77 @@ public class PayoutModeBranchListingDialog extends DialogFragment implements Vie |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onSuccess(BranchListApiResponse branchListApiResponse) { |
|
|
|
if(isUIReady) { |
|
|
|
hideProgressView(true); |
|
|
|
|
|
|
|
if(branchListApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) |
|
|
|
{ |
|
|
|
if(branchListApiResponse.getData().isEmpty()) |
|
|
|
{ |
|
|
|
if (branchListApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|
|
|
if (branchListApiResponse.getData().isEmpty()) { |
|
|
|
showErrorMessage(false, NO_BRANCH_FOUND); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
} else { |
|
|
|
showErrorMessage(false, ""); |
|
|
|
showRecyclerView(true); |
|
|
|
payoutModeBranchListingRvAdapter.setData(branchListApiResponse.getData()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
showErrorMessage(true, branchListApiResponse.getMsg()); |
|
|
|
showRecyclerView(false); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
uiStateHandler.enqueueUITask(()->{ |
|
|
|
hideProgressView(true); |
|
|
|
|
|
|
|
if (branchListApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|
|
|
if (branchListApiResponse.getData().isEmpty()) { |
|
|
|
showErrorMessage(false, NO_BRANCH_FOUND); |
|
|
|
|
|
|
|
} else { |
|
|
|
showErrorMessage(false, ""); |
|
|
|
showRecyclerView(true); |
|
|
|
payoutModeBranchListingRvAdapter.setData(branchListApiResponse.getData()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
showErrorMessage(true, branchListApiResponse.getMsg()); |
|
|
|
showRecyclerView(false); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onFailed(String message) { |
|
|
|
if(isUIReady) { |
|
|
|
hideProgressView(true); |
|
|
|
showErrorMessage(true, message); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
uiStateHandler.enqueueUITask(()->{ |
|
|
|
hideProgressView(true); |
|
|
|
showErrorMessage(true, message); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onConnectionNotEstablished(String message) { |
|
|
|
if(isUIReady) { |
|
|
|
hideProgressView(true); |
|
|
|
showErrorMessage(true, message); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
uiStateHandler.enqueueUITask(()->{ |
|
|
|
hideProgressView(true); |
|
|
|
showErrorMessage(true, message); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|