Search in sources :

Example 1 with TrackList

use of io.recom.howabout.category.music.model.TrackList in project howabout-android by recomio.

the class HowaboutApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // initialze universal image loader.
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder().cacheInMemory().cacheOnDisc().build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).defaultDisplayImageOptions(defaultOptions).build();
    ImageLoader.getInstance().init(config);
    // saved playlist.
    String prefsName = getString(R.string.prefs_name);
    SharedPreferences prefs = getSharedPreferences(prefsName, 0);
    String trackListJson = prefs.getString("trackListJson", null);
    // initialize playlistAdapter to use globally.
    if (trackListJson == null) {
        playlistAdapter = new MusicPlaylistAdapter(this);
    } else {
        Gson gson = new Gson();
        TrackList trackList = gson.fromJson(trackListJson, TrackList.class);
        playlistAdapter = new MusicPlaylistAdapter(this, trackList);
    }
    MusicPlayerService.setPlaylistAdapter(playlistAdapter);
}
Also used : SharedPreferences(android.content.SharedPreferences) MusicPlaylistAdapter(io.recom.howabout.category.music.adapter.MusicPlaylistAdapter) TrackList(io.recom.howabout.category.music.model.TrackList) Gson(com.google.gson.Gson) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 Gson (com.google.gson.Gson)1 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)1 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)1 MusicPlaylistAdapter (io.recom.howabout.category.music.adapter.MusicPlaylistAdapter)1 TrackList (io.recom.howabout.category.music.model.TrackList)1