Search in sources :

Example 1 with HelperToolbar

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

the class NewsGroupPagerFrag method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    Bundle arg = getArguments();
    String groupID = arg.getString("GroupID");
    HelperToolbar mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setListener(new ToolbarListener() {

        @Override
        public void onLeftIconClickListener(View view) {
            popBackStackFragment();
        }
    }).setDefaultTitle(arg.getString("GroupTitle")).setRoundBackground(// cause of imageView below toolbar use flat toolbar is better than round
    false).setLogoShown(true);
    binding.Toolbar.addView(mHelperToolbar.getView());
    if (!arg.getString("GroupPic").equals(""))
        Glide.with(G.context).load(arg.getString("GroupPic")).placeholder(R.mipmap.news_temp_banner).into(binding.groupImage);
    ViewPager viewPager = binding.secondaryLayout.viewPager;
    tabLayout = binding.secondaryLayout.pagerTabLayout;
    // TabAdapter adapter = new TabAdapter(getFragmentManager());
    NewsListFrag frag = new NewsListFrag();
    frag.setApiArg(new NewsApiArg(1, 10, Integer.parseInt(groupID), NewsApiArg.NewsType.GROUP_NEWS));
    frag.setHandler(news -> {
        Glide.with(G.context).load(news.getImage()).into(binding.groupImage);
        binding.groupTitle.setText(news.getTitle());
        binding.headerNews.setOnClickListener(v -> {
            FragmentManager fragmentManager = getChildFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            Fragment fragment = fragmentManager.findFragmentByTag(NewsDetailFrag.class.getName());
            if (fragment == null) {
                fragment = NewsDetailFrag.newInstance();
                fragmentTransaction.addToBackStack(fragment.getClass().getName());
            }
            Bundle args = new Bundle();
            args.putString("NewsID", news.getId());
            fragment.setArguments(args);
            new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
        });
    });
    // adapter.addFragment(frag, getResources().getString(R.string.news_latest));
    NewsListFrag frag2 = new NewsListFrag();
    frag2.setApiArg(new NewsApiArg(1, 10, Integer.parseInt(groupID), NewsApiArg.NewsType.MOST_HITS));
    // adapter.addFragment(frag2, getResources().getString(R.string.news_MHits));
    NewsListFrag frag3 = new NewsListFrag();
    frag3.setApiArg(new NewsApiArg(1, 10, Integer.parseInt(groupID), NewsApiArg.NewsType.CONTROVERSIAL_NEWS));
    // adapter.addFragment(frag3, getResources().getString(R.string.news_ergent));
    // viewPager.setAdapter(adapter);
    tabLayout.setupWithViewPager(viewPager);
    updateFontTabLayout();
}
Also used : Bundle(android.os.Bundle) View(android.view.View) TextView(android.widget.TextView) ViewPager(androidx.viewpager.widget.ViewPager) Fragment(androidx.fragment.app.Fragment) HelperFragment(net.iGap.helper.HelperFragment) BaseFragment(net.iGap.fragments.BaseFragment) FragmentManager(androidx.fragment.app.FragmentManager) NewsApiArg(net.iGap.model.news.NewsApiArg) FragmentTransaction(androidx.fragment.app.FragmentTransaction) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) HelperToolbar(net.iGap.helper.HelperToolbar) HelperFragment(net.iGap.helper.HelperFragment)

Example 2 with HelperToolbar

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

the class NewsPublisherListFrag 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);
    binding.toolbar.addView(mHelperToolbar.getView());
    binding.pullToRefresh.setOnRefreshListener(() -> {
        viewModel.getData();
        binding.noItemInListError.setVisibility(View.GONE);
    });
    binding.rcGroup.setHasFixedSize(true);
    GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 3);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    binding.rcGroup.setLayoutManager(layoutManager);
    viewModel.getData();
    onErrorObserver();
    onDataChanged();
    onProgress();
}
Also used : ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) HelperToolbar(net.iGap.helper.HelperToolbar) View(android.view.View)

