Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Is it possible to change webView width during orientation handling?
Started by joe528 Jan 29 2014 07:41 PM

* * * * * 3 votes
35 replies to this topic
[TOPIC CONTROLS]
Page 1 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

My app is in portrait mode showing a webView, and now I try to handle orientation. Therefore, in my orientation handler (from portrait --> landscapeRight, for example), I try to rotate the webView & change the width to fill the width of the screen like this:

 

webView.rotation = 90
webView.x = newX
webView.y = newY
webView.width = newWidth   -- the width of landscape screen

 

The webView does rotate correctly. If I don't change its width, the webView is positioned correctly at (newX, newY)

 

But if I try to change its width (the 4th line, webView.width = newWidth), there are two problems:

 

(1) The webView is not positioned correctly (seems positioned in the middle)

 

(2) The webView width does not change. And the web page in the webView seems getting "zoomed" instead.

 

 

Please help. How to change webView width correctly in order to handle orientation changes?

 

 

P.S. The behaviors shown above are tested with iPhone 5S. Simulator behaves differently. 



[TOPIC: post.html]
#2

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

I created a simple project to isolate problems. Here is the complete code in main.lua (320x480, letterbox in config.lua, only Portrait mode is supported)

 

local webView = native.newWebView(0, 0, 320, 480)

webView.x = display.contentWidth * 0.5
webView.y = display.contentHeight * 0.5
webView:request("http://www.coronalabs.com")

local function rotateWebView()
print("rotateWebView")

webView.rotation = 90
webView.width = 480
webView.height = 320
end

timer.performWithDelay(3000, function() rotateWebView() end)

 

