use of io.recom.howabout.category.music.adapter.MusicPlaylistAdapter in project howabout-android by recomio.
the class MusicBottomBarFragment method onDestroy.
@Override
public void onDestroy() {
HowaboutApplication application = (HowaboutApplication) getActivity().getApplication();
MusicPlaylistAdapter playlistAdapter = application.getPlaylistAdapter();
playlistAdapter.unregisterDataSetObserver(playlistObserver);
super.onDestroy();
}
use of io.recom.howabout.category.music.adapter.MusicPlaylistAdapter in project howabout-android by recomio.
the class MusicBottomBarFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_music_bottom_bar, container, false);
rootView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), MusicPlaylistActivity.class);
Bundle bundle = new Bundle();
intent.putExtras(bundle);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
}
});
imageView = (ImageView) rootView.findViewById(R.id.image);
trackTitle = (TextView) rootView.findViewById(R.id.trackTitle);
artistName = (TextView) rootView.findViewById(R.id.artistName);
isLoading = (ProgressBar) rootView.findViewById(R.id.isLoading);
isPlaying = (ImageView) rootView.findViewById(R.id.isPlaying);
isPlaying.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HowaboutApplication application = (HowaboutApplication) getActivity().getApplication();
MusicPlaylistAdapter playlistAdapter = application.getPlaylistAdapter();
playlistAdapter.playPauseToggle();
}
});
playlistObserver = new DataSetObserver() {
@Override
public void onChanged() {
updateTrack();
}
@Override
public void onInvalidated() {
updateTrack();
}
};
HowaboutApplication application = (HowaboutApplication) getActivity().getApplication();
MusicPlaylistAdapter playlistAdapter = application.getPlaylistAdapter();
playlistAdapter.registerDataSetObserver(playlistObserver);
return rootView;
}
use of io.recom.howabout.category.music.adapter.MusicPlaylistAdapter 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);
}
Aggregations