summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-06-25 09:47:43 +0400
committerAndrew Dolgov <[email protected]>2012-06-25 09:47:43 +0400
commit9cdc2262d4bc62c449c70c64c1788c43a9e6a60d (patch)
treed4a6151eb3b93669af11faa71ff9c999318bce0a
parent41f36b00d2a2551dbdc0d969af6ea8f58fb4e613 (diff)
support GB title in offline mode
-rw-r--r--src/org/fox/ttrss/offline/OfflineActivity.java164
1 files changed, 86 insertions, 78 deletions
diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java
index 8f2a3413..513b0f6d 100644
--- a/src/org/fox/ttrss/offline/OfflineActivity.java
+++ b/src/org/fox/ttrss/offline/OfflineActivity.java
@@ -916,88 +916,17 @@ public class OfflineActivity extends CommonActivity implements
m_headlinesActionMode.finish();
}
- if (!isCompatMode()) {
+ if (android.os.Build.VERSION.SDK_INT >= 14) {
+ ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider();
- /* if (m_activeFeedId != 0) {
- if (!m_activeFeedIsCat) {
- Cursor feed = getFeedById(m_activeFeedId);
-
- if (feed != null) {
- getActionBar().setTitle(feed.getString(feed.getColumnIndex("title")));
- }
- } else {
- Cursor cat = getCatById(m_activeFeedId);
-
- if (cat != null) {
- getActionBar().setTitle(cat.getString(cat.getColumnIndex("title")));
- }
- }
- } else if (m_activeCatId != -1) {
- Cursor cat = getCatById(m_activeCatId);
-
- if (cat != null) {
- getActionBar().setTitle(cat.getString(cat.getColumnIndex("title")));
- }
-
- } else {
- getActionBar().setTitle(R.string.app_name);
- } */
-
- m_navigationAdapter.clear();
-
- if (m_activeCatId != -1 || (m_activeFeedId != 0 && isSmallScreen())) {
- getActionBar().setDisplayShowTitleEnabled(false);
- getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
-
- m_navigationAdapter.add(new RootNavigationEntry(getString(R.string.app_name)));
-
- if (m_activeCatId != -1) {
- Cursor cat = getCatById(m_activeCatId);
- String title = cat.getString(cat.getColumnIndex("title"));
- m_navigationAdapter.add(new CategoryNavigationEntry(m_activeCatId, title));
- cat.close();
- }
-
- if (m_activeFeedId != 0) {
- Cursor feed = null;
- if (m_activeFeedIsCat) {
- feed = getCatById(m_activeFeedId);
- } else {
- feed = getFeedById(m_activeFeedId);
- }
- String title = feed.getString(feed.getColumnIndex("title"));
- m_navigationAdapter.add(new FeedNavigationEntry(m_activeFeedId, title));
- feed.close();
- }
-
- //if (m_selectedArticle != null)
- // m_navigationAdapter.add(new ArticleNavigationEntry(m_selectedArticle));
-
- getActionBar().setSelectedNavigationItem(getActionBar().getNavigationItemCount());
-
- } else {
- getActionBar().setDisplayShowTitleEnabled(true);
- getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
- getActionBar().setTitle(R.string.app_name);
- }
-
- if (isSmallScreen()) {
- getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticleId != 0 || m_activeFeedId != 0 || m_activeCatId != -1);
- } else {
- getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticleId != 0 || m_activeCatId != -1);
- }
-
- if (android.os.Build.VERSION.SDK_INT >= 14) {
- ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider();
-
- if (m_selectedArticleId != 0) {
- Log.d(TAG, "setting up share provider");
- shareProvider.setShareIntent(getShareIntent(getArticleById(m_selectedArticleId)));
- }
+ if (m_selectedArticleId != 0) {
+ Log.d(TAG, "setting up share provider");
+ shareProvider.setShareIntent(getShareIntent(getArticleById(m_selectedArticleId)));
}
-
}
}
+
+ updateTitle();
}
@Override
@@ -1465,4 +1394,83 @@ public class OfflineActivity extends CommonActivity implements
public boolean activeFeedIsCat() {
return m_activeFeedIsCat;
}
+
+ private void updateTitle() {
+ if (!isCompatMode()) {
+
+ m_navigationAdapter.clear();
+
+ if (m_activeCatId != -1 || (m_activeFeedId != 0 && isSmallScreen())) {
+ getActionBar().setDisplayShowTitleEnabled(false);
+ getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
+
+ m_navigationAdapter.add(new RootNavigationEntry(getString(R.string.app_name)));
+
+ if (m_activeCatId != -1) {
+ Cursor cat = getCatById(m_activeCatId);
+ String title = cat.getString(cat.getColumnIndex("title"));
+ m_navigationAdapter.add(new CategoryNavigationEntry(m_activeCatId, title));
+ cat.close();
+ }
+
+ if (m_activeFeedId != 0) {
+ Cursor feed = null;
+ if (m_activeFeedIsCat) {
+ feed = getCatById(m_activeFeedId);
+ } else {
+ feed = getFeedById(m_activeFeedId);
+ }
+ String title = feed.getString(feed.getColumnIndex("title"));
+ m_navigationAdapter.add(new FeedNavigationEntry(m_activeFeedId, title));
+ feed.close();
+ }
+
+ //if (m_selectedArticle != null)
+ // m_navigationAdapter.add(new ArticleNavigationEntry(m_selectedArticle));
+
+ getActionBar().setSelectedNavigationItem(getActionBar().getNavigationItemCount());
+
+ } else {
+ getActionBar().setDisplayShowTitleEnabled(true);
+ getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ getActionBar().setTitle(R.string.app_name);
+ }
+
+ if (isSmallScreen()) {
+ getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticleId != 0 || m_activeFeedId != 0 || m_activeCatId != -1);
+ } else {
+ getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticleId != 0 || m_activeCatId != -1);
+ }
+
+ } else {
+ if (m_activeFeedId != 0) {
+ if (!m_activeFeedIsCat) {
+ Cursor feed = getFeedById(m_activeFeedId);
+
+ if (feed != null) {
+ setTitle(feed.getString(feed.getColumnIndex("title")));
+ feed.close();
+ }
+ } else {
+ Cursor cat = getCatById(m_activeFeedId);
+
+ if (cat != null) {
+ setTitle(cat.getString(cat.getColumnIndex("title")));
+ cat.close();
+ }
+ }
+ } else if (m_activeCatId != -1) {
+ Cursor cat = getCatById(m_activeCatId);
+
+ if (cat != null) {
+ setTitle(cat.getString(cat.getColumnIndex("title")));
+ cat.close();
+ }
+
+ } else {
+ setTitle(R.string.app_name);
+ }
+
+ }
+ }
} \ No newline at end of file