Example 3 with HelperToolbar

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

the class MplTransactionFragment method setUpViews.

private void setUpViews() {
    LinearLayout toolBarContainer = rootView.findViewById(R.id.ll_mplTransaction_toolBar);
    recyclerView = rootView.findViewById(R.id.rv_mplTransaction);
    swipeRefreshLayout = rootView.findViewById(R.id.sl_itemMplTransAction);
    typeAllTv = rootView.findViewById(R.id.tv_mplTransaction_all);
    typeTopUpTv = rootView.findViewById(R.id.tv_mplTransaction_topup);
    typeCardToCardTv = rootView.findViewById(R.id.tv_mplTransaction_cardToCard);
    typeSalesTv = rootView.findViewById(R.id.tv_mplTransaction_sales);
    typeBillTv = rootView.findViewById(R.id.tv_mplTransaction_bill);
    emptyView = rootView.findViewById(R.id.tv_mplTransaction_emptyView);
    layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    setEnableButton(typeAllTv, typeBillTv, typeCardToCardTv, typeSalesTv, typeTopUpTv);
    viewModel.getFirstPageMplTransactionList(ProtoGlobal.MplTransaction.Type.NONE);
    HelperToolbar toolbar = HelperToolbar.create().setContext(G.fragmentActivity).setLifecycleOwner(getViewLifecycleOwner()).setListener(this).setLogoShown(true).setDefaultTitle(getResources().getString(R.string.payment_history)).setLeftIcon(R.string.icon_back);
    toolBarContainer.addView(toolbar.getView());
}
Also used : HelperToolbar(net.iGap.helper.HelperToolbar) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) LinearLayout(android.widget.LinearLayout)

Example 4 with HelperToolbar

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

the class MplTransactionInfoFragment method setupViews.

private void setupViews() {
    LinearLayout toolBarContainer = rootView.findViewById(R.id.ll_mplTransactionInfo_toolBar);
    swipeRefreshLayout = rootView.findViewById(R.id.sl_mplTransactionInfo);
    RecyclerView recyclerView = rootView.findViewById(R.id.rv_mplTransActionInfo);
    rvContainer = rootView.findViewById(R.id.cl_mplTransactionInfo_rv);
    statusTv = rootView.findViewById(R.id.tv_mplTransactionInfo_stats);
    dataTv = rootView.findViewById(R.id.tv_mplTransactionInfo_data);
    timeTv = rootView.findViewById(R.id.tv_mplTransactionInfo_time);
    statusIv = rootView.findViewById(R.id.fv_mplTransactionInfo_status);
    statusRootView = rootView.findViewById(R.id.cv_mplTransactionInfo);
    emptyView = rootView.findViewById(R.id.tv_mplTransactionInfo_emptyView);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
    recyclerView.setAdapter(adapter);
    HelperToolbar toolbar = HelperToolbar.create().setContext(G.fragmentActivity).setLifecycleOwner(getViewLifecycleOwner()).setListener(this).setLogoShown(true).setRightIcons(R.string.icon_download).setDefaultTitle(getResources().getString(R.string.payment_history)).setLeftIcon(R.string.icon_back);
    toolBarContainer.addView(toolbar.getView());
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) HelperToolbar(net.iGap.helper.HelperToolbar) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) LinearLayout(android.widget.LinearLayout)

Example 5 with HelperToolbar

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

the class StickerSettingFragment method setupViews.

