Skip to content
This repository was archived by the owner on Jul 20, 2021. It is now read-only.

Commit bb960a8

Browse files
committed
- Starting the switch to kotlin
1 parent 8885881 commit bb960a8

File tree

77 files changed

+2021
-2333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2021
-2333
lines changed

Diff for: app/build.gradle

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ android {
2020
}
2121

2222
dependencies {
23-
api fileTree(dir: 'libs', include: ['*.jar'])
24-
api project(path: ":bettervideoplayer")
25-
api "com.android.support:appcompat-v7:$project.googleAPIsVersion"
26-
api "com.android.support:support-compat:$project.googleAPIsVersion"
27-
api "com.android.support:support-v4:$project.googleAPIsVersion"
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
implementation project(path: ":bvpkotlin")
25+
implementation "androidx.appcompat:appcompat:1.0.2"
26+
implementation "androidx.core:core:1.0.1"
27+
implementation "com.google.android.material:material:1.1.0-alpha01"
28+
implementation 'org.jetbrains:annotations-java5:15.0'
2829
}

Diff for: app/src/main/AndroidManifest.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="com.halilibo.sample">
45

56
<uses-permission android:name="android.permission.INTERNET" />
@@ -9,7 +10,8 @@
910
android:icon="@mipmap/ic_launcher"
1011
android:label="@string/app_name"
1112
android:supportsRtl="true"
12-
android:theme="@style/AppTheme">
13+
android:theme="@style/AppTheme"
14+
tools:ignore="GoogleAppIndexingWarning">
1315
<activity android:name=".MainActivity">
1416
<intent-filter>
1517
<action android:name="android.intent.action.MAIN" />

Diff for: app/src/main/java/com/halilibo/sample/BackgroundActivity.java

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package com.halilibo.sample;
22

33
import android.net.Uri;
4-
import android.support.v7.app.AppCompatActivity;
54
import android.os.Bundle;
65
import android.view.View;
76
import android.widget.Toast;
87

9-
import com.halilibo.bettervideoplayer.BetterVideoCallback;
10-
import com.halilibo.bettervideoplayer.BetterVideoPlayer;
8+
import com.halilibo.bvpkotlin.BetterVideoPlayer;
9+
import com.halilibo.bvpkotlin.VideoCallback;
10+
11+
import org.jetbrains.annotations.NotNull;
12+
13+
import androidx.appcompat.app.AppCompatActivity;
1114

