Search in sources :

Example 6 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project easy by MehdiBenmesa.

the class RendezVousStatesFragment 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 RendezVousStatesAdapter(user, (RendezVousStatesAdapter.AdapterInterface) this));
        } else {
            mRecyclerView.setAdapter(new RendezVousStatesAdapter(user, (RendezVousStatesAdapter.AdapterInterface) this));
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) JSONException(org.json.JSONException) RendezVousStatesAdapter(dz.easy.androidclient.Adapters.RendezVousStatesAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 7 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator 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)

Example 8 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project easy by MehdiBenmesa.

the class RendeVousFragment method getTeachersSearcheed.

private void getTeachersSearcheed(final String newTextS) {
    CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_TEACHERS, null, new Response.Listener<JSONArray>() {

        @Override
        public void onResponse(JSONArray response) {
            JSONArray teachers = response;
            if (GRID_LAYOUT) {
                lstView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
            } else {
                lstView.setLayoutManager(new LinearLayoutManager(getActivity()));
            }
            lstView.setHasFixedSize(true);
            //Use this now
            lstView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
            //Search action
            JSONArray lstFound = new JSONArray();
            JSONObject item = null;
            for (int i = 0; i < teachers.length(); i++) {
                try {
                    item = teachers.getJSONObject(i);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                try {
                    if (item.getString("name").contains(newTextS) || item.getString("lastname").contains(newTextS)) {
                        lstFound.put(item);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        /*ArrayAdapter adapter = new ArrayAdapter(RendeVous.this, android.R.layout.simple_list_item_1, lstFound);
          lstView.setAdapter(adapter);*/
        //lstView.setAdapter(new TeachersAdapter(lstFound));
        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
        }
    });
    App.getInstance().addToRequestQueue(jsonReq);
}
Also used : Response(com.android.volley.Response) VolleyError(com.android.volley.VolleyError) CustomRequestArray(dz.easy.androidclient.Util.CustomRequestArray) GridLayoutManager(android.support.v7.widget.GridLayoutManager) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) JSONException(org.json.JSONException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 9 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project easy by MehdiBenmesa.

the class RendezVousFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mReceiver = new DataReceiver(new Handler());
    mReceiver.setReceiver(this);
    ButterKnife.bind(this, view);
    if (GRID_LAYOUT) {
        recyclerViewRendeVous.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    } else {
        recyclerViewRendeVous.setLayoutManager(new LinearLayoutManager(getActivity()));
    }
    recyclerViewRendeVous.setHasFixedSize(true);
    //Use this now
    recyclerViewRendeVous.addItemDecoration(new MaterialViewPagerHeaderDecorator());
    try {
        if (user.getString("_type").equals("Teacher")) {
            //Toast.makeText(getContext() , "Hi Teacher" , Toast.LENGTH_LONG).show();
            RendezVousService.getRendezVousByTeacher(getContext(), mReceiver, rdvState);
        } else if (user.getString("_type").equals("Manager")) {
            //Toast.makeText(getContext() , "Hi Manager" , Toast.LENGTH_LONG).show();
            RendezVousService.getRendezvousByManager(getContext(), mReceiver);
        } else if (user.getString("_type").equals("Student")) {
            //Toast.makeText(getContext() , "Hi Student" , Toast.LENGTH_LONG).show();
            RendezVousService.getRendeVousByStudent(getContext(), mReceiver, rdvState);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) Handler(android.os.Handler) JSONException(org.json.JSONException) DataReceiver(dz.easy.androidclient.Services.DataReceiver) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 10 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project easy by MehdiBenmesa.

the class NoteFragment method getNoteByStudent.

public void getNoteByStudent() {
    try {
        System.out.println("AVANT ABSENCE 2 ");
        CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_NOTE_BY_MODULES + "/" + user.getString("_id") + "/" + moduleID, null, new Response.Listener<JSONArray>() {

            @Override
            public void onResponse(JSONArray response) {
                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());
                mRecyclerView.setAdapter(new NoteAdapter(response));
            }
        }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
            }
        });
        App.getInstance().addToRequestQueue(jsonReq);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : Response(com.android.volley.Response) VolleyError(com.android.volley.VolleyError) CustomRequestArray(dz.easy.androidclient.Util.CustomRequestArray) GridLayoutManager(android.support.v7.widget.GridLayoutManager) JSONArray(org.json.JSONArray) NoteAdapter(dz.easy.androidclient.Adapters.NoteAdapter) JSONException(org.json.JSONException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)14 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)14 MaterialViewPagerHeaderDecorator (com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)14 JSONException (org.json.JSONException)7 Response (com.android.volley.Response)6 VolleyError (com.android.volley.VolleyError)6 CustomRequestArray (dz.easy.androidclient.Util.CustomRequestArray)6 JSONArray (org.json.JSONArray)6 Handler (android.os.Handler)4 DataReceiver (dz.easy.androidclient.Services.DataReceiver)4 TestRecyclerViewAdapter (com.github.florent37.materialviewpager.sample.TestRecyclerViewAdapter)2 TeachersAdapter (dz.easy.androidclient.Adapters.TeachersAdapter)2 ArrayList (java.util.ArrayList)2 JSONObject (org.json.JSONObject)2 NoteAdapter (dz.easy.androidclient.Adapters.NoteAdapter)1 RendezVousStatesAdapter (dz.easy.androidclient.Adapters.RendezVousStatesAdapter)1 TimeTableManagerAdapter (dz.easy.androidclient.Adapters.TimeTableManagerAdapter)1 TimeTableStudentAdapter (dz.easy.androidclient.Adapters.TimeTableStudentAdapter)1 TimeTableTeacherAdapter (dz.easy.androidclient.Adapters.TimeTableTeacherAdapter)1