Skip to content

Commit

Permalink
reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
JarvanMo committed Feb 10, 2018
1 parent 0047792 commit 17d6188
Show file tree
Hide file tree
Showing 30 changed files with 363 additions and 332 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

/**
* Instrumentation test, which will execute on an Android device.
Expand Down
6 changes: 3 additions & 3 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
android:theme="@style/FullscreenTheme">

</activity>
<activity android:name=".SimpleVideoViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
>
<activity
android:name=".SimpleVideoViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
16 changes: 8 additions & 8 deletions demo/src/main/java/com/jarvanmo/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,23 @@ protected void onCreate(Bundle savedInstanceState) {
List<ExoMediaSource.Quality> qualities = new ArrayList<>();
ExoMediaSource.Quality quality;

for (int i = 0; i <6 ; i++) {
SpannableString spannableString = new SpannableString("Quality"+i);
if(i % 2 ==0){
for (int i = 0; i < 6; i++) {
SpannableString spannableString = new SpannableString("Quality" + i);
if (i % 2 == 0) {
ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.YELLOW);
spannableString.setSpan(colorSpan, 0, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);

}else {
} else {
ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.RED);
spannableString.setSpan(colorSpan, 0, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}

quality = new SimpleQuality(spannableString,mediaSource.url());
quality = new SimpleQuality(spannableString, mediaSource.url());
qualities.add(quality);
}
mediaSource.setQualities(qualities);

videoView.play(mediaSource,false);
videoView.play(mediaSource, false);
play.setOnClickListener(view -> {
videoView.play(mediaSource);
play.setVisibility(View.INVISIBLE);
Expand Down Expand Up @@ -180,8 +180,8 @@ protected void onDestroy() {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

if(keyCode == KeyEvent.KEYCODE_BACK){
return videoView.onKeyDown(keyCode,event);
if (keyCode == KeyEvent.KEYCODE_BACK) {
return videoView.onKeyDown(keyCode, event);
}
return super.onKeyDown(keyCode, event);
}
Expand Down
10 changes: 8 additions & 2 deletions demo/src/main/res/drawable/ic_arrow_back_white_24dp.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp">
<path android:fillColor="#FFFFFF" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp">
<path
android:fillColor="#FFFFFF"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z" />
</vector>
10 changes: 8 additions & 2 deletions demo/src/main/res/drawable/ic_error_white_24dp.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp">
<path android:fillColor="#FFFFFF" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp">
<path
android:fillColor="#FFFFFF"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z" />
</vector>
3 changes: 1 addition & 2 deletions demo/src/main/res/layout/activity_simple_video_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.5"
/>
android:layout_weight="1.5" />

<ScrollView
android:id="@+id/wrapper"
Expand Down
4 changes: 1 addition & 3 deletions demo/src/main/res/layout/cutom_view_top.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down
2 changes: 1 addition & 1 deletion demo/src/test/java/com/jarvanmo/demo/ExampleUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.Test;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

/**
* Example local unit test, which will execute on the development machine (host).
Expand Down
2 changes: 1 addition & 1 deletion exoplayerview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
versionName "2.0.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary= true
vectorDrawables.useSupportLibrary = true
}


Expand Down
13 changes: 8 additions & 5 deletions exoplayerview/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jarvanmo.exoplayerview">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application android:allowBackup="true" android:label="@string/app_name"
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">

</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* 剑气纵横三万里 一剑光寒十九洲
*/

public class ExoAdsLoader extends Player.DefaultEventListener implements AdsLoader{
public class ExoAdsLoader extends Player.DefaultEventListener implements AdsLoader {

@Override
public void setSupportedContentTypes(int... contentTypes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public MultiQualitySelectorAdapter(List<ExoMediaSource.Quality> qualities, Multi

@Override
public MultiQualitySelectorViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_quality, parent,false);
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_quality, parent, false);
return new MultiQualitySelectorViewHolder(view);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
public interface OnVideoGestureChangeListener {

int VOLUME_CHANGED_REDUCTION = -1;
int VOLUME_CHANGED_MUTE =VOLUME_CHANGED_REDUCTION+1;
int VOLUME_CHANGED_INCREMENT =VOLUME_CHANGED_MUTE+1;
int VOLUME_CHANGED_MUTE = VOLUME_CHANGED_REDUCTION + 1;
int VOLUME_CHANGED_INCREMENT = VOLUME_CHANGED_MUTE + 1;


@IntDef({VOLUME_CHANGED_REDUCTION, VOLUME_CHANGED_MUTE, VOLUME_CHANGED_INCREMENT})
Expand All @@ -24,7 +24,7 @@ public interface OnVideoGestureChangeListener {
}


void onVolumeChanged(int range,@VolumeChangeType int type);
void onVolumeChanged(int range, @VolumeChangeType int type);

void onBrightnessChanged(int brightnessPercent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class VideoGesture implements View.OnTouchListener {

private boolean enabled = true;

public VideoGesture(Context context, OnVideoGestureChangeListener onVideoGestureChangeListener,@NonNull ExoVideoPlaybackControlView.PlayerAccessor playerAccessor) {
public VideoGesture(Context context, OnVideoGestureChangeListener onVideoGestureChangeListener, @NonNull ExoVideoPlaybackControlView.PlayerAccessor playerAccessor) {
this.context = context;
this.onVideoGestureChangeListener = onVideoGestureChangeListener;
mAudioManager = (AudioManager) context.getSystemService(AUDIO_SERVICE);
Expand All @@ -76,6 +76,7 @@ private void initVol() {
mAudioMax = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);

}

@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
Expand Down Expand Up @@ -299,11 +300,11 @@ private void doSeekTouch(int coef, float gesturesize, boolean seek) {

if (length > 0) {
//Show the jump's size
seekAndShowJump(seek,time + jump, jump > 0);
seekAndShowJump(seek, time + jump, jump > 0);
}
}

private void seekAndShowJump(boolean seek,long jumpSize, boolean isFastForward) {
private void seekAndShowJump(boolean seek, long jumpSize, boolean isFastForward) {
if (onVideoGestureChangeListener != null) {
onVideoGestureChangeListener.onShowSeekSize(jumpSize, isFastForward);
}
Expand Down
Loading

0 comments on commit 17d6188

Please sign in to comment.