properly deselect active feed when going back in tablet mode
other layout-related fixes
This commit is contained in:
parent
c4c6a21ea0
commit
4101ecebee
@ -585,6 +585,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
|
|
||||||
public void setSelectedFeed(Feed feed) {
|
public void setSelectedFeed(Feed feed) {
|
||||||
m_selectedFeed = feed;
|
m_selectedFeed = feed;
|
||||||
|
m_adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -561,14 +561,17 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
private synchronized void refresh() {
|
private synchronized void refresh() {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
|
||||||
if (m_sessionId != null && date.getTime() - m_lastRefresh > 5000) {
|
boolean canRefresh = date.getTime() - m_lastRefresh > 5000;
|
||||||
|
|
||||||
|
if (m_sessionId != null) {
|
||||||
|
|
||||||
FeedsFragment ff = (FeedsFragment) getSupportFragmentManager()
|
FeedsFragment ff = (FeedsFragment) getSupportFragmentManager()
|
||||||
.findFragmentByTag(FRAG_FEEDS);
|
.findFragmentByTag(FRAG_FEEDS);
|
||||||
|
|
||||||
if (ff != null) {
|
if (ff != null) {
|
||||||
Log.d(TAG, "Refreshing feeds...");
|
Log.d(TAG, "Refreshing feeds...");
|
||||||
ff.refresh(true);
|
if (canRefresh) ff.refresh(true);
|
||||||
|
ff.setSelectedFeed(m_activeFeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager()
|
FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager()
|
||||||
@ -576,10 +579,11 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
|
|
||||||
if (cf != null) {
|
if (cf != null) {
|
||||||
Log.d(TAG, "Refreshing categories...");
|
Log.d(TAG, "Refreshing categories...");
|
||||||
cf.refresh(true);
|
if (canRefresh) cf.refresh(true);
|
||||||
|
cf.setSelectedCategory(m_activeCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastRefresh = date.getTime();
|
if (canRefresh) m_lastRefresh = date.getTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1024,6 +1028,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
ft.replace(R.id.headlines_fragment, new DummyFragment(), "");
|
ft.replace(R.id.headlines_fragment, new DummyFragment(), "");
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
|
refresh();
|
||||||
|
|
||||||
initMainMenu();
|
initMainMenu();
|
||||||
} else if (m_activeCategory != null) {
|
} else if (m_activeCategory != null) {
|
||||||
closeCategory();
|
closeCategory();
|
||||||
@ -2303,33 +2309,36 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void closeFeed() {
|
private void closeFeed() {
|
||||||
if (m_smallScreenMode && m_activeFeed != null) {
|
if (m_activeFeed != null) {
|
||||||
if (m_activeFeed.is_cat) {
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
|
||||||
|
|
||||||
Fragment headlines = getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
if (m_smallScreenMode) {
|
||||||
FeedCategoriesFragment cats = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
if (m_activeFeed.is_cat) {
|
||||||
|
|
||||||
ft.show(cats);
|
Fragment headlines = getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
ft.remove(headlines);
|
FeedCategoriesFragment cats = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
||||||
|
|
||||||
cats.setSelectedCategory(null);
|
ft.show(cats);
|
||||||
|
ft.remove(headlines);
|
||||||
|
|
||||||
//ft.replace(R.id.fragment_container, new FeedCategoriesFragment(), FRAG_CATS);
|
//cats.setSelectedCategory(null);
|
||||||
ft.commit();
|
|
||||||
|
//ft.replace(R.id.fragment_container, new FeedCategoriesFragment(), FRAG_CATS);
|
||||||
|
} else {
|
||||||
|
Fragment headlines = getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
FeedsFragment feeds = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
||||||
|
|
||||||
|
ft.show(feeds);
|
||||||
|
ft.remove(headlines);
|
||||||
|
|
||||||
|
//feeds.setSelectedFeed(null);
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
|
||||||
|
|
||||||
Fragment headlines = getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
Fragment headlines = getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
FeedsFragment feeds = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
|
||||||
|
|
||||||
ft.show(feeds);
|
|
||||||
ft.remove(headlines);
|
ft.remove(headlines);
|
||||||
|
|
||||||
feeds.setSelectedFeed(null);
|
|
||||||
|
|
||||||
ft.commit();
|
|
||||||
}
|
}
|
||||||
|
ft.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_activeFeed = null;
|
m_activeFeed = null;
|
||||||
@ -2337,6 +2346,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
initMainMenu();
|
initMainMenu();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1490,6 +1490,7 @@ public class OfflineActivity extends FragmentActivity implements
|
|||||||
ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
|
ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
|
||||||
ft.add(R.id.fragment_container, frag, FRAG_ARTICLE);
|
ft.add(R.id.fragment_container, frag, FRAG_ARTICLE);
|
||||||
} else {
|
} else {
|
||||||
|
findViewById(R.id.feeds_fragment).setVisibility(getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE);
|
||||||
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
|
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
|
||||||
ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE);
|
ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user