Search in sources :

Example 1 with DataReceiver

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

the class ModuleDetailFragment method onCreate.

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReceiver = new DataReceiver(new Handler());
    mReceiver.setReceiver(this);
    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);
    SessionManager sessionManager = new SessionManager(getContext());
    userID = sessionManager.getIdUser();
    // String Module = sessionManager
    NoteService.getNoteByStudent(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)

Example 2 with DataReceiver

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

the class StudentsFragmentAbsence method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_student_absence, container, false);
    mReceiver = new DataReceiver(new Handler());
    mReceiver.setReceiver(this);
    return view;
}
Also used : Handler(android.os.Handler) DataReceiver(dz.easy.androidclient.Services.DataReceiver) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 3 with DataReceiver

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

the class AbsenceFragment 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());
    AbsenceService.getAbsenceByStudentByModule(getContext(), mReceiver, moduleID);
}
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 4 with DataReceiver

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

the class GroupFragment 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);
    System.out.println("OnCreate : ME FIRST ");
    try {
        module = new JSONObject(getArguments().getString("module"));
        user = App.getInstance().getUser();
        if (user.getString("_type").equals("Teacher")) {
            GroupService.getGroupsByModuleByTeacher(getContext(), mReceiver, module.getString("_id"));
        } else if (user.getString("_type").equals("Manager")) {
            Toast.makeText(getContext(), "Hi Manager", Toast.LENGTH_LONG).show();
        // getTeachers();
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    if (GRID_LAYOUT) {
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    } else {
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    }
    mRecyclerView.setHasFixedSize(true);
}
Also used : JSONObject(org.json.JSONObject) 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)

Example 5 with DataReceiver

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

the class ModuleFragment 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());
    try {
        if (user.getString("_type").equals("Teacher")) {
            ModuleService.getModulesByTeacher(getContext(), mReceiver);
        } else if (user.getString("_type").equals("Manager")) {
            ModuleService.getTeachers(getContext(), mReceiver);
        } else if (user.getString("_type").equals("Student")) {
            ModuleService.getModulesByStudent(getContext(), mReceiver);
        }
    } 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)

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