use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class ElectricityBillPayFrag method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperTracker.sendTracker(HelperTracker.TRACKER_ADD_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());
binding.loadAgain.setOnClickListener(v -> viewModel.getData());
viewModel.getBillImage().observe(getViewLifecycleOwner(), data -> downloadFile());
viewModel.getErrorM().observe(getViewLifecycleOwner(), errorModel -> {
switch(errorModel.getMessage()) {
case "001":
showDialog(getResources().getString(R.string.elecBill_error_title), getResources().getString(R.string.elecBill_error_billMissing), getResources().getString(R.string.ok));
break;
case "002":
showDialog(getResources().getString(R.string.elecBill_error_title), getResources().getString(R.string.elecBill_error_bellowMin), getResources().getString(R.string.ok));
break;
case "003":
showDialog(getResources().getString(R.string.elecBill_error_title), getResources().getString(R.string.elecBill_error_MPLError), getResources().getString(R.string.ok));
break;
case "004":
showDialog(getResources().getString(R.string.elecBill_success_title), getResources().getString(R.string.elecBill_success_pay), getResources().getString(R.string.ok));
break;
default:
Snackbar.make(binding.Container, errorModel.getMessage(), Snackbar.LENGTH_LONG).setAction(R.string.ok, v -> {
}).show();
break;
}
});
viewModel.getShowRequestFailedError().observe(getViewLifecycleOwner(), errorMessageResId -> {
if (errorMessageResId != null) {
HelperError.showSnackMessage(getString(errorMessageResId), false);
}
});
if (editMode)
binding.addToList.setText(getResources().getString(R.string.elecBill_edit_Btn));
makePage();
viewModel.getData();
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class ElectricityBillSearchListFrag method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperToolbar mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLeftIcon(R.string.icon_back).setLifecycleOwner(getViewLifecycleOwner()).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
popBackStackFragment();
}
}).setLogoShown(true);
LinearLayout toolbarLayout = binding.Toolbar;
toolbarLayout.addView(mHelperToolbar.getView());
binding.billRecycler.setHasFixedSize(true);
binding.billCompanySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
viewModel.setCompanyPosition(position - 1);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
onDataChangedListener();
resetEditTextLisener();
viewModel.getCompanyData();
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class ElectricityBranchInfoListFrag method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
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());
binding.billRecycler.setHasFixedSize(true);
onDataChangedListener();
viewModel.setBillID(billID);
switch(type) {
case GAS:
viewModel.getDataGas();
break;
case ELECTRICITY:
viewModel.getDataElec();
break;
}
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class TwoStepVerificationFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperTracker.sendTracker(HelperTracker.TRACKER_TWO_STEP);
HelperToolbar toolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.empty_error_message).setRightIcons(R.string.icon_sent).setLogoShown(true).setShowConnectionState(false).setDefaultTitle(getString(R.string.two_step_verification_title)).setListener(new ToolbarListener() {
@Override
public void onRightIconClickListener(View view) {
viewModel.onSubmitPasswordClick();
}
});
binding.toolbar.addView(toolbar.getView());
viewModel.showErrorMessage.observe(getViewLifecycleOwner(), errorMessageRes -> {
if (errorMessageRes != null) {
HelperError.showSnackMessage(getString(errorMessageRes), true);
}
});
viewModel.isHideKeyword.observe(getViewLifecycleOwner(), isHide -> {
if (isHide != null) {
if (isHide) {
hideKeyboard();
} else {
openKeyBoard();
}
}
});
viewModel.showDialogWaitTime.observe(getViewLifecycleOwner(), time -> {
if (getActivity() != null && time != null) {
MaterialDialog dialogWait = new MaterialDialog.Builder(getActivity()).title(R.string.error_check_password).customView(R.layout.dialog_remind_time, true).positiveText(R.string.B_ok).autoDismiss(true).canceledOnTouchOutside(true).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
}
}).show();
View v = dialogWait.getCustomView();
TextView remindTime = v.findViewById(R.id.remindTime);
CountDownTimer countWaitTimer = new CountDownTimer(time * 1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
int seconds = (int) ((millisUntilFinished) / 1000);
int minutes = seconds / 60;
seconds = seconds % 60;
remindTime.setText(String.format(Locale.getDefault(), "%02d:%02d", minutes, seconds));
}
@Override
public void onFinish() {
remindTime.setText("00:00");
}
};
countWaitTimer.start();
}
});
viewModel.showDialogForgotPassword.observe(getViewLifecycleOwner(), listResId -> {
if (getActivity() != null && listResId != null) {
new MaterialDialog.Builder(getActivity()).title(R.string.set_recovery_dialog_title).items(listResId).itemsCallback((dialog, view1, which, text) -> {
viewModel.selectedRecoveryType(text.equals(getString(R.string.recovery_by_email_dialog)));
}).show();
}
});
viewModel.goToSecurityRecoveryPage.observe(getViewLifecycleOwner(), data -> {
if (getActivity() instanceof ActivityRegistration && 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);
((ActivityRegistration) getActivity()).loadFragment(fragmentSecurityRecovery, true);
}
});
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class BeepTunesLocalSongFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RecyclerView recyclerView = rootView.findViewById(R.id.rv_Song);
LinearLayout toolBarContainer = rootView.findViewById(R.id.ll_syncSong_toolBar);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 4));
recyclerView.setAdapter(new BeepTunesLocalSongAdapter(downloadSongs, this));
HelperToolbar helperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setDefaultTitle(title).setLeftIcon(R.string.icon_back).setListener(this);
toolBarContainer.addView(helperToolbar.getView());
}
Aggregations