Search in sources :

Example 21 with HelperToolbar

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

the class FragmentFinancialServices method onViewCreated.

@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    HelperToolbar t = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setRightIcons(R.string.icon_other_vertical_dots).setLogoShown(true).setDefaultTitle(getString(R.string.financial_services)).setListener(new ToolbarListener() {

        @Override
        public void onLeftIconClickListener(View view) {
            if (getActivity() != null) {
                getActivity().onBackPressed();
            }
        }

        @Override
        public void onRightIconClickListener(View view) {
            showMenu();
        }
    });
    binding.walletPriceView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            // Ensure you call it only once
            binding.walletPriceValue.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            ConstraintSet set = new ConstraintSet();
            set.clone(binding.root);
            set.constrainCircle(binding.walletPointer.getId(), binding.walletPriceView.getId(), binding.walletPriceView.getWidth() / 2, 0);
            set.applyTo(binding.root);
        }
    });
    viewModel.walletPointerPosition.observe(this, integer -> {
        if (integer != null) {
            ConstraintSet set = new ConstraintSet();
            set.clone(binding.root);
            set.constrainCircle(binding.walletPointer.getId(), binding.walletPriceView.getId(), binding.walletPriceView.getWidth() / 2, integer);
            set.applyTo(binding.root);
        }
    });
}
Also used : ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) HelperToolbar(net.iGap.helper.HelperToolbar) ConstraintSet(androidx.constraintlayout.widget.ConstraintSet) View(android.view.View) ViewTreeObserver(android.view.ViewTreeObserver)

Example 22 with HelperToolbar

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

the class FragmentMapUsers method initComponent.

private void initComponent(View view) {
    ((ActivityMain) G.fragmentActivity).setOnBackPressedListener(FragmentMapUsers.this, false);
    HelperToolbar toolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setLogoShown(true).setDefaultTitle(getString(R.string.igap_nearby)).setListener(new ToolbarListener() {

        @Override
        public void onLeftIconClickListener(View view) {
            if (ActivityMain.onBackPressedListener != null) {
                ActivityMain.onBackPressedListener.doBack();
            }
            popBackStackFragment();
        }
    });
    ViewGroup layoutToolbar = view.findViewById(R.id.fmu_toolbar);
    layoutToolbar.addView(toolbar.getView());
    imvNothingFound = view.findViewById(R.id.sfl_imv_nothing_found);
    txtEmptyListComment = view.findViewById(R.id.sfl_txt_empty_list_comment);
    mRecyclerView = view.findViewById(R.id.rcy_map_user);
    mRecyclerView.setItemAnimator(null);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(G.fragmentActivity));
    DbManager.getInstance().doRealmTransaction(realm -> {
        realm.where(RealmGeoNearbyDistance.class).findAll().deleteAllFromRealm();
    });
    mAdapter = new MapUserAdapter(DbManager.getInstance().doRealmTask(realm -> {
        return realm.where(RealmGeoNearbyDistance.class).findAll();
    }), true);
    // fastAdapter
    // mAdapter = new MapUserAdapterA();
    mRecyclerView.setAdapter(mAdapter);
    if (mAdapter.getItemCount() > 0) {
        imvNothingFound.setVisibility(View.GONE);
        txtEmptyListComment.setVisibility(View.GONE);
    } else {
        imvNothingFound.setVisibility(View.VISIBLE);
        txtEmptyListComment.setVisibility(View.VISIBLE);
    }
    mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {

        @Override
        public void onItemRangeInserted(int positionStart, int itemCount) {
            super.onItemRangeInserted(positionStart, itemCount);
            if (mAdapter.getItemCount() > 0) {
                imvNothingFound.setVisibility(View.GONE);
                txtEmptyListComment.setVisibility(View.GONE);
            } else {
                imvNothingFound.setVisibility(View.VISIBLE);
                txtEmptyListComment.setVisibility(View.VISIBLE);
            }
        }

        @Override
        public void onItemRangeRemoved(int positionStart, int itemCount) {
            super.onItemRangeRemoved(positionStart, itemCount);
            if (mAdapter.getItemCount() > 0) {
                imvNothingFound.setVisibility(View.GONE);
                txtEmptyListComment.setVisibility(View.GONE);
            } else {
                imvNothingFound.setVisibility(View.VISIBLE);
                txtEmptyListComment.setVisibility(View.VISIBLE);
            }
        }
    });
}
Also used : ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) ActivityMain(net.iGap.activities.ActivityMain) ViewGroup(android.view.ViewGroup) RecyclerView(androidx.recyclerview.widget.RecyclerView) HelperToolbar(net.iGap.helper.HelperToolbar) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) RippleView(net.iGap.libs.rippleeffect.RippleView) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) CircleImageView(net.iGap.module.CircleImageView) TextView(android.widget.TextView) RealmGeoNearbyDistance(net.iGap.realm.RealmGeoNearbyDistance)

