[Android] call setNavigationMode only if NavigationMode changes

Sébastien Toque git at videolan.org
Wed Jun 27 23:41:53 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Wed Jun 27 21:47:10 2012 +0200| [6150372b7cb3b64a54917bcfdd4da3bf646f9ddf] | committer: Sébastien Toque

call setNavigationMode only if NavigationMode changes
this prevents useless tab events

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=6150372b7cb3b64a54917bcfdd4da3bf646f9ddf
---

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 7d34443..d355030 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -302,7 +302,8 @@ public class MainActivity extends SherlockFragmentActivity {
         ft.setCustomAnimations(R.anim.anim_enter_bottom, 0);
 
         /* Remove existing tabs */
-        mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+        if (mActionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
+            mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
         /* Load directory view fragment */
         ft.attach(mDirectoryView);
         ft.commit();
@@ -315,7 +316,8 @@ public class MainActivity extends SherlockFragmentActivity {
         ft.setCustomAnimations(0, R.anim.anim_leave_bottom);
 
         /* Restore the tabs */
-        mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+        if (mActionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_TABS)
+            mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
         /* Remove the directory view from the tabs */
         ft.detach(mDirectoryView);
         ft.commit();



More information about the Android mailing list