[Android] Revert "don't use deprecated getWidth & getHeight + remove unused imports"
Jean-Baptiste Kempf
git at videolan.org
Fri Jun 22 20:24:16 CEST 2012
android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jun 22 20:16:33 2012 +0200| [541fe4ca7311424a30423de068bf9dd0d07b3bb7] | committer: Jean-Baptiste Kempf
Revert "don't use deprecated getWidth & getHeight + remove unused imports"
This reverts commit 8c0f8fa1756c629ced6ee4f8cfc40ec6532dfb36.
This brokes totally video playback on 2.x
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=541fe4ca7311424a30423de068bf9dd0d07b3bb7
---
.../org/videolan/vlc/gui/DirectoryViewFragment.java | 2 ++
.../videolan/vlc/gui/audio/AudioBrowserFragment.java | 4 ++++
.../videolan/vlc/gui/audio/AudioPlayerActivity.java | 9 ++++-----
.../org/videolan/vlc/gui/video/MediaInfoActivity.java | 6 ++----
.../videolan/vlc/gui/video/VideoPlayerActivity.java | 16 ++++++----------
.../src/org/videolan/vlc/widget/FlingViewGroup.java | 2 +-
6 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index 4daa0a6..268039a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -17,7 +17,9 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
import android.widget.ListView;
+import android.widget.AdapterView.OnItemClickListener;
import com.actionbarsherlock.app.SherlockListFragment;
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index c9de90d..b83dd41 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -21,16 +21,20 @@
package org.videolan.vlc.gui.audio;
import java.io.File;
+import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.videolan.vlc.AudioServiceController;
+import org.videolan.vlc.LibVLC;
import org.videolan.vlc.Media;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
+import org.videolan.vlc.gui.video.VideoPlayerActivity;
import org.videolan.vlc.interfaces.ISortable;
import org.videolan.vlc.widget.FlingViewGroup;
import org.videolan.vlc.widget.FlingViewGroup.ViewSwitchListener;
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
index 030be9a..048949a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
@@ -27,8 +27,8 @@ import org.videolan.vlc.Util;
import org.videolan.vlc.interfaces.IAudioPlayer;
import android.app.Activity;
+import android.content.Intent;
import android.graphics.Bitmap;
-import android.graphics.Point;
import android.media.AudioManager;
import android.os.Bundle;
import android.util.Log;
@@ -64,10 +64,9 @@ public class AudioPlayerActivity extends Activity implements IAudioPlayer {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Point size = new Point();
- getWindowManager().getDefaultDisplay().getSize(size);
- int width = size.x;
- int height = size.y;
+ android.view.Display display = getWindowManager().getDefaultDisplay();
+ int width = display.getWidth();
+ int height = display.getHeight();
Log.v(TAG, "width = " + width + " : height = " + height);
if(width == 240 && height == 320) /* QVGA 2.7in */
setContentView(R.layout.audio_player_qvga);
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoActivity.java
index c39f51f..6408bbf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoActivity.java
@@ -33,7 +33,6 @@ import org.videolan.vlc.Util;
import android.app.ListActivity;
import android.content.Intent;
import android.graphics.Bitmap;
-import android.graphics.Point;
import android.graphics.Bitmap.Config;
import android.os.Bundle;
import android.os.Handler;
@@ -109,9 +108,8 @@ public class MediaInfoActivity extends ListActivity {
mHandler.sendEmptyMessage(NEW_TEXT);
if (mImage == null) {
- Point size = new Point();
- getWindowManager().getDefaultDisplay().getSize(size);
- int width = Math.min(size.x, size.y);
+ int width = Math.min(getWindowManager().getDefaultDisplay().getWidth(),
+ getWindowManager().getDefaultDisplay().getHeight());
int height = width * 9 / 16;
// Get the thumbnail.
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 7ceb249..b9e4084 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -49,7 +49,6 @@ import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
-import android.graphics.Point;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
@@ -413,10 +412,8 @@ public class VideoPlayerActivity extends Activity {
private void changeSurfaceSize() {
// get screen size
- Point size = new Point();
- getWindowManager().getDefaultDisplay().getSize(size);
- int dw = size.x;
- int dh = size.y;
+ int dw = getWindowManager().getDefaultDisplay().getWidth();
+ int dh = getWindowManager().getDefaultDisplay().getHeight();
// calculate aspect ratio
double ar = (double) mVideoWidth / (double) mVideoHeight;
@@ -473,11 +470,10 @@ public class VideoPlayerActivity extends Activity {
@Override
public boolean onTouchEvent(MotionEvent event) {
- if (mAudioDisplayRange == 0) {
- Point size = new Point();
- getWindowManager().getDefaultDisplay().getSize(size);
- mAudioDisplayRange = Math.min(size.x, size.y);
- }
+ if (mAudioDisplayRange == 0)
+ mAudioDisplayRange = Math.min(
+ getWindowManager().getDefaultDisplay().getWidth(),
+ getWindowManager().getDefaultDisplay().getHeight());
switch (event.getAction()) {
diff --git a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
index 5c2798a..d24eb29 100644
--- a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
+++ b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
@@ -51,7 +51,7 @@ public class FlingViewGroup extends ViewGroup {
super(context, attrs);
this.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.MATCH_PARENT));
+ ViewGroup.LayoutParams.FILL_PARENT));
mScroller = new Scroller(context);
ViewConfiguration config = ViewConfiguration.get(getContext());
More information about the Android
mailing list