Search in sources :

Example 6 with HelperToolbar

use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.

the class StorySettingFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    if (getContext() == null)
        return super.onCreateView(inflater, container, savedInstanceState);
    HelperToolbar helperToolbar = HelperToolbar.create();
    String title = getResources().getString(R.string.stories_setting);
    View toolBar = helperToolbar.setContext(getContext()).setLogoShown(true).setListener(this).setLeftIcon(R.string.icon_back).setDefaultTitle(getString(R.string.stories_setting)).setDefaultTitle(title).getView();
    FrameLayout rootView = new FrameLayout(getContext());
    rootView.setBackgroundColor(Theme.getInstance().getDividerColor(getContext()));
    rootView.addView(toolBar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.TOP));
    rootView.addView(recyclerListView = new RecyclerListView(getContext()), LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.TOP, 0, LayoutCreator.getDimen(R.dimen.toolbar_height), 0, 0));
    recyclerListView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
    recyclerListView.setAdapter(new ListAdapter());
    recyclerListView.setClipToPadding(false);
    recyclerListView.setPadding(0, 0, 0, LayoutCreator.dp(30));
    return rootView;
}
Also used : FrameLayout(android.widget.FrameLayout) HelperToolbar(net.iGap.helper.HelperToolbar) RecyclerListView(net.iGap.module.customView.RecyclerListView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) RecyclerListView(net.iGap.module.customView.RecyclerListView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) Nullable(androidx.annotation.Nullable)

Example 7 with HelperToolbar

use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.

the class ViewUserDialogFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    isInShowViewUser = true;
    if (tfMain == null)
        tfMain = ResourcesCompat.getFont(getContext(), R.font.main_font);
    rootView = new FrameLayout(getContext());
    dataRootView = new LinearLayout(getContext());
    dataRootView.setOrientation(LinearLayout.VERTICAL);
    rootView.addView(dataRootView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.CENTER));
    if (G.themeColor == Theme.DARK) {
        rootView.setBackgroundColor(new Theme().getPrimaryDarkColor(getContext()));
    } else {
        rootView.setBackgroundColor(Theme.getInstance().getDividerColor(getContext()));
    }
    HelperToolbar helperToolbar = HelperToolbar.create();
    View toolBar = helperToolbar.setContext(getContext()).setLogoShown(true).setListener(this).setDefaultTitle(G.selectedLanguage.equals("fa") ? getString(R.string.story_viewed_by) + " " + HelperCalander.convertToUnicodeFarsiNumber(String.valueOf(count)) + " " + getString(R.string.story_person) : getString(R.string.story_viewed_by) + " " + count).getView();
    dataRootView.addView(toolBar, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER | Gravity.TOP, 0, 0, 0, 0));
    recyclerView = new RecyclerView(getContext());
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    dataRootView.addView(recyclerView, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, 0, 1F, Gravity.CENTER));
    progressBar = new ProgressBar(getContext());
    progressBar.setVisibility(View.GONE);
    rootView.addView(progressBar, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER | Gravity.BOTTOM));
    listAdapter = new ListAdapter();
    listAdapter.setContext(getContext());
    return rootView;
}
Also used : FrameLayout(android.widget.FrameLayout) Theme(net.iGap.module.Theme) RecyclerView(androidx.recyclerview.widget.RecyclerView) HelperToolbar(net.iGap.helper.HelperToolbar) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) AppCompatTextView(androidx.appcompat.widget.AppCompatTextView) ImageLoadingView(net.iGap.story.liststories.ImageLoadingView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) RecyclerListView(net.iGap.module.customView.RecyclerListView) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout) Nullable(androidx.annotation.Nullable)

Example 8 with HelperToolbar

use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.

the class BeepTunesMainFragment method initToolBar.

private void initToolBar(ViewGroup viewGroup) {
    HelperToolbar helperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setSearchBoxShown(true).setLogoShown(true).setListener(this).setRightSmallAvatarShown(true).setLeftIcon(R.string.icon_back);
    viewGroup.addView(helperToolbar.getView());
    avatarHandler.getAvatar(new ParamWithAvatarType(helperToolbar.getAvatarSmall(), AccountManager.getInstance().getCurrentUser().getId()).avatarType(AvatarHandler.AvatarType.USER).showMain());
}
Also used : HelperToolbar(net.iGap.helper.HelperToolbar) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType)

Example 9 with HelperToolbar

use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.

the class ElectricityBillListFrag 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();
        }

        @Override
        public void onRightIconClickListener(View view) {
            List<Integer> items = new ArrayList<>();
            items.add(R.string.elecBill_cell_deleteAccount);
            new TopSheetDialog(getContext()).setListDataWithResourceId(items, -1, position -> {
                if (position == 0) {
                    final MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title(R.string.elecBill_deleteAccount_title).content(R.string.elecBill_deleteAccount_desc).positiveText(R.string.elecBill_deleteAccount_pos).negativeText(R.string.elecBill_deleteAccount_neg).positiveColor(getContext().getResources().getColor(R.color.red)).widgetColor(new Theme().getAccentColor(getContext())).onPositive((dialog1, which) -> viewModel.deleteAccount()).build();
                    dialog.show();
                }
            }).show();
        }
    }).setLogoShown(true);
    LinearLayout toolbarLayout = binding.Toolbar;
    toolbarLayout.addView(mHelperToolbar.getView());
    binding.billRecycler.setHasFixedSize(true);
    onDataChangedListener();
    viewModel.getBillsList();
}
Also used : TopSheetDialog(net.iGap.module.dialog.topsheet.TopSheetDialog) LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) NonNull(androidx.annotation.NonNull) ProtoMplGetBillToken(net.iGap.proto.ProtoMplGetBillToken) Theme(net.iGap.module.Theme) ElectricityBillListVM(net.iGap.viewmodel.electricity_bill.ElectricityBillListVM) ArrayList(java.util.ArrayList) MobileDebit(net.iGap.model.bill.MobileDebit) FragmentElecBillListBinding(net.iGap.databinding.FragmentElecBillListBinding) Toast(android.widget.Toast) Map(java.util.Map) View(android.view.View) ViewModelProviders(androidx.lifecycle.ViewModelProviders) HelperError(net.iGap.helper.HelperError) HelperFragment(net.iGap.helper.HelperFragment) BillList(net.iGap.model.bill.BillList) DataBindingUtil(androidx.databinding.DataBindingUtil) Debit(net.iGap.model.bill.Debit) LayoutInflater(android.view.LayoutInflater) TopSheetDialog(net.iGap.module.dialog.topsheet.TopSheetDialog) ViewGroup(android.view.ViewGroup) BaseAPIViewFrag(net.iGap.api.apiService.BaseAPIViewFrag) BillInfo(net.iGap.model.bill.BillInfo) ElectricityBillListAdapter(net.iGap.adapter.electricity_bill.ElectricityBillListAdapter) List(java.util.List) Nullable(androidx.annotation.Nullable) R(net.iGap.R) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Snackbar(com.google.android.material.snackbar.Snackbar) HelperToolbar(net.iGap.helper.HelperToolbar) ServiceDebit(net.iGap.model.bill.ServiceDebit) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) ArrayList(java.util.ArrayList) Theme(net.iGap.module.Theme) HelperToolbar(net.iGap.helper.HelperToolbar) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 10 with HelperToolbar

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