Android Question View utils snippets on Android 7

Star-Dust

Expert
Licensed User
Longtime User
They work for me. I tried all the rotations.
Maybe you're confusing "It does not work on Android 7" with "I can not make it work". Quote :p
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I will try again.


Thank you. I have few memory but for sure I will remember this your post:
upload_2018-5-16_14-0-51.png
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The test project attached works on Android 4.4.2, does not work on Android 7.
Some rare versions of Android 7 do not rotate with native commands.
For example on some Huawei, you're probably one of the few who's not working. :D


Samsung S6 - Android 7
1.png


Huawei MediaPad M3 - Android 7
2.png
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
Hi there,

I made some similar experiments a while ago, and found different behaviours between models. Not sure if related because I don't own a Huawei with Android 7, but worth a try.

Could you pls try the same example posted in #6 in the Huawei model, adding this sub and calling it at the end of Activity_Create()?
B4X:
Sub increaseCameraDistance(v As View)
    Dim jo = v As JavaObject
    Dim dist As Float = jo.RunMethod("getCameraDistance", Null)
    Log(dist)
    dist = 2*dist
    jo.RunMethod("setCameraDistance",Array(dist))
End Sub

Just curious to see if it changes the output somehow and also the logged value (original cameraDistance)o_O
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Hi there,

I made some similar experiments a while ago, and found different behaviours between models. Not sure if related because I don't own a Huawei with Android 7, but worth a try.

Could you pls try the same example posted in #6 in the Huawei model, adding this sub and calling it at the end of Activity_Create()?
B4X:
Sub increaseCameraDistance(v As View)
    Dim jo = v As JavaObject
    Dim dist As Float = jo.RunMethod("getCameraDistance", Null)
    Log(dist)
    dist = 2*dist
    jo.RunMethod("setCameraDistance",Array(dist))
End Sub

Just curious to see if it changes the output somehow and also the logged value (original cameraDistance)o_O
To study the rotations I use one of my programs that allows me to change the pivot by clicking on the image.
Here are the results with the change you suggested to me

Samsung
Samsung.gif


Huawei
It disappears as soon as it makes different rotations from the Z
Huawei.gif
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
Nice one!

If you decrease this value in the devices where it works (setCameraDistance(0)), there arrives a moment where, regardless the pivots, it makes exactly the same (disappears on X, Y rotations)

That's why I "supposed" that increasing the value on the Huawei would work.

BTW, which is the original cameraDistance value in the Huawei? (would make sense if it reads a 0)
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Yes is 0, Try set up to 0
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Changing the value the Samsung sometimes crashes for the rotations of Y and X
While Huawei work fine, but sometimes crashes

Do you have an explanation?

Update: I found a value that stabilizes the rotation on Huawei and not crashes
 
Last edited:
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
This value affects the perspective settings when rotating around X/Y axis. The perspective will be sharper for lower values.
I think that most devices (I read it somewhere) have a "standard" value that is related to the largest screen side and also proportional to the device scale. When I made my tests, these values were something like 1920 and 1600, for a couple of devices I own.

A cameraDistance of 0 (Huawei) means that, when you rotate over the X/Y axis, a part of the image has negative coordinates relative to the camera, and that's the reason why it was not drawn.

Not sure why it crashes with some values. Possibly the same system makes use of these values to perform its animations, but as it is not a real "3D" camera it may be valid only up to a certain range.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
This value affects the perspective settings when rotating around X/Y axis. The perspective will be sharper for lower values.
I think that most devices (I read it somewhere) have a "standard" value that is related to the largest screen side and also proportional to the device scale. When I made my tests, these values were something like 1920 and 1600, for a couple of devices I own.

A cameraDistance of 0 (Huawei) means that, when you rotate over the X/Y axis, a part of the image has negative coordinates relative to the camera, and that's the reason why it was not drawn.

Not sure why it crashes with some values. Possibly the same system makes use of these values to perform its animations, but as it is not a real "3D" camera it may be valid only up to a certain range.
I entered the standard value I had on the Samsung is on the Huawei works perfectly without crashing
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Now you have the missing piece for a rotating cube ;)
Otherwise I would have done it by hand with the trigonometric functions :D
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
apparently nothing changes.
Do you mean that the view seem the same or that rotation does not work?

As I understand it, it doesn't change the appearance of the view when not rotated. Only has effect when rotating around X and/or Y axis.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Last edited:
Upvote 0
Top