[Android] kill some warnings
Sébastien Toque
git at videolan.org
Sat Aug 18 09:51:15 CEST 2012
vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat Aug 18 08:08:19 2012 +0200| [945685bbdff7556eaef57be1fe01489c654faaf8] | committer: Sébastien Toque
kill some warnings
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=945685bbdff7556eaef57be1fe01489c654faaf8
---
vlc-android/src/org/videolan/vlc/gui/MainActivity.java | 1 -
.../src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java | 10 +++++-----
.../src/org/videolan/vlc/gui/video/MediaInfoActivity.java | 6 ++++--
.../src/org/videolan/vlc/gui/video/VideoListAdapter.java | 2 --
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 2 +-
vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java | 2 +-
6 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index c3b430a..86b6be9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -48,7 +48,6 @@ import android.content.SharedPreferences.Editor;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
-import android.graphics.Color;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
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 61054af..b81d419 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
@@ -35,6 +35,7 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.os.Bundle;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
@@ -69,11 +70,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();
- Log.v(TAG, "width = " + width + " : height = " + height);
- if(width == 240 && height == 320) /* QVGA 2.7in */
+ DisplayMetrics screen = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(screen);
+ Log.v(TAG, "width = " + screen.widthPixels + " : height = " + screen.heightPixels);
+ if(screen.widthPixels == 240 && screen.heightPixels == 320) /* QVGA 2.7in */
setContentView(R.layout.audio_player_qvga);
else
setContentView(R.layout.audio_player);
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 1ac9d00..5406821 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoActivity.java
@@ -38,6 +38,7 @@ import android.graphics.Bitmap.Config;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.util.DisplayMetrics;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
@@ -113,8 +114,9 @@ public class MediaInfoActivity extends ListActivity {
mHandler.sendEmptyMessage(NEW_TEXT);
if (mImage == null) {
- int width = Math.min(getWindowManager().getDefaultDisplay().getWidth(),
- getWindowManager().getDefaultDisplay().getHeight());
+ DisplayMetrics screen = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(screen);
+ int width = Math.min(screen.widthPixels, screen.heightPixels);
int height = width * 9 / 16;
// Get the thumbnail.
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index 2defdd1..e5f01a5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -28,13 +28,11 @@ import org.videolan.vlc.R;
import org.videolan.vlc.Util;
import android.content.Context;
-import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
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 d8a901c..1de9b46 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -408,7 +408,7 @@ public class VideoPlayerActivity extends Activity {
private void lockScreen() {
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
- int rotation = display.getOrientation();
+ int rotation;
if (Build.VERSION.SDK_INT >= 8 /* Android 2.2 has getRotation */) {
try {
Method m = display.getClass().getDeclaredMethod("getRotation");
diff --git a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
index d45bf0a..c91d0d7 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