Example 23 with HelperToolbar

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

the class FragmentNotification method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    roomId = getArguments().getLong("ID");
    initDataBinding();
    HelperToolbar toolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setLogoShown(true).setDefaultTitle(getString(R.string.ntg_title_toolbar)).setListener(new ToolbarListener() {

        @Override
        public void onLeftIconClickListener(View view) {
            try {
                popBackStackFragment();
            } catch (IllegalStateException e) {
                e.printStackTrace();
            }
        }
    });
    fragmentNotificationBinding.ntgLayoutToolbar.addView(toolbar.getView());
}
Also used : ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) HelperToolbar(net.iGap.helper.HelperToolbar) View(android.view.View)

Example 24 with HelperToolbar

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

the class FragmentOtpAuthentication method onViewCreated.

@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    HelperToolbar toolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setRightIcons(R.string.icon_sent).setLeftIcon(R.string.icon_back).setDefaultTitle(requireArguments().getString("title", getString(R.string.unknown))).setListener(this);
    ((ViewGroup) view.findViewById(R.id.toolbar)).addView(toolbar.getView());
    smsCodeEditText = view.findViewById(R.id.smsCodeEditText);
    ViewGroup ltTime = view.findViewById(R.id.stda_layout_time);
    TextView txtPhoneNumber = view.findViewById(R.id.stda_txt_phoneNumber);
    TextView descriptionTextView = view.findViewById(R.id.description_authentication);
    TextView txtTimerLand = view.findViewById(R.id.stda_txt_time);
    txtPhoneNumber.setText(requireArguments().getString("phone", getString(R.string.unknown)));
    descriptionTextView.setText(requireArguments().getString("description"));
    smsCodeEditText.setHint(requireArguments().getString("editTextHint"));
    countDownTimer = new CountDownTimer(1000 * 60, 1000) {

        @Override
        public void onTick(long millisUntilFinished) {
            int seconds = (int) ((millisUntilFinished) / 1000);
            int minutes = seconds / 60;
            seconds = seconds % 60;
            txtTimerLand.setText("" + String.format("%02d", minutes) + ":" + String.format("%02d", seconds));
        }

        @Override
        public void onFinish() {
            ltTime.setVisibility(View.GONE);
        }
    };
    start();
}
Also used : ViewGroup(android.view.ViewGroup) CountDownTimer(android.os.CountDownTimer) TextView(android.widget.TextView) HelperToolbar(net.iGap.helper.HelperToolbar)

Example 25 with HelperToolbar

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

the class NewsDetailFrag method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    Bundle arg = getArguments();
    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.shareNews.setOnClickListener(v -> Toast.makeText(getContext(), "share", Toast.LENGTH_SHORT).show());
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), RecyclerView.HORIZONTAL, false);
    binding.relatedNewsList.setLayoutManager(layoutManager);
    LinearLayoutManager layoutManager2 = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
    binding.commentList.setLayoutManager(layoutManager2);
    binding.shareNewsBTN.setOnClickListener(v -> {
        Intent sendIntent = new Intent(Intent.ACTION_SEND);
        sendIntent.putExtra(Intent.EXTRA_TEXT, viewModel.getData().getValue().getTitle() + "\n" + viewModel.getData().getValue().getLead() + "\n" + "تاریخ انتشار: " + viewModel.getData().getValue().getDate() + "\n" + "قدرت گرفته از آیگپ" + "\n" + "این خبر را در آیگپ بخوانید: " + "igap://news/showDetail/" + arg.getString("NewsID") + "\n" + "لینک خبر: " + viewModel.getData().getValue().getLink());
        sendIntent.setType("text/plain");
        startActivity(Intent.createChooser(sendIntent, "Share via"));
    });
    binding.writeComment.setOnClickListener(v -> {
        NewsAddCommentBottomSheetFrag bottomSheetFragment = new NewsAddCommentBottomSheetFrag().setData(arg.getString("NewsID"), result -> {
            if (result)
                Toast.makeText(getContext(), R.string.news_add_comment_successToast, Toast.LENGTH_SHORT).show();
            else
                Toast.makeText(getContext(), R.string.news_add_comment_failToast, Toast.LENGTH_SHORT).show();
        });
        bottomSheetFragment.show(getFragmentManager(), "AddCommentBottomSheet");
    });
    viewModel.getDataFromServer(arg.getString("NewsID"));
    onErrorObserver();
    onDataChanged();
    onProgress();
}
Also used : ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) Bundle(android.os.Bundle) Intent(android.content.Intent) HelperToolbar(net.iGap.helper.HelperToolbar) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) 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