├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── study
│ │ └── xuan
│ │ └── vrshow
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── BelleBook_Big.stl
│ │ ├── andes1.jpg
│ │ ├── bai.stl
│ │ └── bb.jpg
│ ├── java
│ │ └── com
│ │ │ └── study
│ │ │ └── xuan
│ │ │ └── vrshow
│ │ │ ├── GifActivity.java
│ │ │ ├── GoogleActivity.java
│ │ │ ├── MainActivity.java
│ │ │ └── STLActivity.java
│ └── res
│ │ ├── drawable
│ │ └── demo.gif
│ │ ├── layout
│ │ ├── activity_gif.xml
│ │ ├── activity_google.xml
│ │ ├── activity_main.xml
│ │ ├── activity_stl.xml
│ │ └── main_layout.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── study
│ └── xuan
│ └── vrshow
│ └── ExampleUnitTest.java
├── build.gradle
├── gif
├── book.gif
├── gifdemo.gif
└── googlefinal.gif
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── study
│ │ └── xuan
│ │ └── gifshow
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── study
│ │ │ └── xuan
│ │ │ └── gifshow
│ │ │ ├── gif
│ │ │ └── VrGifView.java
│ │ │ ├── util
│ │ │ └── ScreenUtil.java
│ │ │ └── widget
│ │ │ └── stlview
│ │ │ ├── callback
│ │ │ ├── OnReadCallBack.java
│ │ │ └── OnReadListener.java
│ │ │ ├── model
│ │ │ └── STLModel.java
│ │ │ ├── operate
│ │ │ ├── ISTLReader.java
│ │ │ ├── ReaderHandler.java
│ │ │ └── STLReader.java
│ │ │ ├── util
│ │ │ ├── IOUtils.java
│ │ │ ├── STLUtils.java
│ │ │ └── ScreenUtil.java
│ │ │ └── widget
│ │ │ ├── STLRenderer.java
│ │ │ ├── STLView.java
│ │ │ └── STLViewBuilder.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── study
│ └── xuan
│ └── gifshow
│ └── ExampleUnitTest.java
├── settings.gradle
└── stlshow
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
├── androidTest
└── java
│ └── com
│ └── study
│ └── xuan
│ └── stlshow
│ └── ExampleInstrumentedTest.java
├── main
├── AndroidManifest.xml
└── res
│ └── values
│ └── strings.xml
└── test
└── java
└── com
└── study
└── xuan
└── stlshow
└── ExampleUnitTest.java
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VRShow
2 | VR全景图+Opengl3D模型展示
3 | **使用方式:**
4 | 1.Add it in your root build.gradle at the end of repositories:
5 |
6 | allprojects {
7 | repositories {
8 | ...
9 | maven { url 'https://jitpack.io' }
10 | }
11 | }
12 | Step 2. Add the dependency
13 |
14 | dependencies {
15 | compile 'com.github.sdfdzx:VRShow:v1.0.2'
16 | }
17 | ### 1.全景360°GIF图
18 | 
19 |
20 | **功能:**
21 | >1.支持单指拖拽
22 | >2.支持双指缩放
23 | >3.支持触摸响应速度模式:LOW,NORMAL,FAST
24 |
25 | **使用方式:**
26 | Step 1. XML and Java
27 | ```
28 |
34 |
35 | public class GifActivity extends AppCompatActivity {
36 | private VrGifView mGif;
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 | setContentView(R.layout.activity_gif);
41 | mGif = (VrGifView) findViewById(R.id.gif);
42 | mGif.setTouch(true);//是否 可触摸
43 | mGif.setDrag(true);//是否可拖拽
44 | mGif.setScale(false);//是否可伸缩
45 | mGif.setMoveMode(VrGifView.MODE_FAST);//触摸响应速度
46 | }
47 | }
48 | ```
49 | ### 2.3D模型展示
50 | 
51 |
52 | **功能:**
53 | >1.异步读取STL格式的3D文件
54 | >2.支持进度回调
55 | >3.支持单指拖动
56 | >4.支持双指缩放
57 | >5.支持陀螺仪传感器
58 |
59 | **使用方式:**
60 | Step 1. XML and Java
61 | ```
62 |
66 |
67 |
68 | STLViewBuilder.init(mStl).Assets(this, "bai.stl").build();
69 | mStl.setTouch(true);
70 | mStl.setScale(true);
71 | mStl.setRotate(true);
72 | mStl.setSensor(true);
73 | mStl.setOnReadCallBack(new OnReadCallBack() {
74 | @Override
75 | public void onStart() {}
76 | @Override
77 | public void onReading(int cur, int total) {}
78 | @Override
79 | public void onFinish() {}
80 | });
81 | ```
82 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "27.0.0"
6 | defaultConfig {
7 | applicationId "com.study.xuan.vrshow"
8 | minSdkVersion 19
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile project(':library')
28 | compile 'com.android.support:appcompat-v7:26.+'
29 | compile 'com.google.vr:sdk-panowidget:1.101.0'
30 | testCompile 'junit:junit:4.12'
31 | }
32 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\Program\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/study/xuan/vrshow/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.vrshow;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.study.xuan.vrshow", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/assets/andes1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/assets/andes1.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/bai.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/assets/bai.stl
--------------------------------------------------------------------------------
/app/src/main/assets/bb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/assets/bb.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/study/xuan/vrshow/GifActivity.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.vrshow;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.study.xuan.gifshow.gif.VrGifView;
7 |
8 | public class GifActivity extends AppCompatActivity {
9 | private VrGifView mGif;
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_gif);
14 | mGif = (VrGifView) findViewById(R.id.gif);
15 | mGif.setTouch(true);
16 | mGif.setDrag(true);
17 | mGif.setScale(false);
18 | mGif.setMoveMode(VrGifView.MODE_FAST);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/study/xuan/vrshow/GoogleActivity.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.vrshow;
2 |
3 | import android.content.Intent;
4 | import android.content.res.AssetManager;
5 | import android.graphics.BitmapFactory;
6 | import android.net.Uri;
7 | import android.os.AsyncTask;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.os.Bundle;
10 | import android.text.Html;
11 | import android.text.method.LinkMovementMethod;
12 | import android.util.Log;
13 | import android.util.Pair;
14 | import android.widget.TextView;
15 | import android.widget.Toast;
16 |
17 |
18 | import com.google.vr.sdk.widgets.pano.VrPanoramaEventListener;
19 | import com.google.vr.sdk.widgets.pano.VrPanoramaView;
20 |
21 | import java.io.File;
22 | import java.io.FileInputStream;
23 | import java.io.IOException;
24 | import java.io.InputStream;
25 |
26 | public class GoogleActivity extends AppCompatActivity {
27 | private static final String TAG = GoogleActivity.class.getSimpleName();
28 | /** Actual panorama widget. **/
29 | private VrPanoramaView panoWidgetView;
30 | /**
31 | * Arbitrary variable to track load status. In this example, this variable should only be accessed
32 | * on the UI thread. In a real app, this variable would be code that performs some UI actions when
33 | * the panorama is fully loaded.
34 | */
35 | public boolean loadImageSuccessful;
36 | /** Tracks the file to be loaded across the lifetime of this app. **/
37 | private Uri fileUri;
38 | /** Configuration information for the panorama. **/
39 | private VrPanoramaView.Options panoOptions = new VrPanoramaView.Options();
40 | private ImageLoaderTask backgroundImageLoaderTask;
41 |
42 | /**
43 | * Called when the app is launched via the app icon or an intent using the adb command above. This
44 | * initializes the app and loads the image to render.
45 | */
46 | @Override
47 | protected void onCreate(Bundle savedInstanceState) {
48 | super.onCreate(savedInstanceState);
49 | setContentView(R.layout.main_layout);
50 |
51 | // Make the source link clickable.
52 | TextView sourceText = (TextView) findViewById(R.id.source);
53 | sourceText.setText(Html.fromHtml(getString(R.string.source)));
54 | sourceText.setMovementMethod(LinkMovementMethod.getInstance());
55 |
56 | panoWidgetView = (VrPanoramaView) findViewById(R.id.pano_view);
57 | panoWidgetView.setEventListener(new ActivityEventListener());
58 | //panoWidgetView.setTouchTrackingEnabled(true);
59 |
60 | // Initial launch of the app or an Activity recreation due to rotation.
61 | handleIntent(getIntent());
62 | }
63 |
64 | /**
65 | * Called when the Activity is already running and it's given a new intent.
66 | */
67 | @Override
68 | protected void onNewIntent(Intent intent) {
69 | Log.i(TAG, this.hashCode() + ".onNewIntent()");
70 | // Save the intent. This allows the getIntent() call in onCreate() to use this new Intent during
71 | // future invocations.
72 | setIntent(intent);
73 | // Load the new image.
74 | handleIntent(intent);
75 | }
76 |
77 | /**
78 | * Load custom images based on the Intent or load the default image. See the Javadoc for this
79 | * class for information on generating a custom intent via adb.
80 | */
81 | private void handleIntent(Intent intent) {
82 | // Determine if the Intent contains a file to load.
83 | if (Intent.ACTION_VIEW.equals(intent.getAction())) {
84 | Log.i(TAG, "ACTION_VIEW Intent recieved");
85 |
86 | fileUri = intent.getData();
87 | if (fileUri == null) {
88 | Log.w(TAG, "No data uri specified. Use \"-d /path/filename\".");
89 | } else {
90 | Log.i(TAG, "Using file " + fileUri.toString());
91 | }
92 |
93 | panoOptions.inputType = intent.getIntExtra("inputType", VrPanoramaView.Options.TYPE_MONO);
94 | Log.i(TAG, "Options.inputType = " + panoOptions.inputType);
95 | } else {
96 | Log.i(TAG, "Intent is not ACTION_VIEW. Using default pano image.");
97 | fileUri = null;
98 | panoOptions.inputType = VrPanoramaView.Options.TYPE_MONO;
99 | }
100 |
101 | // Load the bitmap in a background thread to avoid blocking the UI thread. This operation can
102 | // take 100s of milliseconds.
103 | if (backgroundImageLoaderTask != null) {
104 | // Cancel any task from a previous intent sent to this activity.
105 | backgroundImageLoaderTask.cancel(true);
106 | }
107 | backgroundImageLoaderTask = new ImageLoaderTask();
108 | backgroundImageLoaderTask.execute(Pair.create(fileUri, panoOptions));
109 | }
110 |
111 | @Override
112 | protected void onPause() {
113 | panoWidgetView.pauseRendering();
114 | super.onPause();
115 | }
116 |
117 | @Override
118 | protected void onResume() {
119 | super.onResume();
120 | panoWidgetView.resumeRendering();
121 | }
122 |
123 | @Override
124 | protected void onDestroy() {
125 | // Destroy the widget and free memory.
126 | panoWidgetView.shutdown();
127 |
128 | // The background task has a 5 second timeout so it can potentially stay alive for 5 seconds
129 | // after the activity is destroyed unless it is explicitly cancelled.
130 | if (backgroundImageLoaderTask != null) {
131 | backgroundImageLoaderTask.cancel(true);
132 | }
133 | super.onDestroy();
134 | }
135 |
136 | /**
137 | * Helper class to manage threading.
138 | */
139 | class ImageLoaderTask extends AsyncTask, Void, Boolean> {
140 |
141 | /**
142 | * Reads the bitmap from disk in the background and waits until it's loaded by pano widget.
143 | */
144 | @Override
145 | protected Boolean doInBackground(Pair... fileInformation) {
146 | VrPanoramaView.Options panoOptions = null; // It's safe to use null VrPanoramaView.Options.
147 | InputStream istr = null;
148 | if (fileInformation == null || fileInformation.length < 1
149 | || fileInformation[0] == null || fileInformation[0].first == null) {
150 | AssetManager assetManager = getAssets();
151 | try {
152 | istr = assetManager.open("bb.jpg");
153 | panoOptions = new VrPanoramaView.Options();
154 | panoOptions.inputType = VrPanoramaView.Options.TYPE_MONO;
155 | } catch (IOException e) {
156 | Log.e(TAG, "Could not decode default bitmap: " + e);
157 | return false;
158 | }
159 | } else {
160 | try {
161 | istr = new FileInputStream(new File(fileInformation[0].first.getPath()));
162 | panoOptions = fileInformation[0].second;
163 | } catch (IOException e) {
164 | Log.e(TAG, "Could not load file: " + e);
165 | return false;
166 | }
167 | }
168 |
169 | panoWidgetView.loadImageFromBitmap(BitmapFactory.decodeStream(istr), panoOptions);
170 | try {
171 | istr.close();
172 | } catch (IOException e) {
173 | Log.e(TAG, "Could not close input stream: " + e);
174 | }
175 |
176 | return true;
177 | }
178 | }
179 |
180 | /**
181 | * Listen to the important events from widget.
182 | */
183 | private class ActivityEventListener extends VrPanoramaEventListener {
184 | /**
185 | * Called by pano widget on the UI thread when it's done loading the image.
186 | */
187 | @Override
188 | public void onLoadSuccess() {
189 | loadImageSuccessful = true;
190 | }
191 |
192 | /**
193 | * Called by pano widget on the UI thread on any asynchronous error.
194 | */
195 | @Override
196 | public void onLoadError(String errorMessage) {
197 | loadImageSuccessful = false;
198 | Toast.makeText(
199 | GoogleActivity.this, "Error loading pano: " + errorMessage, Toast.LENGTH_LONG)
200 | .show();
201 | Log.e(TAG, "Error loading pano: " + errorMessage);
202 | }
203 | }
204 | }
205 |
--------------------------------------------------------------------------------
/app/src/main/java/com/study/xuan/vrshow/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.vrshow;
2 |
3 | import android.app.ActivityManager;
4 | import android.content.Intent;
5 | import android.content.pm.ConfigurationInfo;
6 | import android.os.Build;
7 | import android.os.Bundle;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.view.View;
10 | import android.widget.TextView;
11 |
12 |
13 | public class MainActivity extends AppCompatActivity{
14 | private boolean supportsEs2;
15 | private TextView mTvGif;
16 | private TextView mTvStl;
17 | private TextView mTvGoogle;
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_main);
23 | initView();
24 | initEvent();
25 | /*checkSupported();
26 | if (supportsEs2) {
27 | setContentView(R.layout.activity_main);
28 | } else {
29 | setContentView(R.layout.activity_main);
30 | Toast.makeText(this, "当前设备不支持OpenGL ES 2.0!", Toast.LENGTH_SHORT).show();
31 | }*/
32 |
33 | }
34 |
35 | private void initView() {
36 | mTvGif = (TextView) findViewById(R.id.gif);
37 | mTvStl = (TextView) findViewById(R.id.stl);
38 | mTvGoogle = (TextView) findViewById(R.id.google);
39 | }
40 |
41 | private void initEvent() {
42 | mTvGif.setOnClickListener(new View.OnClickListener() {
43 | @Override
44 | public void onClick(View v) {
45 | Intent intent = new Intent(MainActivity.this, GifActivity.class);
46 | startActivity(intent);
47 | }
48 | });
49 |
50 | mTvStl.setOnClickListener(new View.OnClickListener() {
51 | @Override
52 | public void onClick(View v) {
53 | Intent intent = new Intent(MainActivity.this, STLActivity.class);
54 | startActivity(intent);
55 | }
56 | });
57 |
58 | mTvGoogle.setOnClickListener(new View.OnClickListener() {
59 | @Override
60 | public void onClick(View v) {
61 | Intent intent = new Intent(MainActivity.this, GoogleActivity.class);
62 | startActivity(intent);
63 | }
64 | });
65 | /*stlView.setRotate(true);
66 | stlView.setScale(true);
67 | stlView.setSensor(true);
68 | stlView.setOnReadCallBack(new OnReadCallBack() {
69 | @Override
70 | public void onStart() {
71 | mTvProgress.setText("开始解析!");
72 | }
73 |
74 | @Override
75 | public void onReading(int cur, int total) {
76 | bundle.putInt("cur", cur);
77 | bundle.putInt("total", total);
78 | Message msg = new Message();
79 | msg.setData(bundle);
80 | handler.sendMessage(msg);
81 | }
82 |
83 | @Override
84 | public void onFinish() {
85 | mTvProgress.setText("解析完成!");
86 | }
87 | });*/
88 | }
89 |
90 |
91 | /*private onReadListener readListener = new onReadListener() {
92 | @Override
93 | public void onstart() {
94 | mTvProgress.setText("开始解析!");
95 | }
96 |
97 | @Override
98 | public void onLoading(int cur, int total) {
99 | bundle.putInt("cur", cur);
100 | bundle.putInt("total", total);
101 | Message msg = new Message();
102 | msg.setData(bundle);
103 | handler.sendMessage(msg);
104 | }
105 |
106 | @Override
107 | public void onFinished(STLModel model) {
108 | mTvProgress.setText("解析完成!");
109 | if (model != null) {
110 | if (stlView == null) {
111 | stlView = new STLView(MainActivity.this,model);
112 | container.addView(stlView);
113 | } else {
114 | stlView.setNewSTLObject(model);
115 | }
116 | }
117 | }
118 |
119 | @Override
120 | public void onFailure(Exception e) {
121 |
122 | }
123 | };*/
124 |
125 |
126 | private void checkSupported() {
127 | ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
128 | ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
129 | supportsEs2 = configurationInfo.reqGlEsVersion >= 0x2000;
130 |
131 | boolean isEmulator = Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1
132 | && (Build.FINGERPRINT.startsWith("generic")
133 | || Build.FINGERPRINT.startsWith("unknown")
134 | || Build.MODEL.contains("google_sdk")
135 | || Build.MODEL.contains("Emulator")
136 | || Build.MODEL.contains("Android SDK built for x86"));
137 |
138 | supportsEs2 = supportsEs2 || isEmulator;
139 | }
140 |
141 | @Override
142 | protected void onPause() {
143 | super.onPause();
144 | /*if (stlView != null) {
145 | stlView.onPause();
146 | }*/
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/app/src/main/java/com/study/xuan/vrshow/STLActivity.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.vrshow;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 | import android.os.Bundle;
6 | import android.os.Handler;
7 | import android.os.Message;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.util.Log;
10 | import android.widget.Toast;
11 |
12 | import com.study.xuan.gifshow.widget.stlview.callback.OnReadCallBack;
13 | import com.study.xuan.gifshow.widget.stlview.widget.STLView;
14 | import com.study.xuan.gifshow.widget.stlview.widget.STLViewBuilder;
15 |
16 | public class STLActivity extends AppCompatActivity {
17 | private STLView mStl;
18 | private Context mContext;
19 | private ProgressDialog mBar;
20 | private Bundle bundle = new Bundle();
21 | private Handler handler = new Handler(){
22 | @Override
23 | public void handleMessage(Message msg) {
24 | Bundle bundle = msg.getData();
25 | float cur = bundle.getFloat("cur");
26 | float total = bundle.getFloat("total");
27 | float progress = cur / total;
28 | Log.i("Progress", progress + "");
29 | mBar.setProgress((int) (progress * 100.0f));
30 | }
31 | };
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.activity_stl);
36 | mContext = this;
37 | mStl = (STLView) findViewById(R.id.stl);
38 | mBar = prepareProgressDialog(mContext);
39 | mStl.setOnReadCallBack(new OnReadCallBack() {
40 | @Override
41 | public void onStart() {
42 | Toast.makeText(mContext, "开始解析!", Toast.LENGTH_LONG).show();
43 | mBar.show();
44 | }
45 |
46 | @Override
47 | public void onReading(int cur, int total) {
48 | bundle.putFloat("cur", cur);
49 | bundle.putFloat("total", total);
50 | Message msg = new Message();
51 | msg.setData(bundle);
52 | handler.sendMessage(msg);
53 | }
54 |
55 | @Override
56 | public void onFinish() {
57 | mBar.dismiss();
58 | }
59 | });
60 | STLViewBuilder.init(mStl).Assets(this, "bai.stl").build();
61 | mStl.setTouch(true);
62 | mStl.setScale(true);
63 | mStl.setRotate(true);
64 | mStl.setSensor(true);
65 | }
66 |
67 | private ProgressDialog prepareProgressDialog(Context context) {
68 | ProgressDialog progressDialog = new ProgressDialog(context);
69 | progressDialog.setTitle(R.string.stl_load_progress_title);
70 | progressDialog.setMax(100);
71 | progressDialog.setMessage(context.getString(R.string.stl_load_progress_message));
72 | progressDialog.setIndeterminate(false);
73 | progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
74 | progressDialog.setCancelable(false);
75 | return progressDialog;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/drawable/demo.gif
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_gif.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_google.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
22 |
34 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_stl.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/main_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
21 |
22 |
28 |
29 |
35 |
36 |
42 |
43 |
49 |
50 |
56 |
57 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #222
7 | #555
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 24dip
4 | 12dip
5 | 15dip
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | VRShow
3 |
4 |
5 | 请等一会.
6 | STL 文件加载中...
7 | STL 文件解析失败.
8 | 文件过大,解析失败!
9 | 关闭对话框
10 | 父目录
11 | 选择STL文件
12 |
13 |
14 |
15 | 移动
16 | 旋转
17 |
18 |
19 | STL展示界面的配置
20 | 红
21 | 绿
22 | 蓝
23 | 透明度
24 | 模型颜色:
25 | 展示坐标和网格:
26 | 网格:
27 | 坐标:
28 | 重置默认值.
29 | 保存 & 关闭
30 |
31 |
32 | Machu Picchu\nWorld Heritage Site
33 | The world-famous citadel of the Andes
34 | Machu Picchu is an Incan citadel set high in the Andes Mountains in
35 | Peru, above the Urubamba River valley.
36 |
37 | A 360 panoramic view of Machu Picchu
38 |
39 | It is situated on a mountain ridge above the Sacred Valley which is 80
40 | kilometres (50 mi) northwest of Cuzco and through which the Urubamba River flows.
41 | Most archaeologists believe that Machu Picchu was built as an estate for the Inca emperor
42 | Pachacuti (1438–1472). Often mistakenly referred to as the Lost City of the Incas,
43 | it is the most familiar icon of Inca civilization.
44 |
45 | \n\nThe Incas built the estate around 1450, but abandoned it a century later at the time of the
46 | Spanish Conquest. Although known locally, it was not known to the Spanish during the colonial
47 | period and remained unknown to the outside world before being brought to international attention
48 | in 1911 by the American historian Hiram Bingham. Most of the outlying buildings have been
49 | reconstructed in order to give tourists a better idea of what the structures originally
50 | looked like. By 1976, 30% of Machu Picchu had been restored; restoration continues today.
51 |
52 | \n\nMachu Picchu was declared a Peruvian Historical Sanctuary in 1981 and a UNESCO World Heritage
53 | Site in 1983. In 2007, Machu Picchu was voted one of the New Seven Wonders of the World in a
54 | worldwide Internet poll.
55 |
56 |
57 | Source <a href="https://en.wikipedia.org/wiki/Machu_Picchu">Wikipedia</a>
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/test/java/com/study/xuan/vrshow/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.vrshow;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.2'
9 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // Add this line
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gif/book.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/gif/book.gif
--------------------------------------------------------------------------------
/gif/gifdemo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/gif/gifdemo.gif
--------------------------------------------------------------------------------
/gif/googlefinal.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/gif/googlefinal.gif
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DrownCoder/VRShow/ad4eea9bf2ca08e6629380c7b11e1f7271611027/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Nov 29 12:18:12 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | group='com.github.sdfdzx'
5 | android {
6 | compileSdkVersion 26
7 | buildToolsVersion "27.0.0"
8 |
9 | defaultConfig {
10 | minSdkVersion 15
11 | targetSdkVersion 26
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 |
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29 | exclude group: 'com.android.support', module: 'support-annotations'
30 | })
31 | compile 'com.android.support:appcompat-v7:26.+'
32 | compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
33 | testCompile 'junit:junit:4.12'
34 | }
35 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\Program\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/library/src/androidTest/java/com/study/xuan/gifshow/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.gifshow;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.study.xuan.gifshow.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/library/src/main/java/com/study/xuan/gifshow/gif/VrGifView.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.gifshow.gif;
2 |
3 | import android.animation.Animator;
4 | import android.animation.ObjectAnimator;
5 | import android.content.Context;
6 | import android.util.AttributeSet;
7 | import android.view.MotionEvent;
8 |
9 | import com.study.xuan.gifshow.util.ScreenUtil;
10 |
11 | import pl.droidsonroids.gif.GifDrawable;
12 | import pl.droidsonroids.gif.GifImageView;
13 |
14 | /**
15 | * Author : xuan.
16 | * Date : 2017/12/16.
17 | * Description :利用3d展示的gif控制播放进度
18 | */
19 |
20 | public class VrGifView extends GifImageView {
21 | //触摸响应速度
22 | public static final int MODE_FAST = 1;
23 | public static final int MODE_NORMAL = 2;
24 | public static final int MODE_LOW = 3;
25 | private int SPEED_FAST = 100;
26 | private int SPEED_NORMAL = 250;
27 | private int SPEED_LOW = 500;
28 |
29 | private Context mContext;
30 | private GifDrawable gifDrawable;
31 | private int gifLength;
32 | //单指旋转
33 | private float lastX;
34 | private float downTime;
35 | private int curPos;
36 | private float moveX;
37 | private float moveDis;
38 | //手指拖动距离和播放位置的映射
39 | private float PX_TO_POS;
40 | private int moveMode;
41 | private int moveSpeed;
42 | //双指缩放
43 | private float pinchScale = 1.0f;
44 | private float pinchStartDistance = 0.0f;
45 | private ObjectAnimator scaleAnimator;
46 | private boolean isUp;
47 | private Animator.AnimatorListener listener;
48 | //当前缩放量
49 | private float scale_now = 1.0f;
50 | //触摸模式
51 | private static final int TOUCH_NONE = 0;
52 | private static final int TOUCH_DRAG = 1;
53 | private static final int TOUCH_ZOOM = 2;
54 | private int touchMode = TOUCH_NONE;
55 | //感应开关
56 | private boolean isTouch;
57 | private boolean isScale;
58 | private boolean isDrag;
59 | private boolean canAnim;
60 |
61 | public VrGifView(Context context) {
62 | this(context, null);
63 | }
64 |
65 | public VrGifView(Context context, AttributeSet attrs) {
66 | this(context, attrs, 0);
67 | }
68 |
69 | public VrGifView(Context context, AttributeSet attrs, int defStyle) {
70 | super(context, attrs, defStyle);
71 | this.mContext = context;
72 | init();
73 | }
74 |
75 | private void init() {
76 | if (gifDrawable == null) {
77 | gifDrawable = (GifDrawable) getDrawable();
78 | }
79 | if (gifDrawable == null) {
80 | return;
81 | }
82 | gifLength = gifDrawable.getDuration();
83 | moveMode = MODE_FAST;
84 | moveSpeed = SPEED_FAST;
85 | canAnim = true;
86 | PX_TO_POS = gifLength / ScreenUtil.getWindowDisplay(mContext).getWidth();
87 | setImageDrawable(gifDrawable);
88 | }
89 |
90 | public void setTouch(boolean touch) {
91 | isTouch = touch;
92 | }
93 |
94 | public void setScale(boolean scale) {
95 | isScale = scale;
96 | if (isScale) {
97 | listener = new Animator.AnimatorListener() {
98 | @Override
99 | public void onAnimationStart(Animator animation) {
100 | canAnim = false;
101 | }
102 |
103 | @Override
104 | public void onAnimationEnd(Animator animation) {
105 | canAnim = true;
106 | }
107 |
108 | @Override
109 | public void onAnimationCancel(Animator animation) {
110 |
111 | }
112 |
113 | @Override
114 | public void onAnimationRepeat(Animator animation) {
115 |
116 | }
117 | };
118 | }
119 | }
120 |
121 | public void setDrag(boolean drag) {
122 | isDrag = drag;
123 | }
124 |
125 | /**
126 | * 设置触摸触发响应速度
127 | */
128 | public void setMoveMode(int mode) {
129 | switch (mode) {
130 | case MODE_FAST:
131 | moveMode = MODE_FAST;
132 | moveSpeed = SPEED_FAST;
133 | break;
134 | case MODE_NORMAL:
135 | moveMode = MODE_NORMAL;
136 | moveSpeed = SPEED_NORMAL;
137 | break;
138 | case MODE_LOW:
139 | moveMode = MODE_LOW;
140 | moveSpeed = SPEED_LOW;
141 | break;
142 | default:
143 | moveMode = MODE_NORMAL;
144 | moveSpeed = SPEED_NORMAL;
145 | break;
146 | }
147 | }
148 |
149 | /**
150 | * 设置gif图
151 | */
152 | public void setGifDrawable(GifDrawable gifDrawable) {
153 | this.gifDrawable = gifDrawable;
154 | }
155 |
156 | @Override
157 | public boolean onTouchEvent(MotionEvent event) {
158 | if (!isTouch) {
159 | return true;
160 | }
161 | //双指缩放
162 | if (isScale) {
163 | zoomScale(event);
164 | }
165 | //单指旋转
166 | if (isDrag) {
167 | rotateModel(event);
168 | }
169 | return true;
170 | }
171 |
172 | private void rotateModel(MotionEvent event) {
173 | switch (event.getAction() & MotionEvent.ACTION_MASK) {
174 | case MotionEvent.ACTION_DOWN:
175 | if (touchMode == TOUCH_NONE && event.getPointerCount() == 1) {
176 | touchMode = TOUCH_DRAG;
177 | gifDrawable.stop();
178 | lastX = event.getX();
179 | downTime = event.getDownTime();
180 | }
181 | break;
182 | case MotionEvent.ACTION_MOVE:
183 | if (touchMode == TOUCH_DRAG) {
184 | if ((event.getEventTime() - downTime) > moveSpeed) {
185 | moveX = event.getX();
186 | moveDis = moveX - lastX;
187 | lastX = moveX;
188 | curPos = gifDrawable.getCurrentPosition();
189 | if ((curPos + moveDis * PX_TO_POS) < 0) {
190 | curPos += moveDis * PX_TO_POS + gifLength;
191 | } else {
192 | curPos += moveDis * PX_TO_POS;
193 | }
194 | if (curPos < 0) {
195 | curPos = 0;
196 | }
197 | gifDrawable.seekTo(curPos);
198 | downTime = event.getEventTime();
199 | }
200 | }
201 | break;
202 | case MotionEvent.ACTION_UP:
203 | if (touchMode == TOUCH_DRAG) {
204 | touchMode = TOUCH_NONE;
205 | }
206 | gifDrawable.start();
207 | break;
208 | }
209 | }
210 |
211 | private void zoomScale(MotionEvent event) {
212 | switch (event.getAction() & MotionEvent.ACTION_MASK) {
213 | // starts pinch
214 | case MotionEvent.ACTION_POINTER_DOWN:
215 | if (event.getPointerCount() >= 2) {
216 | pinchStartDistance = getPinchDistance(event);
217 | downTime = event.getDownTime();
218 | if (pinchStartDistance > 50f) {
219 | touchMode = TOUCH_ZOOM;
220 | }
221 | }
222 | break;
223 |
224 | case MotionEvent.ACTION_MOVE:
225 | if (touchMode == TOUCH_ZOOM && pinchStartDistance > 0) {
226 | // on pinch
227 | if ((event.getEventTime() - downTime) > moveSpeed) {
228 | if (getPinchDistance(event) > pinchStartDistance) {
229 | //递增
230 | isUp = true;
231 | } else {
232 | isUp = false;
233 | }
234 | pinchScale = getPinchDistance(event) / pinchStartDistance;
235 | if (checkScale(pinchScale)) {
236 | changeScale(pinchScale);
237 | }
238 | }
239 | }
240 | break;
241 |
242 | // end pinch
243 | case MotionEvent.ACTION_UP:
244 | case MotionEvent.ACTION_POINTER_UP:
245 | pinchScale = 0;
246 | if (touchMode == TOUCH_ZOOM) {
247 | touchMode = TOUCH_NONE;
248 | }
249 | break;
250 | }
251 | }
252 |
253 | private boolean checkScale(float pinchScale) {
254 | if (canAnim) {
255 | if (isUp) {
256 | if (pinchScale > 1) {
257 | return true;
258 | }
259 | } else {
260 | if (pinchScale < 1) {
261 | return true;
262 | }
263 | }
264 | }
265 | return false;
266 | }
267 |
268 | private void changeScale(float pinchScale) {
269 | scaleAnimator = ObjectAnimator.ofFloat(this, "scale", scale_now, scale_now * pinchScale);
270 | scale_now = scale_now * pinchScale;
271 | scaleAnimator.setDuration(50);
272 | if (listener != null) {
273 | scaleAnimator.addListener(listener);
274 | }
275 | scaleAnimator.start();
276 | }
277 |
278 | private float getPinchDistance(MotionEvent event) {
279 | float x = 0;
280 | float y = 0;
281 | try {
282 | x = event.getX(0) - event.getX(1);
283 | y = event.getY(0) - event.getY(1);
284 | } catch (IllegalArgumentException e) {
285 | e.printStackTrace();
286 | }
287 | return (float) Math.sqrt(x * x + y * y);
288 | }
289 |
290 | /**
291 | * 动画反射需要
292 | */
293 | public void setScale(float value) {
294 | setScaleX(value);
295 | setScaleY(value);
296 | }
297 | }
298 |
--------------------------------------------------------------------------------
/library/src/main/java/com/study/xuan/gifshow/util/ScreenUtil.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.gifshow.util;
2 |
3 | import android.content.Context;
4 | import android.view.Display;
5 | import android.view.WindowManager;
6 |
7 | /**
8 | * Author : xuan.
9 | * Date : 2017/11/30.
10 | * Description :input the description of this file.
11 | */
12 |
13 | public class ScreenUtil {
14 | /**
15 | * 获得屏幕宽高
16 | * 调用getWidth(),getHeight()
17 | */
18 | public static Display getWindowDisplay(Context context) {
19 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
20 | return wm.getDefaultDisplay();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/library/src/main/java/com/study/xuan/gifshow/widget/stlview/callback/OnReadCallBack.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.gifshow.widget.stlview.callback;
2 |
3 | /**
4 | * Author : xuan.
5 | * Date : 2017/12/12.
6 | * Description :抽象类回调
7 | */
8 |
9 | public abstract class OnReadCallBack {
10 | public void onStart() {
11 |
12 | }
13 |
14 | public void onReading(int cur, int total) {
15 |
16 | }
17 |
18 | public void onFinish() {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/library/src/main/java/com/study/xuan/gifshow/widget/stlview/callback/OnReadListener.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.gifshow.widget.stlview.callback;
2 |
3 | import com.study.xuan.gifshow.widget.stlview.model.STLModel;
4 |
5 | public interface OnReadListener {
6 | void onstart();
7 |
8 | void onLoading(int cur, int total);
9 |
10 | void onFinished(STLModel model);
11 |
12 | void onFailure(Exception e);
13 | }
--------------------------------------------------------------------------------
/library/src/main/java/com/study/xuan/gifshow/widget/stlview/model/STLModel.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.gifshow.widget.stlview.model;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.study.xuan.gifshow.widget.stlview.util.STLUtils;
7 |
8 | import java.nio.FloatBuffer;
9 | import javax.microedition.khronos.opengles.GL10;
10 |
11 |
12 | /**
13 | * Author : xuan.
14 | * Date : 2017/12/14.
15 | * Description : stl文件对应转换的3d模型数据
16 | */
17 |
18 | public class STLModel implements Parcelable {
19 | FloatBuffer triangleBuffer;
20 | FloatBuffer normalBuffer;
21 |
22 | public float maxX;
23 | public float maxY;
24 | public float maxZ;
25 | public float minX;
26 | public float minY;
27 | public float minZ;
28 |
29 | //优化使用的数组
30 | public float[] normal_array=null;
31 | public float[] vertex_array=null;
32 | private int vertext_size=0;
33 |
34 | public STLModel() {
35 | }
36 |
37 | public STLModel(Parcel source) {
38 | maxX = source.readFloat();
39 | maxY = source.readFloat();
40 | maxZ = source.readFloat();
41 | minX = source.readFloat();
42 | minY = source.readFloat();
43 | minZ = source.readFloat();
44 | vertext_size = source.readInt();
45 | source.readFloatArray(normal_array);
46 | source.readFloatArray(vertex_array);
47 | setVnorms(normal_array);
48 | setVnorms(vertex_array);
49 | }
50 |
51 | public void draw(GL10 gl) {
52 | if (triangleBuffer == null) {
53 | return;
54 | }
55 | gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
56 | gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
57 | //gl.glFrontFace(GL10.GL_CCW);
58 | gl.glVertexPointer(3, GL10.GL_FLOAT, 0, triangleBuffer);
59 | gl.glNormalPointer(GL10.GL_FLOAT,0, normalBuffer);
60 | gl.glDrawArrays(GL10.GL_TRIANGLES, 0, vertext_size*3);
61 | gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
62 | gl.glDisableClientState(GL10.GL_NORMAL_ARRAY);
63 | }
64 |
65 | public void setMax(float maxX, float maxY, float maxZ) {
66 | this.maxX = maxX;
67 | this.maxY = maxY;
68 | this.maxZ = maxZ;
69 | }
70 |
71 | public void setMin(float minX, float minY, float minZ) {
72 | this.minX = minX;
73 | this.minY = minY;
74 | this.minZ = minZ;
75 | }
76 |
77 | public void setSize(int size) {
78 | this.vertext_size = size;
79 | }
80 |
81 | public void delete (){
82 | }
83 |
84 | public void setVerts(float[] verts) {
85 | this.vertex_array = verts;
86 | this.triangleBuffer = STLUtils.floatToBuffer(vertex_array);
87 | }
88 |
89 | public void setVnorms(float[] vnorms) {
90 | this.normal_array = vnorms;
91 | this.normalBuffer = STLUtils.floatToBuffer(normal_array);
92 | }
93 |
94 | @Override
95 | public int describeContents() {
96 | return 0;
97 | }
98 |
99 | @Override
100 | public void writeToParcel(Parcel dest, int flags) {
101 | dest.writeFloat(maxX);
102 | dest.writeFloat(maxY);
103 | dest.writeFloat(maxZ);
104 | dest.writeFloat(minX);
105 | dest.writeFloat(minY);
106 | dest.writeFloat(minZ);
107 | dest.writeInt(vertext_size);
108 | dest.writeFloatArray(normal_array);
109 | dest.writeFloatArray(vertex_array);
110 | }
111 |
112 | public static final Creator CREATOR = new Creator() {
113 | @Override
114 | public STLModel createFromParcel(Parcel source) {
115 | return new STLModel(source);
116 | }
117 |
118 | @Override
119 | public STLModel[] newArray(int size) {
120 | return new STLModel[size];
121 | }
122 | };
123 | }
124 |
--------------------------------------------------------------------------------
/library/src/main/java/com/study/xuan/gifshow/widget/stlview/operate/ISTLReader.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.gifshow.widget.stlview.operate;
2 |
3 |
4 | import com.study.xuan.gifshow.widget.stlview.callback.OnReadListener;
5 | import com.study.xuan.gifshow.widget.stlview.model.STLModel;
6 |
7 | /**
8 | * Author : xuan.
9 | * Date : 2017/12/10.
10 | * Description : interface of stlreader
11 | */
12 |
13 | public interface ISTLReader {
14 | public STLModel parserBinStl(byte[] bytes);
15 |
16 | public STLModel parserAsciiStl(byte[] bytes);
17 |
18 | public void setCallBack(OnReadListener listener);
19 | }
20 |
--------------------------------------------------------------------------------
/library/src/main/java/com/study/xuan/gifshow/widget/stlview/operate/ReaderHandler.java:
--------------------------------------------------------------------------------
1 | package com.study.xuan.gifshow.widget.stlview.operate;
2 |
3 | import android.os.AsyncTask;
4 |
5 | import com.study.xuan.gifshow.widget.stlview.callback.OnReadListener;
6 | import com.study.xuan.gifshow.widget.stlview.model.STLModel;
7 | import com.study.xuan.gifshow.widget.stlview.util.STLUtils;
8 |
9 | /**
10 | * Author : xuan.
11 | * Date : 2017/12/10.
12 | * Description : 异步加载Stl文件
13 | */
14 | public class ReaderHandler {
15 | private ISTLReader reader;
16 | private ReaderTask backWorker;
17 | private OnReadListener listener;
18 |
19 | public ReaderHandler(ISTLReader reader, OnReadListener listener) {
20 | this.reader = reader;
21 | this.listener = listener;
22 | backWorker = new ReaderTask();
23 | }
24 |
25 |
26 | public void read(byte[] stlBytes) {
27 | try {
28 | backWorker.execute(stlBytes);
29 | } catch (Exception e) {
30 | listener.onFailure(e);
31 | }
32 | }
33 |
34 | private class ReaderTask extends AsyncTask