提交 487c54f8 作者: cbd

1、网络加载dae文件

上级 f9e6587c
...@@ -409,7 +409,7 @@ public class SceneLoader implements LoadListener, EventListener { ...@@ -409,7 +409,7 @@ public class SceneLoader implements LoadListener, EventListener {
public final void toggleLighting() { public final void toggleLighting() {
if (this.drawLighting && this.rotatingLight) { if (this.drawLighting && this.rotatingLight) {
this.rotatingLight = false; this.rotatingLight = false;
makeToastText("Light stopped", Toast.LENGTH_SHORT); //+ makeToastText("Light stopped", Toast.LENGTH_SHORT);
} else if (this.drawLighting && !this.rotatingLight) { } else if (this.drawLighting && !this.rotatingLight) {
this.drawLighting = false; this.drawLighting = false;
makeToastText("Lights off", Toast.LENGTH_SHORT); makeToastText("Lights off", Toast.LENGTH_SHORT);
......
...@@ -198,10 +198,11 @@ public class ModelRenderer implements GLSurfaceView.Renderer { ...@@ -198,10 +198,11 @@ public class ModelRenderer implements GLSurfaceView.Renderer {
} }
public ModelRenderer(Activity parent, ModelSurfaceView modelSurfaceView){ public ModelRenderer(Activity parent, ModelSurfaceView modelSurfaceView, float[] backgroundColor){
this.main = modelSurfaceView; this.main = modelSurfaceView;
try { try {
this.drawer = new RendererFactory(parent); this.drawer = new RendererFactory(parent);
this.backgroundColor = backgroundColor;
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
......
...@@ -58,7 +58,7 @@ public class ModelSurfaceView extends GLSurfaceView implements EventListener { ...@@ -58,7 +58,7 @@ public class ModelSurfaceView extends GLSurfaceView implements EventListener {
super(context, attrs); super(context, attrs);
Log.i("ModelSurfaceView","Loading [OpenGL 2] ModelSurfaceView..........."); Log.i("ModelSurfaceView","Loading [OpenGL 2] ModelSurfaceView...........");
setEGLContextClientVersion(2); setEGLContextClientVersion(2);
mRenderer = new ModelRenderer((Activity) context, this); mRenderer = new ModelRenderer((Activity) context, this,backgroundColor);
mRenderer.addListener(this); mRenderer.addListener(this);
setRenderer(mRenderer); setRenderer(mRenderer);
} }
......
...@@ -77,4 +77,7 @@ dependencies { ...@@ -77,4 +77,7 @@ dependencies {
api 'com.github.SherlockGougou:BigImageViewPager:androidx-7.1.4' api 'com.github.SherlockGougou:BigImageViewPager:androidx-7.1.4'
api 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.10' api 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.10'
//文件downloader
api 'com.liulishuo.filedownloader:library:1.7.5'
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
package="com.orange.widget"> package="com.orange.widget">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<application <application
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.Look" android:theme="@style/Theme.Look"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"
android:name="com.orange.widget.app.App"> android:name="com.orange.widget.app.App">
<!-- <activity--> <!-- <activity-->
<!-- android:name="com.orange.widget.MainActivity"--> <!-- android:name="com.orange.widget.MainActivity"-->
......
package com.orange.widget.app package com.orange.widget.app
import android.app.Application import android.app.Application
import android.util.Log
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.liulishuo.filedownloader.FileDownloader
import com.liulishuo.filedownloader.connection.FileDownloadConnection
import com.liulishuo.filedownloader.connection.FileDownloadUrlConnection
import com.orange.net.net.NetHelper import com.orange.net.net.NetHelper
import com.orange.tool.app.AppUrl import com.orange.tool.app.AppUrl
import com.orange.tool.app.IApp import com.orange.tool.app.IApp
import com.orange.widget.util.NoEtagFileDownloadUrlConnection
import xyz.doikki.videoplayer.util.PlayerUtils.getApplication
import java.io.IOException
class App : IApp(){ class App : IApp(){
...@@ -28,6 +34,19 @@ class App : IApp(){ ...@@ -28,6 +34,19 @@ class App : IApp(){
ARouter.openLog() ARouter.openLog()
ARouter.openDebug() ARouter.openDebug()
ARouter.init(app) ARouter.init(app)
// FileDownloader.setupOnApplicationOnCreate(getApplication())
FileDownloader.setupOnApplicationOnCreate(getApplication())
.connectionCreator(object : FileDownloadUrlConnection.Creator(
FileDownloadUrlConnection.Configuration()
.connectTimeout(15000) // set connection timeout.
.readTimeout(15000) // set read timeout.
) {
@Throws(IOException::class)
override fun create(originUrl: String): FileDownloadConnection {
return NoEtagFileDownloadUrlConnection(originUrl)
}
})
.commit()
} }
override fun init(app: Application, applicationFlag: Boolean) { override fun init(app: Application, applicationFlag: Boolean) {
......
package com.orange.widget.util;
import com.liulishuo.filedownloader.connection.FileDownloadUrlConnection;
import java.io.IOException;
import java.net.URL;
public class NoEtagFileDownloadUrlConnection extends FileDownloadUrlConnection {
public NoEtagFileDownloadUrlConnection(String originUrl, Configuration configuration) throws IOException {
super(originUrl, configuration);
}
public NoEtagFileDownloadUrlConnection(URL url, Configuration configuration) throws IOException {
super(url, configuration);
}
public NoEtagFileDownloadUrlConnection(String originUrl) throws IOException {
super(originUrl);
}
@Override
public void addHeader(String name, String value) {
if ("If-Match".equals(name)) {
return;
}
super.addHeader(name, value);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论