@Override
public void setupViews() {
    RecyclerView recyclerView = rootView.findViewById(R.id.rv_removeSticker);
    LinearLayout linearLayout = rootView.findViewById(R.id.ll_stickerSetting_toolBar);
    HelperToolbar helperToolbar = HelperToolbar.create().setLeftIcon(R.string.icon_back).setLogoShown(true).setDefaultTitle(getResources().getString(R.string.sticker_setting)).setListener(new ToolbarListener() {

        @Override
        public void onLeftIconClickListener(View view) {
            finish();
        }
    }).setContext(getContext());
    linearLayout.addView(helperToolbar.getView());
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    viewModel.getStickersLiveData().observe(getViewLifecycleOwner(), structIGStickerGroups -> adapter.updateAdapter(structIGStickerGroups));
    adapter.setListener(new RemoveStickerAdapter.RemoveStickerDialogListener() {

        @Override
        public void onStickerClick(StructIGStickerGroup stickerGroup) {
            openFragmentAddStickerToFavorite(stickerGroup);
        }

        @Override
        public void onRemoveStickerClick(StructIGStickerGroup stickerGroup, int pos, RemoveStickerAdapter.ProgressStatus progressStatus) {
            if (getContext() != null) {
                new MaterialDialog.Builder(getContext()).title(getResources().getString(R.string.remove_sticker)).content(getResources().getString(R.string.remove_sticker_text)).positiveText(getString(R.string.yes)).negativeText(getString(R.string.no)).onPositive((dialog, which) -> {
                    progressStatus.setVisibility(true);
                    viewModel.removeStickerFromMySticker(stickerGroup, (response, error) -> {
                        if (error == null) {
                            adapter.removeItem(pos);
                        } else {
                            progressStatus.setVisibility(false);
                        }
                    });
                    dialog.dismiss();
                }).show();
            }
        }
    });
    viewModel.getRemoveStickerLiveData().observe(getViewLifecycleOwner(), removedItemPosition -> adapter.removeItem(removedItemPosition));
    TextView removeRecentTv = rootView.findViewById(R.id.tv_stickerSetting_clearRecent);
    removeRecentTv.setOnClickListener(v -> onClearRecentStickerClicked());
    ProgressBar progressBar = rootView.findViewById(R.id.pb_stickerSetting_clearRecent);
    viewModel.getClearRecentStickerLiveData().observe(getViewLifecycleOwner(), progressBar::setVisibility);
    TextView clearInternalStorage = rootView.findViewById(R.id.tv_stickerSetting_clearStorage);
    clearInternalStorage.setOnClickListener(v -> viewModel.clearStickerFromInternalStorage());
    TextView storageSize = rootView.findViewById(R.id.tv_stickerSetting_clearStorageSize);
    viewModel.getStickerFileSizeLiveData().observe(getViewLifecycleOwner(), storageSize::setText);
    TextView clearFavoriteStickerTv = rootView.findViewById(R.id.tv_stickerSetting_clearFavorite);
    clearFavoriteStickerTv.setOnClickListener(v -> onClearFavoriteStickerClicked());
    ProgressBar clearFavoriteStickerPb = rootView.findViewById(R.id.pb_stickerSetting_clearFavorite);
    TextView clearRecentEmojiTv = rootView.findViewById(R.id.tv_stickerSetting_clearEmoji);
    clearRecentEmojiTv.setOnClickListener(v -> onClearRecentEmojiClicked());
    ImageView emptyIv = rootView.findViewById(R.id.iv_stickerSetting_empty);
    TextView emptyTv = rootView.findViewById(R.id.tv_stickerSetting_empty);
    TextView headerTv = rootView.findViewById(R.id.tv_stickerSetting_header);
    viewModel.getEmptyRecentStickerLiveData().observe(getViewLifecycleOwner(), visibility -> {
        emptyIv.setVisibility(visibility);
        emptyTv.setVisibility(visibility);
    });
    viewModel.getRecyclerVisibilityRecentStickerLiveData().observe(getViewLifecycleOwner(), visibility -> {
        recyclerView.setVisibility(visibility);
        headerTv.setVisibility(visibility);
    });
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) StructIGStickerGroup(net.iGap.fragments.emoji.struct.StructIGStickerGroup) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) HelperToolbar(net.iGap.helper.HelperToolbar) ImageView(android.widget.ImageView) ProgressBar(android.widget.ProgressBar) 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