experimental: track selected feed/cat in phone mode
This commit is contained in:
parent
4fe7cacec8
commit
51dcfe817f
@ -425,7 +425,7 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
||||
public int getItemViewType(int position) {
|
||||
FeedCategory cat = items.get(position);
|
||||
|
||||
if (!m_activity.isSmallScreen() && m_selectedCat != null && cat.id == m_selectedCat.id) {
|
||||
if (/*!m_activity.isSmallScreen() &&*/ m_selectedCat != null && cat.id == m_selectedCat.id) {
|
||||
return VIEW_SELECTED;
|
||||
} else {
|
||||
return VIEW_NORMAL;
|
||||
@ -509,6 +509,9 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
||||
|
||||
FeedCategory cat = (FeedCategory)list.getItemAtPosition(position);
|
||||
|
||||
m_selectedCat = null;
|
||||
m_adapter.notifyDataSetChanged();
|
||||
|
||||
if (cat != null) {
|
||||
if (cat.id < 0) {
|
||||
m_activity.onCatSelected(cat, false);
|
||||
@ -516,9 +519,6 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
||||
m_activity.onCatSelected(cat);
|
||||
}
|
||||
|
||||
m_selectedCat = cat;
|
||||
|
||||
m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,9 +530,6 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
||||
m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public FeedCategory getSelectedCategory() {
|
||||
return m_selectedCat;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -458,9 +458,8 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
||||
}
|
||||
}
|
||||
|
||||
m_selectedFeed = feed;
|
||||
|
||||
m_adapter.notifyDataSetChanged();
|
||||
//m_selectedFeed = feed;
|
||||
//m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,7 +507,7 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
||||
public int getItemViewType(int position) {
|
||||
Feed feed = items.get(position);
|
||||
|
||||
if (!m_activity.isSmallScreen() && m_selectedFeed != null && feed.id == m_selectedFeed.id) {
|
||||
if (/*!m_activity.isSmallScreen() &&*/ m_selectedFeed != null && feed.id == m_selectedFeed.id) {
|
||||
return VIEW_SELECTED;
|
||||
} else {
|
||||
return VIEW_NORMAL;
|
||||
@ -645,4 +644,12 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectedfeed(Feed feed) {
|
||||
m_selectedFeed = feed;
|
||||
|
||||
if (m_adapter != null) {
|
||||
m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +242,11 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
||||
|
||||
public void onFeedSelected(Feed feed, final boolean selectedByUser) {
|
||||
|
||||
//ImageLoader.getInstance().clearMemoryCache();
|
||||
FeedsFragment ff = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
||||
|
||||
if (ff != null && ff.isAdded()) {
|
||||
ff.setSelectedfeed(feed);
|
||||
}
|
||||
|
||||
FragmentTransaction ft = getSupportFragmentManager()
|
||||
.beginTransaction();
|
||||
@ -256,7 +260,6 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
||||
|
||||
m_feedIsSelected = true;
|
||||
m_userFeedSelected = selectedByUser;
|
||||
//m_feedWasSelected = true;
|
||||
|
||||
if (m_drawerLayout != null) {
|
||||
m_drawerLayout.closeDrawers();
|
||||
@ -277,7 +280,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
||||
|
||||
if (!openAsFeed) {
|
||||
|
||||
if (fc != null) {
|
||||
if (fc != null && fc.isAdded()) {
|
||||
fc.setSelectedCategory(null);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user