diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml index 72f05555..e20a2912 100644 --- a/res/menu/main_menu.xml +++ b/res/menu/main_menu.xml @@ -7,7 +7,7 @@ = 0); } + private class RootTabListener implements ActionBar.TabListener { + + @Override + public void onTabReselected(Tab arg0, + android.app.FragmentTransaction arg1) { + // TODO Auto-generated method stub + + } + + @Override + public void onTabSelected(Tab arg0, android.app.FragmentTransaction arg1) { + // TODO Auto-generated method stub + + } + + @Override + public void onTabUnselected(Tab arg0, + android.app.FragmentTransaction arg1) { + // TODO Auto-generated method stub + + } + + } + + private class CategoryTabListener implements ActionBar.TabListener { + + private FeedCategory m_cat = null; + + public CategoryTabListener(FeedCategory cat) { + m_cat = cat; + } + + @Override + public void onTabReselected(Tab tab, + android.app.FragmentTransaction _ft) { + // TODO Auto-generated method stub + + } + + @Override + public void onTabSelected(Tab tab, android.app.FragmentTransaction _ft) { + if (m_cat != null) { + m_activeCategory = m_cat; + + initMainMenu(); + + findViewById(R.id.cats_fragment).setVisibility(View.GONE); + findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE); + + FeedsFragment frag = new FeedsFragment(); + + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + ft.replace(R.id.feeds_fragment, frag); + ft.commit(); + } + } + + @Override + public void onTabUnselected(Tab tab, + android.app.FragmentTransaction _ft) { + + findViewById(R.id.feeds_fragment).setVisibility(View.GONE); + findViewById(R.id.cats_fragment).setVisibility(View.VISIBLE); + + m_activeCategory = null; + + initMainMenu(); + refreshCategories(); + } + } } \ No newline at end of file