2 * Copyright (C) 2012 Andrew Neal Licensed under the Apache License, Version 2.0
3 * (the "License"); you may not use this file except in compliance with the
4 * License. You may obtain a copy of the License at
5 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
6 * or agreed to in writing, software distributed under the License is
7 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the specific language
9 * governing permissions and limitations under the License.
12 package com.cyngn.eleven.ui.fragments.profile;
14 import android.app.Activity;
15 import android.os.Bundle;
16 import android.support.v4.content.Loader;
18 import com.cyngn.eleven.Config;
19 import com.cyngn.eleven.R;
20 import com.cyngn.eleven.loaders.LastAddedLoader;
21 import com.cyngn.eleven.model.Song;
22 import com.cyngn.eleven.sectionadapter.SectionCreator;
23 import com.cyngn.eleven.sectionadapter.SectionListContainer;
24 import com.cyngn.eleven.ui.activities.BaseActivity;
25 import com.cyngn.eleven.ui.fragments.ISetupActionBar;
26 import com.cyngn.eleven.utils.MusicUtils;
27 import com.cyngn.eleven.widgets.NoResultsContainer;
30 * This class is used to display all of the songs the user put on their device
31 * within the last four weeks.
33 * @author Andrew Neal (andrewdneal@gmail.com)
35 public class LastAddedFragment extends BasicSongFragment implements ISetupActionBar {
38 * LoaderCallbacks identifier
40 private static final int LOADER = 0;
46 public Loader<SectionListContainer<Song>> onCreateLoader(final int id, final Bundle args) {
47 LastAddedLoader loader = new LastAddedLoader(getActivity());
48 return new SectionCreator<Song>(getActivity(), loader, null);
52 public int getLoaderId() {
57 public void playAll(int position) {
58 MusicUtils.playSmartPlaylist(getActivity(), position,
59 Config.SmartPlaylistType.LastAdded);
63 public void setupNoResultsContainer(NoResultsContainer empty) {
64 super.setupNoResultsContainer(empty);
66 empty.setMainText(R.string.empty_last_added_main);
67 empty.setSecondaryText(R.string.empty_last_added);
71 public void setupActionBar() {
72 ((BaseActivity)getActivity()).setupActionBar(R.string.playlist_last_added);