Search in sources :

Example 1 with PollAdapter

use of net.iGap.adapter.items.poll.PollAdapter in project iGap-Android by KianIranian-STDG.

the class PollFragment method init.

private void init(View view) {
    emptyRecycle = view.findViewById(R.id.emptyRecycle);
    rcDiscovery = view.findViewById(R.id.rcDiscovery);
    pollAdapter = new PollAdapter(getActivity(), new ArrayList<>());
    swipeRefreshLayout = view.findViewById(R.id.pullToRefresh);
    swipeRefreshLayout.setOnRefreshListener(() -> {
        setRefreshing(true);
        boolean isSend = updateOrFetchRecycleViewData();
        if (!isSend) {
            setRefreshing(false);
            HelperError.showSnackMessage(getString(R.string.wallet_error_server), false);
        }
    });
    emptyRecycle.setOnClickListener(v -> {
        boolean isSend = updateOrFetchRecycleViewData();
        if (!isSend) {
            HelperError.showSnackMessage(getString(R.string.wallet_error_server), false);
        }
    });
    rcDiscovery.setLayoutManager(new LinearLayoutManager(getContext()));
    rcDiscovery.setAdapter(pollAdapter);
    mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setLogoShown(true).setListener(new ToolbarListener() {

        @Override
        public void onLeftIconClickListener(View view) {
            popBackStackFragment();
        }
    });
    ViewGroup viewGroup = view.findViewById(R.id.fd_layout_toolbar);
    viewGroup.addView(mHelperToolbar.getView());
    tryToUpdateOrFetchRecycleViewData(0);
}
Also used : PollAdapter(net.iGap.adapter.items.poll.PollAdapter) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) TextView(android.widget.TextView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 2 with PollAdapter

use of net.iGap.adapter.items.poll.PollAdapter in project iGap-Android by KianIranian-STDG.

the class PollFragment method onConfigurationChanged.

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    PollAdapter adapter = (PollAdapter) rcDiscovery.getAdapter();
    if (adapter != null) {
        pollAdapter.notifyChangeData();
    }
}
Also used : PollAdapter(net.iGap.adapter.items.poll.PollAdapter)

Aggregations

PollAdapter (net.iGap.adapter.items.poll.PollAdapter)2 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 TextView (android.widget.TextView)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 ArrayList (java.util.ArrayList)1 ToolbarListener (net.iGap.observers.interfaces.ToolbarListener)1