public ArtistsAdapter(Context context) { super(context, null, false); this.hostManager = HostManager.getInstance(context); // Get the art dimensions Resources resources = context.getResources(); artWidth = (int) (resources.getDimension(R.dimen.artistlist_art_width) / UIUtils.IMAGE_RESIZE_FACTOR); artHeight = (int) (resources.getDimension(R.dimen.artistlist_art_heigth) / UIUtils.IMAGE_RESIZE_FACTOR); }
@Override protected CursorLoader createCursorLoader() { HostInfo hostInfo = HostManager.getInstance(getActivity()).getHostInfo(); Uri uri = MediaContract.Artists.buildArtistsListUri(hostInfo != null ? hostInfo.getId() : -1); String selection = null; String selectionArgs[] = null; String searchFilter = getSearchFilter(); if (!TextUtils.isEmpty(searchFilter)) { selection = MediaContract.ArtistsColumns.ARTIST + " LIKE ?"; selectionArgs = new String[] {"%" + searchFilter + "%"}; } return new CursorLoader( getActivity(), uri, ArtistListQuery.PROJECTION, selection, selectionArgs, ArtistListQuery.SORT); }
/** Manual configuration/review fragment callbacks */ public void onHostManualConfigurationNext(HostInfo hostInfo) { HostManager hostManager = HostManager.getInstance(this); HostInfo newHostInfo = hostManager.addHost(hostInfo); hostManager.switchHost(newHostInfo); switchToFragment(new AddHostFragmentFinish()); }