Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
40f66fc1
Commit
40f66fc1
authored
Feb 21, 2020
by
Evan W. Patton
Committed by
Jeffrey Schiller
Mar 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix accelerometer crashing emulator if UseLegacy is off
Change-Id: I0aa290a74d286d6f8681b4698ea7c6212b36ecb6
parent
f071ee04
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
appinventor/components/src/com/google/appinventor/components/runtime/AccelerometerSensor.java
...e/appinventor/components/runtime/AccelerometerSensor.java
+17
-15
No files found.
appinventor/components/src/com/google/appinventor/components/runtime/AccelerometerSensor.java
View file @
40f66fc1
...
...
@@ -7,18 +7,6 @@
package
com.google.appinventor.components.runtime
;
import
com.google.appinventor.components.annotations.DesignerComponent
;
import
com.google.appinventor.components.annotations.DesignerProperty
;
import
com.google.appinventor.components.annotations.PropertyCategory
;
import
com.google.appinventor.components.annotations.SimpleEvent
;
import
com.google.appinventor.components.annotations.SimpleFunction
;
import
com.google.appinventor.components.annotations.SimpleObject
;
import
com.google.appinventor.components.annotations.SimpleProperty
;
import
com.google.appinventor.components.common.ComponentCategory
;
import
com.google.appinventor.components.common.PropertyTypeConstants
;
import
com.google.appinventor.components.common.YaVersion
;
import
com.google.appinventor.components.runtime.util.ErrorMessages
;
import
android.content.Context
;
import
android.content.res.Configuration
;
import
android.content.res.Resources
;
...
...
@@ -26,13 +14,22 @@ import android.hardware.Sensor;
import
android.hardware.SensorEvent
;
import
android.hardware.SensorEventListener
;
import
android.hardware.SensorManager
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.util.Log
;
import
android.view.Surface
;
import
android.view.WindowManager
;
import
com.google.appinventor.components.annotations.DesignerComponent
;
import
com.google.appinventor.components.annotations.DesignerProperty
;
import
com.google.appinventor.components.annotations.PropertyCategory
;
import
com.google.appinventor.components.annotations.SimpleEvent
;
import
com.google.appinventor.components.annotations.SimpleObject
;
import
com.google.appinventor.components.annotations.SimpleProperty
;
import
com.google.appinventor.components.common.ComponentCategory
;
import
com.google.appinventor.components.common.PropertyTypeConstants
;
import
com.google.appinventor.components.common.YaVersion
;
import
com.google.appinventor.components.runtime.util.ErrorMessages
;
import
com.google.appinventor.components.runtime.util.SdkLevel
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -255,6 +252,11 @@ public class AccelerometerSensor extends AndroidNonvisibleComponent
}
public
int
getDeviceDefaultOrientation
()
{
if
(
Build
.
VERSION
.
SDK_INT
<
SdkLevel
.
LEVEL_FROYO
)
{
// getRotation() is unavailable on versions of Android lower tha Froyo, so assume a default
// orientation of PORTRAIT (which was the implied assumption before we added this check).
return
Configuration
.
ORIENTATION_PORTRAIT
;
}
Configuration
config
=
resources
.
getConfiguration
();
int
rotation
=
windowManager
.
getDefaultDisplay
().
getRotation
();
if
(
DEBUG
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment