/** Method to get the recent music asynchronously */ public void getRecentMusic() { if (!Utilities.deviceOnline(context) || working) return; dismissButtonRefresh(); showProgressBar(); deleteItems(); // starts the thread getRecentMusic(0, 30); }
/** It searches asynchronously the music by one or two keys */ public void searchMusicByKey(String key1, String key2) { if (working) return; dismissButtonRefresh(); userInput.add(0, key1); userInput.add(1, key2); showProgressBar(); deleteItems(); // starts the thread searchMusicByKey(key1, key2, 30); }
/** * Start the filter search asynchronously. The bundle contains alla the users input. We pass all * the info to DownloadService service to start to download the images. */ public void startFilterSearch(Bundle bundle) { if (!Utilities.deviceOnline(context) || working) return; dismissButtonRefresh(); musicAdapter.setLoadingType(3); showProgressBar(); deleteItems(); DownloadResultReceiver resultReceiver = new DownloadResultReceiver(new Handler()); resultReceiver.setReceiver(this); Intent intent = new Intent(Intent.ACTION_SYNC, null, context, DownloadService.class); // query info intent.putExtra(MUSIC_RECEIVER, resultReceiver); intent.putExtra(FilterMusicFragment.ARTIST, bundle.getString(FilterMusicFragment.ARTIST)); intent.putExtra(FilterMusicFragment.TITLE, bundle.getString(FilterMusicFragment.TITLE)); intent.putExtra(FilterMusicFragment.GENRE, bundle.getString(FilterMusicFragment.GENRE)); intent.putExtra(FilterMusicFragment.PER_PAGE, bundle.getString(FilterMusicFragment.PER_PAGE)); getActivity().startService(intent); }