From 26f7283a6f55453ce5bc85c9722ad9102259d3f6 Mon Sep 17 00:00:00 2001 From: samosfator Date: Sun, 25 Jan 2015 00:45:48 +0200 Subject: [PATCH] Hotfix crash on startup --- .../fragment/modules_fragment/ModuleFragment.java | 9 ++++----- .../semesters_subjects_fragment/SubjectsFragment.java | 11 ++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/ua/samosfator/moduleok/fragment/modules_fragment/ModuleFragment.java b/app/src/main/java/ua/samosfator/moduleok/fragment/modules_fragment/ModuleFragment.java index 7b63b4e..d7e97f7 100644 --- a/app/src/main/java/ua/samosfator/moduleok/fragment/modules_fragment/ModuleFragment.java +++ b/app/src/main/java/ua/samosfator/moduleok/fragment/modules_fragment/ModuleFragment.java @@ -46,18 +46,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa public void onEvent(RefreshEvent event) { StudentKeeper.refreshStudent(); ModulesFragment.initSubjects(); - rerenderModuleSubjectsList(); + reRenderModuleSubjectsList(); } public void onEvent(SemesterChangedEvent event) { - Log.d("[ModuleFragment#onEvent(SemesterChangedEvent)]", - "Current semesterIndex:" + StudentKeeper.getCurrentSemesterIndex()); + Log.d("SEMESTER_CHANGED_EVENT", "SemesterIndex:" + StudentKeeper.getCurrentSemesterIndex()); ModulesFragment.initSubjects(); - rerenderModuleSubjectsList(); + reRenderModuleSubjectsList(); } - private void rerenderModuleSubjectsList() { + private void reRenderModuleSubjectsList() { moduleSubjectItemAdapter.notifyItemRangeChanged(0, moduleSubjectItemAdapter.getItemCount()); } diff --git a/app/src/main/java/ua/samosfator/moduleok/fragment/semesters_subjects_fragment/SubjectsFragment.java b/app/src/main/java/ua/samosfator/moduleok/fragment/semesters_subjects_fragment/SubjectsFragment.java index d99b6c0..2d49af6 100644 --- a/app/src/main/java/ua/samosfator/moduleok/fragment/semesters_subjects_fragment/SubjectsFragment.java +++ b/app/src/main/java/ua/samosfator/moduleok/fragment/semesters_subjects_fragment/SubjectsFragment.java @@ -32,7 +32,7 @@ public class SubjectsFragment extends Fragment { private List mSubjects = new ArrayList<>(); private RecyclerView mRecyclerView; - private SubjectItemAdapter mSectionAdapter; + private SubjectItemAdapter mSubjectItemAdapter; public SubjectsFragment() { // Required empty public constructor @@ -57,12 +57,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa } private void initSectionAdapter() { - mSectionAdapter = new SubjectItemAdapter(getActivity(), mSubjects); + mSubjectItemAdapter = new SubjectItemAdapter(getActivity(), mSubjects); } private void initRecyclerView(View rootView) { mRecyclerView = (RecyclerView) rootView.findViewById(R.id.subjects_recycler_view); - mRecyclerView.setAdapter(mSectionAdapter); + mRecyclerView.setAdapter(mSubjectItemAdapter); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() { @Override @@ -91,11 +91,10 @@ private void initSubjects() { } catch (IllegalArgumentException e) { openLoginFragment(); } - reRenderSubjectsList(); } private void reRenderSubjectsList() { - mSectionAdapter.notifyItemRangeChanged(0, mSectionAdapter.getItemCount()); + mSubjectItemAdapter.notifyItemRangeChanged(0, mSubjectItemAdapter.getItemCount()); } private void openLoginFragment() { @@ -107,12 +106,14 @@ private void openLoginFragment() { public void onEvent(RefreshEvent event) { StudentKeeper.refreshStudent(); initSubjects(); + reRenderSubjectsList(); } public void onEvent(SemesterChangedEvent event) { Log.d("SEMESTER_CHANGED_EVENT", "SemesterIndex:" + StudentKeeper.getCurrentSemesterIndex()); initSubjects(); + reRenderSubjectsList(); } @Override