use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class ParentChatMoneyTransferFragment method loadInternetPayment.
public void loadInternetPayment() {
Fragment fragment = InternetFragment.newInstance();
Bundle bundle = new Bundle();
bundle.putString("phoneNumber", phoneNumber);
bundle.putLong("peerId", peerId);
fragment.setArguments(bundle);
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
dismiss();
}
use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class ElectricityBillListFrag method initRecycler.
private void initRecycler(Map<BillList.Bill, Debit> bills) {
adapter = new ElectricityBillListAdapter(getContext(), bills, (item, btnAction) -> {
// ServiceDebit temp = viewModel.getmMapData().getValue().get(item);
switch(btnAction) {
case PAY:
ServiceDebit tempService = (ServiceDebit) bills.get(item).getData();
viewModel.payServiceBill(tempService.getBillID(), tempService.getPaymentID(), tempService.getTotalElectricityBillDebt() != null ? tempService.getTotalElectricityBillDebt() : tempService.getTotalGasBillDebt(), ProtoMplGetBillToken.MplGetBillToken.Type.NONE_VALUE);
break;
case EDIT:
if (item.getBillTitle() == null) {
showDialog(getResources().getString(R.string.elecBill_error_title), getResources().getString(R.string.elecBill_error_notPossible), getResources().getString(R.string.ok));
return;
}
ElectricityBillAddFrag frag = ElectricityBillAddFrag.newInstance(viewModel.getBillInfo(item), true);
frag.setCompleteListener(new ElectricityBillAddFrag.CompleteListener() {
@Override
public void loadAgain() {
viewModel.getBillsList();
}
});
frag.show(getFragmentManager(), "BillAddEdit");
break;
case DELETE:
final MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title(R.string.elecBill_deleteBill_title).content(R.string.elecBill_deleteBill_desc).positiveText(R.string.elecBill_deleteBill_pos).negativeText(R.string.elecBill_deleteBill_neg).positiveColor(getContext().getResources().getColor(R.color.red)).widgetColor(new Theme().getAccentColor(getContext())).onPositive((dialog1, which) -> {
viewModel.deleteItem(item);
Toast.makeText(getContext(), "Deleted", Toast.LENGTH_SHORT).show();
}).build();
dialog.show();
break;
case SHOW_DETAIL:
if (item.getBillTitle() == null) {
showDialog(getResources().getString(R.string.elecBill_error_title), getResources().getString(R.string.elecBill_error_notPossible), getResources().getString(R.string.ok));
return;
}
BillInfo temp = viewModel.getBillInfo(item);
new HelperFragment(getFragmentManager(), ElectricityBillPayFrag.newInstance(temp.getBillType(), temp.getBillID(), temp.getTitle(), true)).setReplace(false).load();
break;
case MID_PAY:
MobileDebit tempMid = (MobileDebit) bills.get(item).getData();
viewModel.payServiceBill(tempMid.getMidTerm().getBillID(), tempMid.getMidTerm().getPayID(), tempMid.getMidTerm().getAmount(), ProtoMplGetBillToken.MplGetBillToken.Type.MID_TERM_VALUE);
break;
case LAST_PAY:
MobileDebit tempLast = (MobileDebit) bills.get(item).getData();
viewModel.payServiceBill(tempLast.getLastTerm().getBillID(), tempLast.getLastTerm().getPayID(), tempLast.getLastTerm().getAmount(), ProtoMplGetBillToken.MplGetBillToken.Type.LAST_TERM_VALUE);
break;
case RELOAD:
viewModel.reloadData(item);
}
});
binding.billRecycler.setAdapter(adapter);
}
use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class ElectricityBillMainFrag method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperTracker.sendTracker(HelperTracker.TRACKER_BILL_PAGE);
HelperToolbar mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
popBackStackFragment();
}
}).setLogoShown(true);
LinearLayout toolbarLayout = binding.Toolbar;
toolbarLayout.addView(mHelperToolbar.getView());
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.billsOptions, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
binding.billSpinner.setAdapter(adapter);
binding.billSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch(position) {
case 0:
viewModel.setType(BillInfo.BillType.ELECTRICITY);
binding.billIdHolder.setHint(getResources().getString(R.string.elecBill_main_billIDHint));
binding.billIdHolder.setCounterMaxLength(13);
binding.billQRscan.setEnabled(true);
binding.billQRscan.setTextColor(getResources().getColor(R.color.gray));
break;
case 1:
viewModel.setType(BillInfo.BillType.GAS);
binding.billIdHolder.setHint(getResources().getString(R.string.elecBill_main_billIDHint3));
binding.billIdHolder.setCounterMaxLength(12);
binding.billQRscan.setEnabled(false);
binding.billQRscan.setTextColor(getResources().getColor(R.color.gray_300));
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
binding.modeGroup.setOnCheckedChangeListener((group, checkedId) -> onModeChangeView(checkedId));
binding.billIdET.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
viewModel.getBillIDErrorEnable().set(false);
}
@Override
public void afterTextChanged(Editable s) {
}
});
viewModel.getGoToBillDetailFrag().observe(getViewLifecycleOwner(), aBoolean -> {
if (aBoolean) {
viewModel.getProgressVisibility().set(View.GONE);
new HelperFragment(getFragmentManager(), ElectricityBillPayFrag.newInstance(viewModel.getType(), viewModel.getBillID().get(), null, false)).setReplace(false).load();
}
});
}
use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class ElectricityBillSearchListFrag method initRecycler.
private void initRecycler(List<ElectricityBranchData> bills) {
ElectricityBillSearchListAdapter adapter = new ElectricityBillSearchListAdapter(getContext(), bills, position -> new HelperFragment(getFragmentManager(), ElectricityBillPayFrag.newInstance(viewModel.getmBranchData().getValue().get(position).getBillID(), false)).setReplace(false).load());
binding.billRecycler.setAdapter(adapter);
}
use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class FragmentSecurity method onViewCreated.
@Override
public void onViewCreated(@NotNull final View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
securityToolbar = new Toolbar(getContext());
securityToolbar.setBackIcon(new BackDrawable(false));
securityToolbar.setTitle(getString(R.string.two_step_pass_code));
ToolbarItem toolbarItem;
toolbarItem = securityToolbar.addItem(rippleOkTag, R.string.icon_sent, Color.WHITE);
securityToolbar.setListener(i -> {
switch(i) {
case -1:
fragmentSecurityViewModel.onClickRippleBack(view);
break;
case rippleOkTag:
fragmentSecurityViewModel.onClickRippleOk(view);
break;
}
});
fragmentSecurityBinding.ffsLayoutToolbar.addView(securityToolbar, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.dp(56), Gravity.TOP));
toolbarItem.setVisibility(View.GONE);
fragmentSecurityViewModel.titleToolbar.observe(G.fragmentActivity, s -> securityToolbar.setTitle(s));
fragmentSecurityViewModel.rippleOkVisibility.observe(G.fragmentActivity, visibility -> toolbarItem.setVisibility(visibility));
fragmentSecurityViewModel.goToSetSecurityPassword.observe(getViewLifecycleOwner(), password -> {
if (getActivity() != null && password != null) {
FragmentSetSecurityPassword fragmentSetSecurityPassword = new FragmentSetSecurityPassword();
Bundle bundle = new Bundle();
bundle.putString("OLD_PASSWORD", password);
fragmentSetSecurityPassword.setArguments(bundle);
new HelperFragment(getActivity().getSupportFragmentManager(), fragmentSetSecurityPassword).load();
}
});
fragmentSecurityViewModel.showForgetPasswordDialog.observe(getViewLifecycleOwner(), listRes -> {
if (getActivity() != null && listRes != null) {
new MaterialDialog.Builder(getActivity()).title(R.string.set_recovery_dialog_title).items(listRes).itemsCallback((dialog, view1, which, text) -> fragmentSecurityViewModel.forgetPassword(text.equals(getString(R.string.recovery_by_email_dialog)))).show();
}
});
fragmentSecurityViewModel.goToSecurityRecoveryPage.observe(getViewLifecycleOwner(), data -> {
if (getActivity() != null && data != null) {
FragmentSecurityRecovery fragmentSecurityRecovery = new FragmentSecurityRecovery();
Bundle bundle = new Bundle();
bundle.putSerializable("PAGE", data.getSecurity());
bundle.putString("QUESTION_ONE", data.getQuestionOne());
bundle.putString("QUESTION_TWO", data.getQuestionTwo());
bundle.putString("PATERN_EMAIL", data.getEmailPattern());
bundle.putBoolean("IS_EMAIL", data.isEmail());
bundle.putBoolean("IS_CONFIRM_EMAIL", data.isConfirmEmail());
fragmentSecurityRecovery.setArguments(bundle);
new HelperFragment(getActivity().getSupportFragmentManager(), fragmentSecurityRecovery).load();
}
});
onPopBackStackFragment = this::popBackStackFragment;
}
Aggregations