properly unmark categories when going back

This commit is contained in:
Andrew Dolgov 2012-01-24 14:04:45 +03:00
parent 5aaba5a070
commit c8a5161d4f
2 changed files with 19 additions and 1 deletions

View File

@ -337,4 +337,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
m_selectedCatId = cat.id; m_selectedCatId = cat.id;
m_adapter.notifyDataSetChanged(); m_adapter.notifyDataSetChanged();
} }
public void setSelectedCategoryId(int id) {
m_selectedCatId = id;
}
} }

View File

@ -764,6 +764,13 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
findViewById(R.id.feeds_fragment).setVisibility(View.GONE); findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
m_activeCategory = null; m_activeCategory = null;
FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager()
.findFragmentById(R.id.cats_fragment);
if (cf != null) {
cf.setSelectedCategoryId(0);
}
initMainMenu(); initMainMenu();
refreshCategories(); refreshCategories();
@ -794,12 +801,19 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
R.anim.slide_right)); R.anim.slide_right));
} }
if (m_activeFeed != null && m_activeFeed.is_cat) { if (m_activeFeed.is_cat) {
findViewById(R.id.cats_fragment) findViewById(R.id.cats_fragment)
.setVisibility(View.VISIBLE); .setVisibility(View.VISIBLE);
findViewById(R.id.headlines_fragment).setVisibility( findViewById(R.id.headlines_fragment).setVisibility(
View.GONE); View.GONE);
FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager()
.findFragmentById(R.id.cats_fragment);
if (cf != null) {
cf.setSelectedCategoryId(0);
}
refreshCategories(); refreshCategories();
} else { } else {
findViewById(R.id.feeds_fragment).setVisibility( findViewById(R.id.feeds_fragment).setVisibility(