Skip to content

Commit ba9e8d5

Browse files
author
Lucem-Anb
committed
zoomable
1 parent dc52626 commit ba9e8d5

File tree

26 files changed

+177
-156
lines changed

26 files changed

+177
-156
lines changed
5 Bytes
Binary file not shown.

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 27
4+
compileSdkVersion 28
55
defaultConfig {
66
applicationId "hbisoft.com.surfaceviewpinchzoom"
77
minSdkVersion 18
8-
targetSdkVersion 27
8+
targetSdkVersion 28
99
versionCode 1
1010
versionName "1.0"
1111
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -20,8 +20,7 @@ android {
2020

2121
dependencies {
2222
implementation fileTree(dir: 'libs', include: ['*.jar'])
23-
implementation 'com.android.support:appcompat-v7:27.1.1'
24-
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
23+
implementation 'com.android.support:appcompat-v7:28.0.0'
2524
testImplementation 'junit:junit:4.12'
26-
implementation project(path: ':lib')
25+
implementation project(path: ':zoomable')
2726
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
android:supportsRtl="true"
1414
android:theme="@style/AppTheme">
1515
<activity
16-
android:name=".MainActivity"
16+
android:name="com.lucemanb.MainActivity"
1717
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
1818
<intent-filter>
1919
<action android:name="android.intent.action.MAIN" />
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package com.lucemanb;
2+
3+
import android.app.Activity;
4+
import android.graphics.SurfaceTexture;
5+
import android.media.MediaPlayer;
6+
import android.os.Bundle;
7+
import android.view.Surface;
8+
import android.view.TextureView;
9+
10+
import com.lucemanb.zoomable.ZoomableTextureView;
11+
12+
import java.io.IOException;
13+
import hbisoft.com.surfaceviewpinchzoom.R;
14+
15+
16+
public class MainActivity extends Activity{
17+
18+
String path = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4";
19+
private MediaPlayer mediaPlayerTexture;
20+
21+
@Override
22+
protected void onCreate(Bundle savedInstanceState) {
23+
super.onCreate(savedInstanceState);
24+
setContentView(R.layout.activity_main);
25+
26+
final MediaPlayer.OnPreparedListener listener = new MediaPlayer.OnPreparedListener() {
27+
@Override
28+
public void onPrepared(MediaPlayer mp) {
29+
mp.start();
30+
}
31+
};
32+
33+
ZoomableTextureView textureView = findViewById(R.id.textureView);
34+
35+
textureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
36+
@Override
37+
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
38+
Surface s = new Surface(surface);
39+
mediaPlayerTexture = new MediaPlayer();
40+
mediaPlayerTexture.setSurface(s);
41+
try {
42+
mediaPlayerTexture.setDataSource(path);
43+
} catch (IOException e) {
44+
e.printStackTrace();
45+
}
46+
mediaPlayerTexture.prepareAsync();
47+
mediaPlayerTexture.setOnPreparedListener(listener);
48+
}
49+
50+
@Override
51+
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
52+
53+
}
54+
55+
@Override
56+
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
57+
return false;
58+
}
59+
60+
@Override
61+
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
62+
63+
}
64+
});
65+
}
66+
67+
@Override
68+
protected void onDestroy() {
69+
super.onDestroy();
70+
if (mediaPlayerTexture != null) {
71+
mediaPlayerTexture.release();
72+
mediaPlayerTexture = null;
73+
}
74+
}
75+
76+
}

app/src/main/java/hbisoft/com/surfaceviewpinchzoom/MainActivity.java

Lines changed: 0 additions & 88 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:orientation="vertical"
7+
android:layout_height="match_parent"
8+
tools:context=".Frames">
9+
10+
<SeekBar
11+
android:layout_width="match_parent"
12+
android:layout_margin="8dp"
13+
android:id="@+id/control"
14+
android:background="@color/colorPrimary"
15+
android:layout_height="10dp" />
16+
17+
<hbisoft.com.surfaceviewpinchzoom.layout.PlayerView
18+
android:layout_width="match_parent"
19+
android:id="@+id/player"
20+
android:layout_height="match_parent" />
21+
22+
</LinearLayout>

0 commit comments

Comments
 (0)