question

sreekant avatar image
sreekant asked etherealestelle answered

How to maintain UI in station Pro.

I am using below code to find flex device. I am able to manage the UI for clover mini and clover station but when i release production build it does not work. The UI for flex is showing in station Pro device. Please suggest how to know, its station pro.


 public static boolean isFlexDevice(Context context) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {//for flex/mini 2nd gen
            boolean mobileData = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
//            BPS_Logger.e("FLEX_DEVICE", "" + mobileData);
            return mobileData;
        }
        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1) { //only for flex 1st gen
//            BPS_Logger.e("FLEX_DEVICE", "Build.VERSION_CODES.LOLLIPOP ");
            return true;
        } else { //for all landscape
//            BPS_Logger.e("FLEX_DEVICE", "Platform.isCloverFlex() "+Platform.isCloverFlex());
            return Platform.isCloverFlex();
        }
    }
station pro
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image
Jeffrey Blattman answered

In most cases it is incorrect to write device model aware code.

You say "manage the UI" to I assume you want to vary the user interface based on the device model. To what end? If the purpose is to have your UI adjust to the screen orientation and size of different Clover devices you should be using resource qualifiers, like this:

  • (default resources): Flex-size screens
  • *-sw600dp: Mini-size screens
  • *-sw768dp: Station (1)-sized screens
  • *-sw811dp: Station (2018, Pro)-sized screens
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacob Abrams avatar image
Jacob Abrams answered Jacob Abrams edited

Please see the javadocs in this class for more details about how to write your app in a fashion that is not hardcoded for particular devices:

https://clover.github.io/clover-android-sdk/com/clover/sdk/util/Platform2.html

Remember Clover comes out with new devices every year, sometimes several devices, most of these devices are only marginally different from older devices and we want your apps to work out of the box whenever possible and not require code changes for each new Clover device, much like how Android app developers do not write code specifically for every single Android phone on the market.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

etherealestelle avatar image
etherealestelle answered

Maintaining UI in Station Pro is a breeze! With its intuitive design and user-friendly interface, keeping your website looking sleek and professional is effortless. Plus, for businesses like the City Tour Bus Dubai, having a visually appealing online presence is crucial for attracting tourists and showcasing the vibrant experiences awaiting them in the bustling city of Dubai.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community