1215
public class BackgroundActivity extends AppCompatActivity {
1316

@@ -18,24 +21,24 @@ protected void onCreate(Bundle savedInstanceState) {
1821

1922
BetterVideoPlayer bvp = findViewById(R.id.bvp);
2023
bvp.setSource(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
21-
bvp.setCallback(new BetterVideoCallback() {
24+
bvp.setCallback(new VideoCallback() {
2225
@Override
23-
public void onStarted(BetterVideoPlayer player) {
26+
public void onStarted(@NotNull BetterVideoPlayer player) {
2427

2528
}
2629

2730
@Override
28-
public void onPaused(BetterVideoPlayer player) {
31+
public void onPaused(@NotNull BetterVideoPlayer player) {
2932

3033
}
3134

3235
@Override
33-
public void onPreparing(BetterVideoPlayer player) {
36+
public void onPreparing(@NotNull BetterVideoPlayer player) {
3437

3538
}
3639

3740
@Override
38-
public void onPrepared(BetterVideoPlayer player) {
41+
public void onPrepared(@NotNull BetterVideoPlayer player) {
3942
player.setVolume(0,0);
4043
}
4144

@@ -45,17 +48,17 @@ public void onBuffering(int percent) {
4548
}
4649

4750
@Override
48-
public void onError(BetterVideoPlayer player, Exception e) {
51+
public void onError(@NotNull BetterVideoPlayer player, Exception e) {
4952

5053
}
5154

5255
@Override
53-
public void onCompletion(BetterVideoPlayer player) {
56+
public void onCompletion(@NotNull BetterVideoPlayer player) {
5457

5558
}
5659

5760
@Override
58-
public void onToggleControls(BetterVideoPlayer player, boolean isShowing) {
61+
public void onToggleControls(@NotNull BetterVideoPlayer player, boolean isShowing) {
5962

6063
}
6164
});

Diff for: app/src/main/java/com/halilibo/sample/FullscreenActivity.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import android.annotation.SuppressLint;
44
import android.net.Uri;
5-
import android.support.v7.app.ActionBar;
6-
import android.support.v7.app.AppCompatActivity;
75
import android.os.Bundle;
86
import android.os.Handler;
97
import android.view.MotionEvent;
108
import android.view.View;
119

12-
import com.halilibo.bettervideoplayer.BetterVideoPlayer;
10+
import com.halilibo.bvpkotlin.BetterVideoPlayer;
11+
12+
import androidx.appcompat.app.ActionBar;
13+
import androidx.appcompat.app.AppCompatActivity;
1314

1415
/**
1516
* An example full-screen activity that shows and hides the system UI (i.e.
@@ -91,12 +92,12 @@ protected void onCreate(Bundle savedInstanceState) {
9192
setContentView(R.layout.activity_fullscreen);
9293

9394
mVisible = true;
94-
mBetterVideoPlayer = (BetterVideoPlayer) findViewById(R.id.bvp);
95+
mBetterVideoPlayer = findViewById(R.id.bvp);
9596
mBetterVideoPlayer.setSource(Uri.parse("android.resource://" + getPackageName() + "/" + com.halilibo.sample.R.raw.video));
9697

9798
mBetterVideoPlayer.getToolbar().setTitle("FullScreen Sample");
9899
mBetterVideoPlayer.getToolbar()
99-
.setNavigationIcon(android.support.v7.appcompat.R.drawable.abc_ic_ab_back_material);
100+
.setNavigationIcon(androidx.appcompat.R.drawable.abc_ic_ab_back_material);
100101
mBetterVideoPlayer.getToolbar().setNavigationOnClickListener(new View.OnClickListener() {
101102
@Override
102103
public void onClick(View v) {

Diff for: app/src/main/java/com/halilibo/sample/MainActivity.java

+20-18
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22

33
import android.content.Intent;
44
import android.net.Uri;
5-
import android.support.v4.content.ContextCompat;
6-
import android.support.v7.app.AppCompatActivity;
75
import android.os.Bundle;
8-
import android.support.v7.widget.Toolbar;
96
import android.view.MenuItem;
107
import android.view.View;
118

12-
import com.halilibo.bettervideoplayer.BetterVideoCallback;
13-
import com.halilibo.bettervideoplayer.BetterVideoPlayer;
14-
import com.halilibo.bettervideoplayer.subtitle.CaptionsView;
9+
import com.halilibo.bvpkotlin.BetterVideoPlayer;
10+
import com.halilibo.bvpkotlin.VideoCallback;
11+
import com.halilibo.bvpkotlin.captions.CaptionsView;
12+
13+
import org.jetbrains.annotations.NotNull;
14+
15+
import androidx.appcompat.app.AppCompatActivity;
16+
import androidx.appcompat.widget.Toolbar;
17+
import androidx.core.content.ContextCompat;
1518

1619
public class MainActivity extends AppCompatActivity {
1720

1821
private BetterVideoPlayer bvp;
19-
private String TAG = "BetterSample";
2022

2123
@Override
2224
protected void onCreate(Bundle savedInstanceState) {
@@ -41,8 +43,8 @@ public void onClick(View view) {
4143

4244
if(savedInstanceState == null) {
4345
bvp.setAutoPlay(true);
44-
bvp.setSource(Uri.parse("android.resource://" + getPackageName() + "/" + com.halilibo.sample.R.raw.video));
45-
bvp.setCaptions(R.raw.sub, CaptionsView.CMime.SUBRIP);
46+
bvp.setSource(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
47+
bvp.setCaptions(R.raw.sub, CaptionsView.SubMime.SUBRIP);
4648
}
4749

4850
bvp.setHideControlsOnPlay(true);
@@ -69,7 +71,7 @@ public boolean onMenuItemClick(MenuItem item) {
6971
bvp.setBottomProgressBarVisibility(false);
7072
break;
7173
case R.id.action_show_captions:
72-
bvp.setCaptions(R.raw.sub, CaptionsView.CMime.SUBRIP);
74+
bvp.setCaptions(R.raw.sub, CaptionsView.SubMime.SUBRIP);
7375
break;
7476
case R.id.action_hide_captions:
7577
bvp.removeCaptions();
@@ -80,24 +82,24 @@ public boolean onMenuItemClick(MenuItem item) {
8082

8183
bvp.enableSwipeGestures(getWindow());
8284

83-
bvp.setCallback(new BetterVideoCallback() {
85+
bvp.setCallback(new VideoCallback() {
8486
@Override
85-
public void onStarted(BetterVideoPlayer player) {
87+
public void onStarted(@NotNull BetterVideoPlayer player) {
8688
//Log.i(TAG, "Started");
8789
}
8890

8991
@Override
90-
public void onPaused(BetterVideoPlayer player) {
92+
public void onPaused(@NotNull BetterVideoPlayer player) {
9193
//Log.i(TAG, "Paused");
9294
}
9395

9496
@Override
95-
public void onPreparing(BetterVideoPlayer player) {
97+
public void onPreparing(@NotNull BetterVideoPlayer player) {
9698
//Log.i(TAG, "Preparing");
9799
}
98100

99101
@Override
100-
public void onPrepared(BetterVideoPlayer player) {
102+
public void onPrepared(@NotNull BetterVideoPlayer player) {
101103
//Log.i(TAG, "Prepared");
102104
}
103105

@@ -107,17 +109,17 @@ public void onBuffering(int percent) {
107109
}
108110

109111
@Override
110-
public void onError(BetterVideoPlayer player, Exception e) {
112+
public void onError(@NotNull BetterVideoPlayer player, Exception e) {
111113
//Log.i(TAG, "Error " +e.getMessage());
112114
}
113115

114116
@Override
115-
public void onCompletion(BetterVideoPlayer player) {
117+
public void onCompletion(@NotNull BetterVideoPlayer player) {
116118
//Log.i(TAG, "Completed");
117119
}
118120

119121
@Override
120-
public void onToggleControls(BetterVideoPlayer player, boolean isShowing) {
122+
public void onToggleControls(@NotNull BetterVideoPlayer player, boolean isShowing) {
121123

122124
}
123125
});

Diff for: app/src/main/res/layout/activity_background.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:bvp="http://schemas.android.com/apk/res-auto"
77
tools:context="com.halilibo.sample.BackgroundActivity">
88

9-
<com.halilibo.bettervideoplayer.BetterVideoPlayer
9+
<com.halilibo.bvpkotlin.BetterVideoPlayer
1010
android:id="@+id/bvp"
1111
android:layout_width="match_parent"
1212
android:layout_height="match_parent"

Diff for: app/src/main/res/layout/activity_fullscreen.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
android:background="#0099cc"
77
tools:context="com.halilibo.sample.FullscreenActivity">
88

9-
<com.halilibo.bettervideoplayer.BetterVideoPlayer
9+
<com.halilibo.bvpkotlin.BetterVideoPlayer
1010
android:id="@+id/bvp"
1111
android:layout_width="match_parent"
1212
android:layout_height="match_parent"

Diff for: app/src/main/res/layout/activity_main.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
android:configChanges="orientation|keyboardHidden|screenLayout|screenSize"
1212
tools:context="com.halilibo.sample.MainActivity">
1313

14-
<com.halilibo.bettervideoplayer.BetterVideoPlayer
14+
<com.halilibo.bvpkotlin.BetterVideoPlayer
1515
android:id="@+id/bvp"
1616
android:layout_width="wrap_content"
17-
android:layout_height="240dp"
17+
android:layout_height="220dp"
1818
bvp:bvp_autoPlay="true"
19-
bvp:bvp_captionColor="@android:color/holo_blue_light"
19+
bvp:bvp_captionColor="#e7e7e7"
2020
bvp:bvp_captionSize="20sp"
2121
bvp:bvp_hideControlsOnPlay="true"
2222
bvp:bvp_loadingStyle="RotatingPlane"

Diff for: bettervideoplayer/build.gradle

-63
This file was deleted.

Diff for: bettervideoplayer/proguard-rules.pro

-17
This file was deleted.

Diff for: bettervideoplayer/src/main/AndroidManifest.xml

-5
This file was deleted.

0 commit comments

Comments
 (0)