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. 16
      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 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 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) switch(layoutID)
{ {
case R.layout.fragment_payout_mode_send_money_v2: case R.layout.fragment_payout_mode_send_money_v2:
return new PayoutModeSendMoneyFragment(); return new PayoutModeSendMoneyFragment();
case R.layout.fragment_amount_detail_send_money_v2: 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: case R.layout.fragment_verification_send_money_v2:
return new VerificationSendMoneyFragment();
return (verificationSendMoneyFragment==null)?new VerificationSendMoneyFragment():verificationSendMoneyFragment;
default: default:
return null; 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"; public static String RECIPIENT_DATA = "recipientData";
private PasswordPromptListener passwordPromptListener; private PasswordPromptListener passwordPromptListener;
private SendMoneyScreenManager sendMoneyScreenManager;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -78,12 +79,12 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
} }
private void initialize() { private void initialize() {
sendMoneyScreenManager=new SendMoneyScreenManager();
} }
public boolean addScreenToSendMoney(@LayoutRes int layoutID, boolean addTransitionEffect) { public boolean addScreenToSendMoney(@LayoutRes int layoutID, boolean addTransitionEffect) {
BaseFragment baseFragment = SendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
BaseFragment baseFragment = sendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
if (baseFragment != null) { if (baseFragment != null) {
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
if (addTransitionEffect) if (addTransitionEffect)
@ -98,7 +99,7 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
} }
public boolean addScreenToSendMoneyOnly(@LayoutRes int layoutID, boolean addTransitionEffect) { public boolean addScreenToSendMoneyOnly(@LayoutRes int layoutID, boolean addTransitionEffect) {
BaseFragment baseFragment = SendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
BaseFragment baseFragment = sendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
if (baseFragment != null) { if (baseFragment != null) {
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
if (addTransitionEffect) if (addTransitionEffect)
@ -112,7 +113,7 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
} }
public boolean replaceCurrentScreen(@LayoutRes int layoutID) { public boolean replaceCurrentScreen(@LayoutRes int layoutID) {
BaseFragment baseFragment = SendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
BaseFragment baseFragment = sendMoneyScreenManager.getSendMoneyScreenFromId(layoutID);
if (baseFragment != null) { if (baseFragment != null) {
android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
@ -318,4 +319,9 @@ public class SendMoneyV2Activity extends BaseActivity implements SendMoneyAction
public void updateFinalTranstionToDefault() { public void updateFinalTranstionToDefault() {
setDefaultBg(page3TxtView); setDefaultBg(page3TxtView);
} }
@Override
public void prepareRemainingFragments() {
sendMoneyScreenManager.prepareFragmentsLazily();
}
} }

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

@ -234,8 +234,7 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
} }
private boolean focusOutAndHideKeyboard() { private boolean focusOutAndHideKeyboard() {
if(ed_account.hasFocus())
{
if (ed_account.hasFocus()) {
View currentViewWithFocus = rootView.getFocusedChild(); View currentViewWithFocus = rootView.getFocusedChild();
if (currentViewWithFocus != null) if (currentViewWithFocus != null)
@ -408,6 +407,7 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
} else { } else {
showPopUpMessage(payoutModeApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null); showPopUpMessage(payoutModeApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
} }
} else { } else {
scheduleTaskLater(() -> { scheduleTaskLater(() -> {
showProgressBar(false, ""); showProgressBar(false, "");
@ -465,19 +465,19 @@ public class PayoutModeSendMoneyFragment extends BaseFragment implements SendMon
@Override @Override
protected void onSuccess(AccountValidationApiResponse accountValidationApiResponse) { protected void onSuccess(AccountValidationApiResponse accountValidationApiResponse) {
if (isUIReady()) { if (isUIReady()) {
if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2))
if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
((SendMoneyActionListener) getActivity()).showAmountDetailPage(); ((SendMoneyActionListener) getActivity()).showAmountDetailPage();
else
{
((SendMoneyActionListener) getActivity()).prepareRemainingFragments();
} else {
showPopUpMessage(accountValidationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null); showPopUpMessage(accountValidationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
} }
} else { } else {
scheduleTaskLater(() -> { scheduleTaskLater(() -> {
if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2))
if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
((SendMoneyActionListener) getActivity()).showAmountDetailPage(); ((SendMoneyActionListener) getActivity()).showAmountDetailPage();
else
{
((SendMoneyActionListener) getActivity()).prepareRemainingFragments();
} else {
showPopUpMessage(accountValidationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null); showPopUpMessage(accountValidationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
} }

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

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

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

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