Skip to content

Commit 85ec5bb

Browse files
committed
android: fix minor java warnings
1 parent c24ef70 commit 85ec5bb

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

flutter_vlc_player/android/src/main/java/software/solid/fluttervlcplayer/Enums/DataSourceType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
public enum DataSourceType {
44
ASSET,
55
NETWORK,
6-
FILE;
6+
FILE
77
}

flutter_vlc_player/android/src/main/java/software/solid/fluttervlcplayer/Enums/HwAcc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ public enum HwAcc {
44
AUTOMATIC,
55
DISABLED,
66
DECODING,
7-
FULL;
7+
FULL
88
}

flutter_vlc_player/android/src/main/java/software/solid/fluttervlcplayer/FlutterVlcPlayerFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import android.content.Context;
44

5+
import androidx.annotation.NonNull;
6+
57
import io.flutter.plugin.common.BinaryMessenger;
68
import io.flutter.plugin.common.StandardMessageCodec;
79
import io.flutter.plugin.platform.PlatformView;
@@ -23,7 +25,7 @@ public interface KeyForAssetAndPackageName {
2325
private final KeyForAssetFn keyForAsset;
2426
private final KeyForAssetAndPackageName keyForAssetAndPackageName;
2527
//
26-
private FlutterVlcPlayerBuilder flutterVlcPlayerBuilder;
28+
private final FlutterVlcPlayerBuilder flutterVlcPlayerBuilder;
2729

2830
public FlutterVlcPlayerFactory(BinaryMessenger messenger, TextureRegistry textureRegistry, KeyForAssetFn keyForAsset, KeyForAssetAndPackageName keyForAssetAndPackageName) {
2931
super(StandardMessageCodec.INSTANCE);
@@ -35,6 +37,7 @@ public FlutterVlcPlayerFactory(BinaryMessenger messenger, TextureRegistry textur
3537
flutterVlcPlayerBuilder = new FlutterVlcPlayerBuilder();
3638
}
3739

40+
@NonNull
3841
@Override
3942
public PlatformView create(Context context, int viewId, Object args) {
4043
// Map<String, Object> params = (Map<String, Object>) args;

flutter_vlc_player/android/src/main/java/software/solid/fluttervlcplayer/QueuingEventSink.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
final class QueuingEventSink implements EventChannel.EventSink {
1717
private EventChannel.EventSink delegate;
18-
private ArrayList<Object> eventQueue = new ArrayList<>();
18+
private final ArrayList<Object> eventQueue = new ArrayList<>();
1919
private boolean done = false;
2020

2121
public void setDelegate(EventChannel.EventSink delegate) {

flutter_vlc_player/android/src/main/java/software/solid/fluttervlcplayer/VLCTextureView.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import android.view.View;
1010
import android.view.ViewGroup;
1111

12+
import androidx.annotation.NonNull;
13+
1214
import org.videolan.libvlc.MediaPlayer;
1315
import org.videolan.libvlc.interfaces.IVLCVout;
1416

@@ -98,7 +100,7 @@ private void updateSurfaceTexture() {
98100
}
99101

100102
@Override
101-
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
103+
public void onSurfaceTextureAvailable(@NonNull SurfaceTexture surface, int width, int height) {
102104
if (mSurfaceTexture == null || mSurfaceTexture.isReleased()) {
103105
mSurfaceTexture = surface;
104106

@@ -127,12 +129,12 @@ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int hei
127129
}
128130

129131
@Override
130-
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
132+
public void onSurfaceTextureSizeChanged(@NonNull SurfaceTexture surface, int width, int height) {
131133
setSize(width, height);
132134
}
133135

134136
@Override
135-
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
137+
public boolean onSurfaceTextureDestroyed(@NonNull SurfaceTexture surface) {
136138
if (mMediaPlayer != null) {
137139
wasPlaying = mMediaPlayer.isPlaying();
138140
}
@@ -150,7 +152,7 @@ public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
150152
}
151153

152154
@Override
153-
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
155+
public void onSurfaceTextureUpdated(@NonNull SurfaceTexture surface) {
154156

155157
}
156158

@@ -176,24 +178,21 @@ public void updateLayoutSize(View view) {
176178
}
177179

178180
private void setSize(int width, int height) {
179-
int mVideoWidth = 0;
180-
int mVideoHeight = 0;
181-
mVideoWidth = width;
182-
mVideoHeight = height;
183-
if (mVideoWidth * mVideoHeight <= 1) return;
181+
if (width * height <= 1) return;
184182

185183
// Screen size
186184
int w = this.getWidth();
187185
int h = this.getHeight();
188186

189187
// Size
188+
// TODO: fix this always false condition, it seems to reverse the width and height
190189
if (w > h && w < h) {
191190
int i = w;
192191
w = h;
193192
h = i;
194193
}
195194

196-
float videoAR = (float) mVideoWidth / (float) mVideoHeight;
195+
float videoAR = (float) width / (float) height;
197196
float screenAR = (float) w / (float) h;
198197

199198
if (screenAR < videoAR) {

0 commit comments

Comments
 (0)