Search in sources :

Example 6 with DataReceiver

use of dz.easy.androidclient.Services.DataReceiver in project easy by MehdiBenmesa.

the class NoteFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    mReceiver = new DataReceiver(new Handler());
    mReceiver.setReceiver(this);
    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());
    getNoteByStudent();
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) Handler(android.os.Handler) DataReceiver(dz.easy.androidclient.Services.DataReceiver) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 7 with DataReceiver

use of dz.easy.androidclient.Services.DataReceiver 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 8 with DataReceiver

use of dz.easy.androidclient.Services.DataReceiver in project easy by MehdiBenmesa.

the class StudentsFragmentNote method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    mReceiver = new DataReceiver(new Handler());
    mReceiver.setReceiver(this);
    addItemsOnSpinner();
    if (GRID_LAYOUT) {
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    } else {
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    }
    mRecyclerView.setHasFixedSize(true);
    try {
        studentsListNoteAdapter = new StudentsListNoteAdapter(students, module.getString("_id"), (StudentsListNoteAdapter.AdapterInterface) StudentsFragmentNote.this);
    } catch (JSONException e1) {
        e1.printStackTrace();
    }
    mRecyclerView.setAdapter(studentsListNoteAdapter);
    /*
            mRecyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    System.out.println("VALIER /// 2 ");
                    StudentsListNoteAdapter.MyViewHolder child;
                    ArrayList<StudentsListNoteAdapter.MyViewHolder> myList = studentsListNoteAdapter.getMyList();
                    Toast.makeText(getContext() , "Hello From Module Fragment "+ myList.size() +" hihi " , Toast.LENGTH_LONG).show();
                    for (int i = 0; i < myList.size(); i++) {
                        child = myList.get(i);
                        Toast.makeText(getContext() , child.title.getText() , Toast.LENGTH_LONG).show();
                    }
                }
            });*/
    valider = (Button) view.findViewById(R.id.valider);
    valider.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            System.out.println("VALIER /// ");
            try {
                studentsListNoteAdapter.updateNotes(getActivity(), module.getString("_id"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    });
// mRecyclerView.
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) StudentsListNoteAdapter(dz.easy.androidclient.Adapters.StudentsListNoteAdapter) Handler(android.os.Handler) JSONException(org.json.JSONException) DataReceiver(dz.easy.androidclient.Services.DataReceiver) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 9 with DataReceiver

use of dz.easy.androidclient.Services.DataReceiver in project easy by MehdiBenmesa.

the class AbsenceDetailFragment method onCreate.

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    exam = (TextView) getActivity().findViewById(R.id.exam);
    controle = (TextView) getActivity().findViewById(R.id.control);
    intero = (TextView) getActivity().findViewById(R.id.intero);
    tp = (TextView) getActivity().findViewById(R.id.tps);
    mReceiver = new DataReceiver(new Handler());
    mReceiver.setReceiver(this);
    SessionManager sessionManager = new SessionManager(getContext());
    userID = sessionManager.getIdUser();
    // String Module = sessionManager
    AbsenceService.getAbsenceByStudent(getContext(), mReceiver);
    if (getArguments().containsKey(ARG_ITEM_ID)) {
    // load dummy item by using the passed item ID.
    // accident = AppContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
    }
    // Toast.makeText(getContext() , moduleID , Toast.LENGTH_LONG).show();
    setHasOptionsMenu(true);
}
Also used : SessionManager(dz.easy.androidclient.Util.SessionManager) Handler(android.os.Handler) DataReceiver(dz.easy.androidclient.Services.DataReceiver) RequiresApi(android.support.annotation.RequiresApi)

Aggregations

Handler (android.os.Handler)9 DataReceiver (dz.easy.androidclient.Services.DataReceiver)9 GridLayoutManager (android.support.v7.widget.GridLayoutManager)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 MaterialViewPagerHeaderDecorator (com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)4 JSONException (org.json.JSONException)4 RequiresApi (android.support.annotation.RequiresApi)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 TextView (android.widget.TextView)2 BindView (butterknife.BindView)2 SessionManager (dz.easy.androidclient.Util.SessionManager)2 AdapterView (android.widget.AdapterView)1 StudentsListNoteAdapter (dz.easy.androidclient.Adapters.StudentsListNoteAdapter)1 JSONObject (org.json.JSONObject)1