use of com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicFragment 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();
}
}
use of com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicFragment in project MusicDNA by harjot-oberai.
the class HomeActivity method onBackPressed.
// //////////////////////////////////////////////////////////////////////////////////////////////
/*
* Standard Activity methods
*/
@Override
public void onBackPressed() {
PlayerFragment plFrag = playerFragment;
LocalMusicViewPagerFragment flmFrag = (LocalMusicViewPagerFragment) fragMan.findFragmentByTag("local");
LocalMusicFragment lFrag = null;
if (flmFrag != null) {
lFrag = (LocalMusicFragment) flmFrag.getFragmentByPosition(0);
}
QueueFragment qFrag = (QueueFragment) fragMan.findFragmentByTag("queue");
EqualizerFragment eqFrag = (EqualizerFragment) fragMan.findFragmentByTag("equalizer");
ViewSavedDNA vsdFrag = (ViewSavedDNA) fragMan.findFragmentByTag("allSavedDNAs");
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else if (showCase != null && showCase.isShowing()) {
showCase.hide();
} else if (plFrag != null && plFrag.isShowcaseVisible()) {
plFrag.hideShowcase();
} else if (lFrag != null && lFrag.isShowcaseVisible()) {
lFrag.hideShowcase();
} else if (qFrag != null && qFrag.isShowcaseVisible()) {
qFrag.hideShowcase();
} else if (eqFrag != null && eqFrag.isShowcaseVisible()) {
eqFrag.hideShowcase();
} else if (vsdFrag != null && vsdFrag.isShowcaseVisible()) {
vsdFrag.hideShowcase();
} else if (isFullScreenEnabled) {
isFullScreenEnabled = false;
plFrag.bottomContainer.setVisibility(View.VISIBLE);
plFrag.seekBarContainer.setVisibility(View.VISIBLE);
plFrag.toggleContainer.setVisibility(View.VISIBLE);
plFrag.spToolbar.setVisibility(View.VISIBLE);
onFullScreen();
} else if (isEqualizerVisible) {
showPlayer2();
} else if (isQueueVisible) {
showPlayer3();
} else if (isPlayerVisible && !isPlayerTransitioning && playerFragment.smallPlayer != null) {
hidePlayer();
// showTabs();
isPlayerVisible = false;
} else if (isLocalVisible && flmFrag != null && flmFrag.searchBox != null && flmFrag.isSearchboxVisible) {
flmFrag.searchBox.setText("");
flmFrag.searchBox.setVisibility(View.INVISIBLE);
flmFrag.isSearchboxVisible = false;
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
flmFrag.searchIcon.setImageResource(R.drawable.ic_search);
flmFrag.fragTitle.setVisibility(View.VISIBLE);
} else if (!searchView.isIconified()) {
searchView.setQuery("", true);
searchView.setIconified(true);
new Thread(new CancelCall()).start();
if (localRecyclerContainer.getVisibility() == View.VISIBLE || streamRecyclerContainer.getVisibility() == View.VISIBLE) {
localRecyclerContainer.setVisibility(GONE);
streamRecyclerContainer.setVisibility(GONE);
}
} else if (localRecyclerContainer.getVisibility() == View.VISIBLE || streamRecyclerContainer.getVisibility() == View.VISIBLE) {
localRecyclerContainer.setVisibility(GONE);
streamRecyclerContainer.setVisibility(GONE);
} else {
if (isEditVisible) {
hideFragment("Edit");
} else if (isAlbumVisible) {
hideFragment("viewAlbum");
} else if (isArtistVisible) {
hideFragment("viewArtist");
} else {
if (isLocalVisible) {
hideFragment("local");
setTitle("Music DNA");
} else if (isQueueVisible) {
hideFragment("queue");
setTitle("Music DNA");
} else if (isStreamVisible) {
hideFragment("stream");
setTitle("Music DNA");
} else if (isPlaylistVisible) {
hideFragment("playlist");
setTitle("Music DNA");
} else if (isNewPlaylistVisible) {
hideFragment("newPlaylist");
setTitle("Music DNA");
} else if (isEqualizerVisible) {
finalSelectedTracks.clear();
hideFragment("equalizer");
setTitle("Music DNA");
} else if (isFavouriteVisible) {
hideFragment("favourite");
setTitle("Music DNA");
} else if (isAllPlaylistVisible) {
hideFragment("allPlaylists");
setTitle("Music DNA");
} else if (isFolderContentVisible) {
hideFragment("folderContent");
setTitle("Folders");
} else if (isAllFolderVisible) {
hideFragment("allFolders");
setTitle("Music DNA");
} else if (isAllSavedDnaVisisble) {
hideFragment("allSavedDNAs");
setTitle("Music DNA");
} else if (isSavedDNAVisible) {
hideFragment("savedDNA");
setTitle("Music DNA");
} else if (isRecentVisible) {
hideFragment("recent");
setTitle("Music DNA");
} else if (isAboutVisible) {
hideFragment("About");
setTitle("Settings");
} else if (isSettingsVisible) {
hideFragment("settings");
new SaveSettings().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
setTitle("Music DNA");
} else if (!isPlayerTransitioning) {
startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
}
}
}
}
use of com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicFragment in project MusicDNA by harjot-oberai.
the class HomeActivity method updateLocalList.
private void updateLocalList(String query) {
LocalMusicViewPagerFragment flmFrag = (LocalMusicViewPagerFragment) fragMan.findFragmentByTag("local");
LocalMusicFragment lFrag = null;
if (flmFrag != null)
lFrag = (LocalMusicFragment) flmFrag.getFragmentByPosition(0);
if (lFrag != null)
lFrag.hideShuffleFab();
if (!isLocalVisible)
localRecyclerContainer.setVisibility(View.VISIBLE);
finalLocalSearchResultList.clear();
for (int i = 0; i < localTrackList.size(); i++) {
LocalTrack lt = localTrackList.get(i);
String tmp1 = lt.getTitle().toLowerCase();
String tmp2 = query.toLowerCase();
if (tmp1.contains(tmp2)) {
finalLocalSearchResultList.add(lt);
}
}
if (!isLocalVisible && localsongsRecyclerView != null) {
if (finalLocalSearchResultList.size() == 0) {
localsongsRecyclerView.setVisibility(GONE);
localNothingText.setVisibility(View.VISIBLE);
} else {
localsongsRecyclerView.setVisibility(View.VISIBLE);
localNothingText.setVisibility(View.INVISIBLE);
}
(localsongsRecyclerView.getAdapter()).notifyDataSetChanged();
}
if (lFrag != null)
lFrag.updateAdapter();
if (query.equals("")) {
localRecyclerContainer.setVisibility(GONE);
}
if (query.equals("") && isLocalVisible) {
if (lFrag != null)
lFrag.showShuffleFab();
}
}
Aggregations