Browse Source

Adding form based progress bar

master
Preyea Regmi 5 years ago
parent
commit
b747bce9f7
  1. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/SendMoneyActionListener.java
  2. 16
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/SendMoneyScreenManager.java
  3. 14
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/SendMoneyV2Activity.java
  4. 48
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/payoutmode/PayoutModeSendMoneyFragment.java
  5. 4
      app/src/main/res/anim/enter_from_right.xml
  6. 4
      app/src/main/res/anim/exit_to_left.xml

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/SendMoneyActionListener.java

@ -24,5 +24,5 @@ public interface SendMoneyActionListener {
void updateFinalTranstionToDefault();
void prepareRemainingFragments();
}

16
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/SendMoneyScreenManager.java

@ -10,16 +10,26 @@ import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.verification.Ve
public class SendMoneyScreenManager
{
public static BaseFragment getSendMoneyScreenFromId(@LayoutRes int layoutID )
AmountDetailSendMoneyFragment amountDetailSendMoneyFragment;
VerificationSendMoneyFragment verificationSendMoneyFragment;
public SendMoneyScreenManager() {
}
public void prepareFragmentsLazily() {
amountDetailSendMoneyFragment= new AmountDetailSendMoneyFragment();
verificationSendMoneyFragment= new VerificationSendMoneyFragment();
}
public BaseFragment getSendMoneyScreenFromId(@LayoutRes int layoutID )
{
switch(layoutID)
{
case R.layout.fragment_payout_mode_send_money_v2:
return new PayoutModeSendMoneyFragment();
case R.layout.fragment_amount_detail_send_money_v2:
return new AmountDetailSendMoneyFragment();
return (amountDetailSendMoneyFragment==null)?new AmountDetailSendMoneyFragment():amountDetailSendMoneyFragment;
case R.layout.fragment_verification_send_money_v2:
return new VerificationSendMoneyFragment();
return (verificationSendMoneyFragment==null)?new VerificationSendMoneyFragment():verificationSendMoneyFragment;
default:
return null;
}

14
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/SendMoneyV2Activity.java

@ -50,6 +50,7 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
public static String RECIPIENT_DATA = "recipientData";
private PasswordPromptListener passwordPromptListener;
private SendMoneyScreenManager sendMoneyScreenManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -78,12 +79,12 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
}
private void initialize() {
sendMoneyScreenManager=new SendMoneyScreenManager();
}
public boolean addScreenToSendMoney(@LayoutRes int layoutID, boolean addTransitionEffect) {
BaseFragment baseFragment = SendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
BaseFragment baseFragment = sendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
if (baseFragment != null) {
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
if (addTransitionEffect)
@ -98,7 +99,7 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
}
public boolean addScreenToSendMoneyOnly(@LayoutRes int layoutID, boolean addTransitionEffect) {
BaseFragment baseFragment = SendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
BaseFragment baseFragment = sendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
if (baseFragment != null) {
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
if (addTransitionEffect)
@ -112,7 +113,7 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
}
public boolean replaceCurrentScreen(@LayoutRes int layoutID) {
BaseFragment baseFragment = SendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
BaseFragment baseFragment = sendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
if (baseFragment != null) {
android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
@ -318,4 +319,9 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
public void updateFinalTranstionToDefault() {
setDefaultBg(page3TxtView);
}
@Override
public void prepareRemainingFragments() {
sendMoneyScreenManager.prepareFragmentsLazily();
}
}

48
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/payoutmode/PayoutModeSendMoneyFragment.java

@ -234,11 +234,10 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
}
private boolean focusOutAndHideKeyboard() {
if(ed_account.hasFocus())
{
if (ed_account.hasFocus()) {
View currentViewWithFocus=rootView.getFocusedChild();
if(currentViewWithFocus!=null)
View currentViewWithFocus = rootView.getFocusedChild();
if (currentViewWithFocus != null)
currentViewWithFocus.clearFocus();
hideKeyBoard();
@ -316,8 +315,8 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
paymentModeRvAdapter.setData(data);
}
public void setDataToPaymentModeWithDefaultSelected(List<PayoutMode> data,int selectedItemPosition) {
paymentModeRvAdapter.setDataWithDefaultSelectedValue(data,selectedItemPosition);
public void setDataToPaymentModeWithDefaultSelected(List<PayoutMode> data, int selectedItemPosition) {
paymentModeRvAdapter.setDataWithDefaultSelectedValue(data, selectedItemPosition);
}
@Override
@ -404,15 +403,16 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
if (isUIReady()) {
showProgressBar(false, "");
if (payoutModeApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
setDataToPaymentModeWithDefaultSelected(payoutModeApiResponse.getData().getPayoutMode(),0);
setDataToPaymentModeWithDefaultSelected(payoutModeApiResponse.getData().getPayoutMode(), 0);
} else {
showPopUpMessage(payoutModeApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
}
} else {
scheduleTaskLater(() -> {
showProgressBar(false, "");
if (payoutModeApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
setDataToPaymentModeWithDefaultSelected(payoutModeApiResponse.getData().getPayoutMode(),0);
setDataToPaymentModeWithDefaultSelected(payoutModeApiResponse.getData().getPayoutMode(), 0);
} else {
showPopUpMessage(payoutModeApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
@ -425,12 +425,12 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
public void onFailed(String message) {
if (isUIReady()) {
showProgressBar(false, "");
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED,null);
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null);
} else {
scheduleTaskLater(() -> {
showProgressBar(false, "");
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED,null);
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null);
});
}
@ -440,12 +440,12 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
protected void onConnectionNotEstablished(String message) {
if (isUIReady()) {
showProgressBar(false, "");
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET,null);
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null);
} else {
scheduleTaskLater(() -> {
showProgressBar(false, "");
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET,null);
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null);
});
}
@ -465,20 +465,20 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
@Override
protected void onSuccess(AccountValidationApiResponse accountValidationApiResponse) {
if (isUIReady()) {
if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2))
if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
((SendMoneyActionListener) getActivity()).showAmountDetailPage();
else
{
showPopUpMessage(accountValidationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED,null);
((SendMoneyActionListener) getActivity()).prepareRemainingFragments();
} else {
showPopUpMessage(accountValidationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
}
} else {
scheduleTaskLater(() -> {
if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2))
if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
((SendMoneyActionListener) getActivity()).showAmountDetailPage();
else
{
showPopUpMessage(accountValidationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED,null);
((SendMoneyActionListener) getActivity()).prepareRemainingFragments();
} else {
showPopUpMessage(accountValidationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
}
});
@ -488,10 +488,10 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
@Override
public void onFailed(String message) {
if (isUIReady()) {
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED,null);
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null);
} else {
scheduleTaskLater(() -> {
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED,null);
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null);
});
}
}
@ -499,10 +499,10 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
@Override
protected void onConnectionNotEstablished(String message) {
if (isUIReady()) {
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET,null);
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null);
} else {
scheduleTaskLater(() -> {
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET,null);
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null);
});
}
}

4
app/src/main/res/anim/enter_from_right.xml

@ -4,5 +4,7 @@
<translate
android:fromXDelta="100%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="300" />
android:duration="300"
android:startOffset="100"
/>
</set>

4
app/src/main/res/anim/exit_to_left.xml

@ -4,5 +4,7 @@
<translate
android:fromXDelta="0%" android:toXDelta="-100%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="300"/>
android:duration="300"
android:startOffset="100"
/>
</set>
Loading…
Cancel
Save