Search in sources :

Example 1 with TimeTableTeacherAdapter

use of dz.easy.androidclient.Adapters.TimeTableTeacherAdapter in project easy by MehdiBenmesa.

the class TimeTableFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    if (GRID_LAYOUT) {
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    } else {
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    }
    mRecyclerView.setHasFixedSize(true);
    //Use this now
    mRecyclerView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
    try {
        if (user.getString("_type").equals("Student")) {
            mRecyclerView.setAdapter(new TimeTableStudentAdapter(user));
        } else if (user.getString("_type").equals("Manager")) {
            mRecyclerView.setAdapter(new TimeTableManagerAdapter(user));
        } else {
            mRecyclerView.setAdapter(new TimeTableTeacherAdapter(user));
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : TimeTableStudentAdapter(dz.easy.androidclient.Adapters.TimeTableStudentAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager) JSONException(org.json.JSONException) TimeTableManagerAdapter(dz.easy.androidclient.Adapters.TimeTableManagerAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator) TimeTableTeacherAdapter(dz.easy.androidclient.Adapters.TimeTableTeacherAdapter)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 MaterialViewPagerHeaderDecorator (com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)1 TimeTableManagerAdapter (dz.easy.androidclient.Adapters.TimeTableManagerAdapter)1 TimeTableStudentAdapter (dz.easy.androidclient.Adapters.TimeTableStudentAdapter)1 TimeTableTeacherAdapter (dz.easy.androidclient.Adapters.TimeTableTeacherAdapter)1 JSONException (org.json.JSONException)1