A method, apparatus, device, and storage medium for adapting the UI layout of an in-vehicle device.
By using JSON configuration files to dynamically adapt the UI and business logic in Android application development, the problems of code redundancy and maintenance difficulties in multi-device adaptation are solved, achieving efficient and flexible multi-platform adaptation, improving operation and maintenance efficiency and user experience consistency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU MAITANG TECH CO LTD
- Filing Date
- 2026-02-10
- Publication Date
- 2026-05-26
AI Technical Summary
In Android application development, especially for security assistant applications, there are differences in screen size, UI display requirements, and business logic when adapting to various devices. This leads to problems such as code redundancy, maintenance difficulties, and high update and iteration costs.
It adopts a single codebase and uses JSON configuration files to parse UI components and business logic on the target vehicle device. It manages UI parameters and business logic parameters of multiple platforms in a unified manner through external JSON configuration files, achieving dynamic adaptation. It supports independent configuration files for different devices, which facilitates expansion and rapid adaptation to new devices.
It enables efficient and flexible UI and business logic adaptation across multiple platforms, reducing operation and maintenance costs and improving deployment efficiency and user experience consistency.
Smart Images

Figure CN122086404A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle engineering, and in particular to a method, apparatus, device, and storage medium for adapting the UI layout of in-vehicle equipment. Background Technology
[0002] In Android application development, especially for security assistant applications, it is necessary to adapt to various different devices (such as in-vehicle systems and smart terminals). These devices have significantly different screen sizes, UI display requirements, and business logic (for example, clicking a control on one device will redirect to an interface, while clicking it on another device will result in a pop-up window, or certain controls may not exist on specific devices). This adaptation method leads to code redundancy, maintenance difficulties, and high update and iteration costs. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a method, apparatus, device, and storage medium for adapting the UI layout of in-vehicle devices, which can efficiently and flexibly adapt the UI and business logic dynamically across multiple platforms using a single codebase. The specific solution is as follows: Firstly, this application discloses a UI layout adaptation method for in-vehicle devices, applied to a target in-vehicle device, including: The target application to be adapted is launched on the target vehicle device. The target application reads the target configuration file local to the target vehicle device and parses the target configuration file to obtain the corresponding parsing results. The target configuration file is a JSON configuration file. Based on the parsing results, the UI components of the target application are adjusted using the target configuration file to obtain the adjusted layout corresponding to the target application, and the business logic corresponding to the adjusted layout is adapted based on the logic rules in the target configuration file to obtain the target layout corresponding to the target application. The target application initiates an adaptation layout display request, and after obtaining the corresponding request result, the target application is restarted based on the request result to display the main activity interface of the target application based on the target layout.
[0004] Optionally, reading the target configuration file locally on the target vehicle device and parsing the target configuration file to obtain the corresponding parsing result includes: The target file reading function is used to read the target configuration file locally on the target vehicle device, and the target parsing library is used to parse the target configuration file to obtain the corresponding parsing results.
[0005] Optionally, the step of adjusting the UI components of the target application based on the parsing result using the target configuration file to obtain the adjusted layout corresponding to the target application includes: If the parsing result indicates that the target configuration file has failed to be parsed, then a corresponding alternative configuration file is obtained based on the pre-selected alternative file path, the alternative configuration file is determined as the new target configuration file, and the process jumps to the step of parsing the target configuration file to obtain the corresponding parsing result.
[0006] Optionally, adjusting the UI components of the target application using the target configuration file to obtain the adjusted layout of the target application includes: Obtain the target vehicle model parameters corresponding to the target vehicle-mounted device; Using the target configuration file, the UI components of the target application are adjusted based on the target vehicle model parameters to obtain the adjusted layout corresponding to the target application.
[0007] Optionally, the in-vehicle device UI layout adaptation method further includes: If the target vehicle model parameters corresponding to the target in-vehicle device cannot be obtained, the UI components of the target application are adjusted using the default layout configuration in the target configuration file to obtain the adjusted layout corresponding to the target application.
[0008] Optionally, adapting the business logic corresponding to the adjusted layout based on the logical rules in the target configuration file includes: Determine the system version corresponding to the target vehicle-mounted device, and determine the target adapter interface corresponding to the system version; The target adaptation interface is used to adapt the business logic corresponding to the adjusted layout based on the logical rules in the target configuration file.
[0009] Optionally, the in-vehicle device UI layout adaptation method further includes: Obtain a configuration file modification instruction, and modify the target configuration file locally on the target vehicle device based on the configuration file modification instruction to obtain the modified target configuration file; The modified target configuration file is obtained using the target application, and the process jumps to the step of parsing the target configuration file to obtain the corresponding parsing results.
[0010] Secondly, this application discloses a vehicle-mounted device UI layout adaptation device, applied to a target vehicle-mounted device, comprising: The configuration file parsing module 11 is used to launch the target application to be adapted on the target vehicle device, use the target application to read the target configuration file local to the target vehicle device, and parse the target configuration file to obtain the corresponding parsing result; the target configuration file is a JSON configuration file. The layout adaptation module 12 is used to adjust the UI components of the target application based on the parsing result using the target configuration file to obtain the adjusted layout corresponding to the target application, and to adapt the business logic corresponding to the adjusted layout based on the logic rules in the target configuration file to obtain the target layout corresponding to the target application. The layout display module 13 is used to initiate an adaptation layout display request using the target application, and after obtaining the corresponding request result, restart the target application based on the request result to display the main activity interface of the target application based on the target layout.
[0011] Thirdly, this application discloses an electronic device, comprising: Memory, used to store computer programs; A processor is used to execute the computer program to implement the aforementioned in-vehicle device UI layout adaptation method.
[0012] Fourthly, this application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned vehicle-mounted device UI layout adaptation method.
[0013] In this application, when adapting the UI layout of a target application to be adapted, the target in-vehicle device launches the target application on the target in-vehicle device, reads the target configuration file locally on the target in-vehicle device using the target application, and parses the target configuration file to obtain the corresponding parsing results; the target configuration file is a JSON configuration file; based on the parsing results, the UI components of the target application are adjusted using the target configuration file to obtain the adjusted layout corresponding to the target application, and the business logic corresponding to the adjusted layout is adapted based on the logic rules in the target configuration file to obtain the target layout corresponding to the target application; the target application initiates an adaptation layout display request, and after obtaining the corresponding request result, the target application is restarted based on the request result to display the main activity interface of the target application based on the target layout. It can be seen that this application uses an external JSON configuration file to uniformly manage UI parameters and business logic parameters across multiple platforms, facilitating batch management and version control, and achieving runtime dynamic parsing and adaptation. Based on the target configuration file, different business behaviors can be dynamically selected according to the configuration in the event handling of various controls in the target application. By externalizing the adaptation logic, configuration loading and code logic are decoupled. Modifying the configuration does not require recompiling the code; simply replacing the JSON file is sufficient to adapt to new devices, significantly improving operational efficiency. It also supports independent configuration files for different devices, facilitating expansion and rapid adaptation to new devices. This enhances the deployment efficiency and user experience consistency of in-vehicle applications such as safety assistants across a multi-device ecosystem. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0015] Figure 1 This application discloses a flowchart of a method for adapting the UI layout of an in-vehicle device. Figure 2 This is a schematic diagram of a specific in-vehicle device UI layout adaptation method disclosed in this application; Figure 3 This is a signaling diagram illustrating a specific method for adapting the UI layout of an in-vehicle device disclosed in this application; Figure 4 This is a schematic diagram of the structure of a vehicle-mounted device UI layout adaptation device disclosed in this application; Figure 5 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] In Android application development, especially for security assistant applications, it is necessary to adapt to various devices (such as in-vehicle systems and smart terminals). These devices have significantly different screen sizes, UI display requirements, and business logic (for example, clicking a control on one device will redirect to an interface, while clicking it on another device will result in a pop-up window, or certain controls may not exist on specific devices). This adaptation method leads to code redundancy, maintenance difficulties, and high update and iteration costs. To solve the above technical problems, this application discloses a UI layout adaptation method for in-vehicle devices, which can efficiently and flexibly dynamically adapt the UI and business logic across multiple platforms using a single codebase.
[0018] See Figure 1 As shown, this embodiment of the invention discloses a UI layout adaptation method for in-vehicle devices, applied to a target in-vehicle device, including: Step S11: Start the target application to be adapted on the target vehicle device, use the target application to read the target configuration file local to the target vehicle device, and parse the target configuration file to obtain the corresponding parsing result; the target configuration file is a JSON configuration file.
[0019] In this embodiment, the target application to be adapted on the target vehicle device can be a security assistant application. For example... Figure 2 As shown, when the target application is launched on the target vehicle device, the system reads the target configuration file locally on the target vehicle device and parses the target configuration file to obtain the corresponding parsing results. This includes: using a target file reading function to read the target configuration file locally on the target vehicle device, and using a target parsing library to parse the target configuration file to obtain the corresponding parsing results. For example, the system on the target vehicle device will read the target configuration file in JSON format through a parsing module, such as calling FileInputStream to obtain a JSON string and using the JSONObject library to convert it into an object structure.
[0020] In this embodiment, when storing the target configuration file, Android's internal storage (such as context.getAssets().open) or external storage (such as Environment.getExternalStorageDirectory()) can be used to save the JSON configuration file. Local storage of the target configuration file can also be used to ensure offline availability. The file format is UTF-8 encoded and supports nested structures, such as...
[0021] "AY5T": {
[0022] "frontend": {
[0023] "runningMode": "HIGH_EFFICIENCY", "ADiGO": { "version": "5.1", "isFullScreen": false } }; When parsing the target configuration file, the Gson library can be used to parse the JSON string into a JSONObject. First, FileInputStream is called to read the file, and then Gson.fromJson() is used to convert it into a Bean class. This class is defined as `public class Message{}`. When handling exceptions, a try-catch block is used to catch `JsonSyntaxException` and retrieve its default value.
[0024] Step S12: Based on the parsing results, adjust the UI components of the target application using the target configuration file to obtain the adjusted layout corresponding to the target application, and adapt the business logic corresponding to the adjusted layout based on the logic rules in the target configuration file to obtain the target layout corresponding to the target application.
[0025] In this embodiment, as Figure 2 As shown, based on the parsing results, the UI components of the target application are adjusted using the target configuration file to obtain the adjusted layout corresponding to the target application. This includes: if the parsing result indicates that the target configuration file failed to be parsed, a corresponding alternative configuration file is obtained based on a pre-selected alternative file path, the alternative configuration file is determined as the new target configuration file, and the process jumps to the step of parsing the target configuration file to obtain the corresponding parsing results. In other words, if the target configuration file is parsed successfully, the process of adapting the UI begins; otherwise, the process of loading the default configuration (i.e., the alternative configuration file) begins, and the alternative configuration file is parsed.
[0026] In this embodiment, a configuration file modification instruction can also be obtained, and the target configuration file on the target vehicle device can be modified based on the configuration file modification instruction to obtain the modified target configuration file. The modified target configuration file is obtained using the target application, and the process jumps to the step of parsing the target configuration file to obtain the corresponding parsing results. It should be noted that in this embodiment, the target application to be adapted is generally installed under system / app / , and the target configuration file and the target background application are in the same directory. The content of the alternative configuration file and the target configuration file are exactly the same, but the alternative configuration file is inside the target background application. In practical applications, the target configuration file can be modified by the user, and the modified target configuration file can be pushed to the target background application to achieve synchronous hot update of the alternative configuration file. The updated target configuration file will take effect after the process restarts. When the application is running, updating the JSON file can adjust the corresponding UI layout strategy in real time, such as changing the UI style, which improves the version iteration speed. If it is necessary to directly modify the alternative configuration file, the application developers need to modify, test, and release it, and then the car owner can update the system to bypass the target configuration file and achieve direct update of the alternative configuration file. Understandably, the alternative configuration file serves as a fallback solution, primarily to handle exceptional situations where the target configuration file cannot be parsed. In practical applications, the combination of both ensures normal data reporting. This embodiment also supports server-side distribution of the target configuration file, enabling remote dynamic updates. Furthermore, compared to XML format configuration files, JSON configuration files offer the advantages of being lightweight and natively supported by Android.
[0027] In this embodiment, the UI components of the target application are adjusted using the target configuration file to obtain the adjusted layout corresponding to the target application. This includes: obtaining the target vehicle model parameters corresponding to the target in-vehicle device; and adjusting the UI components of the target application based on the target vehicle model parameters using the target configuration file to obtain the adjusted layout corresponding to the target application. During this process, the layout is dynamically set according to the parsed data, and attributes (such as color and position) are set. In addition, setContentView(layout) can be used to set different ADIGO versions, whether to display in full screen, whether to display corresponding controls, etc., based on the information in the configuration. For example, in the JSON configuration file, "version="5.0" indicates loading the UI layout corresponding to ADIGO version 5.0, and "isFullScreen": true" indicates full-screen display. Furthermore, "isAdaptiveExit": true" can be used in the configuration file to control the background to detect CPU usage and automatically exit the application when the CPU usage reaches a preset threshold. The performance mode can be controlled using "runningMode", which can be either "HIGH_EFFICIENCY (high performance)" or "HIGH_AVAILABILITY (high user experience or background stability)". In other words, the target configuration file in this embodiment includes front-end configuration items and back-end configuration items. The front-end configuration items include version number control for UI layout selection, full-screen mode, running mode, etc.; the back-end configuration items include adaptive exit, running mode, etc.
[0028] In this embodiment, the business logic corresponding to the adjusted layout is adapted based on the logical rules in the target configuration file. This includes: determining the system version corresponding to the target vehicle device and determining the target adaptation interface corresponding to the system version; and using the target adaptation interface to adapt the business logic corresponding to the adjusted layout based on the logical rules in the target configuration file. By executing the logical rules in the configuration, such as conditional branches calling different business logic, the adaptation of the business logic corresponding to each module in the adjusted layout can be completed. When adapting to multiple platforms, the target application can adjust the API (Application Programming Interface) calls by detecting Build.VERSION.SDK_INT, such as using Scoped Storage when the Android version of the target vehicle device is not lower than 10. This API call method can reduce if-else branches in the code to a certain extent, making the code more concise and readable.
[0029] In this embodiment, the entire layout adjustment process supports exception branches. For example, if the vehicle model cannot be obtained, the default UI model will be used. Specifically, if the target vehicle model parameters corresponding to the target in-vehicle device cannot be obtained, the default layout configuration in the target configuration file will be used to adjust the UI components of the target application to obtain the adjusted layout corresponding to the target application.
[0030] Step S13: Initiate an adaptation layout display request using the target application, and after obtaining the corresponding request result, restart the target application based on the request result to display the main activity interface of the target application based on the target layout.
[0031] In this embodiment, once all UI components have been adapted, the application can enter the running process. The target application initiates a layout adaptation display request, and upon receiving the corresponding request result, the target application is restarted to display its main activity interface based on the target layout. After completing the entire adaptation process, the application enters its normal operation phase. When displaying the final adapted interface based on the target layout, `startActivity(new Intent())` or `setVisible(true)` can be used. Specific code examples are as follows: { "frontend": { "runningMode": "HIGH_EFFICIENCY", "ADiGO": { "version": "5.0", "isFullScreen": true } }, "backend": { "runningMode": "HIGH_AVAILABILITY", "isAdaptiveExit": false } }
[0032] As can be seen, this application uses an external JSON configuration file to uniformly manage UI parameters and business logic parameters across multiple platforms, facilitating batch management and version control, and enabling dynamic parsing and adaptation at runtime. Based on the target configuration file, different business behaviors can be dynamically selected according to the configuration in the event handling of various controls in the target application. By externalizing the adaptation logic, configuration loading and code logic are decoupled. Modifying the configuration does not require recompiling the code; only the JSON file needs to be replaced to adapt to new devices, significantly improving operational efficiency. Furthermore, it supports independent configuration files for different devices, facilitating expansion and rapid adaptation to new devices, and improving the deployment efficiency and user experience consistency of in-vehicle applications such as safety assistants in a multi-device ecosystem.
[0033] As described in the previous embodiment, this application discloses a method for adapting the UI layout of an in-vehicle device. Applied to a target in-vehicle device, it can efficiently and flexibly adapt the UI and business logic dynamically across multiple platforms using a single codebase. Next, the UI layout adaptation process for in-vehicle devices will be explained in detail from a timing perspective.
[0034] See Figure 3 As we know, when a user clicks the icon of the target application to be adapted, it triggers `MainActivity.onCreate()`, which sends a "Start Application" message to the system on the target in-vehicle device. The system calls `readJsonFromFile` to send a "Read Configuration" message to a JSON file, and the JSON file returns "Configuration Data" as a corresponding String via `InputStream`. During the internal system processing phase, the system calls `uiAdapter.applyConfig(config.ui)` to send the "Application UI Configuration" to the UI module. Internally, `Handler.post()` is used to update the view on the main thread. Once the UI module is ready, it returns `boolean true`, setting different layouts for display. Simultaneously, `businessAdapter.applyConfig(config.business)` is called to send the "Application Business Configuration" to the business module, which is executed in the background using `AsyncTask`. The business module calls different business logic according to the configuration and returns `true` when the logic is ready. Finally, the system calls `startActivity(new Intent())` or directly sends a "Show Adapted Interface" message to the user. If the configuration is updated and the application restarts, it can automatically run different code based on the configuration file.
[0035] As can be seen, this application uses an external JSON configuration file to uniformly manage UI parameters and business logic parameters across multiple platforms, facilitating batch management and version control, and enabling dynamic parsing and adaptation at runtime. Based on the target configuration file, different business behaviors can be dynamically selected according to the configuration in the event handling of various controls in the target application. By externalizing the adaptation logic, configuration loading and code logic are decoupled. Modifying the configuration does not require recompiling the code; only the JSON file needs to be replaced to adapt to new devices, significantly improving operational efficiency. Furthermore, it supports independent configuration files for different devices, facilitating expansion and rapid adaptation to new devices, and improving the deployment efficiency and user experience consistency of in-vehicle applications such as safety assistants in a multi-device ecosystem.
[0036] See Figure 4 As shown, this application discloses a vehicle-mounted device UI layout adaptation device, applied to a target vehicle-mounted device, comprising: The configuration file parsing module 11 is used to launch the target application to be adapted on the target vehicle device, use the target application to read the target configuration file local to the target vehicle device, and parse the target configuration file to obtain the corresponding parsing result; the target configuration file is a JSON configuration file. The layout adaptation module 12 is used to adjust the UI components of the target application based on the parsing result using the target configuration file to obtain the adjusted layout corresponding to the target application, and to adapt the business logic corresponding to the adjusted layout based on the logic rules in the target configuration file to obtain the target layout corresponding to the target application. The layout display module 13 is used to initiate an adaptation layout display request using the target application, and after obtaining the corresponding request result, restart the target application based on the request result to display the main activity interface of the target application based on the target layout.
[0037] As can be seen, this application uses an external JSON configuration file to uniformly manage UI parameters and business logic parameters across multiple platforms, facilitating batch management and version control, and enabling dynamic parsing and adaptation at runtime. Based on the target configuration file, different business behaviors can be dynamically selected according to the configuration in the event handling of various controls in the target application. By externalizing the adaptation logic, configuration loading and code logic are decoupled. Modifying the configuration does not require recompiling the code; only the JSON file needs to be replaced to adapt to new devices, significantly improving operational efficiency. Furthermore, it supports independent configuration files for different devices, facilitating expansion and rapid adaptation to new devices, and improving the deployment efficiency and user experience consistency of in-vehicle applications such as safety assistants in a multi-device ecosystem.
[0038] In one specific implementation, the configuration file parsing module 11 may include: The configuration file parsing unit is used to read the target configuration file local to the target vehicle device using the target file reading function, and to parse the target configuration file using the target parsing library to obtain the corresponding parsing results.
[0039] In one specific implementation, the layout adaptation module 12 may include: The configuration file re-acquisition unit is used to, if the parsing result indicates that the target configuration file has failed to be parsed, obtain the corresponding alternative configuration file based on the pre-selected alternative file path, determine the alternative configuration file as the new target configuration file, and jump to the step of parsing the target configuration file to obtain the corresponding parsing result.
[0040] In one specific implementation, the layout adaptation module 12 may include: The vehicle model parameter determination unit is used to obtain the target vehicle model parameters corresponding to the target vehicle-mounted device. The layout adjustment unit is used to adjust the UI components of the target application based on the target vehicle model parameters using the target configuration file to obtain the adjusted layout corresponding to the target application.
[0041] In one specific embodiment, the device may further include: The default layout configuration module is used to adjust the UI components of the target application to obtain the adjusted layout corresponding to the target application if the target vehicle model parameters corresponding to the target vehicle device cannot be obtained.
[0042] In one specific implementation, the layout adaptation module 12 may include: The adapter interface determination unit is used to determine the system version corresponding to the target vehicle device and to determine the target adapter interface corresponding to the system version. The business logic adaptation unit is used to adapt the business logic corresponding to the adjusted layout based on the logic rules in the target configuration file using the target adaptation interface.
[0043] In one specific embodiment, the device may further include: The configuration file modification module is used to obtain configuration file modification instructions and modify the target configuration file locally on the target vehicle device based on the configuration file modification instructions to obtain the modified target configuration file; The configuration file re-parsing module is used to obtain the modified target configuration file using the target application, and then jump to the step of parsing the target configuration file to obtain the corresponding parsing results.
[0044] Furthermore, embodiments of this application also disclose an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0045] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the vehicle-mounted device UI layout adaptation method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be a computer.
[0046] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0047] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored thereon can include an operating system 221, computer programs 222, etc., and the storage method can be temporary storage or permanent storage.
[0048] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the vehicle-mounted device UI layout adaptation method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0049] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed in-vehicle device UI layout adaptation method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0050] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0051] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0052] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0053] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0054] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for adapting the UI layout of an in-vehicle device, characterized in that, Applied to target vehicle-mounted devices, including: The target application to be adapted is launched on the target vehicle device. The target application reads the target configuration file local to the target vehicle device and parses the target configuration file to obtain the corresponding parsing results. The target configuration file is a JSON configuration file. Based on the parsing results, the UI components of the target application are adjusted using the target configuration file to obtain the adjusted layout corresponding to the target application, and the business logic corresponding to the adjusted layout is adapted based on the logic rules in the target configuration file to obtain the target layout corresponding to the target application. The target application initiates an adaptation layout display request, and after obtaining the corresponding request result, the target application is restarted based on the request result to display the main activity interface of the target application based on the target layout.
2. The in-vehicle device UI layout adaptation method according to claim 1, characterized in that, The step of reading the target configuration file locally on the target vehicle device and parsing the target configuration file to obtain the corresponding parsing results includes: The target file reading function is used to read the target configuration file locally on the target vehicle device, and the target parsing library is used to parse the target configuration file to obtain the corresponding parsing results.
3. The in-vehicle device UI layout adaptation method according to claim 1, characterized in that, The step of adjusting the UI components of the target application based on the parsing result using the target configuration file to obtain the adjusted layout of the target application includes: If the parsing result indicates that the target configuration file has failed to be parsed, then a corresponding alternative configuration file is obtained based on the pre-selected alternative file path, the alternative configuration file is determined as the new target configuration file, and the process jumps to the step of parsing the target configuration file to obtain the corresponding parsing result.
4. The in-vehicle device UI layout adaptation method according to claim 1, characterized in that, The step of adjusting the UI components of the target application using the target configuration file to obtain the adjusted layout of the target application includes: Obtain the target vehicle model parameters corresponding to the target vehicle-mounted device; Using the target configuration file, the UI components of the target application are adjusted based on the target vehicle model parameters to obtain the adjusted layout corresponding to the target application.
5. The in-vehicle device UI layout adaptation method according to claim 4, characterized in that, Also includes: If the target vehicle model parameters corresponding to the target in-vehicle device cannot be obtained, the UI components of the target application are adjusted using the default layout configuration in the target configuration file to obtain the adjusted layout corresponding to the target application.
6. The in-vehicle device UI layout adaptation method according to claim 1, characterized in that, The adaptation of the business logic corresponding to the adjusted layout based on the logical rules in the target configuration file includes: Determine the system version corresponding to the target vehicle-mounted device, and determine the target adapter interface corresponding to the system version; The target adaptation interface is used to adapt the business logic corresponding to the adjusted layout based on the logical rules in the target configuration file.
7. The in-vehicle device UI layout adaptation method according to claim 1, characterized in that, Also includes: Obtain a configuration file modification instruction, and modify the target configuration file locally on the target vehicle device based on the configuration file modification instruction to obtain the modified target configuration file; The modified target configuration file is obtained using the target application, and the process jumps to the step of parsing the target configuration file to obtain the corresponding parsing results.
8. A vehicle-mounted device UI layout adaptation device, characterized in that, Applied to target vehicle-mounted devices, including: The configuration file parsing module is used to launch the target application to be adapted on the target vehicle device, use the target application to read the target configuration file local to the target vehicle device, and parse the target configuration file to obtain the corresponding parsing results; the target configuration file is a JSON configuration file. The layout adaptation module is used to adjust the UI components of the target application based on the parsing result using the target configuration file to obtain the adjusted layout corresponding to the target application, and to adapt the business logic corresponding to the adjusted layout based on the logic rules in the target configuration file to obtain the target layout corresponding to the target application. The layout display module is used to initiate an adaptation layout display request using the target application, and after obtaining the corresponding request result, restart the target application based on the request result to display the main activity interface of the target application based on the target layout.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the in-vehicle device UI layout adaptation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the in-vehicle device UI layout adaptation method as described in any one of claims 1 to 7.