Skip to content

Commit

Permalink
Merge pull request #6 from vkay94/dev
Browse files Browse the repository at this point in the history
Merge dev for Release 0.7.1
  • Loading branch information
vkay94 authored Jul 6, 2020
2 parents df0950e + 4a36f8d commit 01a75cc
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 61 deletions.
6 changes: 0 additions & 6 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Then, in your app's directory, you can include it the same way like other librar

```gradle
dependencies {
implementation 'com.github.vkay94:DoubleTapPlayerView:0.7.0'
implementation 'com.github.vkay94:DoubleTapPlayerView:0.7.1'
}
```

Expand Down
17 changes: 7 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
buildToolsVersion '29.0.3'
defaultConfig {
applicationId "com.github.vkay94.doubletapplayerviewexample"
minSdkVersion 21
minSdkVersion 16
targetSdkVersion 29
versionCode 70
versionName "0.7.0"
versionCode libVersionCode
versionName "$libMajor.$libMinor.$libPatch"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -33,16 +33,13 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation 'androidx.core:core-ktx:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation "androidx.core:core-ktx:$core_ktx_version"
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"

// ExoPlayer2
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayer_version"

implementation 'com.github.QuadFlask:colorpicker:0.0.15'
implementation "com.github.QuadFlask:colorpicker:$colorpicker_version"
implementation project(path: ':doubletapplayerview')
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import android.os.Bundle
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import com.github.vkay94.dtpv.DoubleTapPlayerView
import com.google.android.exoplayer2.*
import com.google.android.exoplayer2.source.ExtractorMediaSource
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
import com.google.android.exoplayer2.trackselection.TrackSelection
import com.google.android.exoplayer2.upstream.BandwidthMeter
import com.google.android.exoplayer2.DefaultLoadControl
import com.google.android.exoplayer2.LoadControl
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.SimpleExoPlayer
import com.google.android.exoplayer2.source.ProgressiveMediaSource
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
import com.google.android.exoplayer2.util.Util
Expand Down Expand Up @@ -42,7 +41,7 @@ open class BaseVideoActivity : AppCompatActivity() {
Util.getUserAgent(this@BaseVideoActivity, resources.getString(R.string.app_name)),
bandwidthMeter
)
val videoSource = ExtractorMediaSource.Factory(dataSourceFactory)
val videoSource = ProgressiveMediaSource.Factory(dataSourceFactory, Mp4ExtractorFactory())
.createMediaSource(mUri)

player?.prepare(videoSource)
Expand All @@ -60,19 +59,10 @@ open class BaseVideoActivity : AppCompatActivity() {
)
.createDefaultLoadControl()

val bandwidthMeter: BandwidthMeter = DefaultBandwidthMeter.Builder(this).build()
val defaultRenderersFactory = DefaultRenderersFactory(this)
player = SimpleExoPlayer.Builder(this)
.setLoadControl(loadControl)
.build()

val videoTrackSelectionFactory: TrackSelection.Factory =
AdaptiveTrackSelection.Factory(bandwidthMeter)
val trackSelector = DefaultTrackSelector(videoTrackSelectionFactory)

player = ExoPlayerFactory.newSimpleInstance(
this,
defaultRenderersFactory,
trackSelector,
loadControl
)
playerView.player = player
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.github.vkay94.doubletapplayerviewexample

import com.google.android.exoplayer2.extractor.Extractor
import com.google.android.exoplayer2.extractor.ExtractorsFactory
import com.google.android.exoplayer2.extractor.mp4.Mp4Extractor

class Mp4ExtractorFactory : ExtractorsFactory {

override fun createExtractors(): Array<Extractor> {
return arrayOf(
Mp4Extractor()
)
}
}
19 changes: 15 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.50'
ext.exoplayer_version = '2.10.8'
ext.appcompat_version = '1.1.0'
ext {
libMajor = 0
libMinor = 7
libPatch = 1

libVersionCode = libPatch + (libMinor * 100) + (libMajor * 10000)

kotlin_version = '1.3.72'
core_ktx_version = '1.3.0'
exoplayer_version = '2.11.7'
appcompat_version = '1.1.0'
constraintlayout_version = '1.1.3'
colorpicker_version = '0.0.15'
}

repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
17 changes: 6 additions & 11 deletions doubletapplayerview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion '29.0.2'

buildToolsVersion '29.0.3'

defaultConfig {
minSdkVersion 21
minSdkVersion 16
targetSdkVersion 29
versionCode 70
versionName "0.7.0"
versionCode libVersionCode
versionName "$libMajor.$libMinor.$libPatch"

vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}

Expand All @@ -41,12 +39,9 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation 'androidx.core:core-ktx:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "androidx.core:core-ktx:$core_ktx_version"

implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayer_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Custom player class for Double-Tapping listening
*
*/
public final class DoubleTapPlayerView extends PlayerView {
public class DoubleTapPlayerView extends PlayerView {

public static final String TAG = ".DoubleTapPlayerView";
public static boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release");
Expand All @@ -31,7 +31,7 @@ public final class DoubleTapPlayerView extends PlayerView {

private Handler mHandler = new Handler();
private Runnable mRunnable = () -> {
Log.d(TAG, "Runnable called");
if (DEBUG) Log.d(TAG, "Runnable called");
isDoubleTap = false;
controls.onDoubleTapFinished();
};
Expand Down Expand Up @@ -90,7 +90,7 @@ public long getDoubleTapDelay() {
/**
* Resets the timeout to keep in double tap mode.
*
* Called once in {@link PlayerDoubleTapListener#onDoubleTapStarted} Needs to be called
* Called once in {@link PlayerDoubleTapListener#onDoubleTapStarted}. Needs to be called
* from outside if the double tap is customized / overridden to detect ongoing taps
*/
public void keepInDoubleTapMode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.github.vkay94.dtpv.R
* Draws a arc shape and provides a circle scaling animation.
* Used by YouTubeOverlay.
*/
class CircleClipTapView(context: Context?, attrs: AttributeSet) :
internal class CircleClipTapView(context: Context?, attrs: AttributeSet) :
View(context, attrs) {

private var backgroundPaint = Paint()
Expand All @@ -33,8 +33,8 @@ class CircleClipTapView(context: Context?, attrs: AttributeSet) :

// Circle

var cX = 0f
var cY = 0f
private var cX = 0f
private var cY = 0f

private var currentRadius = 0f
private var minRadius: Int = 0
Expand Down
11 changes: 11 additions & 0 deletions doubletapplayerview/src/main/res/values/public.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<public />

<public name="YouTubeOverlay_yt_playerView" type="attr" />
<public name="YouTubeOverlay_yt_ffrDuration" type="attr" />
<public name="YouTubeOverlay_yt_animationDuration" type="attr" />
<public name="YouTubeOverlay_yt_arcSize" type="attr" />
<public name="YouTubeOverlay_yt_tapCircleColor" type="attr" />
<public name="YouTubeOverlay_yt_backgroundCircleColor" type="attr" />
</resources>
2 changes: 1 addition & 1 deletion doubletapplayerview/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name" translatable="false">DoubleTapPlayer</string>
<string name="dtpv_app_name" translatable="false">DoubleTapPlayer</string>
</resources>
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Aug 17 00:00:30 CEST 2019
#Sun Jul 05 19:47:33 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

0 comments on commit 01a75cc

Please sign in to comment.