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

Commit 8885881

Browse files
committed
Removed SpinKit
1 parent 51d8620 commit 8885881

File tree

19 files changed

+41
-189
lines changed

19 files changed

+41
-189
lines changed

.idea/markdown-navigator/profiles_settings.xml

-3
This file was deleted.

.idea/misc.xml

-34
This file was deleted.

.idea/modules.xml

-10
This file was deleted.

.idea/runConfigurations.xml

-12
This file was deleted.

app/build.gradle

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

2222
dependencies {
23-
implementation fileTree(dir: 'libs', include: ['*.jar'])
24-
implementation project(path: ":bettervideoplayer")
25-
implementation "com.android.support:appcompat-v7:$project.googleAPIsVersion"
26-
implementation "com.android.support:support-compat:$project.googleAPIsVersion"
27-
implementation "com.android.support:support-v4:$project.googleAPIsVersion"
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"
2828
}

app/src/main/java/com/halilibo/sample/MainActivity.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.content.Intent;
44
import android.net.Uri;
5+
import android.support.v4.content.ContextCompat;
56
import android.support.v7.app.AppCompatActivity;
67
import android.os.Bundle;
78
import android.support.v7.widget.Toolbar;
@@ -40,13 +41,14 @@ public void onClick(View view) {
4041

4142
if(savedInstanceState == null) {
4243
bvp.setAutoPlay(true);
43-
bvp.setSource(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
44+
bvp.setSource(Uri.parse("android.resource://" + getPackageName() + "/" + com.halilibo.sample.R.raw.video));
4445
bvp.setCaptions(R.raw.sub, CaptionsView.CMime.SUBRIP);
4546
}
4647

4748
bvp.setHideControlsOnPlay(true);
4849

4950
bvp.getToolbar().inflateMenu(R.menu.menu_dizi);
51+
bvp.getToolbar().setOverflowIcon(ContextCompat.getDrawable(this, R.drawable.ic_settings_white_24dp));
5052
bvp.getToolbar().setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
5153
@Override
5254
public boolean onMenuItemClick(MenuItem item) {
Loading
Loading
Loading
Loading
Loading

bettervideoplayer/build.gradle

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ dependencies {
2525
implementation "com.android.support:appcompat-v7:$project.googleAPIsVersion"
2626
implementation "com.android.support:support-compat:$project.googleAPIsVersion"
2727
implementation "com.android.support:design:$project.googleAPIsVersion"
28-
implementation 'me.zhanghai.android.materialprogressbar:library:1.1.7'
28+
implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'
2929
implementation 'org.adw.library:discrete-seekbar:1.0.1'
30-
implementation 'com.devbrackets.android:exomedia:3.0.1'
31-
implementation 'com.github.ybq:Android-SpinKit:1.1.0'
3230
}
3331

3432
// build a jar with source files

bettervideoplayer/src/main/java/com/halilibo/bettervideoplayer/BetterVideoPlayer.java

+10-90
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.animation.AnimatorListenerAdapter;
55
import android.annotation.TargetApi;
66
import android.content.Context;
7+
import android.content.res.ColorStateList;
78
import android.content.res.Resources;
89
import android.content.res.TypedArray;
910
import android.graphics.Color;
@@ -28,7 +29,6 @@
2829
import android.util.AttributeSet;
2930
import android.util.Log;
3031
import android.util.TypedValue;
31-
import android.view.GestureDetector;
3232
import android.view.LayoutInflater;
3333
import android.view.MotionEvent;
3434
import android.view.Surface;
@@ -44,28 +44,18 @@
4444
import android.widget.RelativeLayout;
4545
import android.widget.SeekBar;
4646
import android.widget.TextView;
47-
48-
import com.github.ybq.android.spinkit.SpinKitView;
49-
import com.github.ybq.android.spinkit.style.ChasingDots;
50-
import com.github.ybq.android.spinkit.style.Circle;
51-
import com.github.ybq.android.spinkit.style.CubeGrid;
52-
import com.github.ybq.android.spinkit.style.DoubleBounce;
53-
import com.github.ybq.android.spinkit.style.FadingCircle;
54-
import com.github.ybq.android.spinkit.style.Pulse;
55-
import com.github.ybq.android.spinkit.style.RotatingCircle;
56-
import com.github.ybq.android.spinkit.style.RotatingPlane;
57-
import com.github.ybq.android.spinkit.style.ThreeBounce;
58-
import com.github.ybq.android.spinkit.style.WanderingCubes;
59-
import com.github.ybq.android.spinkit.style.Wave;
6047
import com.halilibo.bettervideoplayer.subtitle.CaptionsView;
6148
import com.halilibo.bettervideoplayer.utility.EmptyCallback;
6249
import com.halilibo.bettervideoplayer.utility.Util;
6350

6451
import java.io.IOException;
6552
import java.lang.annotation.Retention;
6653
import java.lang.annotation.RetentionPolicy;
54+
import java.util.HashMap;
6755
import java.util.Map;
6856

57+
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
58+
6959
/**
7060
* @author Aidan Follestad
7161
* Modified and improved by Halil Ozercan
@@ -79,7 +69,7 @@ public class BetterVideoPlayer extends RelativeLayout implements IUserMethods,
7969
private static final String BETTER_VIDEO_PLAYER_BRIGHTNESS = "BETTER_VIDEO_PLAYER_BRIGHTNESS";
8070
private static final int UPDATE_INTERVAL = 100;
8171

82-
private SpinKitView mProgressBar;
72+
private MaterialProgressBar mProgressBar;
8373
private TextView mPositionTextView, viewForward, viewBackward;
8474

8575
private CaptionsView mSubView;
@@ -88,33 +78,12 @@ public class BetterVideoPlayer extends RelativeLayout implements IUserMethods,
8878
private String mTitle;
8979
private int mSubViewTextSize;
9080
private int mSubViewTextColor;
91-
private Context context;
9281

9382
/**
9483
* Window that hold the player. Necessary for setting brightness.
9584
*/
9685
private Window mWindow;
9786

98-
private static final int DOUBLE_BOUNCE = 0;
99-
private static final int ROTATING_PLANE = 1;
100-
private static final int WAVE = 2;
101-
private static final int WANDERING_CUBES = 3;
102-
private static final int PULSE = 4;
103-
private static final int CHASING_DOTS = 5;
104-
private static final int THREE_BOUNCE = 6;
105-
private static final int CIRCLE = 7;
106-
private static final int CUBE_GRID = 8;
107-
private static final int FADING_CIRCLE = 9;
108-
private static final int ROTATING_CIRCLE = 10;
109-
110-
@IntDef({DOUBLE_BOUNCE, ROTATING_PLANE, WAVE,
111-
WANDERING_CUBES, PULSE, CHASING_DOTS,
112-
THREE_BOUNCE, CIRCLE, CUBE_GRID,
113-
FADING_CIRCLE, ROTATING_CIRCLE})
114-
@Retention(RetentionPolicy.SOURCE)
115-
public @interface LoadingStyle {
116-
}
117-
11887
private static final int PLAY_BUTTON = 0;
11988
private static final int PAUSE_BUTTON = 1;
12089
private static final int RESTART_BUTTON = 2;
@@ -172,7 +141,7 @@ public BetterVideoPlayer(Context context, AttributeSet attrs, int defStyleAttr)
172141
private int viewVisibility;
173142

174143
private Uri mSource;
175-
private Map<String, String> headers;
144+
private Map<String, String> headers = new HashMap<>();
176145

177146
private BetterVideoCallback mCallback;
178147
private BetterVideoProgressCallback mProgressCallback;
@@ -189,15 +158,13 @@ public BetterVideoPlayer(Context context, AttributeSet attrs, int defStyleAttr)
189158
private int mGestureType = NO_GESTURE;
190159
private boolean mAutoPlay = false;
191160
private boolean mControlsDisabled = false;
192-
private int mLoadingStyle = CHASING_DOTS;
193161
private int mInitialPosition = -1;
194162
private int mHideControlsDuration = 2000; // defaults to 2 seconds.
195163
private int mDoubleTapSeekDuration;
196164

197165

198166
private void init(Context context, AttributeSet attrs) {
199167
setBackgroundColor(Color.BLACK);
200-
this.context = context;
201168
if (attrs != null) {
202169
TypedArray a = context.getTheme().obtainStyledAttributes(
203170
attrs,
@@ -219,8 +186,6 @@ private void init(Context context, AttributeSet attrs) {
219186
R.styleable.BetterVideoPlayer_bvp_pauseDrawable);
220187
mRestartDrawable = a.getDrawable(
221188
R.styleable.BetterVideoPlayer_bvp_restartDrawable);
222-
mLoadingStyle = a.getInt(
223-
R.styleable.SpinKitView_SpinKit_Style, 0);
224189
mHideControlsDuration = a.getInteger(
225190
R.styleable.BetterVideoPlayer_bvp_hideControlsDuration, mHideControlsDuration);
226191

@@ -245,7 +210,7 @@ private void init(Context context, AttributeSet attrs) {
245210
getResources().getDimensionPixelSize(R.dimen.bvp_subtitle_size));
246211
mSubViewTextColor = a.getColor(
247212
R.styleable.BetterVideoPlayer_bvp_captionColor,
248-
ContextCompat.getColor(context, R.color.bvp_subtitle_color));
213+
getResources().getColor(R.color.bvp_subtitle_color));
249214

250215
} catch (Exception e) {
251216
LOG("Exception " + e.getMessage());
@@ -255,7 +220,7 @@ private void init(Context context, AttributeSet attrs) {
255220
}
256221
} else {
257222
mSubViewTextSize = getResources().getDimensionPixelSize(R.dimen.bvp_subtitle_size);
258-
mSubViewTextColor = ContextCompat.getColor(context, R.color.bvp_subtitle_color);
223+
mSubViewTextColor = getResources().getColor(R.color.bvp_subtitle_color);
259224
}
260225

261226
if (mPlayDrawable == null)
@@ -874,15 +839,14 @@ protected void onFinishInflate() {
874839

875840
// Inflate and add progress
876841
mProgressFrame = li.inflate(R.layout.bvp_include_progress, this, false);
877-
mProgressBar = mProgressFrame.findViewById(R.id.spin_kit);
842+
mProgressBar = mProgressFrame.findViewById(R.id.material_progress_bar);
878843
mBottomProgressBar = mProgressFrame.findViewById(R.id.progressBarBottom);
879844

880845
TypedValue typedValue = new TypedValue();
881846
Resources.Theme theme = getContext().getTheme();
882847
theme.resolveAttribute(R.attr.colorAccent, typedValue, true);
883848
int color = typedValue.data;
884-
mProgressBar.setColor(color);
885-
setLoadingStyle(mLoadingStyle);
849+
mProgressBar.setProgressTintList(ColorStateList.valueOf(color));
886850

887851
mPositionTextView = mProgressFrame.findViewById(R.id.position_textview);
888852
mPositionTextView.setShadowLayer(3, 3, 3, Color.BLACK);
@@ -1067,50 +1031,6 @@ public void setLoop(boolean loop) {
10671031
this.mLoop = loop;
10681032
}
10691033

1070-
@Override
1071-
public void setLoadingStyle(@LoadingStyle int style) {
1072-
Drawable drawable;
1073-
switch (style) {
1074-
case DOUBLE_BOUNCE:
1075-
drawable = new DoubleBounce();
1076-
break;
1077-
case ROTATING_PLANE:
1078-
drawable = new RotatingPlane();
1079-
break;
1080-
case WAVE:
1081-
drawable = new Wave();
1082-
break;
1083-
case WANDERING_CUBES:
1084-
drawable = new WanderingCubes();
1085-
break;
1086-
case PULSE:
1087-
drawable = new Pulse();
1088-
break;
1089-
case CHASING_DOTS:
1090-
drawable = new ChasingDots();
1091-
break;
1092-
case THREE_BOUNCE:
1093-
drawable = new ThreeBounce();
1094-
break;
1095-
case CIRCLE:
1096-
drawable = new Circle();
1097-
break;
1098-
case CUBE_GRID:
1099-
drawable = new CubeGrid();
1100-
break;
1101-
case FADING_CIRCLE:
1102-
drawable = new FadingCircle();
1103-
break;
1104-
case ROTATING_CIRCLE:
1105-
drawable = new RotatingCircle();
1106-
break;
1107-
default:
1108-
drawable = new ThreeBounce();
1109-
break;
1110-
}
1111-
mProgressBar.setIndeterminateDrawable(drawable);
1112-
}
1113-
11141034
OnSwipeTouchListener clickFrameSwipeListener =
11151035
new OnSwipeTouchListener(true) {
11161036

bettervideoplayer/src/main/java/com/halilibo/bettervideoplayer/HelperMethods.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
public class HelperMethods {
1212

1313
public static boolean isRemotePath(Uri path){
14-
return (path.getScheme().equals("http") || path.getScheme().equals("https"));
14+
return ("http".equals(path.getScheme()) || "https".equals(path.getScheme()));
1515
}
1616

1717
public static String secondsToDuration(int seconds){
18-
return String.format("%02d:%02d:%02d",
18+
return String.format(Locale.getDefault(), "%02d:%02d:%02d",
1919
seconds / 3600,
2020
(seconds % 3600) / 60,
2121
(seconds % 60)

bettervideoplayer/src/main/java/com/halilibo/bettervideoplayer/IUserMethods.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.util.Map;
2020

2121
/**
22-
* @author Aidan Follestad (halilibo)
22+
* @author Aidan Follestad (halilozercan)
2323
* This interface defines which methods should be available to
2424
* library users. The methods found here constitutes the actual
2525
* interface of the player.
@@ -55,13 +55,6 @@ void setVolume(@FloatRange(from = 0f, to = 1f) float leftVolume,
5555

5656
void setLoop(boolean loop);
5757

58-
/**
59-
* BetterVideoPlayer utilizes @see com.github.ybq.android.spinkit.SpinKitView
60-
* to have 'better' loading animations.
61-
* @param style A style from SpinKit family.
62-
*/
63-
void setLoadingStyle(@BetterVideoPlayer.LoadingStyle int style);
64-
6558
void setHideControlsDuration(int hideControlsDuration);
6659

6760
void setInitialPosition(@IntRange(from = 0, to = Integer.MAX_VALUE) int pos);

bettervideoplayer/src/main/res/drawable/bvp_topbar_background.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<item>
44
<shape>
55
<gradient
6-
android:startColor="#BB000000"
6+
android:startColor="#88000000"
77
android:endColor="#00000000"
88
android:angle="270" />
99
</shape>

bettervideoplayer/src/main/res/layout/bvp_include_progress.xml

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
44
android:layout_height="match_parent"
5+
xmlns:app="http://schemas.android.com/apk/res-auto"
56
android:orientation="vertical">
67

7-
<com.github.ybq.android.spinkit.SpinKitView
8-
android:id="@+id/spin_kit"
9-
style="@style/SpinKitView.Large.FadingCircle"
8+
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
9+
android:id="@+id/material_progress_bar"
1010
android:layout_centerVertical="true"
1111
android:layout_centerHorizontal="true"
1212
android:layout_width="wrap_content"
1313
android:layout_height="wrap_content"
1414
android:layout_gravity="center"
15-
android:visibility="visible" />
15+
android:visibility="visible"
16+
android:indeterminate="true"
17+
app:mpb_progressStyle="circular"/>
1618

1719
<TextView
1820
android:id="@+id/position_textview"

0 commit comments

Comments
 (0)