@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_item_detail, container, false); // click on category in list OpenHoursManager lm = new OpenHoursManager(getActivity()); String[] categories = { "library", "info", "cafeteria_gar", "cafeteria_grh", "cafeteria", "cafeteria_pas", "cafeteria_wst" }; Cursor c = lm.getAllHoursFromDb(categories[mItemId]); RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.fragment_item_detail_recyclerview); recyclerView.setAdapter(new OpeningHoursDetailAdapter(c)); final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(layoutManager); recyclerView.setHasFixedSize(true); return rootView; }
/** Import default location and opening hours from assets */ private void importLocationsDefaults() throws IOException { OpenHoursManager lm = new OpenHoursManager(this); if (lm.empty()) { List<String[]> rows = Utils.readCsv(getAssets().open(CSV_LOCATIONS)); for (String[] row : rows) { lm.replaceIntoDb( new Location( Integer.parseInt(row[0]), row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8])); } } }