[Android] Fix menudrawer being removed from view hierarchy
Geoffrey Métais
git at videolan.org
Thu Oct 30 15:29:16 CET 2014
vlc-ports/android | branch: 1.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct 30 10:33:58 2014 +0100| [fd4f527da433309009b642783d8e8dc756073372] | committer: Geoffrey Métais
Fix menudrawer being removed from view hierarchy
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=fd4f527da433309009b642783d8e8dc756073372
---
vlc-android/res/layout/audio_player_tips.xml | 1 +
vlc-android/res/layout/audio_playlist_tips.xml | 1 +
.../src/org/videolan/vlc/gui/MainActivity.java | 20 +++++++-------------
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/vlc-android/res/layout/audio_player_tips.xml b/vlc-android/res/layout/audio_player_tips.xml
index 850f67a..148931f 100644
--- a/vlc-android/res/layout/audio_player_tips.xml
+++ b/vlc-android/res/layout/audio_player_tips.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/audio_tips"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent_white"
diff --git a/vlc-android/res/layout/audio_playlist_tips.xml b/vlc-android/res/layout/audio_playlist_tips.xml
index c3396d5..7694c12 100644
--- a/vlc-android/res/layout/audio_playlist_tips.xml
+++ b/vlc-android/res/layout/audio_playlist_tips.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/audio_tips"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent_white"
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 7d1321e..f4052a9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -71,11 +71,11 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
-import android.support.v4.widget.DrawerLayout.LayoutParams;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.InputType;
import android.util.Log;
+import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -88,9 +88,7 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.ProgressBar;
-import android.widget.RelativeLayout;
import android.widget.TextView;
-import android.view.KeyEvent;
public class MainActivity extends ActionBarActivity {
public final static String TAG = "VLC/MainActivity";
@@ -896,14 +894,6 @@ public class MainActivity extends ActionBarActivity {
mRootContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
removeTipViewIfDisplayed();
mAudioPlayer.showAudioPlayerTips();
- /*
- * TODO proper resolution of this bug
- * Drawer listview disappears when audio player is displayed
- * Here we restore it, this is just a workaround...
- */
- if (findViewById(R.id.sidelist) == null){
- mRootContainer.addView(mListView);
- }
}
@Override
@@ -959,7 +949,11 @@ public class MainActivity extends ActionBarActivity {
* Remove the current tip view if there is one displayed.
*/
public void removeTipViewIfDisplayed() {
- if (mRootContainer.getChildCount() > 1)
- mRootContainer.removeViewAt(1);
+ if (mRootContainer.getChildCount() > 2){
+ for (int i = 0 ; i< mRootContainer.getChildCount() ; ++i){
+ if (mRootContainer.getChildAt(i).getId() == R.id.audio_tips)
+ mRootContainer.removeViewAt(i);
+ }
+ }
}
}
More information about the Android
mailing list