Search in sources :

Example 11 with StructIGStickerGroup

use of net.iGap.fragments.emoji.struct.StructIGStickerGroup in project iGap-Android by KianIranian-STDG.

the class AddStickersFragment method setupViews.

@Override
public void setupViews() {
    progressBar = rootView.findViewById(R.id.progress_stricker);
    addStickerToolbar = rootView.findViewById(R.id.toolbar2);
    customTextViewMedium = rootView.findViewById(R.id.title);
    buttonBack = rootView.findViewById(R.id.chl_ripple_back_Button);
    if (title == null)
        addStickerToolbar.setVisibility(View.GONE);
    else
        customTextViewMedium.setText(title);
    RecyclerView recyclerView = rootView.findViewById(R.id.rcvSettingPage);
    recyclerView.setAdapter(adapter);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    EndlessRecyclerViewScrollListener scrollListener = new EndlessRecyclerViewScrollListener(layoutManager) {

        @Override
        public void onLoadMore(int iPage, int totalItemsCount, RecyclerView view) {
            viewModel.onPageEnded();
        }
    };
    buttonBack.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            popBackStackFragment();
        }
    });
    recyclerView.addOnScrollListener(scrollListener);
    adapter.setListener(new AddStickerFragmentAdapter.AddStickerAdapterListener() {

        @Override
        public void onButtonClick(StructIGStickerGroup stickerGroup, AddStickerFragmentAdapter.ProgressStatus progressStatus) {
            viewModel.onItemButtonClicked(stickerGroup, sticker -> {
                if (sticker.getGroupId().equals(stickerGroup.getGroupId())) {
                    progressStatus.setVisibility(sticker.isInUserList());
                }
            });
        }

        @Override
        public void onCellClick(StructIGStickerGroup stickerGroup) {
            viewModel.onItemCellClicked(stickerGroup);
        }

        @Override
        public void onButtonStatusChange(AddStickerFragmentAdapter.ButtonsStatus buttonsStatus) {
            viewModel.getButtonStatusChangedLiveData().observe(getViewLifecycleOwner(), buttonsStatus::changed);
        }
    });
    viewModel.getOpenStickerDetailLiveData().observe(getViewLifecycleOwner(), sticker -> openFragmentAddStickerToFavorite(sticker.getGroupId()));
    viewModel.getLoadMoreProgressLiveData().observe(getViewLifecycleOwner(), visibility -> progressBar.setVisibility(visibility));
    viewModel.getStickerGroupLiveData().observe(getViewLifecycleOwner(), stickerGroup -> adapter.addData(stickerGroup));
}
Also used : RippleView(net.iGap.libs.rippleeffect.RippleView) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) StructIGStickerGroup(net.iGap.fragments.emoji.struct.StructIGStickerGroup) CustomTextViewMedium(net.iGap.module.CustomTextViewMedium) StructIGStickerCategory(net.iGap.fragments.emoji.struct.StructIGStickerCategory) Nullable(androidx.annotation.Nullable) MyAppBarLayout(net.iGap.module.MyAppBarLayout) ObserverFragment(net.iGap.observers.rx.ObserverFragment) View(android.view.View) RelativeLayout(android.widget.RelativeLayout) ViewModelProviders(androidx.lifecycle.ViewModelProviders) R(net.iGap.R) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) RecyclerView(androidx.recyclerview.widget.RecyclerView) EndlessRecyclerViewScrollListener(net.iGap.module.EndlessRecyclerViewScrollListener) AddStickerViewModel(net.iGap.viewmodel.AddStickerViewModel) EndlessRecyclerViewScrollListener(net.iGap.module.EndlessRecyclerViewScrollListener) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) StructIGStickerGroup(net.iGap.fragments.emoji.struct.StructIGStickerGroup) RippleView(net.iGap.libs.rippleeffect.RippleView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 12 with StructIGStickerGroup

use of net.iGap.fragments.emoji.struct.StructIGStickerGroup in project iGap-Android by KianIranian-STDG.

the class AddStickersFragment method openFragmentAddStickerToFavorite.

private void openFragmentAddStickerToFavorite(String groupId) {
    StructIGStickerGroup stickerGroup = new StructIGStickerGroup(groupId);
    StickerDialogFragment dialogFragment = StickerDialogFragment.getInstance(stickerGroup, true);
    if (getFragmentManager() != null)
        dialogFragment.show(getFragmentManager(), "dialogFragment");
}
Also used : StructIGStickerGroup(net.iGap.fragments.emoji.struct.StructIGStickerGroup)

Example 13 with StructIGStickerGroup

use of net.iGap.fragments.emoji.struct.StructIGStickerGroup in project iGap-Android by KianIranian-STDG.

the class StickerDialogFragment method getInstance.

public static StickerDialogFragment getInstance(String groupId) {
    StickerDialogFragment dialogAddSticker = new StickerDialogFragment();
    dialogAddSticker.stickerGroup = new StructIGStickerGroup(groupId);
    return dialogAddSticker;
}
Also used : StructIGStickerGroup(net.iGap.fragments.emoji.struct.StructIGStickerGroup)

Aggregations

StructIGStickerGroup (net.iGap.fragments.emoji.struct.StructIGStickerGroup)13 ArrayList (java.util.ArrayList)8 HashSet (java.util.HashSet)5 R (net.iGap.R)5 StructIGStickerCategory (net.iGap.fragments.emoji.struct.StructIGStickerCategory)5 RealmStickerGroup (net.iGap.realm.RealmStickerGroup)5 Base64 (android.util.Base64)4 Gson (com.google.gson.Gson)4 JsonObject (com.google.gson.JsonObject)4 Completable (io.reactivex.Completable)4 CompletableObserver (io.reactivex.CompletableObserver)4 Flowable (io.reactivex.Flowable)4 Single (io.reactivex.Single)4 SingleSource (io.reactivex.SingleSource)4 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)4 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)4 Disposable (io.reactivex.disposables.Disposable)4 Schedulers (io.reactivex.schedulers.Schedulers)4 RealmResults (io.realm.RealmResults)4 Sort (io.realm.Sort)4