Search in sources :

Example 1 with AlbumFragment

use of com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.AlbumFragment in project MusicDNA by harjot-oberai.

the class HomeActivity method updateAlbumList.

private void updateAlbumList(String query) {
    finalAlbums.clear();
    for (int i = 0; i < albums.size(); i++) {
        Album album = albums.get(i);
        String tmp1 = album.getName().toLowerCase();
        String tmp2 = query.toLowerCase();
        if (tmp1.contains(tmp2)) {
            finalAlbums.add(album);
        }
    }
    LocalMusicViewPagerFragment flmFrag = (LocalMusicViewPagerFragment) fragMan.findFragmentByTag("local");
    if (flmFrag != null) {
        AlbumFragment aFrag = (AlbumFragment) flmFrag.getFragmentByPosition(1);
        if (aFrag != null) {
            aFrag.updateAdapter();
        }
    }
}
Also used : LocalMusicViewPagerFragment(com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicViewPagerFragment) Album(com.sdsmdg.harjot.MusicDNA.models.Album) AlbumFragment(com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.AlbumFragment) ViewAlbumFragment(com.sdsmdg.harjot.MusicDNA.fragments.ViewAlbumFragment.ViewAlbumFragment) TextPaint(android.text.TextPaint)

Example 2 with AlbumFragment

use of com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.AlbumFragment in project MusicDNA by harjot-oberai.

the class HomeActivity method onEditSongSave.

////////////////////////////////////////////////////////////////////////////////////////////////
/*
     * EditSongFragment callbacks START
     * onEditSongSave() -> called when save is clicked to store edited fields.
     * deleteMediaStoreCache() -> used to delete the media store cache so that it is rebuilt and new album art is cached.
     * getNewBitmap() -> called to statr the image picker intent for album art.
     */
@Override
public void onEditSongSave(boolean wasSaveSuccessful) {
    hideFragment("Edit");
    if (!wasSaveSuccessful) {
        Toast.makeText(this, "Error occured while editing", Toast.LENGTH_SHORT).show();
        return;
    }
    MediaCacheUtils.updateMediaCache(editSong.getTitle(), editSong.getArtist(), editSong.getAlbum(), editSong.getId(), this);
    refreshAlbumAndArtists();
    if (isAlbumVisible) {
        hideFragment("viewAlbum");
    } else if (isArtistVisible) {
        hideFragment("viewArtist");
    }
    LocalMusicViewPagerFragment flmFrag = (LocalMusicViewPagerFragment) fragMan.findFragmentByTag("local");
    LocalMusicFragment lFrag = null;
    if (flmFrag != null) {
        lFrag = (LocalMusicFragment) flmFrag.getFragmentByPosition(0);
    }
    if (lFrag != null) {
        lFrag.updateAdapter();
    }
    ArtistFragment artFrag = null;
    if (flmFrag != null) {
        artFrag = (ArtistFragment) flmFrag.getFragmentByPosition(2);
    }
    if (artFrag != null) {
        artFrag.updateAdapter();
    }
    AlbumFragment albFrag = null;
    if (flmFrag != null) {
        albFrag = (AlbumFragment) flmFrag.getFragmentByPosition(1);
    }
    if (albFrag != null) {
        albFrag.updateAdapter();
    }
}
Also used : ViewArtistFragment(com.sdsmdg.harjot.MusicDNA.fragments.ViewArtistFragment.ViewArtistFragment) ArtistFragment(com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.ArtistFragment) LocalMusicViewPagerFragment(com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicViewPagerFragment) LocalMusicFragment(com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicFragment) AlbumFragment(com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.AlbumFragment) ViewAlbumFragment(com.sdsmdg.harjot.MusicDNA.fragments.ViewAlbumFragment.ViewAlbumFragment)

Aggregations

AlbumFragment (com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.AlbumFragment)2 LocalMusicViewPagerFragment (com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicViewPagerFragment)2 ViewAlbumFragment (com.sdsmdg.harjot.MusicDNA.fragments.ViewAlbumFragment.ViewAlbumFragment)2 TextPaint (android.text.TextPaint)1 ArtistFragment (com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.ArtistFragment)1 LocalMusicFragment (com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicFragment)1 ViewArtistFragment (com.sdsmdg.harjot.MusicDNA.fragments.ViewArtistFragment.ViewArtistFragment)1 Album (com.sdsmdg.harjot.MusicDNA.models.Album)1