@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_library); setTitle(R.string.title_activity_library); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Page adapter SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); ViewPager viewPager = (ViewPager) findViewById(R.id.container); viewPager.setAdapter(sectionsPagerAdapter); initActivityState(); // Media service Intent intent = new Intent(this, MediaService.class); startService(intent); // Tabs TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); // TODO: Attach a content observer to listen for MediaStore changes. // This will require changes to many components to deal with all the edge cases. // There may be some noise around this as it appears the observer is notified when // tracks are simply accessed. }
@Override public void onResume() { super.onResume(); // Playlist Manager m_playlistManager = new DBPlaylistManager(getContentResolver()); // MediaStore Playlists DBPlaylist.ListCreator playlistsTask = new DBPlaylist.ListCreator(getContentResolver(), m_playlistManager.getPlaylists()); playlistsTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); }