diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-06-23 16:19:53 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-06-23 16:19:53 +0200 |
commit | b7f9d066b91fc5efe7e471ae080e885be649e1df (patch) | |
tree | a38ddf27e10f66172cd9c6f3af11410ce3879a76 /src/de/podfetcher/fragment | |
parent | 3608ba18b68830f9bd65b0970ba85a4a3a1d5d44 (diff) | |
download | AntennaPod-b7f9d066b91fc5efe7e471ae080e885be649e1df.zip |
Moved Feedmenu into separate file
Diffstat (limited to 'src/de/podfetcher/fragment')
-rw-r--r-- | src/de/podfetcher/fragment/FeedItemlistFragment.java | 6 | ||||
-rw-r--r-- | src/de/podfetcher/fragment/FeedlistFragment.java | 43 |
2 files changed, 25 insertions, 24 deletions
diff --git a/src/de/podfetcher/fragment/FeedItemlistFragment.java b/src/de/podfetcher/fragment/FeedItemlistFragment.java index d8be380fe..e01065c6f 100644 --- a/src/de/podfetcher/fragment/FeedItemlistFragment.java +++ b/src/de/podfetcher/fragment/FeedItemlistFragment.java @@ -24,6 +24,7 @@ import de.podfetcher.storage.DownloadRequester; import de.podfetcher.util.FeedItemMenuHandler; public class FeedItemlistFragment extends SherlockListFragment { + @Override public void onViewCreated(View view, Bundle savedInstanceState) { this.getListView().setItemsCanFocus(true); @@ -127,5 +128,10 @@ public class FeedItemlistFragment extends SherlockListFragment { return true; } }; + + public FeedItemlistAdapter getListAdapter() { + return fila; + } + } diff --git a/src/de/podfetcher/fragment/FeedlistFragment.java b/src/de/podfetcher/fragment/FeedlistFragment.java index aecaa7165..2b42c8548 100644 --- a/src/de/podfetcher/fragment/FeedlistFragment.java +++ b/src/de/podfetcher/fragment/FeedlistFragment.java @@ -7,6 +7,7 @@ import de.podfetcher.adapter.FeedlistAdapter; import de.podfetcher.asynctask.FeedRemover; import de.podfetcher.storage.DownloadRequester; import de.podfetcher.service.DownloadService; +import de.podfetcher.util.FeedMenuHandler; import android.os.Bundle; import android.app.Activity; import android.view.View; @@ -57,20 +58,17 @@ public class FeedlistFragment extends SherlockListFragment { manager = FeedManager.getInstance(); fla = new FeedlistAdapter(pActivity, 0, manager.getFeeds()); setListAdapter(fla); - } - - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); return inflater.inflate(R.layout.feedlist, container, false); - + } - + @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); @@ -89,7 +87,6 @@ public class FeedlistFragment extends SherlockListFragment { mActionMode = getSherlockActivity().startActionMode( mActionModeCallback); - } return true; } @@ -137,8 +134,7 @@ public class FeedlistFragment extends SherlockListFragment { @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { - MenuInflater inflater = mode.getMenuInflater(); - inflater.inflate(R.menu.feedlist, menu); + FeedMenuHandler.onCreateOptionsMenu(mode.getMenuInflater(), menu); mode.setTitle(selectedFeed.getTitle()); return true; } @@ -150,23 +146,22 @@ public class FeedlistFragment extends SherlockListFragment { @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - switch (item.getItemId()) { - case R.id.remove_item: - FeedRemover remover = new FeedRemover(getSherlockActivity()){ - @Override - protected void onPostExecute(Void result) { - super.onPostExecute(result); - fla.notifyDataSetChanged(); - } - }; - remover.execute(selectedFeed); - break; - case R.id.mark_all_read_item: - for (FeedItem feeditem : selectedFeed.getItems()) { - manager.markItemRead(getSherlockActivity(), feeditem, true); - } + if (FeedMenuHandler.onOptionsItemClicked(getSherlockActivity(), + item, selectedFeed)) { fla.notifyDataSetChanged(); - break; + } else { + switch (item.getItemId()) { + case R.id.remove_item: + FeedRemover remover = new FeedRemover(getSherlockActivity()) { + @Override + protected void onPostExecute(Void result) { + super.onPostExecute(result); + fla.notifyDataSetChanged(); + } + }; + remover.execute(selectedFeed); + break; + } } mode.finish(); return true; |