openhab-android icon indicating copy to clipboard operation
openhab-android copied to clipboard

WebView refreshes to the main page when rotating device

Open mmc20520 opened this issue 3 years ago • 6 comments

Actual behaviour

WebView refreshes to the main page when rotating device

For example, randomly browser in the webview. Before rotation: Screen Shot 2022-03-04 at 4 23 15 PM

After rotation:

Screen Shot 2022-03-04 at 4 23 27 PM

Expected behaviour

The loaded web page should remain unchanged

Steps to reproduce

Already mentioned above

Can you reproduce the issue in demo mode?

yes

Environment data

Client

  • Android version: 10
  • Device model: emulator
  • App version : 2.19.0
  • Build flavor :
  • Device language:

Server

  • Server version:
  • Reverse Proxy:
  • Authentication method :

openHAB Cloud

  • Self hosted cloud or myopenhab.org:
  • openHAB Cloud version :
  • Authentication method :

Logs

App log

Click to expand
Please add the app log if the issue is not a pure UI issue or it cannot be reproduced in demo mode.
Open the app, go to `Settings` => `View log` and insert the log here.

openHAB Server log

Click to expand
Not required.
If you have installed openHAB via `apt-get`, the log is located under `/var/log/openhab2/openhab.log`

mmc20520 avatar Mar 04 '22 08:03 mmc20520

Duplicate of https://github.com/openhab/openhab-android/issues/2606

mueller-ma avatar Mar 05 '22 22:03 mueller-ma

Is it fixed now? Seems I can still reproduce the issue in 3.7.0. I can also observe the issue from Frontail.

littlecd avatar Sep 19 '23 04:09 littlecd

Also still happening for me on OH 4.1.0 and app 3.10.

GIF_20240310_183251_807

vguna avatar Mar 10 '24 17:03 vguna

@florian-h05 ping as desired ;-) Reference for restoring the URL: we do this here

maniac103 avatar Dec 02 '24 05:12 maniac103

Thanks for pinging.

First question: Is it really required and cannot be avoided that the Android WebView reloads on every orientation change?

Second: Main UI still is not perfect with encoding its current navigation into the navigation route, it now does this for tabs as well (not sure if I added that before or after 4.2.0), but for the popup based stuff like the semantic model cards, this is not implemented. Overall it’s not easy to do that I think due to the way framework7 opens its modals. Those models usually modify the navigation route, but there is no actual route defined for them in the route so you cannot load the application into that modal. I can have a look at improving that if you say there is no other way though.

florian-h05 avatar Dec 02 '24 06:12 florian-h05

First question: Is it really required and cannot be avoided that the Android WebView reloads on every orientation change?

Yes. This is related to having differing layouts for portrait and landscape orientation. The activity is recreated and all views within are recreated with it. One can avoid recreation by specifying the 'orientation' value for configChanges in the manifest, but that only works properly for pure WebView activities (that is, the only layout element is a WebView), which isn't the case for us, since for sitemaps we switch between a one and a two pane layout.

maniac103 avatar Dec 02 '24 06:12 maniac103