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) {
|
public int getItemViewType(int position) {
|
||||||
FeedCategory cat = items.get(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;
|
return VIEW_SELECTED;
|
||||||
} else {
|
} else {
|
||||||
return VIEW_NORMAL;
|
return VIEW_NORMAL;
|
||||||
@ -509,6 +509,9 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
|||||||
|
|
||||||
FeedCategory cat = (FeedCategory)list.getItemAtPosition(position);
|
FeedCategory cat = (FeedCategory)list.getItemAtPosition(position);
|
||||||
|
|
||||||
|
m_selectedCat = null;
|
||||||
|
m_adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
if (cat != null) {
|
if (cat != null) {
|
||||||
if (cat.id < 0) {
|
if (cat.id < 0) {
|
||||||
m_activity.onCatSelected(cat, false);
|
m_activity.onCatSelected(cat, false);
|
||||||
@ -516,9 +519,6 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
|||||||
m_activity.onCatSelected(cat);
|
m_activity.onCatSelected(cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_selectedCat = cat;
|
|
||||||
|
|
||||||
m_adapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -531,8 +531,5 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public FeedCategory getSelectedCategory() {
|
|
||||||
return m_selectedCat;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -458,9 +458,8 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_selectedFeed = feed;
|
//m_selectedFeed = feed;
|
||||||
|
//m_adapter.notifyDataSetChanged();
|
||||||
m_adapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +507,7 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
|||||||
public int getItemViewType(int position) {
|
public int getItemViewType(int position) {
|
||||||
Feed feed = items.get(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;
|
return VIEW_SELECTED;
|
||||||
} else {
|
} else {
|
||||||
return VIEW_NORMAL;
|
return VIEW_NORMAL;
|
||||||
@ -645,4 +644,12 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
|||||||
return null;
|
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) {
|
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()
|
FragmentTransaction ft = getSupportFragmentManager()
|
||||||
.beginTransaction();
|
.beginTransaction();
|
||||||
@ -256,7 +260,6 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
|||||||
|
|
||||||
m_feedIsSelected = true;
|
m_feedIsSelected = true;
|
||||||
m_userFeedSelected = selectedByUser;
|
m_userFeedSelected = selectedByUser;
|
||||||
//m_feedWasSelected = true;
|
|
||||||
|
|
||||||
if (m_drawerLayout != null) {
|
if (m_drawerLayout != null) {
|
||||||
m_drawerLayout.closeDrawers();
|
m_drawerLayout.closeDrawers();
|
||||||
@ -277,7 +280,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
|||||||
|
|
||||||
if (!openAsFeed) {
|
if (!openAsFeed) {
|
||||||
|
|
||||||
if (fc != null) {
|
if (fc != null && fc.isAdded()) {
|
||||||
fc.setSelectedCategory(null);
|
fc.setSelectedCategory(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user