[Android] don't use deprecated getWidth & getHeight + remove unused imports
Sébastien Toque
git at videolan.org
Fri Jun 22 07:04:57 CEST 2012
android | branch: master | Sébastien Toque <xilasz at gmail.com> | Fri Jun 22 06:41:56 2012 +0200| [8c0f8fa1756c629ced6ee4f8cfc40ec6532dfb36] | committer: Sébastien Toque
don't use deprecated getWidth & getHeight + remove unused imports
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=8c0f8fa1756c629ced6ee4f8cfc40ec6532dfb36
---
.../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, 20 insertions(+), 19 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index 2dcd9e5..e139812 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -18,9 +18,7 @@ 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 b195625..fe2e48d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -21,20 +21,16 @@
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 048949a..030be9a 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,9 +64,10 @@ public class AudioPlayerActivity extends Activity implements IAudioPlayer {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- android.view.Display display = getWindowManager().getDefaultDisplay();
- int width = display.getWidth();
- int height = display.getHeight();
+ Point size = new Point();
+ getWindowManager().getDefaultDisplay().getSize(size);
+ int width = size.x;
+ int height = size.y;
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 6408bbf..c39f51f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoActivity.java
@@ -33,6 +33,7 @@ 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;
@@ -108,8 +109,9 @@ public class MediaInfoActivity extends ListActivity {
mHandler.sendEmptyMessage(NEW_TEXT);
if (mImage == null) {
- int width = Math.min(getWindowManager().getDefaultDisplay().getWidth(),
- getWindowManager().getDefaultDisplay().getHeight());
+ Point size = new Point();
+ getWindowManager().getDefaultDisplay().getSize(size);
+ int width = Math.min(size.x, size.y);
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 a591f43..5f46acb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -48,6 +48,7 @@ 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;
@@ -421,8 +422,10 @@ public class VideoPlayerActivity extends Activity {
private void changeSurfaceSize() {
// get screen size
- int dw = getWindowManager().getDefaultDisplay().getWidth();
- int dh = getWindowManager().getDefaultDisplay().getHeight();
+ Point size = new Point();
+ getWindowManager().getDefaultDisplay().getSize(size);
+ int dw = size.x;
+ int dh = size.y;
// calculate aspect ratio
double ar = (double) mVideoWidth / (double) mVideoHeight;
@@ -479,10 +482,11 @@ public class VideoPlayerActivity extends Activity {
@Override
public boolean onTouchEvent(MotionEvent event) {
- if (mAudioDisplayRange == 0)
- mAudioDisplayRange = Math.min(
- getWindowManager().getDefaultDisplay().getWidth(),
- getWindowManager().getDefaultDisplay().getHeight());
+ if (mAudioDisplayRange == 0) {
+ Point size = new Point();
+ getWindowManager().getDefaultDisplay().getSize(size);
+ mAudioDisplayRange = Math.min(size.x, size.y);
+ }
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 d24eb29..5c2798a 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.FILL_PARENT));
+ ViewGroup.LayoutParams.MATCH_PARENT));
mScroller = new Scroller(context);
ViewConfiguration config = ViewConfiguration.get(getContext());
More information about the Android
mailing list