@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_view_edit_place) { listener.onEditGeoClick(mPlaceId); } else if (id == R.id.remove_place) { listener.onPlaceRemove(mPlaceId); } else if (id == android.R.id.home) { backNavigateListener.onNavigateBack(); } return super.onOptionsItemSelected(item); }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); listener.setPlaceDescriptionFragment(this); LoaderManager.LoaderCallbacks placeCallback = new PlaceCallback( getActivity(), new PlaceCallback.LoaderListener() { @Override public void onDataFetched(Cursor cursor) { if (cursor.moveToFirst()) { descriptionTextView.setText( cursor.getString(cursor.getColumnIndex(DataBase.PLACES_TEXT_COLUMN))); lastVisitedTextView.setText( cursor.getString(cursor.getColumnIndex(DataBase.PLACES_LAST_VISITED_COLUMN))); } } }); getActivity() .getLoaderManager() .restartLoader(LoadersFactory.FETCH_PLACE_LOADER, getArguments(), placeCallback); LoaderManager.LoaderCallbacks photosCallback = new PlaceCallback( getActivity(), new PlaceCallback.LoaderListener() { @Override public void onDataFetched(Cursor cursor) { adapter.swapCursor(cursor); } }); getActivity() .getLoaderManager() .restartLoader(LoadersFactory.FETCH_PHOTOS_LOADER, getArguments(), photosCallback); photoGridView.setAdapter(adapter); }