diff options
author | Andrew Dolgov <[email protected]> | 2013-11-29 00:47:38 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-11-29 00:47:38 +0400 |
commit | 7bbbadee1ece513dd186e36854ecf1763b648032 (patch) | |
tree | 129fcad25ec0f7d6dcd05456e461e534541f3292 /src/org | |
parent | f0a29f9bcba46c09a750f19b715a730fcc74eb02 (diff) |
add ability to toggle headlines activity sidebar manually in landscape
on tablets
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/fox/ttrss/FeedsActivity.java | 2 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesActivity.java | 5 | ||||
-rw-r--r-- | src/org/fox/ttrss/OnlineActivity.java | 16 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineActivity.java | 11 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineFeedsActivity.java | 2 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java | 5 |
6 files changed, 37 insertions, 4 deletions
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 9c8a54bc..9682a31f 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -194,6 +194,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe m_menu.findItem(R.id.update_headlines).setVisible(false); } + m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false); + MenuItem item = m_menu.findItem(R.id.show_feeds); if (getUnreadOnly()) { diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java index 18b1eeff..e96f15a2 100644 --- a/src/org/fox/ttrss/HeadlinesActivity.java +++ b/src/org/fox/ttrss/HeadlinesActivity.java @@ -39,7 +39,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL GlobalState.getInstance().load(savedInstanceState); - if (isPortrait()) { + if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) { findViewById(R.id.headlines_fragment).setVisibility(View.GONE); } @@ -161,7 +161,8 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL //HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); - m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen()); + m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen()); + m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(!isPortrait() && !isSmallScreen()); ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 8d856cd9..d82c92cf 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -18,6 +18,7 @@ import org.jsoup.nodes.Document; import org.jsoup.select.Elements; import uk.co.senab.actionbarpulltorefresh.extras.actionbarsherlock.PullToRefreshAttacher; +import android.animation.ObjectAnimator; import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.Dialog; @@ -36,11 +37,13 @@ import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; +import android.support.v4.app.FragmentTransaction; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.Window; import android.widget.EditText; +import android.widget.FrameLayout; import android.widget.SearchView; import android.widget.TextView; @@ -641,6 +644,19 @@ public class OnlineActivity extends CommonActivity { /* case android.R.id.home: finish(); return true; */ + case R.id.headlines_toggle_sidebar: + if (true && !isSmallScreen()) { + View v = findViewById(R.id.headlines_fragment); + + if (v != null) { + SharedPreferences.Editor editor = m_prefs.edit(); + editor.putBoolean("headlines_hide_sidebar", !m_prefs.getBoolean("headlines_hide_sidebar", false)); + editor.commit(); + + v.setVisibility(m_prefs.getBoolean("headlines_hide_sidebar", false) ? View.GONE : View.VISIBLE); + } + } + return true; case R.id.subscribe_to_feed: Intent subscribe = new Intent(OnlineActivity.this, SubscribeActivity.class); startActivityForResult(subscribe, 0); diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index 756e49c0..c879b0b1 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -267,6 +267,17 @@ public class OfflineActivity extends CommonActivity { /* case android.R.id.home: finish(); return true; */ + case R.id.headlines_toggle_sidebar: + if (true && !isSmallScreen()) { + SharedPreferences.Editor editor = m_prefs.edit(); + editor.putBoolean("headlines_hide_sidebar", !m_prefs.getBoolean("headlines_hide_sidebar", false)); + editor.commit(); + + if (ohf != null && ohf.isAdded()) { + ohf.getView().setVisibility(m_prefs.getBoolean("headlines_hide_sidebar", false) ? View.GONE : View.VISIBLE); + } + } + return true; case R.id.go_online: switchOnline(); return true; diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java index 3d01530f..ac5ed128 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java @@ -215,6 +215,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); } + m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false); + MenuItem item = m_menu.findItem(R.id.show_feeds); if (getUnreadOnly()) { diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java index d3883879..644b7c61 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java @@ -39,7 +39,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); - if (isPortrait()) { + if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) { findViewById(R.id.headlines_fragment).setVisibility(View.GONE); } @@ -143,7 +143,8 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline //OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); - m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen()); + m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen()); + m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(!isPortrait() && !isSmallScreen()); Fragment af = getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); |