resolve 'no empty constructor' error

This commit is contained in:
Tom Hennen 2015-11-29 08:39:51 -05:00
parent 87daa77ce4
commit 2d32a39e8d
2 changed files with 12 additions and 6 deletions

View File

@ -11,7 +11,6 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
@ -23,7 +22,6 @@ import com.joanzapata.iconify.fonts.FontAwesomeIcons;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -58,9 +56,16 @@ public class EpisodesApplyActionFragment extends Fragment {
private int textColor;
public EpisodesApplyActionFragment(List<FeedItem> episodes) {
this.episodes = episodes;
this.idMap = new HashMap<>(episodes.size());
public EpisodesApplyActionFragment() {
this.episodes = new ArrayList<>();
this.idMap = new HashMap<>();
}
public void setEpisodes(List<FeedItem> episodes) {
this.episodes.clear();
this.episodes.addAll(episodes);
this.idMap.clear();
for(FeedItem episode : episodes) {
this.idMap.put(episode.getId(), episode);
}

View File

@ -257,7 +257,8 @@ public class ItemlistFragment extends ListFragment {
if (!FeedMenuHandler.onOptionsItemClicked(getActivity(), item, feed)) {
switch (item.getItemId()) {
case R.id.episode_actions:
Fragment fragment = new EpisodesApplyActionFragment(feed.getItems());
EpisodesApplyActionFragment fragment = new EpisodesApplyActionFragment();
fragment.setEpisodes(feed.getItems());
((MainActivity)getActivity()).loadChildFragment(fragment);
return true;
case R.id.remove_item: