From eae76193b4c38f3a87ae6b8adefc88b269ad1b54 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 3 Dec 2011 17:22:06 +0300 Subject: [PATCH] fix compatibility with cupcake, fix selection menu being displayed when logged out --- AndroidManifest.xml | 2 +- src/org/fox/ttrss/MainActivity.java | 65 +------------------------ src/org/fox/ttrss/TransitionHelper.java | 11 +++++ 3 files changed, 14 insertions(+), 64 deletions(-) create mode 100644 src/org/fox/ttrss/TransitionHelper.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index eb29d237..625100f9 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -3,7 +3,7 @@ package="org.fox.ttrss" android:versionCode="29" android:versionName="0.1.28"> - + diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 3974b5f8..1c05e758 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.Timer; import java.util.TimerTask; -import android.animation.LayoutTransition; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; @@ -26,9 +25,7 @@ import android.view.MenuItem; import android.view.View; import android.view.animation.AnimationUtils; import android.widget.AdapterView.AdapterContextMenuInfo; -import android.widget.ArrayAdapter; import android.widget.LinearLayout; -import android.widget.ListView; import android.widget.TextView; import com.google.gson.JsonElement; @@ -324,9 +321,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe Log.d(TAG, "m_compatMode=" + m_compatMode); if (!m_compatMode) { - LayoutTransition transitioner = new LayoutTransition(); - LinearLayout layout = (LinearLayout)findViewById(R.id.main); - layout.setLayoutTransition(transitioner); + new TransitionHelper((LinearLayout)findViewById(R.id.main)); } if (m_smallScreenMode) { @@ -829,65 +824,9 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe m_menu.setGroupVisible(R.id.menu_group_feeds, false); m_menu.setGroupVisible(R.id.menu_group_headlines, false); m_menu.setGroupVisible(R.id.menu_group_article, false); + m_menu.setGroupVisible(R.id.menu_group_headlines_selection, false); m_menu.setGroupVisible(R.id.menu_group_logged_out, true); } - - /* if (m_sessionId != null) { - m_menu.findItem(R.id.login).setVisible(false); - - m_menu.findItem(R.id.logout).setVisible(m_activeFeed == null && m_selectedArticle == null); - - if (m_selectedArticle != null) { - m_menu.findItem(R.id.close_article).setVisible(true); - m_menu.findItem(R.id.share_article).setVisible(true); - m_menu.findItem(R.id.toggle_marked).setVisible(true); - m_menu.findItem(R.id.toggle_published).setVisible(true); - m_menu.findItem(R.id.set_unread).setVisible(true); - - m_menu.findItem(R.id.update_feeds).setVisible(false); - m_menu.findItem(R.id.show_feeds).setVisible(false); - m_menu.findItem(R.id.back_to_categories).setVisible(false); - } else { - m_menu.findItem(R.id.close_article).setVisible(false); - m_menu.findItem(R.id.share_article).setVisible(false); - m_menu.findItem(R.id.toggle_marked).setVisible(false); - m_menu.findItem(R.id.toggle_published).setVisible(false); - m_menu.findItem(R.id.set_unread).setVisible(false); - - if (!m_smallScreenMode || m_activeFeed == null) { - m_menu.findItem(R.id.show_feeds).setVisible(true); - m_menu.findItem(R.id.update_feeds).setVisible(true); - } else { - m_menu.findItem(R.id.show_feeds).setVisible(false); - m_menu.findItem(R.id.update_feeds).setVisible(false); - } - - m_menu.findItem(R.id.back_to_categories).setVisible(m_activeCategory != null); - } - - if (!m_smallScreenMode) { - m_menu.findItem(R.id.load_more_articles).setVisible(m_activeFeed != null && m_canLoadMore); - m_menu.findItem(R.id.show_all_articles).setVisible(m_activeFeed != null); - } else { - m_menu.findItem(R.id.load_more_articles).setVisible(m_activeFeed != null && m_selectedArticle == null && m_canLoadMore && - (!m_enableCats || m_activeCategory != null)); - m_menu.findItem(R.id.show_all_articles).setVisible(m_activeFeed != null && m_selectedArticle == null); - } - - - - } else { - m_menu.findItem(R.id.login).setVisible(true); - - m_menu.findItem(R.id.logout).setVisible(false); - m_menu.findItem(R.id.close_article).setVisible(false); - m_menu.findItem(R.id.share_article).setVisible(false); - m_menu.findItem(R.id.load_more_articles).setVisible(false); - m_menu.findItem(R.id.back_to_categories).setVisible(false); - - m_menu.findItem(R.id.update_feeds).setVisible(false); - m_menu.findItem(R.id.show_feeds).setVisible(false); - } */ } } diff --git a/src/org/fox/ttrss/TransitionHelper.java b/src/org/fox/ttrss/TransitionHelper.java new file mode 100644 index 00000000..466602e6 --- /dev/null +++ b/src/org/fox/ttrss/TransitionHelper.java @@ -0,0 +1,11 @@ +package org.fox.ttrss; + +import android.animation.LayoutTransition; +import android.widget.LinearLayout; + +public class TransitionHelper { + public TransitionHelper(LinearLayout layout) { + LayoutTransition transitioner = new LayoutTransition(); + layout.setLayoutTransition(transitioner); + } +}