Search in sources :

Example 1 with LoaderItem

use of com.mikepenz.aboutlibraries.ui.item.LoaderItem in project AboutLibraries by mikepenz.

the class LibsFragmentCompat method onCreateView.

public View onCreateView(Context context, LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, Bundle arguments) {
    if (arguments != null) {
        builder = (LibsBuilder) arguments.getSerializable("data");
    } else {
        Log.e("AboutLibraries", "The AboutLibraries fragment can't be build without the bundle containing the LibsBuilder");
    }
    View view = inflater.inflate(R.layout.fragment_opensource, container, false);
    // allows to modify the view before creating
    if (LibsConfiguration.getInstance().getUiListener() != null) {
        view = LibsConfiguration.getInstance().getUiListener().preOnCreateView(view);
    }
    // init CardView
    RecyclerView mRecyclerView;
    if (view.getId() == R.id.cardListView) {
        mRecyclerView = (RecyclerView) view;
    } else {
        mRecyclerView = (RecyclerView) view.findViewById(R.id.cardListView);
    }
    mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
    if (LibsConfiguration.getInstance().getItemAnimator() != null) {
        mRecyclerView.setItemAnimator(LibsConfiguration.getInstance().getItemAnimator());
    } else {
        mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    }
    if (builder != null) {
        mItemAdapter = new ItemAdapter();
        mAdapter = FastAdapter.with(mItemAdapter);
        mRecyclerView.setAdapter(mAdapter);
        if (builder.showLoadingProgress) {
            mItemAdapter.add(new LoaderItem());
        }
    }
    // allows to modify the view after creating
    if (LibsConfiguration.getInstance().getUiListener() != null) {
        view = LibsConfiguration.getInstance().getUiListener().postOnCreateView(view);
    }
    return view;
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) LoaderItem(com.mikepenz.aboutlibraries.ui.item.LoaderItem) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) ItemAdapter(com.mikepenz.fastadapter.adapters.ItemAdapter)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 LoaderItem (com.mikepenz.aboutlibraries.ui.item.LoaderItem)1 ItemAdapter (com.mikepenz.fastadapter.adapters.ItemAdapter)1