Quantcast
Jump to content

Adapt Your App to Foldable Devices for an Optimal User Experience


STF News
 Share

Recommended Posts

2021-09-14-01-banner.jpg

Foldable technology for mobile is a groundbreaking experience not only for users but also for developers. The presence of many form factors like immersive display, app continuity, Flex mode and UX optimization challenge developers to think outside of the box to adapt to this technology. In this blog, we discuss a checklist to provide a better understanding about the adaptation, modification and design changes that are required. So, let's go through each point, one-by-one.

Large screen optimization

Samsung foldable devices have two different physical screens: the cover display and the main display. As the cover display is much smaller than the main display, large screen optimization is one of the key areas of designing UX for foldable devices. In a nutshell, your app can utilize the extra space in the main display by showing more information. Just having a different UI design with the same information can do the trick of optimization as well.

Large screen optimization of a note app Large screen optimization of a note app

To implement this scenario, define different layout files for each display using the alternate resources option. For example, if you want to define a different UI for the main display, create a new directory named layout-sw600dp under the res directory and then create an xml file named activity_main. Then add the layout code as required.

UI is designed separately for the main display and the cover display UI is designed separately for the main display and the cover display

Flex mode optimization

In Galaxy Z series devices, Samsung introduced a new mode called Flex mode. This mode allows users to use apps while the book-like phone is partially folded. Creative design can really make your app stand out from others in Flex mode.

Google Duo App in Flex mode in Galaxy Z series devices Google Duo app in Flex mode in Galaxy Z series devices

Using Google’s new Jetpack library, WindowManager, you can detect the current posture of a Galaxy Z series device and update the UI accordingly by following these steps:

Step 1: Add the dependencies in the build.gradle.

implementation "androidx.window:window:1.0.0-alpha01"

Step 2: Define a WindowManager instance.

val windowManager = WindowManager(this, null)

Step 3: Register the DeviceState change listener. The listener notices changes in the device state (for example CLOSED, OPENED, HALF_OPENED).

windowManager.registerDeviceStateChangeCallback( 
mainThreadExecutor /* Executor */, 
callback /* Consumer<DeviceState> */
)

Step 4: Write a callback function to check deviceState.posture to get the current posture of the device. If the posture is POSTURE_HALF_OPENED, the app UI gets updated for Flex mode.

val callback = Consumer<DeviceState> { deviceState ->
  if (deviceState.posture == DeviceState.POSTURE_HALF_OPENED) {
    // Display is folded, show Split UX
  } else {
    // Display is not folded, show Full Screen UX
  }
}

Check out the CodeLab challenge on Flex mode for a more hands-on experience.

App continuity

While folding and unfolding the device, the app must prevent data loss thus ensuring its continuity. This is achievable by using the onSaveInstanceState() method. First, save the data to retain the current state with onSaveInstanceState().

@Override
public void onSaveInstanceState(Bundle savedInstanceState)
{
    //Save the current state
}

Then, restore the data in the onCreate() function.

@Override
protected void onCreate(Bundle savedInstanceState)
{
    if (savedInstanceState != null) {
        //restore the previous state
    }
}
2020-11-26-01-02.jpg 2020-11-26-01-03.jpg

Stopwatch app continuity while unfolding device

To have a better understanding of implementing app continuity, see the CodeLab challenge on app continuity.

Responsive UI layout

To adapt to new form factors such as a diverse aspect ratio, Flex mode, multi-window, and pop-up window, utilize the following guidelines :

  • Design a responsive UI layout for your app using ConstraintLayout.
  • Define the activity of your app as resizable, to ensure the maximum compatibility of your app with both the cover display and the main display of the device. Set the resizableActivity attribute to true in Manifest.xml.
<activity android:name=".MainActivity" android:resizeableActivity="true">
  
…
</activity>

Responsive layout of the Spotify app Responsive layout of the Spotify app

Cutout and punch hole of the main display

The main display of a Galaxy Z Fold is covered by an area on the top-right side called the “L-cut” whereas the Galaxy Z Fold2 and Fold3 have a punch hole in the upper right side and the Galaxy Z Flip devices have a punch hole in the middle. Some portion of your app’s UI could be covered by the L-cut or the punch hole.

