summaryrefslogtreecommitdiff
path: root/src/org/fox/ttrss/MainActivity.java
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>2011-11-28 12:45:19 +0300
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>2011-11-28 12:45:19 +0300
commitebb1253ddd886f6330ff85332763bb652c5101b9 (patch)
treec579252dd2c9d4df2c83c556da8032b6e59bdbc3 /src/org/fox/ttrss/MainActivity.java
parent9decf04ac355765ea74c3cbcb5c38c8a62ab552e (diff)
implement moving between articles
Diffstat (limited to 'src/org/fox/ttrss/MainActivity.java')
-rw-r--r--src/org/fox/ttrss/MainActivity.java55
1 files changed, 48 insertions, 7 deletions
diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java
index 08971d59..10beb477 100644
--- a/src/org/fox/ttrss/MainActivity.java
+++ b/src/org/fox/ttrss/MainActivity.java
@@ -148,6 +148,10 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
/** Called when the activity is first created. */
+ public boolean isSmallScreen() {
+ return m_smallScreenMode;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
m_prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
@@ -627,10 +631,21 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
}
}
- public void openArticle(Article article) {
+ public void openArticle(Article article, int compatAnimation) {
m_selectedArticle = article;
+ if (article.unread) {
+ article.unread = false;
+ saveArticleUnread(article);
+ }
+
initMainMenu();
+
+ HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
+
+ if (hf != null) {
+ hf.setActiveArticleId(article.id);
+ }
ArticleFragment frag = new ArticleFragment();
@@ -639,7 +654,10 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
ft.commit();
if (m_compatMode) {
- findViewById(R.id.main).setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_left));
+ if (compatAnimation == 0)
+ findViewById(R.id.main).setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_left));
+ else
+ findViewById(R.id.main).setAnimation(AnimationUtils.loadAnimation(this, compatAnimation));
}
if (m_smallScreenMode) {
@@ -652,11 +670,6 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
}
- @Override
- public void onArticleOpened(Article article) {
- openArticle(article);
- }
-
public Feed getActiveFeed() {
return m_activeFeed;
}
@@ -714,4 +727,32 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
setLoadingStatus(R.string.login_in_progress, true);
}
}
+
+ @Override
+ public Article getRelativeArticle(Article article, RelativeArticle ra) {
+ HeadlinesFragment frag = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
+ if (frag != null) {
+ ArticleList articles = frag.getAllArticles();
+ for (int i = 0; i < articles.size(); i++) {
+ Article a = articles.get(i);
+
+ if (a.id == article.id) {
+ if (ra == RelativeArticle.AFTER) {
+ try {
+ return articles.get(i+1);
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ } else {
+ try {
+ return articles.get(i-1);
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
} \ No newline at end of file