
All week there were announcements of folding smartphones: Samsung and Huawei are already eager to deprive us of a large amount, while Oppo and Xiaomi have prototypes.
They were vigorously discussed, but mostly it was about iron and prices. And for any new form factor, software support is also important: you can remember that when the iPad appeared, you first had to use “iPhone” applications that looked awful on a 10-inch screen, and then adapted gradually appeared.
')
Will existing Android applications have difficulties on clamshells? Why prepare for those users who decide to buy an expensive device? And what should the developer do to make these users satisfied? How to test your application if there is no $ 2000 device at hand?
Under the cut, we described it from the "user" side, and from the "development". Could have missed something - so, if Android developers add to the comments, we will be happy.
UI optimization
Hooray, thanks to the folding bed in the pocket now breaks the big screen! You can not constantly scroll the text of three lines, and see a lot of information at once! Conveniently, how to use everything will be! So?
Well, let's compare. On the left is what the Twitter app looks like now on the screen of a 6-inch smartphone. On the right, what it might look like on a new-fashioned folding piece with a close to square screen, like in Huawei Mate X (we won’t vouch for pixel-by-pixel accuracy, but this is the essence):

That is, the old screen got two tweets, and the new one and a half. Oops. Now you can buy a phone more expensive than $ 2000, so that it becomes more inconvenient to read Twitter.
Why is that? The Twitter application interface is designed only for a regular phone screen, where the “close up the full width of the photo” will never be too wide. (In the end, under ChromeOS, this application
looks like you don’t want to see it.)
It seems that we already went through all this in 2011 with the advent of Android tablets: first, the phone applications looked bad on them, then Fragments were added to Android, the developers started working to make their applications look different on different screens, everything became so good? The problem is that now Android tablets are not in demand, it has become unclear whether it is necessary to invest in their support, and as a result, applications with display on large screens now have very different things. Specifically, folding smartphones also have non-standard aspect ratio.
Theoretically, the appearance of clamshells could change the situation: a new fashionable category of devices bursts in, and everyone is trying to make their applications look better on them. But practically, as long as such smartphones cost from $ 2000, their market share will be so small that they are unlikely to be adjusted to them.
This is not the end of the world: for example, the same Twitter in the web version looks much better, and in general the web adapts much better to different screen sizes, so browsing should really become more comfortable. In addition, if in the future, folding phones fall in price, it can change the alignment. But, in general, so far not everything is smooth in the Danish kingdom.
Conclusion for usersDo not believe the beautiful pictures from the presentations, where they will pick up great-looking applications on the device - if you want to buy a clamshell, check first what important ones look to you.
Developer InferenceWhether to invest resources in different versions of the interface, you know better yourself, based on your situation. But on the occasion of the emergence of "clamshells" try at least in the emulator to open your application on the screen more than the phone and see what happens - perhaps you yourself will shudder and want to change the situation.
Transition between screens
Usually, Android developers are not faced with the fact that their application is directly transferred to another screen with a different resolution and aspect ratio during use. In the presentations of folding smartphones, they show how seamlessly all this will happen: I started watching the video on the folded device, then laid it out and continue from the same place. Is it in practice always going to be so seamless?
From the point of view of the application, at the moment of transition, what happens in the Android development is called configuration change. By default, Android in such cases re-creates the current screen of the application, which theoretically could mean the loss of part of the current data.
But, fortunately, this is not the first type of configuration change to appear: for example, a simple screen rotation of a regular smartphone also fits this definition. And since this simple turn could have long deprived the user of the data he had just entered, measures for their preservation have also been taken for a long time. Finally, it all depends on the developers of a specific application (did they take care that their application correctly handled the configuration change), but in general the situation is good: there was no new big problem, only a variation of the old one that has been successfully coped for a long time.
Conclusion for usersProbably, the vast majority of popular applications will work out the transition between the screens correctly, but in some cases there may be flaws.
Developer InferenceIn general, it just requires your application to correctly handle the configuration change (see, for example,
the “Handle configuration changes”
page in the official documentation).
And how to test in practice that the transition between the screens goes well, if you don’t have the “clamshell” for testing? While there are no virtual clamshells in the Android Studio emulator either, Samsung made a
crutch an intermediate solution: an addition to the existing emulator, which allows you to get not a virtual Samsung Fold, but something like that.
You create a large tablet in AVD Manager, install a special APK file
from the Samsung website , and add a “switch” between the two options: in each, only the part of the tablet screen corresponding to one of the Samsung Fold screens is used. It looks like this (switch on the virtual screen at the bottom right with numbers 1 and 2):

Multi mode
Another feature of the new category is multi-windowing: Samsung speaks directly about how great it will be to display Fold three applications at once. What will happen to this?
At first glance, there is no revolution here either: back in Android 7.0, it was possible to display two applications at once, and the transition from two windows to three is not so fundamental. It seems that then you can draw all the conclusions on how this will work, on what we have seen for a long time?
But just now a new nuance has emerged: Google announced that a new version of “multi-resume” is appearing in multi-window mode. Previously, of simultaneously displayed applications, only one was “fully active” (the one that was “in focus”), and the rest turned out to be in “pause” mode, but now several can be equally active at once:

And what causes this and what changes? Google
writes about the following (freely translate from polite English to spoken Russian):
“Developers, I’ve got some kind of backdrops, you don’t read official guides, and you don’t implement the correct approach to the multiwindow mode. You think that once called “pause”, you need to pause everything in the application - video, for example. But if the user has divided the screen between your video player and another application, then the hedgehog is clear that he wants to continue watching the video. Well, since it’s too difficult for you to follow the right practices, FIG with you, we will tune up: now all applications on the screen can be active at the same time. ”
So far this is all in test mode (multi-resume will work only in cases where both the application developer has expressed his consent to this, and the device manufacturer). But later they are going to make it the norm for everyone, and not only on clamshells, but also in a two-window split-screen on ordinary smartphones.
Conclusion for usersSo far, everything is in an intermediate state. It seems that at the moment some applications in multi-window mode will work inconveniently (for example, the messenger may not show new incoming messages if it is currently not in focus). But Google is struggling to fix it. You look, in a couple of years it will be better.
Developer InferenceYou can connect to the new version of multi-resume by adding the following line to AndroidManifest:
<meta-data android:name="android.allow_multiple_resumed_activities" android:value="true" />
But since the consent of the manufacturer of the device is also required (and it is not yet clear whether everyone will give it), it’s probably better to go through the Google “Multi-window support”
page and implement onPause () with its account without sticking the whole stop there.
Minute advertising. If you were interested in “conclusions for developers” in this text, then the Mobius conference may also be of interest to you: from there, mobile developers can draw many valuable conclusions for a variety of reasons. It will be held May 22-23 in St. Petersburg, you can learn more on the site .
And if you yourself have valuable conclusions on a vital issue for mobile developers - now the last days are coming when you can apply for a report !