diff --git a/build.gradle b/build.gradle index 0177000..f70fab9 100644 --- a/build.gradle +++ b/build.gradle @@ -2,11 +2,13 @@ buildscript { repositories { + google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.3.0' - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.android.tools.build:gradle:3.4.0' + classpath 'com.google.gms:google-services:4.2.0' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -16,5 +18,6 @@ buildscript { allprojects { repositories { jcenter() + google() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6fdff39..311b134 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Sep 14 15:16:09 CST 2015 +#Sun Apr 28 16:47:14 CEST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/universalvideoview/build.gradle b/universalvideoview/build.gradle index 53c6245..2a7892a 100644 --- a/universalvideoview/build.gradle +++ b/universalvideoview/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 23 - buildToolsVersion "23.0.2" + compileSdkVersion 28 + buildToolsVersion "28.0.3" defaultConfig { - minSdkVersion 9 - targetSdkVersion 23 + minSdkVersion 14 + targetSdkVersion 28 versionCode 4 versionName "1.1.0" } @@ -19,8 +19,8 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:23.0.0' + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0' } apply from: "bintrayUpload.gradle" diff --git a/universalvideoview/src/main/java/com/universalvideoview/UniversalMediaController.java b/universalvideoview/src/main/java/com/universalvideoview/UniversalMediaController.java index 31b80f7..864423c 100644 --- a/universalvideoview/src/main/java/com/universalvideoview/UniversalMediaController.java +++ b/universalvideoview/src/main/java/com/universalvideoview/UniversalMediaController.java @@ -164,9 +164,9 @@ private void initControllerView(View v) { mProgress.setMax(1000); } - mEndTime = (TextView) v.findViewById(R.id.duration); - mCurrentTime = (TextView) v.findViewById(R.id.has_played); - mTitle = (TextView) v.findViewById(R.id.title); + mEndTime = v.findViewById(R.id.duration); + mCurrentTime = v.findViewById(R.id.has_played); + mTitle = v.findViewById(R.id.title); mFormatBuilder = new StringBuilder(); mFormatter = new Formatter(mFormatBuilder, Locale.getDefault()); } diff --git a/universalvideoview/src/main/java/com/universalvideoview/UniversalVideoView.java b/universalvideoview/src/main/java/com/universalvideoview/UniversalVideoView.java index c0abff2..fe90248 100644 --- a/universalvideoview/src/main/java/com/universalvideoview/UniversalVideoView.java +++ b/universalvideoview/src/main/java/com/universalvideoview/UniversalVideoView.java @@ -17,7 +17,6 @@ package com.universalvideoview; -import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.pm.ActivityInfo; @@ -26,8 +25,6 @@ import android.media.MediaPlayer; import android.net.Uri; import android.os.Build; -import android.os.Handler; -import android.os.Message; import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; @@ -185,9 +182,8 @@ private void onMeasureKeepAspectRatio(int widthMeasureSpec, int heightMeasureSpe height = width * mVideoHeight / mVideoWidth; } } - } else { - // no size yet, just adopt the given spec sizes - } + } // else: no size yet, just adopt the given spec sizes + setMeasuredDimension(width, height); } diff --git a/universalvideoview/src/main/res/layout/uvv_on_error_layout.xml b/universalvideoview/src/main/res/layout/uvv_on_error_layout.xml index 9001b25..4075e67 100644 --- a/universalvideoview/src/main/res/layout/uvv_on_error_layout.xml +++ b/universalvideoview/src/main/res/layout/uvv_on_error_layout.xml @@ -15,7 +15,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" - android:text="出错了!" + android:text="@string/uvv_loading_error" android:textColor="@android:color/white" android:textSize="13dp" /> - \ No newline at end of file + diff --git a/universalvideoview/src/main/res/layout/uvv_on_loading_layout.xml b/universalvideoview/src/main/res/layout/uvv_on_loading_layout.xml index 320f02b..b72240c 100644 --- a/universalvideoview/src/main/res/layout/uvv_on_loading_layout.xml +++ b/universalvideoview/src/main/res/layout/uvv_on_loading_layout.xml @@ -16,7 +16,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" - android:text="加载中..." + android:text="@string/uvv_loading" android:textColor="@android:color/white" android:textSize="13dp" /> - \ No newline at end of file + diff --git a/universalvideoview/src/main/res/layout/uvv_player_controller.xml b/universalvideoview/src/main/res/layout/uvv_player_controller.xml index 2e6e27e..39a4bb2 100644 --- a/universalvideoview/src/main/res/layout/uvv_player_controller.xml +++ b/universalvideoview/src/main/res/layout/uvv_player_controller.xml @@ -41,7 +41,7 @@ android:layout_width="50dp" android:layout_height="fill_parent" android:background="#00000000" - android:contentDescription="返回" + android:contentDescription="@string/uvv_return" android:gravity="center" android:scaleType="centerInside" android:src="@drawable/uvv_back_btn" @@ -152,4 +152,4 @@ - \ No newline at end of file + diff --git a/universalvideoview/src/main/res/values-es/strings.xml b/universalvideoview/src/main/res/values-es/strings.xml new file mode 100644 index 0000000..7e0dcdf --- /dev/null +++ b/universalvideoview/src/main/res/values-es/strings.xml @@ -0,0 +1,5 @@ + + Cargando... + Volver + ¡Algo ha ido mal! + diff --git a/universalvideoview/src/main/res/values-fr/strings.xml b/universalvideoview/src/main/res/values-fr/strings.xml new file mode 100644 index 0000000..29209b3 --- /dev/null +++ b/universalvideoview/src/main/res/values-fr/strings.xml @@ -0,0 +1,5 @@ + + Chargement... + Retour + Quelque chose c\'est mal passé ! + diff --git a/universalvideoview/src/main/res/values-zh/strings.xml b/universalvideoview/src/main/res/values-zh/strings.xml new file mode 100644 index 0000000..15be285 --- /dev/null +++ b/universalvideoview/src/main/res/values-zh/strings.xml @@ -0,0 +1,5 @@ + + 加载中... + 返回 + 出错了! + diff --git a/universalvideoview/src/main/res/values/strings.xml b/universalvideoview/src/main/res/values/strings.xml index 5320db6..4f613ab 100644 --- a/universalvideoview/src/main/res/values/strings.xml +++ b/universalvideoview/src/main/res/values/strings.xml @@ -1,5 +1,9 @@ - UniversalVideoView Library + UniversalVideoView Library - Settings + Settings + + Loading... + Return + Something goes wrong! diff --git a/universalvideoviewsample/build.gradle b/universalvideoviewsample/build.gradle index 9fb65f9..a0f0f4f 100644 --- a/universalvideoviewsample/build.gradle +++ b/universalvideoviewsample/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 23 - buildToolsVersion "23.0.2" + compileSdkVersion 28 + buildToolsVersion "28.0.3" defaultConfig { applicationId "com.universalvideoviewsample" - minSdkVersion 9 - targetSdkVersion 23 + minSdkVersion 14 + targetSdkVersion 28 versionCode 3 versionName "1.0.2" } @@ -20,7 +20,7 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:23.0.0' - compile project(':universalvideoview') + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation project(':universalvideoview') } diff --git a/universalvideoviewsample/src/main/AndroidManifest.xml b/universalvideoviewsample/src/main/AndroidManifest.xml index fae744c..564126c 100644 --- a/universalvideoviewsample/src/main/AndroidManifest.xml +++ b/universalvideoviewsample/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ + android:configChanges="orientation|keyboardHidden|screenSize" android:label="@string/app_name" > diff --git a/universalvideoviewsample/src/main/java/com/universalvideoviewsample/MainActivity.java b/universalvideoviewsample/src/main/java/com/universalvideoviewsample/MainActivity.java index 5e4cbf4..633f183 100644 --- a/universalvideoviewsample/src/main/java/com/universalvideoviewsample/MainActivity.java +++ b/universalvideoviewsample/src/main/java/com/universalvideoviewsample/MainActivity.java @@ -32,7 +32,9 @@ public class MainActivity extends AppCompatActivity implements UniversalVideoVie private static final String TAG = "MainActivity"; private static final String SEEK_POSITION_KEY = "SEEK_POSITION_KEY"; - private static final String VIDEO_URL = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"; + // Use https video on devices/emulators over Android 7.0 + // For Android 8 and over, you need to modify the manifest to handle http communication + private static final String VIDEO_URL = "https://www.quirksmode.org/html5/videos/big_buck_bunny.webm"; UniversalVideoView mVideoView; UniversalMediaController mMediaController; @@ -52,12 +54,12 @@ protected void onCreate(Bundle savedInstanceState) { mVideoLayout = findViewById(R.id.video_layout); mBottomLayout = findViewById(R.id.bottom_layout); - mVideoView = (UniversalVideoView) findViewById(R.id.videoView); - mMediaController = (UniversalMediaController) findViewById(R.id.media_controller); + mVideoView = findViewById(R.id.videoView); + mMediaController = findViewById(R.id.media_controller); mVideoView.setMediaController(mMediaController); setVideoAreaSize(); mVideoView.setVideoViewCallback(this); - mStart = (TextView) findViewById(R.id.start); + mStart = findViewById(R.id.start); mStart.setOnClickListener(new View.OnClickListener() { @Override