use of dz.easy.androidclient.Adapters.StudentsListNoteAdapter 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.
}
Aggregations