Search in sources :

Example 1 with PodcastsChannel

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;
}
Also used : PodcastsChannel(org.moire.ultrasonic.domain.PodcastsChannel) TextView(android.widget.TextView) NonNull(android.support.annotation.NonNull)

Example 2 with PodcastsChannel

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();
}
Also used : TabActivityBackgroundTask(org.moire.ultrasonic.util.TabActivityBackgroundTask) PodcastsChannelsAdapter(org.moire.ultrasonic.view.PodcastsChannelsAdapter) PodcastsChannel(org.moire.ultrasonic.domain.PodcastsChannel) MusicService(org.moire.ultrasonic.service.MusicService) List(java.util.List)

Example 3 with PodcastsChannel

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();
}
Also used : PodcastsChannel(org.moire.ultrasonic.domain.PodcastsChannel) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

PodcastsChannel (org.moire.ultrasonic.domain.PodcastsChannel)3 Intent (android.content.Intent)1 NonNull (android.support.annotation.NonNull)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 List (java.util.List)1 MusicService (org.moire.ultrasonic.service.MusicService)1 TabActivityBackgroundTask (org.moire.ultrasonic.util.TabActivityBackgroundTask)1 PodcastsChannelsAdapter (org.moire.ultrasonic.view.PodcastsChannelsAdapter)1