[Android] Remove unnecessary global reference

Geoffrey Métais git at videolan.org
Thu Jan 5 10:16:31 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan  5 09:50:03 2017 +0100| [f3990363d74a773725bab44abe5c0076398e84a2] | committer: Geoffrey Métais

Remove unnecessary global reference

> https://code.videolan.org/videolan/vlc-android/commit/f3990363d74a773725bab44abe5c0076398e84a2
---

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java      | 4 ----
 vlc-android/src/org/videolan/vlc/gui/MainActivity.java              | 6 ++++--
 vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java         | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index c6cb5c3..93f1f0a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -39,7 +39,6 @@ import android.support.design.widget.AppBarLayout;
 import android.support.design.widget.BottomSheetBehavior;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
-import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.app.AppCompatDelegate;
 import android.support.v7.widget.Toolbar;
@@ -81,7 +80,6 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
     protected static final String ID_PREFERENCES = "preferences";
     protected static final String ID_ABOUT = "about";
 
-    protected ActionBar mActionBar;
     protected AppBarLayout mAppBarLayout;
     protected Toolbar mToolbar;
     protected AudioPlayer mAudioPlayer;
@@ -110,7 +108,6 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
 
         mToolbar = (Toolbar) findViewById(R.id.main_toolbar);
         setSupportActionBar(mToolbar);
-        mActionBar = getSupportActionBar();
         mAppBarLayout = (AppBarLayout) findViewById(R.id.appbar);
         mAppBarLayout.setExpanded(true);
 
@@ -247,7 +244,6 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
         }
         if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) {
             mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
-            mActionBar.collapseActionView();
         }
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 7e02a15..8f9915f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -50,6 +50,7 @@ import android.support.v4.app.FragmentTransaction;
 import android.support.v4.content.LocalBroadcastManager;
 import android.support.v4.view.GravityCompat;
 import android.support.v4.view.MenuItemCompat;
+import android.support.v7.app.ActionBar;
 import android.support.v7.app.ActionBarDrawerToggle;
 import android.support.v7.view.ActionMode;
 import android.support.v7.widget.SearchView;
@@ -273,8 +274,9 @@ public class MainActivity extends AudioPlayerContainerActivity implements Device
 
     @TargetApi(Build.VERSION_CODES.HONEYCOMB)
     private void prepareActionBar() {
-        mActionBar.setDisplayHomeAsUpEnabled(true);
-        mActionBar.setHomeButtonEnabled(true);
+        ActionBar actionBar = getSupportActionBar();
+        actionBar.setDisplayHomeAsUpEnabled(true);
+        actionBar.setHomeButtonEnabled(true);
     }
 
     @Override
diff --git a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
index 6c11454..0e4391a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
@@ -65,7 +65,7 @@ public class SecondaryActivity extends AudioPlayerContainerActivity {
         setContentView(R.layout.secondary);
 
         initAudioPlayerContainerActivity();
-        mActionBar.setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 
         if (getSupportFragmentManager().getFragments() == null) {
             String fragmentId = getIntent().getStringExtra(KEY_FRAGMENT);



More information about the Android mailing list