/** @return A custom ContextMenu header */ public View setHeaderLayout() { // Get album name String albumName = mCursor.getString(mAlbumNameIndex); // Get artist name String artistName = mCursor.getString(mArtistNameIndex); // Get albumId String albumId = mCursor.getString(mAlbumIdIndex); // Inflate the header View LayoutInflater inflater = getActivity().getLayoutInflater(); View header = inflater.inflate(R.layout.context_menu_header, null, false); // Artist image ImageView headerImage = (ImageView) header.findViewById(R.id.header_image); ImageInfo mInfo = new ImageInfo(); mInfo.type = TYPE_ALBUM; mInfo.size = SIZE_THUMB; mInfo.source = SRC_FIRST_AVAILABLE; mInfo.data = new String[] {albumId, artistName, albumName}; ImageProvider.getInstance(getActivity()).loadImage(headerImage, mInfo); // Set artist name TextView headerText = (TextView) header.findViewById(R.id.header_text); headerText.setText(albumName); headerText.setBackgroundColor(getResources().getColor(R.color.transparent_black)); return header; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.listview, container, false); mListView = (ListView) root.findViewById(android.R.id.list); // Set the header for @TrackBrowser String header = getActivity().getResources().getString(R.string.album_header); int left = getActivity().getResources().getInteger(R.integer.listview_padding_left); int right = getActivity().getResources().getInteger(R.integer.listview_padding_right); ApolloUtils.listHeader(this, root, header); ApolloUtils.setListPadding(this, mListView, left, 0, right, 0); return root; }