/* * Copyright 2010-2013 Eric Kok et al. * * Transdroid is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Transdroid is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Transdroid. If not, see . */ package org.transdroid.core.gui; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.Locale; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Click; import org.androidannotations.annotations.EFragment; import org.androidannotations.annotations.InstanceState; import org.androidannotations.annotations.ItemClick; import org.androidannotations.annotations.ViewById; import org.transdroid.R; import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.SystemSettings; import org.transdroid.core.gui.lists.TorrentsAdapter; import org.transdroid.core.gui.lists.TorrentsAdapter_; import org.transdroid.core.gui.navigation.Label; import org.transdroid.core.gui.navigation.NavigationFilter; import org.transdroid.core.gui.navigation.RefreshableActivity; import org.transdroid.core.gui.navigation.SelectionManagerMode; import org.transdroid.core.gui.navigation.SetLabelDialog; import org.transdroid.core.gui.navigation.SetLabelDialog.OnLabelPickedListener; import org.transdroid.daemon.Daemon; import org.transdroid.daemon.Torrent; import org.transdroid.daemon.TorrentsComparator; import org.transdroid.daemon.TorrentsSortBy; import android.app.Fragment; import android.view.ActionMode; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AbsListView.MultiChoiceModeListener; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; /** * Fragment that shows a list of torrents that are active on the server. It supports sorting and filtering and can show * connection progress and issues. However, actual task starting and execution and overall navigation elements are part * of the containing activity, not this fragment. * @author Eric Kok */ @EFragment(resName = "fragment_torrents") public class TorrentsFragment extends Fragment implements OnLabelPickedListener { // Local data @Bean protected ApplicationSettings applicationSettings; @Bean protected SystemSettings systemSettings; @InstanceState protected ArrayList torrents = null; @InstanceState protected ArrayList lastMultiSelectedTorrents; @InstanceState protected ArrayList