And the result screenshot is attached. Please take a look. (Not only width/height is not set right. The web content is totally "weird)

 
Is this a bug or am I doing something wrong?

Attached Thumbnails

  • 2014-01-31 12.12.11.png


[TOPIC: post.html]
#3

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

The above has to be tested in actual devices. For example, I tested it with iPhone 5S.

 

Simulator behaves differently. Please ignore Simulator.



[TOPIC: post.html]
#4

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

Any thoughts or comment?



[TOPIC: post.html]
#5

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

This problem is quite urgent because it's a basic requirement to implement webView to support device orientation.

 

I have filed a bug report, Case 30097

 

Hope Corona can act on it asap. Thanks.



[TOPIC: post.html]
#6

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

@Corona

 

Any plan or input about this bug?

 

When it comes to this bug, it's always like I am talking to myself (scroll up and see the avatars).



[TOPIC: post.html]
#7

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,625 posts
  • Enterprise

If you've filed a bug report, then the QA department will go through the bug reports, verify them,  prioritize them and schedule engineering to work on it.  From what I can see it's still in being researched.

 

Rob



[TOPIC: post.html]
#8

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

Thanks for your reply, I really hope this can be fixed at your earliest convenience.

 

Most of my user complaints are all about this right now.

 

Besides, I will be really quiet about webView after this fix... hopefully.



[TOPIC: post.html]
#9

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

I spent two hours yesterday trying to "tune" the positions after the webView is rotated.

 

I thought I could fine tune but finally I gave up. It's really a bug.

 

(1) For Simulator, I could tune the positions so that webView can be rotated and put correctly in the screen. (but the algorithm is quite odd)

 

(2) I thought I could do the same for the device.

 

(3) Actual devices (I tested with iPhone 5S & iPad 3) behaves differently than Simulator after webView rotates. The webView in actual devices gets really funky when changing its width/height after changing its rotation property.

 

(4) Even without any orientation or rotation, simply changing webView width/height is screwing the webView content. (The content is stretched)

 

CONCLUSION

 

The conclusion is that current webView cannot support device orientation at all, no matter how.

 

I really hope this can be addressed as soon as possible. 

 

For a business app that supports orientation + webView, it's a common practice but it's not achievable via Corona right now.



[TOPIC: post.html]
#10

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

@Corona

 

Please give me some hint if you are going to fix this problem or not, and probably how long?

 

I am seriously planning to discontinue my current business app or trying to get it to a next level.

 

This problem (bug) is really holding me back. This problem is very FUNDAMENTAL if an app with webView wants to support orientation!

 

I don't know what to do next.

 

Please at least let me know if you are not going to fix it for a long time, then I will just discard the plan and move on to something else!



[TOPIC: post.html]
#11

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,625 posts
  • Enterprise

@joe528, I will bring this up to the engineers. 

 

Rob



[TOPIC: post.html]
#12

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

Consider this:

 

( a ) a business app with web browser   <----- common

 

( b ) a business app that supports orientation    <----- common

 

Now, a business app with web browser that supports orientation cannot be achieved by Corona SDK

 

I think this should be escalated to product managers to decide if this problem should be addressed or not (and when)



[TOPIC: post.html]
#13

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

still waiting eagerly & deperately to know



[TOPIC: post.html]
#14

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

Forget about any orientation or rotation, just one simple question

 

Changing width/height of webView currently screws the content, are you planning to fix this one or not? If it's a technical constraint, please let me know that you are not going to fix this, so I can move on to something else.

 

Please. This has been bugging me continuously for two months.



[TOPIC: post.html]
#15

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

Q: Can I use Corona for developing business apps?

A: Yes, of course.

 

Q: Does Corona support device orientation?

A: Yes, absolutely.

 

Q: Can I have an embedded web browser in my business app?

A: Yes, Corona has a webView component.

 

Q: Can my business app with a webView support orientation?

A: well............................ there are some bugs so ............................

 

Q: So?

A: ........................................

 

Q: And?

A: ........................................

 

Q: Should I use Corona to develop this kind of business app after all?

A: .......................................

 

Q: Maybe I should not use Corona to develop this kind of business app?

A: .......................................

 

Q: Maybe I should wait a bit?

A: .......................................

 

Q: Maybe I shouldn't wait and move on to something else?

A: ......................................



[TOPIC: post.html]
#16

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,625 posts
  • Enterprise

I asked engineering again on the status. I'll update this thread when I know more.

 

Rob



[TOPIC: post.html]
#17

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

I saw build 2260 trying to fix the width/height changing problem of the webView, which is good, finally, thanks.

 

I was very excited to test it out, but soon I found it's very obvious it introduced another bug. Now changing the webview width/height (no need to rotate at all) gives wrong width/height (probably due to scaling).... have you really tested it after the fix?!

 

The webView rotation problem is more complicated than that... there is another bug when playing a video in full-screen via webView. When a full-video is played via webView, rotate the device (don't rotate it back), press DONE to end the video, the "system" width/height is messed up! 

 

Without fixing the second problem, webView orientation support is still a problem. Corona should understand and fix webView orientation problem as a whole.



[TOPIC: post.html]
#18

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

Look, it's very hard for us app developers to build customer base and to face the fierce market competition.

 

For a business app with webView, if I can support orientation, I believe my app retention rate can be doubled right away. Now when every day goes by, it's a loss to me for not supporting orientation.

 

Before I started to use Corona, I did ask your sales if I could use Corona to build a business app with webView. Although I didn't ask in such a detail that if webView orientation could be supported, but it was a straight-forward assumption that it could. Corona shouldn't just treat them as regular bugs so it's not something should be decided by the engineers but something that should be considered as a product-level plan. They are really very "obvious" & "fundamental" bugs that I don't understand why Corona could generate them (& even generating a obvious regression bug in last fix attempt) and keep them exist for such a long time. 

 

Unless there is some technical constraint, if so, please just let me know, I can do some different planning such as using native coding. Do you really think I like to think about this issue every day? No, I don't!



[TOPIC: post.html]
#19

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,625 posts
  • Enterprise

Joe, I feel your frustration.  Engineering is still trying to address this. 



[TOPIC: post.html]
#20

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

Hi Rob,

 

I have tested the latest fix in build 2272, the good news is that the width/height issue is fixed for iOS device, but not for Android device. (I really don't understand why the engineer didn't test on Android device)

 

And, there is one more bug related to webView orientation I filed earlier, Case# 31803

 

It is a bug when playing a video in full-screen from the webView, rotate the device (don't rotate back), click DONE to end the video (or wait for the video to finish and press DONE), the "system" width/height (such as display.contentHeight/display.contentWidth) are not updated to the current orientation even though there is an orientation event. Therefore, when exiting the video, the whole screen is messed up totally! 

 

Could you also help to let the engineers know? They need to fix both bugs "completely" in order for webView to support orientation.



[TOPIC: post.html]
#21

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,625 posts
  • Enterprise

I'll let them know.  I don't know when they can get to the other bug.  You can also reply to the bug report letting them know its still broken on Android and that will keep the bug active.

 

Rob



[TOPIC: post.html]
#22

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,625 posts
  • Enterprise

I just looked at the bug report and it specifically says it was tested on Android. 

 

I just verified that changing the webview width and
height (as in your latest test code) works find on both iPad Mini and
Galaxy Tab 3 7". This is with build 2275.

 

So you need to get build 2275 and try that.

 

Rob



[TOPIC: post.html]
#23

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

It's only a partial fix. (sign... just can't do one step further?)

 

Android devices still have some problem in changing webView width/height.

 

It appears ok to change webView width/height but if you change more than once (using a timer delay), there is something wrong.

 

Or say, if a device orientation changes, changing webView width/height is still going to mess up webView. Try to rotate the device more than one time.

 

I have filed another bug report, Case 32270.

 

Does Corona has product-level manager, can I talk to him/her? It seems an endless road for webView orientation support. To report a bug, "I" test it, and find another bug. Repeat.



[TOPIC: post.html]
#24

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

I am really disappointed about Corona.

 

I was seriously thinking to construct a tutorial site & a local learning program to promote Corona as the main development tool for mobile apps. However, with this kind of obvious bugs, passiveness & ignorance, I just have to forget about it.

 

Apple now presents a new language, Swift. I think I have found my solution. On the other hand, I used to think cross-platform was very important, but now I think product is much more important and once it's approved by the market, one always has the resource to make it available for other platforms. There is no obvious reason I need to rely solely on Corona anymore.



[TOPIC: post.html]
#25

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

This is a key issue with Corona Labs leadership decision making process. Priority always goes to new features that will sell more or attract more investor dollars. Bug fixes & maintenance, while going on all the time, is not the biggest priority. When you see significant issues taking months or even years (ie widgets) to resolve you know how things work around here. I learned to make peace with all this and do the best I can with the given toolset. I'm too old and too busy to learn a new trick so I'll be around for a while longer but not out of choice really...  :(




[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]