Search in sources :

Example 16 with StudentManagerApplication

use of com.shu.studentmanager.StudentManagerApplication in project student-manager by SYYANI.

the class TeacherFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    teacherViewModel = new ViewModelProvider(this).get(TeacherViewModel.class);
    teacherFragmentBinding = DataBindingUtil.inflate(inflater, R.layout.teacher_fragment, container, false);
    teacherFragmentBinding.setTeacherViewModel(teacherViewModel);
    teacherFragmentBinding.setLifecycleOwner(getActivity());
    StudentManagerApplication application = (StudentManagerApplication) getActivity().getApplication();
    teacherFragmentBinding.teacherFragmentTeacherName.setText(application.getName());
    teacherFragmentBinding.teacherFramentTeacherId.setText(application.getId());
    course_list_recycleview = teacherFragmentBinding.courseListRecycleview;
    setCoureListRecycleView();
    View root = teacherFragmentBinding.getRoot();
    try {
        initCourseList();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return root;
// return inflater.inflate(R.layout.teacher_fragment, container, false);
}
Also used : IOException(java.io.IOException) StudentManagerApplication(com.shu.studentmanager.StudentManagerApplication) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TeacherViewModel(com.shu.studentmanager.viewmodel.TeacherViewModel) ViewModelProvider(androidx.lifecycle.ViewModelProvider)

Aggregations

StudentManagerApplication (com.shu.studentmanager.StudentManagerApplication)16 OkHttpClient (okhttp3.OkHttpClient)11 Request (okhttp3.Request)11 Response (okhttp3.Response)11 IOException (java.io.IOException)10 Gson (com.google.gson.Gson)5 ArrayList (java.util.ArrayList)5 Handler (android.os.Handler)4 Message (android.os.Message)4 View (android.view.View)4 ViewModelProvider (androidx.lifecycle.ViewModelProvider)3 MaterialAlertDialogBuilder (com.google.android.material.dialog.MaterialAlertDialogBuilder)3 MainActivity (com.shu.studentmanager.activity.MainActivity)3 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 TypeToken (com.google.gson.reflect.TypeToken)2 MediaType (okhttp3.MediaType)2 RequestBody (okhttp3.RequestBody)2 JSONObject (org.json.JSONObject)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1