diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-12-05 10:36:09 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-12-19 19:47:38 +0100 |
commit | 120db7ae7e7edf0716cbdebfac024f96a0888d40 (patch) | |
tree | 1919ffd10eed3f2a9074dd9601fd62d0d83a1461 /app/src/main/java/de | |
parent | bba448aa69d6d974d3ef19cee02d57f3861fd4cd (diff) | |
download | AntennaPod-120db7ae7e7edf0716cbdebfac024f96a0888d40.zip |
Replaced tabs with viewpager indicators
Tabs are not supported when using Toolbars
Diffstat (limited to 'app/src/main/java/de')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java | 58 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java | 57 |
2 files changed, 3 insertions, 112 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java index 5a71cb36b..712db1421 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java @@ -1,19 +1,16 @@ package de.danoeh.antennapod.fragment; -import android.app.Activity; import android.content.res.Resources; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; -import android.support.v7.app.ActionBar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; + import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.MainActivity; /** * Shows the CompletedDownloadsFragment and the RunningDownloadsFragment @@ -27,7 +24,6 @@ public class DownloadsFragment extends Fragment { public static final int POS_LOG = 2; private ViewPager pager; - private MainActivity activity; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -36,42 +32,6 @@ public class DownloadsFragment extends Fragment { pager = (ViewPager) root.findViewById(R.id.pager); DownloadsPagerAdapter pagerAdapter = new DownloadsPagerAdapter(getChildFragmentManager(), getResources()); pager.setAdapter(pagerAdapter); - final ActionBar actionBar = activity.getMainActivtyActionBar(); - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - ActionBar.TabListener tabListener = new ActionBar.TabListener() { - @Override - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - pager.setCurrentItem(tab.getPosition()); - } - - @Override - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - - } - - @Override - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - - } - }; - actionBar.removeAllTabs(); - actionBar.addTab(actionBar.newTab() - .setText(R.string.downloads_running_label) - .setTabListener(tabListener)); - actionBar.addTab(actionBar.newTab() - .setText(R.string.downloads_completed_label) - .setTabListener(tabListener)); - actionBar.addTab(actionBar.newTab() - .setText(R.string.downloads_log_label) - .setTabListener(tabListener)); - - pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override - public void onPageSelected(int position) { - super.onPageSelected(position); - actionBar.setSelectedNavigationItem(position); - } - }); return root; } @@ -84,24 +44,8 @@ public class DownloadsFragment extends Fragment { } } - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - this.activity = (MainActivity) activity; - } - - @Override - public void onDetach() { - super.onDetach(); - activity.getMainActivtyActionBar().removeAllTabs(); - activity.getMainActivtyActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); - } - public class DownloadsPagerAdapter extends FragmentPagerAdapter { - - - Resources resources; public DownloadsPagerAdapter(FragmentManager fm, Resources resources) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java index ec8f69368..45b2403c8 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java @@ -1,85 +1,32 @@ package de.danoeh.antennapod.fragment.gpodnet; -import android.app.Activity; import android.content.res.Resources; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; -import android.support.v7.app.ActionBar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; + import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.MainActivity; /** * Main navigation hub for gpodder.net podcast directory */ public class GpodnetMainFragment extends Fragment { - private ViewPager pager; - private MainActivity activity; - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(R.layout.pager_fragment, container, false); - pager = (ViewPager) root.findViewById(R.id.pager); + ViewPager pager = (ViewPager) root.findViewById(R.id.pager); GpodnetPagerAdapter pagerAdapter = new GpodnetPagerAdapter(getChildFragmentManager(), getResources()); pager.setAdapter(pagerAdapter); - final ActionBar actionBar = activity.getMainActivtyActionBar(); - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - ActionBar.TabListener tabListener = new ActionBar.TabListener() { - @Override - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - pager.setCurrentItem(tab.getPosition()); - } - - @Override - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - - } - - @Override - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - - } - }; - actionBar.removeAllTabs(); - actionBar.addTab(actionBar.newTab() - .setText(R.string.gpodnet_taglist_header) - .setTabListener(tabListener)); - actionBar.addTab(actionBar.newTab() - .setText(R.string.gpodnet_toplist_header) - .setTabListener(tabListener)); - actionBar.setTitle(R.string.gpodnet_main_label); - - pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override - public void onPageSelected(int position) { - super.onPageSelected(position); - actionBar.setSelectedNavigationItem(position); - } - }); return root; } - @Override - public void onDestroyView() { - super.onDestroyView(); - activity.getMainActivtyActionBar().removeAllTabs(); - activity.getMainActivtyActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); - } - - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - this.activity = (MainActivity) activity; - } - public class GpodnetPagerAdapter extends FragmentPagerAdapter { |