Content is covered by the L-cut in a Galaxy Fold device Content is covered by the L-cut in a Galaxy Fold device in landscape mode

To avoid such a scenario, depending on your UI content style, define a display cutout mode. For example, the content is letterboxed in landscape mode whereas it is rendered into the cutout area in portrait mode by default. Define the display cutout mode in the style.xml as shortEdges so that your content is rendered into the cutout area in both portrait and landscape modes.

<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
2020-11-26-01-07.jpg 2020-11-26-01-08.jpg

Display cutout in the default mode and the shortEdges mode, respectively

Last but not the least, you can test your app on our device cloud, Samsung Remote Test Lab, to make sure you have implemented all the checkpoints discussed in this blog. You can also participate in our Codelab challenges to have a clear understanding of the implementation details.

In this blog we have discussed about how to adapt your app for foldable devices. We hope it is a good guide for you to start with. You can also check out Samsung’s official documentation and reach out to our developer community if you have any queries.

View the full blog at its source

Link to comment
Share on other sites



  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Similar Topics

    • By BGR
      Rumors about Apple launching a foldable device aren’t new. This time, Samsung is preparing for the Cupertino company to join a market that the South Korean firm currently has the lead. While everyone expects a foldable iPhone, Samsung doesn’t think this will be the first Apple device to bend.
      According to a report by The Elec, Samsung thinks the foldable market will grow 80% by 2025, and one of the reasons will be Apple joining the competition in 2024. Samsung’s mobile business, Mobile Experience, said that the Cupertino company would enter the foldable market, not with smartphones, but with notebooks and tablets first.
      Samsung Galaxy Fold 4 next to Galaxy Flip 4. Image source: Samsung Last month, CCS Insight published its annual prediction report and said Apple would likely launch a foldable iPad in 2024.
      One of the reasons why Apple won’t likely launch a foldable iPhone at first is not to cannibalize the existing iPhones as, according to the analyst, the foldable option would have to be “incredibly expensive.”
      Early this year, display analyst Ross Young said Apple was mulling a 20-inch foldable MacBook display, which could also be an iPad. Bloomberg‘s Mark Gurman also corroborated Apple entering this new market.
      Both analysts Ming-Chi Kuo and Ross Young expect a foldable iPhone to be introduced in 2025 at the earliest. In a couple of years from now, a foldable iPad/MacBook makes more sense.
      BGR will keep reporting on Apple’s new market approaches as the company is rumored to announce soon a Mixed Reality headset, an Augmented Reality headset, and a car in this decade.
      More Apple coverage: What’s really causing the M2 MacBook Pro launch delay?
      The post Samsung expects Apple to join foldable market in 2024 but not with iPhones appeared first on BGR.
      View the full article
    • By BGR
      Samsung is a couple of weeks away from returning to the Unpacked stage. This time, it’ll unveil new foldable devices and wearable gadgets. The Galaxy Z Fold 4 and Flip 4 will be the main stars of the event, although Samsung fans also expect the Watch 5 and brand new Galaxy Buds, come August 10th. Almost everything has leaked about the new foldable phones in the past few weeks. The only thing missing was the price for the Galaxy Z Fold 4 and Flip 4, but there’s a rumor about that.
      The European pricing structure for the Flip 4 has leaked, indicating that Samsung might not plan any significant price changes for the more affordable foldable handset. The Flip 4 should cost just as much as its predecessor in the region, so we’d expect Samsung to keep the Fold 4 price in place as well.
      Smartphone price hikes shouldn’t be a surprise
      Flagship smartphone vendors routinely keep last year’s pricing structure in place, but 2022 isn’t a regular year, and foldable phones aren’t regular flagships. The massive inflation following the pandemic and the war in Ukraine has forced suppliers to increase prices. In turn, smartphone makers might pass those costs to the consumer.
      That’s not great news for Samsung foldable devices, which continue to be more expensive than traditional flagships. Samsung has lowered the prices since the first Fold and Flip models. And the company throws plenty of promos at consumers in a bid to reduce the entry cost. But Samsung phones are more expensive than their counterparts from China. Luckily for Samsung, those rival devices aren’t widely available.
      Considering all these conditions, it’s clear that Samsung can’t offer massive price discounts for the Galaxy Z Fold 4 and Flip 4 this year. At best, Samsung can keep prices in place for one more year. That’s what the new leak suggests.
      Galaxy Z Flip 4 leaked press render. Image source: MySmartPrice Galaxy Z Flip 4 price in Europe
      As always, with European Union prices for goods, we’ll remind you that the prices below factor in tax. That’s how it works. Therefore, converting the prices in dollars will not get you the full picture. On the other hand, since the dollar and the euro reached parity, converting the prices below is very simple.
      That said, a new report provides the purported prices for the Galaxy Z Flip 4 variants. Here’s what buyers in the EU might expect:
      128GB Galaxy Z Flip 4: $1,080 256GB Galaxy Z Flip 4: $1,160 512GB Galaxy Z Flip 4: $1,280 Whatever the final price for the Flip 4, the entire EU region will offer a similar pricing structure, with small variations. Italian blog Tutto Android speculates that the 128GB model might cost $1,099 in Italy. That price point is in line with the Galaxy Z Flip 3’s cost last year.
      Galaxy Z Fold 4 press image leak. Image source: 91mobiles/Evan Blass How to reduce the cost of foldable phones.
      If the Flip 4 price quotes are accurate, we’d expect Samsung to keep the Flip 3 prices in various markets. The new affordable foldable might start at $999 in the US before all the deals.
      Similarly, Fold 4 might keep the Fold 3 starting price in place. That’s $1,799 before deals and promos. But you might get just 128GB of storage instead of 256GB like last year.
      The good news is that Samsung will have plenty of preorder deals for fans. You can start saving right away by registering your interest to preorder. You score at least $100 in savings for either the Fold 4 or Flip 4. And savings go up to $200 if you also register to preorder the new Samsung wearables.
      The post Galaxy Z Flip 4 leak indicates no price changes for affordable foldable appeared first on BGR.
      View the full article
    • By BGR
      Like clockwork, Samsung president and head of the mobile division TM Roh penned a blog this week, just a few weeks ahead of the upcoming Unpacked press conference that will focus on this year’s Galaxy Z foldable phones, the Fold 4 and Flip 4. We saw the same thing happen last year, and we now expect Roh to keep writing similar blogs with every Fold and Flip release.
      Roh just hinted that Samsung sold a massive number of foldable phones in 2021 by mentioning a figure of 10 million foldable phone sales for the period. Or so it seems. Because, when you think about it, 10 million units is a drop in the bucket for Samsung, whose smartphone sales routinely pass 250 million units a year.
      Roh’s remarks indicate what some consumers might have already realized: Foldable phones might not be worth it yet. What Samsung really needs is a foldable iPhone to lead the way.
      Foldable phones like the Galaxy Z Fold and Flip are fascinating on paper. They offer larger screens and smaller footprints. The Fold is especially exciting as it lets the user make the most of two types of devices — a smartphone and a tablet.
      A brief history of Samsung’s foldable phones
      Samsung has been at the forefront of foldable handsets for years. It teased the form factor well before the technology was ready. And then it released the first Galaxy Fold before actually testing it properly in real-life environments. The initial launch failed miserably, as Samsung had to find fixes for critical design flaws that led to the destruction of the phone.
      The Fold 2 and Fold 3 significantly improved the phone’s durability, especially the latter. The Fold 3 is the best possible foldable phone that Samsung can make. And even so, the Fold 3 is hardly perfect. The Fold 4 should fix some of the usability and design issues the Fold 3 suffers from. The new foldable will have a larger external display and weigh less than its predecessor.
      Galaxy Fold (2019) teardown highlights the phone’s design issues. Image source: iFixit But Samsung’s foldables aren’t true flagships like the Galaxy S and Note. The Fold series actually helped “kill” the Note without replacing it. The camera experience is still unable to match that of the Galaxy S Ultra, although the Fold 4 might change that. The Flip 4 is even further away.
      Not to mention that Samsung can’t fully control the software. Samsung’s success in the foldable business hinges on Google’s willingness to adapt Android for foldable screens. And it’s up to Google to convince Android app developers to update their apps to make the most of Fold and Flip phones. But why go through all that hassle for just 10 million potential customers?
      Add to that the flagship price for a somewhat fragile, not-flagship device, and you’ll get why people won’t want a foldable instead of a traditional phone, especially in this economy.
      Are foldables really going mainstream?
      This brings us to Roh’s new post about Samsung foldable phones titled The Mainstream Moment for Foldable Smartphones Is Here.
      In this post, he said the industry registered almost 10 million foldable smartphone sales worldwide last year. That’s an increase of more than 300% from 2020. And Roh says he predicts “this fast-paced growth will continue.”
      “We are reaching the moment where these foldable devices are becoming widespread and staking a bigger claim in the overall smartphone market,” he said.
      A quick back-of-the-napkin calculation tells us that handset makers should sell 30 million foldable phones this year to keep that 300% pace in place. That is hardly reasonable for the economy we’re currently living in.
      Not to mention that some estimates see Samsung selling only 15 million foldable phones in 2022. It’s unlikely that Chinese companies can make up for the rest. And a foldable iPhone isn’t coming anytime soon.
      Google apps running on Galaxy Fold 3 foldable. Image source: Google How many Galaxy Z Fold 3 units did Samsung sell?
      Then, Samsung might sell only 10 million Fold 5 and Flip 5 units in 2023. If these estimates are accurate, Samsung’s foldable sales will grow by 50% this year compared to the entire industry’s performance in 2021. And then they’ll stay flat next year in a best-case scenario.
      To put things in perspective, Apple routinely sells around 200 million iPhones yearly. For massive profits and without crazy deals in place.
      Also, annual smartphone shipments have reached at least 1.28 billion units per year since 2014.
      Meanwhile, reports say that Apple can’t make a foldable iPhone because it can’t mass-produce enough foldable glass covers to satisfy its needs. That implies that foldable iPhone volumes would be so large no supplier could handle the parts order. Not even Samsung, whose foldable phone tech might very well end up inside a foldable iPhone.
      Let’s also observe that Roh did not reveal which foldable smartphones sold the best. Last year, Samsung sold four foldable handsets: The Fold 2, Flip 2, Fold 3, and Flip 3. But he did say that 70% of Samsung’s buyers opted for the Flip experience rather than the Fold.
      The Note would have probably outsold all Samsung foldables combined last year. But Samsung had no Note 21 in stores. Apple’s iPhone SE 2 outsold the Galaxy Folds and Flips combined. And while that’s a mid-range device, it still delivers better durability and performance than any Samsung flagship.
      Oppo Find N foldable phone. Image source: Christian de Looper for BGR Where the foldable iPhone could help
      These are all signs that Samsung’s foldable phones while doing well, are hardly getting to be mainstream devices. And while Samsung has been selling more foldables than anybody else, it barely has any competition. Some of the exciting foldable phones from China aren’t available widely.
      Not to mention that Samsung ran massive campaigns to convince buyers to try and keep foldable phones. You could try the Fold 2 for 100 days and then return it. Or trade in everything but the kitchen sink to buy a Fold 3, with a retail price starting at $1,799. The Fold 4 isn’t out yet, but you can already save up to $200 on it by reserving the right to preorder it.
      Concept image of a foldable iPhone with a clamshell design. Image source: ConceptsiPhone/YouTube Time will tell whether Samsung can accelerate the rate of foldable smartphone innovations without a real competitor to pressure it. And whether foldables will go mainstream with Samsung as the locomotive.
      But that’s where a foldable iPhone would really help. Samsung would not rest on its laurels and write self-congratulatory blog posts every summer if a foldable iPhone were to launch just a few weeks after the newest Fold.
      Also, the more time that passes without a foldable iPhone, the harder it will be for Samsung to replace the traditional smartphone with a foldable form factor. And at 10 million units sold annually, that’s hardly going mainstream. That’s because something else might kill traditional smartphones: The sophisticated AR glasses of the future. And that sort of tech is a priority for Apple.
      That’s not to say all the tech Samsung has devised for foldable phones won’t come in handy. But the world might use it to create other types of foldable devices instead of phones.
      The post Why Samsung needs Apple to make a foldable iPhone appeared first on BGR.
      View the full article



×
×
  • Create New...