use of org.moire.ultrasonic.domain.PodcastsChannel in project ultrasonic by ultrasonic.
the class PodcastsChannelsAdapter method getView.
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
PodcastsChannel entry = getItem(position);
TextView view;
if (convertView != null && convertView instanceof PlaylistView) {
view = (TextView) convertView;
} else {
view = (TextView) layoutInflater.inflate(R.layout.podcasts_channel_item, parent, false);
}
view.setText(entry.getTitle());
return view;
}
use of org.moire.ultrasonic.domain.PodcastsChannel in project ultrasonic by ultrasonic.
the class PodcastsActivity method load.
private void load() {
BackgroundTask<List<PodcastsChannel>> task = new TabActivityBackgroundTask<List<PodcastsChannel>>(this, true) {
@Override
protected List<PodcastsChannel> doInBackground() throws Throwable {
MusicService musicService = MusicServiceFactory.getMusicService(PodcastsActivity.this);
List<PodcastsChannel> channels = musicService.getPodcastsChannels(false, PodcastsActivity.this, this);
/* TODO c'est quoi ce nettoyage de cache ?
if (!Util.isOffline(PodcastsActivity.this))
new CacheCleaner(PodcastsActivity.this, getDownloadService()).cleanPlaylists(playlists);
*/
return channels;
}
@Override
protected void done(List<PodcastsChannel> result) {
channelItemsListView.setAdapter(new PodcastsChannelsAdapter(currentActivity, result));
emptyTextView.setVisibility(result.isEmpty() ? View.VISIBLE : View.GONE);
}
};
task.execute();
}
use of org.moire.ultrasonic.domain.PodcastsChannel in project ultrasonic by ultrasonic.
the class PodcastsActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
this.currentActivity = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.podcasts);
emptyTextView = findViewById(R.id.select_podcasts_empty);
channelItemsListView = (ListView) findViewById(R.id.podcasts_channels_items_list);
channelItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
PodcastsChannel pc = (PodcastsChannel) parent.getItemAtPosition(position);
if (pc == null) {
return;
}
Intent intent = new Intent(currentContext, SelectAlbumActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_PODCAST_CHANNEL_ID, pc.getId());
startActivityForResultWithoutTransition(PodcastsActivity.this, intent);
}
});
load();
}
Aggregations