Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #563 from TCA-Team/pfent/fix#561
Browse files Browse the repository at this point in the history
fix preemptive closing of cursors. Fixes #561
  • Loading branch information
kordianbruck authored Nov 9, 2017
2 parents 235c360 + 92bd295 commit 15898df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
// click on category in list
OpenHoursManager lm = new OpenHoursManager(getActivity());
String[] categories = {"library", "info", "cafeteria_gar", "cafeteria_grh", "cafeteria", "cafeteria_pas", "cafeteria_wst"};
RecyclerView recyclerView;
LinearLayoutManager layoutManager;
try (Cursor c = lm.getAllHoursFromDb(categories[mItemId])) {
recyclerView = rootView.findViewById(R.id.fragment_item_detail_recyclerview);
recyclerView.setAdapter(new OpeningHoursDetailAdapter(c));
}
layoutManager = new LinearLayoutManager(getContext());
Cursor c = lm.getAllHoursFromDb(categories[mItemId]);
RecyclerView recyclerView = rootView.findViewById(R.id.fragment_item_detail_recyclerview);
recyclerView.setAdapter(new OpeningHoursDetailAdapter(c));
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ public void onCreate(Bundle savedInstanceState) {

// Initialize stations adapter
CalendarManager calendarManager = new CalendarManager(this);
try (Cursor lectureCursor = calendarManager.getLecturesFromWidget(this.appWidgetId)) {
listViewLectures.setAdapter(new LectureListSelectionAdapter(this, lectureCursor, true, this.appWidgetId));
}
Cursor lectureCursor = calendarManager.getLecturesFromWidget(this.appWidgetId);
listViewLectures.setAdapter(new LectureListSelectionAdapter(this, lectureCursor, true, this.appWidgetId));
listViewLectures.requestFocus();
}

Expand Down

0 comments on commit 15898df

Please sign in to comment.