diff options
author | Andrew Dolgov <[email protected]> | 2012-09-18 15:17:39 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-09-18 15:17:39 +0400 |
commit | 46751e25b3b73c5b8cc5241033c4154ad469b7b7 (patch) | |
tree | 3ec10a5fa4adcbd237a0c1b245de5a6b82d7ab65 /src/org | |
parent | 62622642b8e70237e9d2fa677080e2f6ac26b8cd (diff) |
implement refreshing headlines in headlinesactivity
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/fox/ttrss/ArticlePager.java | 7 | ||||
-rw-r--r-- | src/org/fox/ttrss/FeedsActivity.java | 15 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesActivity.java | 30 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesEventListener.java | 1 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 1 | ||||
-rw-r--r-- | src/org/fox/ttrss/OnlineActivity.java | 6 |
6 files changed, 45 insertions, 15 deletions
diff --git a/src/org/fox/ttrss/ArticlePager.java b/src/org/fox/ttrss/ArticlePager.java index f62087a0..6ba4a1ef 100644 --- a/src/org/fox/ttrss/ArticlePager.java +++ b/src/org/fox/ttrss/ArticlePager.java @@ -26,7 +26,7 @@ public class ArticlePager extends Fragment { private PagerAdapter m_adapter;
private HeadlinesEventListener m_onlineServices;
private Article m_article;
- private ArticleList m_articles;
+ private ArticleList m_articles = GlobalState.getInstance().m_loadedArticles;
private OnlineActivity m_activity;
private String m_searchQuery = "";
@@ -73,7 +73,6 @@ public class ArticlePager extends Fragment { View view = inflater.inflate(R.layout.article_pager, container, false);
if (savedInstanceState != null) {
- m_articles = savedInstanceState.getParcelable("articles");
m_article = savedInstanceState.getParcelable("article");
}
@@ -178,7 +177,6 @@ public class ArticlePager extends Fragment { public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out);
- out.putParcelable("articles", m_articles);
out.putParcelable("article", m_article);
}
@@ -188,8 +186,6 @@ public class ArticlePager extends Fragment { m_onlineServices = (HeadlinesEventListener)activity;
m_activity = (OnlineActivity)activity;
-
- m_articles = GlobalState.getInstance().m_loadedArticles;
}
@Override
@@ -212,5 +208,4 @@ public class ArticlePager extends Fragment { pager.setCurrentItem(position);
}
-
}
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 86c3dfae..6645a7ee 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -121,7 +121,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && hf.getSelectedArticles().size() == 0);
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, hf != null && hf.isAdded() && hf.getSelectedArticles().size() != 0);
- m_menu.findItem(R.id.update_headlines).setVisible(hf != null && hf.isAdded());
+ if (isSmallScreen()) {
+ m_menu.findItem(R.id.update_headlines).setVisible(hf != null && hf.isAdded());
+ } else {
+ m_menu.findItem(R.id.update_headlines).setVisible(false);
+ }
MenuItem item = m_menu.findItem(R.id.show_feeds);
@@ -204,9 +208,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe case R.id.update_feeds:
refresh();
return true;
- case R.id.update_headlines:
- refresh();
- return true;
default:
Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
return super.onOptionsItemSelected(item);
@@ -285,4 +286,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe super.catchupFeed(feed);
refresh();
}
+
+ @Override
+ public void onHeadlinesLoaded() {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java index b76a1a0e..0f92a487 100644 --- a/src/org/fox/ttrss/HeadlinesActivity.java +++ b/src/org/fox/ttrss/HeadlinesActivity.java @@ -71,6 +71,13 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL }
@Override
+ protected void refresh() {
+ super.refresh();
+
+
+ }
+
+ @Override
protected void loginSuccess() {
Log.d(TAG, "loginSuccess");
@@ -144,9 +151,6 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
af.setActiveArticle(article);
-
-// ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE);
-// ft.addToBackStack(null);
hf.notifyUpdated();
@@ -161,4 +165,24 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL initMenu();
}
+
+ @Override
+ public void onHeadlinesLoaded() {
+ HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
+
+ if (hf != null) {
+ Article article = hf.getAllArticles().get(0);
+
+ hf.setActiveArticle(article);
+
+ ArticlePager af = new ArticlePager(article);
+
+ FragmentTransaction ft = getSupportFragmentManager()
+ .beginTransaction();
+
+ ft.replace(R.id.article_fragment, af, FRAG_ARTICLE);
+
+ ft.commit();
+ }
+ }
}
diff --git a/src/org/fox/ttrss/HeadlinesEventListener.java b/src/org/fox/ttrss/HeadlinesEventListener.java index d286df17..71549ea1 100644 --- a/src/org/fox/ttrss/HeadlinesEventListener.java +++ b/src/org/fox/ttrss/HeadlinesEventListener.java @@ -7,4 +7,5 @@ public interface HeadlinesEventListener { void onArticleListSelectionChange(ArticleList m_selectedArticles);
void onArticleSelected(Article article);
void onArticleSelected(Article article, boolean open);
+ void onHeadlinesLoaded();
}
diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 6d1fe926..9cc1c41f 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -357,6 +357,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, super.onPostExecute(result);
m_refreshInProgress = false;
m_adapter.notifyDataSetChanged();
+ m_listener.onHeadlinesLoaded();
}
};
diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 8ecb08de..31da1d0a 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -664,7 +664,10 @@ public class OnlineActivity extends CommonActivity { if (ap != null && ap.getSelectedArticle() != null) {
editArticleLabels(ap.getSelectedArticle());
}
- return true;
+ return true;
+ case R.id.update_headlines:
+ refresh();
+ return true;
default:
Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
return super.onOptionsItemSelected(item);
@@ -1079,7 +1082,6 @@ public class OnlineActivity extends CommonActivity { m_menu.findItem(R.id.set_labels).setEnabled(m_apiLevel >= 1);
m_menu.findItem(R.id.article_set_note).setEnabled(m_apiLevel >= 1);
- m_menu.findItem(R.id.update_headlines).setVisible(false);
MenuItem search = m_menu.findItem(R.id.search);
search.setEnabled(m_apiLevel >= 2);
|