Commit 7cca7005 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf
Browse files

Remove context paramter from MediaLibrary.getInstance

parent e5a4789d
......@@ -98,7 +98,7 @@ public class MediaLibrary {
return false;
}
public static MediaLibrary getInstance(Context context) {
public static MediaLibrary getInstance() {
if (mInstance == null)
mInstance = new MediaLibrary();
return mInstance;
......
......@@ -331,7 +331,7 @@ public class MainActivity extends ActionBarActivity {
/* Load media items from database and storage */
if (mScanNeeded)
MediaLibrary.getInstance(this).loadMediaItems();
MediaLibrary.getInstance().loadMediaItems();
}
@Override
......@@ -398,9 +398,9 @@ public class MainActivity extends ActionBarActivity {
super.onPause();
/* Check for an ongoing scan that needs to be resumed during onResume */
mScanNeeded = MediaLibrary.getInstance(this).isWorking();
mScanNeeded = MediaLibrary.getInstance().isWorking();
/* Stop scanning for files */
MediaLibrary.getInstance(this).stop();
MediaLibrary.getInstance().stop();
/* Save the tab status in pref */
SharedPreferences.Editor editor = getSharedPreferences("MainActivity", MODE_PRIVATE).edit();
editor.putString("fragment", mCurrentFragment);
......@@ -639,7 +639,7 @@ public class MainActivity extends ActionBarActivity {
else if(mCurrentFragment != null && mCurrentFragment.equals("history"))
((HistoryFragment) getFragment(mCurrentFragment)).refresh();
else
MediaLibrary.getInstance(this).loadMediaItems(this, true);
MediaLibrary.getInstance().loadMediaItems(this, true);
break;
// Restore last playlist
case R.id.ml_menu_last_playlist:
......@@ -681,7 +681,7 @@ public class MainActivity extends ActionBarActivity {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == ACTIVITY_RESULT_PREFERENCES) {
if (resultCode == PreferencesActivity.RESULT_RESCAN)
MediaLibrary.getInstance(this).loadMediaItems(this, true);
MediaLibrary.getInstance().loadMediaItems(this, true);
else if (resultCode == PreferencesActivity.RESULT_RESTART) {
Intent intent = getIntent();
finish();
......
......@@ -20,7 +20,6 @@
package org.videolan.vlc.gui;
import java.lang.Override;
import java.util.ArrayList;
import java.util.Locale;
......@@ -105,7 +104,7 @@ public class SearchFragment extends ListFragment {
// set result adapter to the list
mResultAdapter.clear();
String[] keys = key.toString().split("\\s+");
ArrayList<Media> allItems = MediaLibrary.getInstance(getActivity()).getMediaItems();
ArrayList<Media> allItems = MediaLibrary.getInstance().getMediaItems();
int results = 0;
for (int i = 0; i < allItems.size(); i++) {
Media item = allItems.get(i);
......
......@@ -101,7 +101,7 @@ public class AudioAlbumsSongsFragment extends Fragment {
mSongsAdapter.setContextPopupMenuListener(mContextPopupMenuListener);
mAudioController = AudioServiceController.getInstance();
mMediaLibrary = MediaLibrary.getInstance(getActivity());
mMediaLibrary = MediaLibrary.getInstance();
}
@Override
......
......@@ -97,7 +97,7 @@ public class AudioBrowserFragment extends Fragment {
mAudioController = AudioServiceController.getInstance();
mMediaLibrary = MediaLibrary.getInstance(getActivity());
mMediaLibrary = MediaLibrary.getInstance();
mSongsAdapter = new AudioBrowserListAdapter(getActivity(), AudioBrowserListAdapter.ITEM_WITH_COVER);
mArtistsAdapter = new AudioBrowserListAdapter(getActivity(), AudioBrowserListAdapter.ITEM_WITH_COVER);
......@@ -375,7 +375,7 @@ public class AudioBrowserFragment extends Fragment {
};
private void updateLists() {
List<Media> audioList = MediaLibrary.getInstance(getActivity()).getAudioItems();
List<Media> audioList = MediaLibrary.getInstance().getAudioItems();
if (audioList.isEmpty())
mEmptyView.setVisibility(View.VISIBLE);
......
......@@ -101,7 +101,7 @@ public class MediaInfoFragment extends ListFragment {
public void setMediaLocation(String MRL) {
if (MRL == null)
return;
mItem = MediaLibrary.getInstance(getActivity()).getMediaItem(MRL);
mItem = MediaLibrary.getInstance().getMediaItem(MRL);
}
Runnable mLoadImage = new Runnable() {
......
......@@ -118,7 +118,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
mAudioController = AudioServiceController.getInstance();
mVideoAdapter = new VideoListAdapter(getActivity(), this);
mMediaLibrary = MediaLibrary.getInstance(getActivity());
mMediaLibrary = MediaLibrary.getInstance();
setListAdapter(mVideoAdapter);
/* Load the thumbnailer */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment