Skip to content

Commit

Permalink
Merge pull request #63 from BrutalCoding/master
Browse files Browse the repository at this point in the history
Fixed crash 'java.lang.IllegalArgumentException: Parameter specified …'
  • Loading branch information
giandifra authored Oct 17, 2020
2 parents 59d98bb + 9735ef1 commit f210ffa
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 49 deletions.
119 changes: 118 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,121 @@ build/

*.sfb

pubspec.lock
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# Visual Studio Code related
.classpath
.project
.settings/
.vscode/

# Flutter repo-specific
/bin/cache/
/bin/mingit/
/dev/benchmarks/mega_gallery/
/dev/bots/.recipe_deps
/dev/bots/android_tools/
/dev/devicelab/ABresults*.json
/dev/docs/doc/
/dev/docs/flutter.docs.zip
/dev/docs/lib/
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
version
analysis_benchmark.json

# packages file containing multi-root paths
.packages.generated

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
**/generated_plugin_registrant.dart
.packages
.pub-cache/
.pub/
build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/key.properties
*.jks

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/.last_build_id
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift
**/macos/Flutter/Flutter-Debug.xcconfig
**/macos/Flutter/Flutter-Release.xcconfig
**/macos/Flutter/Flutter-Profile.xcconfig

# Coverage
coverage/

# Symbols
app.*.symbols

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
134 changes: 134 additions & 0 deletions .idea/codeStyles/Project.xml

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

6 changes: 6 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Tue Sep 15 12:06:53 AWST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,20 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess
loadMesh(textureBytes)
}
"dispose" -> {
Log.i(TAG, " updateMaterials")
Log.i(TAG, "Disposing ARCore now")
dispose()
}
"resume" -> {
Log.i(TAG, "Resuming ARCore now")
onResume()
}
"getTrackingState" -> {
Log.i(TAG, "1/3: Requested tracking state, returning that back to Flutter now")

val trState = arSceneView?.arFrame?.camera?.trackingState
Log.i(TAG, "2/3: Tracking state is " + trState.toString())
methodChannel.invokeMethod("getTrackingState", trState.toString())
}
else -> {
}
}
Expand All @@ -220,7 +231,7 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess

private fun setupLifeCycle(context: Context) {
activityLifecycleCallbacks = object : Application.ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle) {
override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
Log.i(TAG, "onActivityCreated")
// maybeEnableArButton()
}
Expand All @@ -240,15 +251,16 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess
}

override fun onActivityStopped(activity: Activity) {
Log.i(TAG, "onActivityStopped")
onPause()
Log.i(TAG, "onActivityStopped (Just so you know)")
// onPause()
}

override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}

override fun onActivityDestroyed(activity: Activity) {
Log.i(TAG, "onActivityDestroyed")
onDestroy()
Log.i(TAG, "onActivityDestroyed (Just so you know)")
// onDestroy()
// dispose()
}
}

Expand Down Expand Up @@ -470,6 +482,7 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess
}

if (arSceneView?.session != null) {
arSceneView!!.getPlaneRenderer().setVisible(false)
Log.i(TAG, "Searching for surfaces")
}
}
Expand All @@ -481,11 +494,20 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess
}

fun onDestroy() {
if (arSceneView != null) {
arSceneView?.scene?.removeOnUpdateListener(sceneUpdateListener)
arSceneView?.scene?.removeOnUpdateListener(faceSceneUpdateListener)
arSceneView?.destroy()
arSceneView = null
if (arSceneView != null) {
Log.i(TAG, "Goodbye ARCore! Destroying the Activity now 7.")

try {
arSceneView?.scene?.removeOnUpdateListener(sceneUpdateListener)
arSceneView?.scene?.removeOnUpdateListener(faceSceneUpdateListener)
Log.i(TAG, "Goodbye arSceneView.")

arSceneView?.destroy()
arSceneView = null

}catch (e : Exception){
e.printStackTrace();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ open class BaseArCoreView(val activity: Activity, context: Context, messenger: B

private fun setupLifeCycle(context: Context) {
activityLifecycleCallbacks = object : Application.ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle) {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
Log.i(TAG, "onActivityCreated")
}

Expand All @@ -70,7 +70,7 @@ open class BaseArCoreView(val activity: Activity, context: Context, messenger: B

override fun onActivityDestroyed(activity: Activity) {
Log.i(TAG, "onActivityDestroyed")
onDestroy()
// onDestroy()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class RenderableCustomFactory {
val url = flutterArCoreNode.objectUrl

val localObject = flutterArCoreNode.object3DFileName

if (localObject != null) {
Log.e(TAG, "Modified by BrutalCoding - 1");
if (false) {
val builder = ModelRenderable.builder()
builder.setSource(context, Uri.parse(localObject))
builder.build().thenAccept { renderable ->
Expand All @@ -42,7 +42,7 @@ class RenderableCustomFactory {
val renderableSourceBuilder = RenderableSource.builder()

renderableSourceBuilder
.setSource(context, Uri.parse(url), RenderableSource.SourceType.GLTF2)
.setSource(context, Uri.parse(url), RenderableSource.SourceType.GLB)
.setScale(0.5f)
.setRecenterMode(RenderableSource.RecenterMode.ROOT)

Expand Down
Loading

0 comments on commit f210ffa

Please sign in to comment.