Search in sources :

Example 1 with TopTracksLoader

use of com.wm.remusic.recent.TopTracksLoader in project remusic by aa112901.

the class RecentActivity method onCreate.

//接受歌曲播放变化和列表变化广播,刷新列表
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_recent);
    // initQuickControls();
    recentStore = RecentStore.getInstance(this);
    TopTracksLoader recentloader = new TopTracksLoader(this, TopTracksLoader.QueryType.RecentSongs);
    List<Song> recentsongs = SongLoader.getSongsForCursor(TopTracksLoader.getCursor());
    int songCountInt = recentsongs.size();
    mList = recentsongs;
    recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setPadding(0, CommonUtils.getStatusHeight(RecentActivity.this), 0, 0);
    setSupportActionBar(toolbar);
    final ActionBar ab = getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle("最近播放");
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    new loadSongs().execute("");
}
Also used : Song(com.wm.remusic.recent.Song) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TopTracksLoader(com.wm.remusic.recent.TopTracksLoader) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar)

Example 2 with TopTracksLoader

use of com.wm.remusic.recent.TopTracksLoader in project remusic by aa112901.

the class RecentFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_recent, container, false);
    TopTracksLoader recentloader = new TopTracksLoader(getActivity(), TopTracksLoader.QueryType.RecentSongs);
    List<Song> recentsongs = SongLoader.getSongsForCursor(TopTracksLoader.getCursor());
    int songCountInt = recentsongs.size();
    mList = recentsongs;
    recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(layoutManager);
    toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    toolbar.setPadding(0, CommonUtils.getStatusHeight(getActivity()), 0, 0);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle("最近播放");
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    new loadSongs().execute("");
    return view;
}
Also used : Song(com.wm.remusic.recent.Song) AppCompatActivity(android.support.v7.app.AppCompatActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) TopTracksLoader(com.wm.remusic.recent.TopTracksLoader) ActionBar(android.support.v7.app.ActionBar)

Aggregations

ActionBar (android.support.v7.app.ActionBar)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 Song (com.wm.remusic.recent.Song)2 TopTracksLoader (com.wm.remusic.recent.TopTracksLoader)2 AppCompatActivity (android.support.v7.app.AppCompatActivity)1