Search in sources :

Example 11 with HelperToolbar

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();
}
Also used : LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) Environment(android.os.Environment) NonNull(androidx.annotation.NonNull) Intent(android.content.Intent) Toast(android.widget.Toast) ElectricityBillPayVM(net.iGap.viewmodel.electricity_bill.ElectricityBillPayVM) View(android.view.View) ViewModelProviders(androidx.lifecycle.ViewModelProviders) HelperError(net.iGap.helper.HelperError) HelperFragment(net.iGap.helper.HelperFragment) Log(android.util.Log) DataBindingUtil(androidx.databinding.DataBindingUtil) HelperTracker(net.iGap.helper.HelperTracker) HelperCalander(net.iGap.helper.HelperCalander) LayoutInflater(android.view.LayoutInflater) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) LastBillData(net.iGap.model.electricity_bill.LastBillData) ViewGroup(android.view.ViewGroup) BaseAPIViewFrag(net.iGap.api.apiService.BaseAPIViewFrag) File(java.io.File) BillInfo(net.iGap.model.bill.BillInfo) Bill(net.iGap.model.electricity_bill.Bill) FragmentElecBillPayBinding(net.iGap.databinding.FragmentElecBillPayBinding) Nullable(androidx.annotation.Nullable) Base64(android.util.Base64) R(net.iGap.R) HelperMimeType(net.iGap.helper.HelperMimeType) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Snackbar(com.google.android.material.snackbar.Snackbar) HelperToolbar(net.iGap.helper.HelperToolbar) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) HelperToolbar(net.iGap.helper.HelperToolbar) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 12 with HelperToolbar

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();
}
Also used : ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) AdapterView(android.widget.AdapterView) HelperToolbar(net.iGap.helper.HelperToolbar) View(android.view.View) AdapterView(android.widget.AdapterView) LinearLayout(android.widget.LinearLayout)

Example 13 with HelperToolbar

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;
    }
}
Also used : ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) HelperToolbar(net.iGap.helper.HelperToolbar) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 14 with HelperToolbar

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);
        }
    });
}
Also used : HelperTracker(net.iGap.helper.HelperTracker) Bundle(android.os.Bundle) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) LayoutInflater(android.view.LayoutInflater) NonNull(androidx.annotation.NonNull) FragmentTwoStepVerificationBinding(net.iGap.databinding.FragmentTwoStepVerificationBinding) DialogAction(com.afollestad.materialdialogs.DialogAction) ViewGroup(android.view.ViewGroup) CountDownTimer(android.os.CountDownTimer) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) Locale(java.util.Locale) View(android.view.View) ViewModelProviders(androidx.lifecycle.ViewModelProviders) R(net.iGap.R) ActivityRegistration(net.iGap.activities.ActivityRegistration) HelperError(net.iGap.helper.HelperError) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) TwoStepVerificationViewModel(net.iGap.viewmodel.TwoStepVerificationViewModel) DataBindingUtil(androidx.databinding.DataBindingUtil) HelperToolbar(net.iGap.helper.HelperToolbar) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Bundle(android.os.Bundle) CountDownTimer(android.os.CountDownTimer) TextView(android.widget.TextView) View(android.view.View) ActivityRegistration(net.iGap.activities.ActivityRegistration) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) DialogAction(com.afollestad.materialdialogs.DialogAction) NonNull(androidx.annotation.NonNull) TextView(android.widget.TextView) HelperToolbar(net.iGap.helper.HelperToolbar)

Example 15 with HelperToolbar

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());
}
Also used : BeepTunesLocalSongAdapter(net.iGap.adapter.beepTunes.BeepTunesLocalSongAdapter) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) RecyclerView(androidx.recyclerview.widget.RecyclerView) HelperToolbar(net.iGap.helper.HelperToolbar) LinearLayout(android.widget.LinearLayout)

Aggregations

HelperToolbar (net.iGap.helper.HelperToolbar)32 View (android.view.View)21 ToolbarListener (net.iGap.observers.interfaces.ToolbarListener)17 LinearLayout (android.widget.LinearLayout)14 RecyclerView (androidx.recyclerview.widget.RecyclerView)9 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)8 TextView (android.widget.TextView)7 Bundle (android.os.Bundle)6 ViewGroup (android.view.ViewGroup)6 Nullable (androidx.annotation.Nullable)6 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)4 HelperFragment (net.iGap.helper.HelperFragment)4 LayoutInflater (android.view.LayoutInflater)3 FrameLayout (android.widget.FrameLayout)3 ProgressBar (android.widget.ProgressBar)3 NonNull (androidx.annotation.NonNull)3 DataBindingUtil (androidx.databinding.DataBindingUtil)3 ViewModelProviders (androidx.lifecycle.ViewModelProviders)3 GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)3 R (net.iGap.R)3