Skip to content

Commit d82e9ea

Browse files
committed
bug fixes.
new setOnProgressView() method
1 parent 5a0b50b commit d82e9ea

File tree

9 files changed

+74
-67
lines changed

9 files changed

+74
-67
lines changed

FVVLibrary.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id="FVVLibrary" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.github.rtoshiro.fullscreenvideoview" external.system.module.version="1.1.1" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id="FVVLibrary" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.github.rtoshiro.fullscreenvideoview" external.system.module.version="1.1.2" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="java-gradle" name="Java-Gradle">
55
<configuration>

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ And, support for min SDK version is 7.
1111
### Gradle
1212

1313
```
14-
compile 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.1'
14+
compile 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.2'
1515
```
1616

1717
```
@@ -20,7 +20,7 @@ compile 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.1'
2020
}
2121
```
2222

23-
If you want to use the last development release, you can use the SNAPSHOT tag:
23+
<!--If you want to use the last development release, you can use the SNAPSHOT tag:
2424
2525
```
2626
compile 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.2a-SNAPSHOT'
@@ -34,7 +34,7 @@ allprojects {
3434
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
3535
}
3636
}
37-
```
37+
```-->
3838

3939
[![Build Status](https://travis-ci.org/rtoshiro/FullscreenVideoView.svg?branch=master)](https://travis-ci.org/rtoshiro/FullscreenVideoView)
4040

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:2.1.2'
9+
classpath 'com.android.tools.build:gradle:2.1.3'
1010
}
1111
}
1212

fullscreenvideoview/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
defaultConfig {
1111
minSdkVersion 7
1212
targetSdkVersion 23
13-
versionCode 9
14-
versionName "1.1.1"
13+
versionCode 10
14+
versionName "1.1.2"
1515
}
1616
buildTypes {
1717
release {

fullscreenvideoview/fullscreenvideoview.iml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id=":fullscreenvideoview" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rtoshiro.fullscreenvideoview" external.system.module.version="1.1.1" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id=":fullscreenvideoview" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rtoshiro.fullscreenvideoview" external.system.module.version="1.1.2" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>
@@ -65,14 +65,6 @@
6565
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
6666
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
6767
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
68-
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
69-
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
70-
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
71-
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
72-
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
73-
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
74-
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
75-
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
7668
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
7769
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
7870
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
@@ -81,6 +73,14 @@
8173
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
8274
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
8375
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
76+
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
77+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
78+
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
79+
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
80+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
81+
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
82+
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
83+
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
8484
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
8585
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
8686
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
@@ -90,7 +90,6 @@
9090
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
9191
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
9292
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
93-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/mockable-android-23.jar" />
9493
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
9594
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
9695
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />

fullscreenvideoview/src/main/java/com/github/rtoshiro/view/video/FullscreenVideoLayout.java

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright (C) 2016 Toshiro Sugii
3-
* <p>
3+
* <p/>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
* <p>
7+
* <p/>
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p>
9+
* <p/>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -111,22 +111,28 @@ protected void initObjects() {
111111
this.videoControlsView = inflater.inflate(R.layout.view_videocontrols, this, false);
112112
}
113113

114-
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
115-
params.addRule(ALIGN_PARENT_BOTTOM);
116-
addView(videoControlsView, params);
117-
118-
this.seekBar = (SeekBar) this.videoControlsView.findViewById(R.id.vcv_seekbar);
119-
this.imgfullscreen = (ImageButton) this.videoControlsView.findViewById(R.id.vcv_img_fullscreen);
120-
this.imgplay = (ImageButton) this.videoControlsView.findViewById(R.id.vcv_img_play);
121-
this.textTotal = (TextView) this.videoControlsView.findViewById(R.id.vcv_txt_total);
122-
this.textElapsed = (TextView) this.videoControlsView.findViewById(R.id.vcv_txt_elapsed);
114+
if (videoControlsView != null) {
115+
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
116+
params.addRule(ALIGN_PARENT_BOTTOM);
117+
addView(videoControlsView, params);
118+
119+
this.seekBar = (SeekBar) this.videoControlsView.findViewById(R.id.vcv_seekbar);
120+
this.imgfullscreen = (ImageButton) this.videoControlsView.findViewById(R.id.vcv_img_fullscreen);
121+
this.imgplay = (ImageButton) this.videoControlsView.findViewById(R.id.vcv_img_play);
122+
this.textTotal = (TextView) this.videoControlsView.findViewById(R.id.vcv_txt_total);
123+
this.textElapsed = (TextView) this.videoControlsView.findViewById(R.id.vcv_txt_elapsed);
124+
}
123125

124-
this.imgplay.setOnClickListener(this);
125-
this.imgfullscreen.setOnClickListener(this);
126-
this.seekBar.setOnSeekBarChangeListener(this);
126+
if (this.imgplay != null)
127+
this.imgplay.setOnClickListener(this);
128+
if (this.imgfullscreen != null)
129+
this.imgfullscreen.setOnClickListener(this);
130+
if (this.seekBar != null)
131+
this.seekBar.setOnSeekBarChangeListener(this);
127132

128133
// Start controls invisible. Make it visible when it is prepared
129-
this.videoControlsView.setVisibility(View.INVISIBLE);
134+
if (this.videoControlsView != null)
135+
this.videoControlsView.setVisibility(View.INVISIBLE);
130136
}
131137

132138
@Override
@@ -150,6 +156,9 @@ protected void stopCounter() {
150156
}
151157

152158
protected void updateCounter() {
159+
if (this.textElapsed == null)
160+
return;
161+
153162
int elapsed = getCurrentPosition();
154163
// getCurrentPosition is a little bit buggy :(
155164
if (elapsed > 0 && elapsed < getDuration()) {
@@ -206,25 +215,28 @@ protected void tryToPrepare() {
206215
super.tryToPrepare();
207216

208217
if (getCurrentState() == State.PREPARED || getCurrentState() == State.STARTED) {
209-
int total = getDuration();
210-
if (total > 0) {
211-
seekBar.setMax(total);
212-
seekBar.setProgress(0);
213-
214-
total = total / 1000;
215-
long s = total % 60;
216-
long m = (total / 60) % 60;
217-
long h = (total / (60 * 60)) % 24;
218-
if (h > 0) {
219-
textElapsed.setText("00:00:00");
220-
textTotal.setText(String.format(Locale.US, "%d:%02d:%02d", h, m, s));
221-
} else {
222-
textElapsed.setText("00:00");
223-
textTotal.setText(String.format(Locale.US, "%02d:%02d", m, s));
218+
if (textElapsed != null && textTotal != null) {
219+
int total = getDuration();
220+
if (total > 0) {
221+
seekBar.setMax(total);
222+
seekBar.setProgress(0);
223+
224+
total = total / 1000;
225+
long s = total % 60;
226+
long m = (total / 60) % 60;
227+
long h = (total / (60 * 60)) % 24;
228+
if (h > 0) {
229+
textElapsed.setText("00:00:00");
230+
textTotal.setText(String.format(Locale.US, "%d:%02d:%02d", h, m, s));
231+
} else {
232+
textElapsed.setText("00:00");
233+
textTotal.setText(String.format(Locale.US, "%02d:%02d", m, s));
234+
}
224235
}
225236
}
226237

227-
videoControlsView.setVisibility(View.VISIBLE);
238+
if (videoControlsView != null)
239+
videoControlsView.setVisibility(View.VISIBLE);
228240
}
229241
}
230242

@@ -270,6 +282,8 @@ public void stop() throws IllegalStateException {
270282
}
271283

272284
protected void updateControls() {
285+
if (imgplay == null) return;
286+
273287
Drawable icon;
274288
if (getCurrentState() == State.STARTED) {
275289
icon = context.getResources().getDrawable(R.drawable.fvl_selector_pause);

fvvapplication/fvvapplication.iml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id=":fvvapplication" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rtoshiro.fullscreenvideoview" external.system.module.version="1.1.1" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id=":fvvapplication" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rtoshiro.fullscreenvideoview" external.system.module.version="1.1.2" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>
@@ -64,14 +64,6 @@
6464
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
6565
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
6666
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
67-
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
68-
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
69-
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
70-
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
71-
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
72-
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
73-
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
74-
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
7567
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
7668
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
7769
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
@@ -80,24 +72,26 @@
8072
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
8173
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
8274
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
75+
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
76+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
77+
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
78+
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
79+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
80+
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
81+
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
82+
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
8383
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
8484
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
85-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
8685
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
8786
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
8887
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
8988
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
90-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
91-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
9289
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
93-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
9490
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
9591
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
9692
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
9793
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
98-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
9994
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
100-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
10195
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
10296
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
10397
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19-
VERSION_NAME=1.1.2a-SNAPSHOT
19+
VERSION_NAME=1.1.2
2020
VERSION_CODE=10
2121
GROUP=com.github.rtoshiro.fullscreenvideoview
2222

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Apr 14 09:18:32 BRT 2016
1+
#Wed Aug 17 14:08:57 BRT 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

0 commit comments

Comments
 (0)