Card creating method and device, computer readable storage medium and vehicle

By obtaining the card type, determining the creation strategy, and transforming the data object to generate the view container, the problem of high coupling in the card creation logic code of the intelligent cockpit system is solved, resulting in a clearer code structure and a smoother user experience.

CN121833072APending Publication Date: 2026-04-10GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-04
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In existing smart cockpit systems, the card creation logic is highly coupled, has poor code readability, and executes slowly, resulting in a poor user experience.

Method used

By obtaining the corresponding card type based on the card data object, determining the card creation strategy, converting the format of the card data object, generating component data objects, and finally creating the target view container, the graphical interface rendering of the card is realized.

Benefits of technology

It reduces code coupling, improves code readability and maintainability, optimizes performance, and provides a smoother user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833072A_ABST
    Figure CN121833072A_ABST
Patent Text Reader

Abstract

The invention discloses a card creating method and device, a computer readable storage medium and a vehicle, and relates to the technical field of vehicles, and the method comprises the steps: obtaining a corresponding card type based on a card data object; determining a card creation strategy based on the card type; performing format conversion on the card data object to obtain a component data object; and creating a corresponding target view container based on the card creation strategy and the component data object, the target view container representing a graphical interface of the card, and the graphical interface being rendered and added to the user interface. According to the method, the card can be created with a low code coupling degree, the code structure is clear and easy to understand and maintain, the performance is optimized, and smoother user experience is provided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of vehicles, and particularly relates to a card creation method, a computer readable storage medium, a vehicle and a card creation device. BACKGROUND

[0002] In an AI (Artificial Intelligence) generated UI (User Interface) scene of an intelligent cockpit system, the AI generated UI description contains different types of cards (such as list cards, matrix cards, etc.). However, the existing general card creation scheme usually adopts if-else or switch-case to concentrate the creation logic of all cards in one method. In the scene of AI dynamically generating a UI, the type needs to be frequently judged, the code coupling degree is high, the creation logic of different cards is mixed together, the code readability is poor, the execution speed is slow, and a poor experience is brought to users. SUMMARY

[0003] The present application aims to at least solve one of the technical problems in the related art. To this end, the first object of the present application is to provide a card creation method, which can realize the creation of a card with a lower code coupling degree, and has a clear code structure, is easy to understand and maintain, optimizes performance, and provides a more smooth user experience.

[0004] The second object of the present application is to provide a computer readable storage medium.

[0005] The third object of the present application is to provide a vehicle.

[0006] The fourth object of the present application is to provide a card creation device.

[0007] To achieve the above objects, the first aspect of the present application provides a card creation method, which comprises: obtaining a corresponding card type based on a card data object; determining a card creation strategy based on the card type; performing format conversion on the card data object to obtain a component data object; and creating a corresponding target view container based on the card creation strategy and the component data object, wherein the target view container represents a graphical interface of a card, and the graphical interface is rendered and added to a user interface.

[0008] According to the card creation method provided in the embodiments of the present application, a corresponding card type is obtained based on a card data object, a card creation strategy is determined based on the card type, a component data object is obtained by performing format conversion on the card data object, and a corresponding target view container is created based on the card creation strategy and the component data object, where the target view container represents a graphical interface of the card, and the graphical interface is rendered and added to a user interface. Thus, the method can realize the creation of the card with low code coupling degree, clear code structure, easy understanding and maintenance, optimized performance, and a more smooth user experience.

[0009] In addition, the card creation method provided in the embodiments of the present application can have the following additional technical features: According to an embodiment of the present application, the card creation strategy is determined based on the card type and a preset strategy mapping relationship, where the preset strategy mapping relationship is used to indicate the relationship between the card type and the card creation strategy.

[0010] According to an embodiment of the present application, the target view container is created based on the card creation strategy and the component data object, including determining card content and the card type based on the component data object, and creating the target view container based on the card type, the card content and the card creation strategy.

[0011] According to an embodiment of the present application, the method further includes: in the case where the card content includes view elements, creating a component tree based on the view elements, determining a view container based on the card type and the card content to add the component tree to the view container, and updating the target view container based on the view container, where the updated target view container contains the view container.

[0012] According to an embodiment of the present application, the method further includes: receiving data in a target format sent by an intelligent cockpit, and performing format analysis on the data to obtain the card data object, where the card data object encapsulates card data.

[0013] According to an embodiment of the present application, the method further includes: in the case where the preset strategy mapping relationship does not include a card type of the card data object, updating the preset strategy mapping relationship, where the updating of the preset strategy mapping relationship includes defining a new strategy class, associating the new strategy class with a new card type, and adding the new strategy class to the preset strategy mapping relationship.

[0014] According to an embodiment of the present application, the card type includes at least one of a flexible box type, a list type, a matrix type, and a webpage type, the card creation strategy corresponding to the flexible box type includes converting the card data into a flexible box component, the flexible box component being used to adjust the layout of its sub-elements, the card creation strategy corresponding to the list type includes creating a list view to realize list display, the card creation strategy corresponding to the matrix type includes creating a matrix grid layout to realize grid data display and interaction, and the card creation strategy corresponding to the webpage type includes creating a webpage view component to realize webpage content loading and interaction.

[0015] To achieve the above object, the second aspect of the present application provides a computer readable storage medium, which stores a program, and the program is executed by a processor to implement the card creation method.

[0016] According to the computer readable storage medium of the present application, the card creation method is implemented by execution, the card creation can be realized with low code coupling degree, the code structure is clear, easy to understand and maintain, the performance is optimized, and a more smooth user experience is provided.

[0017] To achieve the above object, the third aspect of the present application provides a vehicle, which includes a memory, a processor, and a program stored in the memory and executable on the processor, and the processor executes the program to implement the card creation method.

[0018] According to the vehicle of the present application, the card creation method is executed to realize the card creation with low code coupling degree, the code structure is clear, easy to understand and maintain, the performance is optimized, and a more smooth user experience is provided.

[0019] To achieve the above object, the fourth aspect of the present application provides a card creation device, which includes an acquisition module, configured to acquire a corresponding card type based on a card data object; a determination module, configured to determine a card creation strategy based on the card type; a conversion module, configured to perform format conversion on the card data object to obtain a component data object; and a creation module, configured to create a target view container corresponding to the card creation strategy and the component data object, wherein the target view container represents a graphical interface of a card, and the graphical interface is rendered and added to a user interface.

[0020] According to the card creation apparatus, the obtaining module is configured to obtain a card type corresponding to the card data object, the determining module is configured to determine a card creation strategy based on the card type, the converting module is configured to perform format conversion on the card data object to obtain a component data object, and the creating module is configured to create a target view container corresponding to the card based on the card creation strategy and the component data object, where the target view container represents a graphical interface of the card, and the graphical interface is rendered and added to a user interface. Thus, the card creation can be implemented with low code coupling, the code structure is clear, easy to understand and maintain, the performance is optimized, and a more smooth user experience is provided.

[0021] Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will become apparent to those having ordinary skill in the art upon examination of the following or can be learned from practice of the application. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 A flowchart of a card creation method according to an embodiment of the application.

[0023] Figure 2 A schematic diagram of a card creation method according to an embodiment of the application.

[0024] Figure 3 A flowchart of a card creation method according to a specific example of the application.

[0025] Figure 4 A block schematic diagram of a vehicle according to an embodiment of the application.

[0026] Figure 5 A block schematic diagram of a card creation apparatus according to an embodiment of the application. DETAILED DESCRIPTION

[0027] Embodiments of the application are described in detail below with reference to the accompanying drawings, in which like reference numerals designate identical or corresponding elements or elements with identical or corresponding functions throughout the several views. The embodiments described below are examples in which the application is applied, and are intended to explain the application, and cannot be understood as limiting the application.

[0028] The card creation method, computer-readable storage medium, vehicle and card creation apparatus according to the embodiments of the application are described below with reference to the accompanying drawings.

[0029] Figure 1 A flowchart of a card creation method according to an embodiment of the application.

[0030] As Figure 1 shown, the card creation method according to an embodiment of the application can include the following steps: S1, obtaining a card type corresponding to the card data object based on the card data object.

[0031] S2, determine the card creation strategy based on the card type.

[0032] S3 converts the format of the card data object to obtain the component data object.

[0033] S4. Based on the card creation strategy and component data object, a corresponding target view container is created. The target view container represents the graphical interface of the card, and the graphical interface is rendered and added to the user interface.

[0034] Specifically, the intelligent cockpit system can dynamically create and display different types of cards based on AI-generated data, such as list-type cards and matrix-type cards. These cards need to be adaptable to different layouts and content requirements, and the system needs to be easily expandable to support new card types. The intelligent cockpit system includes, but is not limited to, an in-vehicle infotainment system (providing music playback, radio, video playback, etc.), a navigation system (providing route planning, real-time traffic information, point-of-interest search, etc.), a vehicle control interface (allowing the driver or passengers to adjust vehicle settings, such as air conditioning, seat heating, window control, etc.), and a digital instrument panel (displaying vehicle status, speed, fuel efficiency, etc.). The core of this system is to provide a user-friendly interface that allows drivers and passengers to safely and conveniently access and control these functions. For example, the display and updates of the user interface can be managed through the vehicle's user interface controller, which can execute the card creation method of this application to create and display the corresponding cards.

[0035] First, the corresponding card type can be obtained based on the card data object. A card data object (CardData) is a custom object that encapsulates card information, representing the card's data. It can contain card type information, content information, style information, etc. Type information determines the layout and display method, providing foundational data for subsequent strategy selection and view creation. For example, user operations through the central control interface of a smart cockpit system, such as clicking menus, selecting functions, or entering query conditions, trigger the acquisition and processing of card data. Alternatively, internal system events, such as vehicle startup, arrival at a specific location, or time point, trigger the acquisition and display of relevant card data. Furthermore, when an external data source (such as a cloud service) provides new information, the card content on the cockpit interface needs to be updated. Suppose a user selects to view news updates in a smart cockpit system (such as an in-vehicle infotainment system). The user can click a news card icon on the main interface of the central control screen. The user interface controller captures the click event, requests news data, and sends a request to the cloud news service via network connection to obtain the latest news data. Then, the received news data (JSON format) is parsed to create a CardData object. The type information can be extracted from the CardData object. Assuming the extracted type is a list type, the current news can be displayed in list form. User interface elements can be generated based on this data.

[0036] After obtaining the card type, a card creation strategy can be determined based on that type. Different card types require different card creation strategies. For example, a pre-defined correspondence can be used to determine the card creation strategy. This involves pre-determining the relationship between card types and card creation strategies; once the card type is determined, the corresponding relationship can be directly invoked to obtain the card creation strategy. This decouples the card type from the creation logic, and each card type's creation strategy can be encapsulated in an independent strategy class, reducing dependencies between code segments. By encapsulating the creation logic in independent strategy classes, the code becomes more modular, easier to understand, and easier to maintain. A strategy class is a special class that encapsulates the specific implementation of a certain algorithm or behavior. In the intelligent cockpit system, strategy classes are used to encapsulate the logic for creating specific types of cards. Each card type (such as list-type cards, matrix-type cards, etc.) may require different layouts, styles, or interaction methods; therefore, each card type corresponds to a strategy class to handle its creation process.

[0037] After obtaining the card data, the card data object is formatted to obtain the component data object, providing necessary information for subsequent view creation and component assembly. The CardData object encapsulates the raw card data generated from artificial intelligence. This data is typically provided in JSON format and contains the card's type, content, style, and other metadata. For example, the type identifies the card's type, such as "flexbox," "list," "matrix," or "web." The content includes the specific card content, which may include text, images, links, data items, etc. The style includes the card's visual style information, such as color, font, and margins. The ComponentData object stores the transformed data, which will directly guide the creation and assembly of view components. For example, a new JsonObject instance is created, which will serve as the carrier of the ComponentData. All properties in the CardData are iterated through and copied to the ComponentData's JsonObject, including all relevant information such as type, content, and style. This effectively transforms raw card data into a data format suitable for view creation and component assembly, improving data availability and view creation flexibility. It also makes the view creation process more modular and reusable, as ComponentData can be reused by different view creation strategies.

[0038] After determining the component data object, a corresponding target view container can be created based on the card creation strategy and the component data object. The target view container refers to the view component ultimately used to display the card content, representing the card's graphical interface. This graphical interface is rendered and added to the user interface. In other words, the graphical interface refers to the visual elements on the user interface, including text, images, buttons, etc., which together constitute the interface through which the user interacts with the application. Rendering refers to the process of converting the created view components and layout into pixels that can be displayed on the screen. The user interface refers to the interface through which the user interacts with the software application, including all visible elements and layouts.

[0039] For example, suppose you are developing a smart cockpit system that needs to dynamically create different types of card views based on AI-generated data. For instance, creating news cards to display news titles and summaries. First, parse the CardData object from the AI-generated JSON data to determine the card type contained within it. For example, if the determined type is a list, a corresponding list card creation strategy can be determined based on this. Copy the properties from the CardData to a new JsonObject to form the initial data of ComponentData, i.e., convert it into a ComponentData object containing the title and summary. Specifically, for news cards, find and instantiate the ListCardStrategy class (a specialized strategy class that implements the list card creation strategy; the strategy class defines the algorithm's interface (i.e., the strategy interface), which typically contains one or more creation methods for handling list card creation). Use the ListCardStrategy class to call its creation methods and generate an adapted target view container to display the news list based on the content of the component data object. For example, choose a suitable container (such as LinearLayout) to wrap the created news list and add the target view container to the main layout of the user interface. The text view containing the title and summary is then added to a LinearLayout container, which is then added to the main layout of the user interface. Ultimately, a news card containing the news title and summary is displayed on the user interface.

[0040] This allows for the dynamic selection of appropriate creation strategies based on card type, thereby generating corresponding view layouts and content. This approach not only improves code maintainability and scalability but also enables the system to adapt to changing needs, such as adding new card types. Simultaneously, it optimizes performance, enhances user experience, and makes the UI generation of the smart cockpit more flexible and personalized.

[0041] According to one embodiment of this application, determining a card creation strategy based on card type includes: determining a card creation strategy based on a card type and a preset strategy mapping relationship, wherein the preset strategy mapping relationship is used to indicate the relationship between card type and card creation strategy.

[0042] Specifically, when determining a card creation strategy based on card type, the strategy can be determined based on the card type and a preset strategy mapping relationship. Card type refers to the type identifier contained in the card data object, such as "flexbox," "list," "matrix," "web," etc., used to distinguish different card types. The preset strategy mapping relationship is a predefined mapping mechanism used to indicate the relationship between card types and card creation strategies, mapping card types to corresponding creation strategies. This mapping relationship can be hard-coded, or it can be a configuration file, database entry, or other form. A card creation strategy refers to a series of rules or algorithms used to create specific types of cards. Each card type has a corresponding creation strategy, and these strategies define how to generate views based on data. That is, the extracted card type can be used as a key to query the corresponding creation strategy in the preset strategy mapping relationship. Based on the queried mapping relationship, the card creation strategy corresponding to that type can be found, thereby instantiating this card creation strategy and using it to create cards. In other words, the creation method in the card creation strategy will generate the corresponding view components based on the card data and type.

[0043] For example, suppose there is a smart cockpit system that needs to display different types of information cards, such as news, music playlists, and weather update notifications. The system is designed with the following preset strategy mapping relationships: "flexbox" maps to FlexboxCardStrategy, "list" maps to ListCardStrategy, "matrix" maps to MatrixCardStrategy, and "web" maps to WebCardStrategy. By parsing the JSON data, the value of the "type" field is extracted. Based on the value of "type", the corresponding strategy is found in the preset mapping relationship. Suppose the card data object (such as news) is found to have a card type of "list", thus mapping to the list card creation strategy. The list card creation strategy is then used to call its creation method, passing in the news content and other necessary information (such as line spacing, font size, color, etc.) to generate a news card view, which is then added to the user interface.

[0044] Therefore, this method allows for flexible handling of different types of card creation requests. This approach, which determines the card creation strategy based on the mapping relationship between card type and preset strategy, improves the maintainability and scalability of the code.

[0045] According to one embodiment of this application, creating a corresponding target view container based on a card creation strategy and a component data object includes: determining card content and card type based on the component data object; and creating a target view container based on the card type, card content, and card creation strategy.

[0046] Specifically, when creating the corresponding target view container based on the card creation strategy and component data object, the card content and card type can be determined based on the component data object. That is, the card type and content are first extracted from the ComponentData object. The ComponentData object is an object that encapsulates the data of a single component or card, containing parsed and transformed card data, such as component type, attributes, and sub-components. This data guides the creation of the view. Assume the current ComponentData object contains information of type "list" and content consisting of a series of news items. Then, the target view container can be created based on the card type, card content, and card creation strategy. The card type includes list type, matrix type, webpage type, flexbox, etc., used to determine the layout and display method. The card content refers to the specific information to be displayed on the card, such as text, images, and links. The card creation strategy is a creation method pre-determined based on the card type for creating specific types of cards.

[0047] Once the card creation strategy is determined to be a list card creation strategy, the corresponding card creation method can be used to create the various parts of the card based on the extracted card content, such as text boxes and images. The most suitable view container is then generated as the target view container based on the card type. The properties of the target view container, such as layout parameters and styles, can be configured according to the card content and card type to ensure the card is displayed correctly on the interface. For example, for list-type cards, when creating cards based on the list card creation strategy, a RecyclerView (a list view, a view component that can display long lists of data) will be created as the target view container to display the news list. It should be noted that when the card content is small, a simple view container, such as a LinearLayout or FlexboxLayout, can be created directly. These containers are sufficient to display the card content without scrolling. If the card contains only one news item, the title and summary can be displayed directly in a LinearLayout.

[0048] This allows for the dynamic selection of appropriate creation strategies and view containers based on the quantity and type of card content, thereby generating corresponding view layouts and content. This approach not only improves code maintainability and scalability but also enables the system to adapt to changing needs, such as adding new card types. Simultaneously, it optimizes performance, enhances user experience, and makes the UI generation of the smart cockpit more flexible and personalized.

[0049] According to one embodiment of this application, the card creation method further includes: creating a component tree based on the multiple view elements when the card content includes multiple view elements; determining a view container based on the card type and card content to add the component tree to the view container; and updating a target view container based on the view container, wherein the updated target view container contains the view container.

[0050] Specifically, the process involves determining the card's content. If the card content includes multiple view elements, a component tree can be created based on these view elements. This means identifying all view elements from the ComponentData, which are the basic elements that make up the card, such as text boxes, image boxes, and buttons. These elements can display information individually or be combined to display more complex information. A corresponding view component is then created for each identified view element. For example, a text component is created for text, and an image component is created for images. These created view components are then assembled according to logical relationships to form a component tree.

[0051] Next, based on the card type and content, a suitable view container is determined to wrap the component tree. That is, the appropriate container type is selected according to the card type and content requirements, thus adding the component tree to the view container. For example, if the card content might exceed the screen's boundaries, a ScrollView might be needed to support scrolling. An instance of the selected container type is created. For example, if ScrollView is selected, a ScrollView object is instantiated, and its properties, such as scrolling behavior, padding, and margins, can be set as needed to include the component tree. In other words, this view container can serve as the root node of the component tree, with child nodes being the view components corresponding to multiple view elements.

[0052] After determining the view container, the target view container can be updated based on it. The updated target view container contains the view container. In other words, the target view container is the final container that displays the cards in the user interface. This container can be the application's main layout or a specific area, such as a sidebar or pop-up window. A newly created view container containing the component tree is then added to the target view container. This involves setting the new container as a child view of a layout or replacing the old view container. Once the new container is added to the target view container, the entire interface will be updated to display the view container containing the new component tree.

[0053] Suppose we have a list of cards containing multiple news items, and the main layout of the user interface is a LinearLayout. After identifying each news item as a child component, we create a text view and an image view for each item to display the title and image. These view components are then added to a RecyclerView to form a component tree. Since the list content can be long, we choose a ScrollView as the view container; that is, we instantiate a ScrollView object and configure it to support vertical scrolling. We store the component tree in the view container and update the LinearLayout to contain the ScrollView, which in turn contains the RecyclerView, thus completing the display of the entire card. This approach ensures that the newly created view container integrates correctly into the existing user interface, providing a consistent and coherent user experience.

[0054] According to one embodiment of this application, the card creation method further includes: receiving data in a target format sent by a smart cockpit; parsing the data to obtain a card data object, wherein the card data object encapsulates the card data.

[0055] Specifically, the system first receives data in the target format sent by the smart cockpit. This target format data refers to data sent by the smart cockpit system that conforms to specific format requirements (such as JSON data). This format is usually predefined by the application for easy parsing and processing. After obtaining the target format data, it performs format parsing to obtain card data objects. These card data objects encapsulate the AI-generated card data. In other words, format parsing refers to the process of converting received raw data (such as JSON, XML, etc.) into structured data that the program can understand and process. A card data object is an object that encapsulates card-related information (such as type, content, style, etc.). It is generated by the parsing process and used for subsequent view creation. AI-generated card data refers to data generated by the AI ​​system according to specific algorithms or models and used to be displayed on the smart cockpit interface.

[0056] In other words, the intelligent cockpit system first needs to receive data from within or outside the system. This data is sent in a predefined target format (such as JSON). This data forms the basis for displaying various information cards (such as news, weather, music playlists, etc.) on the cockpit's user interface. After receiving the data, it undergoes format parsing, that is, converting the raw data into an object form that the program can manipulate. This step typically involves converting JSON data in string format into CardData objects. The CardData object is a customized data structure based on the specific needs and design of the intelligent cockpit system. In the intelligent cockpit system, the CardData object contains card type, card content, card style, and defines the user's interaction with the card, such as click events and swipe actions. In other words, the CardData object encapsulates all the necessary information, generated by artificial intelligence, to describe how to display the cards.

[0057] After parsing is complete, the CardData object will be used to guide the view creation process. Based on the card type and content information encapsulated in CardData, a suitable view container can be selected to create a view component tree, and these components can be added to the container to ultimately form a complete card view.

[0058] Therefore, data can be parsed and processed accurately and quickly, which helps improve the application's response speed and provide a smoother user experience. The clear data parsing process and the encapsulated CardData object make the code easier to understand and maintain.

[0059] According to one embodiment of this application, the card creation method further includes: updating the preset strategy mapping relationship when there is no card type of card data object in the preset strategy mapping relationship, wherein updating the preset strategy mapping relationship includes defining a new strategy class, associating the new strategy class with a new card type, and adding it to the preset strategy mapping relationship.

[0060] Specifically, in intelligent cockpit systems, with the introduction of new functions or changes in user needs, card types of card data objects that do not exist in the preset strategy mapping relationship may be encountered. In this case, the preset strategy mapping relationship needs to be updated to support the new card type. That is, currently, in the process of creating views for newly added cards, adding a new card type requires modifying the core creation code, while this application does not require modification of the core creation code. Specifically, it involves identifying the new card type that needs to be supported, such as a new information display card type "video" (video card). This is done by analyzing user needs or system updates to identify the new card type that needs to be added. The creation logic for the new card type can be handled by creating a new strategy class. For example, a new card creation strategy can be defined based on the characteristics and requirements of the new card type. For example, a VideoCardStrategy can be created for video cards. The card creation method is implemented in the newly defined card creation strategy. For example, VideoCardStrategy may need to handle the creation and configuration of video playback components. The new card creation strategy is then associated with the new card type and added to the preset strategy mapping relationship. This involves adding new entries to the strategy mapping table, associating new card types with new strategy classes, and ensuring that the system can recognize and use the new strategy classes.

[0061] Therefore, by simply adding new strategy classes and updating mapping relationships, it is easy to extend the system to support new card types. New card types and strategies can be updated independently of existing code, reducing maintenance costs and allowing for rapid adaptation to new user needs or market changes. This enables users to enjoy a richer and more personalized smart cockpit experience. In this way, the smart cockpit system can flexibly adapt to new requirements, continuously expand its functionality, while maintaining clean and maintainable code.

[0062] According to one embodiment of this application, the card type includes at least one of flexbox type, list type, matrix type and web page type. The card creation strategy corresponding to the flexbox type includes converting card data into flexbox components, which are used to adjust the layout of their child elements. The card creation strategy corresponding to the list type includes creating a list view to realize list display. The card creation strategy corresponding to the matrix type includes creating a matrix grid layout to realize grid data display and interaction. The card creation strategy corresponding to the web page type includes creating a web page view component to realize web page content loading and interaction.

[0063] Specifically, card types include at least one of the following: Flexbox, List, Matrix, and Web. Flexbox cards are used to display cards with flexible layouts, such as news cards and notification cards. List cards are used to display scrollable list data, such as music playlists and news lists. Matrix cards are used to display grid-layout data, such as image grids and application icons. Web cards are used to embed web content within cards, such as news articles and online services.

[0064] The card creation strategy for flexbox types includes converting card data into flexbox components, which are used to adjust the layout of their child elements. A flexbox component is a UI component used to implement a flexbox layout, allowing for flexible adjustment of its child element layout. Converting card data into a flexbox component allows the component to dynamically adjust the layout of its child elements based on the content, adapting to different display needs and screen sizes. For example, properties in the CardData object are converted into ComponentData, ready for creating a flexbox layout. A Component View Factory is used to create the flexbox layout component from the ComponentData. Properties of the flexbox component, such as the direction of the main and cross axes, and alignment, are set to adapt to different child element layout requirements. The child component data in the ComponentData is converted into specific view components and added to the flexbox layout. Assuming CardData contains news titles and summaries, a flexbox layout is created where the titles and summaries are displayed horizontally.

[0065] The card creation strategy for list types includes creating a list view to display the list. A list view refers to a UI component used to display list data, such as a recyclable list view that supports swiping and scrolling to view list items. Creating a list view to display the list involves generating a scrollable list view to display a series of data items. For example, the list data in CardData is converted into ComponentData objects. A recyclable list view is created using a component view factory, and the corresponding adapter is configured. The layout manager of the list view is set, binding the data items in ComponentData to the list view's adapter. Assuming CardData contains a series of news items, a recyclable list view is created, displaying each news item as a list item.

[0066] The card creation strategy corresponding to the matrix type includes creating a matrix grid layout to enable the display and interaction of grid data. Here, a matrix grid layout refers to a UI component used to implement a matrix or grid layout, such as a grid layout, for displaying data in a grid format. Creating a matrix grid layout to enable grid data display and interaction generates a grid layout that allows users to browse and select items within the grid. For example, the grid data in CardData is converted into ComponentData objects. The grid layout is created using a component view factory, setting the number of columns and row height, as well as the size of the grid items. The grid item data in ComponentData is converted into view components and added to the grid layout. Assuming CardData contains a series of application icons, a grid layout is created, with each icon displayed as a grid item.

[0067] The card creation strategy corresponding to the webpage type includes creating webpage view components to enable loading and interaction of webpage content. Webpage view components refer to UI components, such as webpage views, used to load and display webpage content within the application. This strategy generates a component that can load webpage content, allowing users to interact directly with it within the application. For example, it converts the webpage URL or HTML content in CardData into ComponentData objects. It then uses a component view factory to create the webpage view component, setting its properties such as base URL and JavaScript enabled. Finally, it loads the specified webpage content into the webpage view. For instance, assuming CardData contains a URL linking to a news website, a webpage view is created to load the content of that URL.

[0068] Therefore, this method allows for the dynamic selection and application of appropriate creation strategies based on different card types, thereby generating card views that adapt to different display needs. This approach not only improves the system's flexibility and scalability but also enables the system to quickly adapt to new requirements and changes.

[0069] In summary, combining Figure 2As shown in the illustration, the `Type` field of the `CardData` object is used to retrieve card type information. For example, the `Type` field, which indicates the card type (such as "flexbox", "list", "matrix", or "web"), can be extracted from the `Type` field. The `StrategyFactory` method is used to retrieve the corresponding creation strategy based on the card type. For instance, using the `StrategyFactory` method of the `CardStrategy`, the corresponding card type can be obtained based on the value of the `Type` field in `CardData`, allowing the selection of an appropriate creation strategy. This could be achieved by selecting the appropriate card creation strategy (such as `FlexboxCardStrategy`, `ListCardStrategy`, `MatrixCardStrategy`, or `WebCardStrategy`) based on the type information in `CardData`.

[0070] Among them, FlexboxCardStrategy is used to create cards that use a Flexbox layout. Flexbox layout is a CSS layout pattern that allows for flexible adjustment of the layout of its child elements. When the card type is "flexbox", this strategy generates a FlexboxLayout or similar layout container so that the child elements within the card can dynamically adjust their position and size according to screen size and content. ListCardStrategy is used to create cards that display list data, such as news lists or music playlists. When the card type is "list", this strategy generates a list view (such as a RecyclerView) and configures the adapter to display each item in the list. MatrixCardStrategy is used to create cards that display content in a matrix grid format, such as an image grid or an app icon grid. When the card type is "matrix", this strategy generates a grid layout and fills each cell in the grid to display the corresponding content. WebCardStrategy is a card creation strategy used to create cards that can embed web page content, such as articles or online services. When the card type is "web," this strategy generates a WebView component to load and display the web page content. These card creation strategies implement the Card Strategy Factory interface, which defines a unified method signature for creating cards. Each card creation strategy encapsulates the card creation logic for a specific type, allowing the system to dynamically select and apply the correct creation strategy based on the card type. This design pattern improves the system's flexibility and scalability, allowing for the easy addition of new card types and corresponding creation strategies.

[0071] The `CreateCard` method is used to create specific card views. For example, calling the `CreateCard` method with a selected card creation strategy, passing in necessary parameters (such as context and ComponentData), generates the corresponding card view. During card view creation, the context is used to obtain system services, access application resources, and manage lifecycle events; it is one of the necessary parameters when creating view components because view components need access to application resources and functionality. During card view creation, ComponentData guides how to create specific view components based on the card's content and type, providing detailed data required for the view creation logic. Converting card data to component data transforms the raw card data into a format more suitable for component creation and view assembly. For example, all properties in `CardData` are copied to a new `JsonObject` to form the initial data for `ComponentData`. Setting the view name involves setting the `viewName` property of `ComponentData` (the view name property) based on the card type, such as setting the `flexbox` type to "FlexboxLayout". This view name is also the view container. If the content of `ComponentData` includes a single view element, the view container can be directly displayed to the user. If `ComponentData` has multiple view elements, the component view factory can create specific view components based on the view name. For example, the component view factory creates the corresponding view component based on the viewName in the ComponentData. Recursively creating the component tree is used to create and assemble all view elements to form a complete component tree. Container wrapping is used to wrap the created component tree in a suitable container to support additional functionality (such as scrolling). For example, wrapping the created component tree in a suitable container (such as a ScrollView) to support additional functionality (such as scrolling). Returning a card view is used to return a card view; for example, after completing the creation of the component tree and container wrapping, the final card view is returned.

[0072] This approach allows for the dynamic selection of appropriate creation strategies based on card type, thereby generating corresponding view layouts and content. This not only improves code maintainability and scalability but also enables the system to adapt to changing needs, such as adding new card types. Simultaneously, it optimizes performance, enhances user experience, and makes the UI generation of the smart cockpit more flexible and personalized.

[0073] The following is combined Figure 3 The method described in this application is used to describe the method.

[0074] As a specific example, the card creation method of this application may include the following steps: S101 receives data in the target format sent by the smart cockpit and parses the data to obtain a card data object, which encapsulates the card data.

[0075] S102, obtain the corresponding card type based on the card data object.

[0076] S103, determine the card creation strategy based on the card type and the preset strategy mapping relationship, wherein the preset strategy mapping relationship is used to indicate the relationship between the card type and the card creation strategy.

[0077] S104, convert the format of the card data object to obtain the component data object.

[0078] S105, determine card content and card type based on component data object.

[0079] S106, Create a target view container based on card type, card content, and card creation strategy.

[0080] S107, Determine whether the card content includes multiple view elements. If yes, proceed to step S108; if no, proceed to step S106.

[0081] S108, create a component tree based on multiple view elements, and determine the view container based on card type and card content, so as to add the component tree to the view container.

[0082] S109, Update the target view container based on the view container, wherein the updated target view container contains the view container.

[0083] In summary, the card creation method according to the embodiments of this application obtains the corresponding card type based on the card data object, determines the card creation strategy based on the card type, performs format conversion on the card data object to obtain a component data object, and creates a corresponding target view container based on the card creation strategy and the component data object. The target view container represents the graphical interface of the card, which is rendered and added to the user interface. Therefore, this method can achieve card creation with low code coupling, and the code structure is clear, easy to understand and maintain, optimizes performance, and provides a smoother user experience.

[0084] Corresponding to the above embodiments, this application also proposes a computer-readable storage medium.

[0085] The computer-readable storage medium of this application embodiment stores a program that, when executed by a processor, implements the card creation method described above.

[0086] According to the computer-readable storage medium of the embodiments of this application, by executing the card creation method described above, card creation can be achieved with low code coupling, and the code structure is clear, easy to understand and maintain, optimizes performance, and provides a smoother user experience.

[0087] Corresponding to the above embodiments, this application also proposes a vehicle.

[0088] like Figure 4 As shown, the vehicle 200 in this embodiment may include: a memory 210, a processor 220, and a program stored in the memory 210 and executable on the processor 220. When the processor 220 executes the program, it implements the card creation method described above.

[0089] According to the vehicle in the embodiments of this application, by executing the card creation method described above, card creation can be achieved with low code coupling, and the code structure is clear, easy to understand and maintain, optimizes performance, and provides a smoother user experience.

[0090] Corresponding to the above embodiments, this application also proposes a card creation apparatus.

[0091] like Figure 5 As shown, the card creation device 100 of this application embodiment includes: an acquisition module 110, a determination module 120, a conversion module 130, and a creation module 140.

[0092] The acquisition module 110 is used to obtain the corresponding card type based on the card data object. The determination module 120 is used to determine the card creation strategy based on the card type. The conversion module 130 is used to convert the format of the card data object to obtain the component data object. The creation module 140 is used to create the corresponding target view container based on the card creation strategy and the component data object, wherein the target view container represents the graphical interface of the card, and the graphical interface is rendered and added to the user interface.

[0093] According to one embodiment of this application, the determining module 120 determines a card creation strategy based on the card type, specifically for: determining a card creation strategy based on a card type and a preset strategy mapping relationship, wherein the preset strategy mapping relationship is used to indicate the relationship between the card type and the card creation strategy.

[0094] According to one embodiment of this application, the creation module 140 creates a corresponding target view container based on the card creation strategy and component data object, specifically used for: determining card content and card type based on component data object; and creating the target view container based on card type, card content, and card creation strategy.

[0095] According to one embodiment of this application, the creation module 140 is further configured to: create a component tree based on multiple view elements when the card content includes multiple view elements; determine a view container based on type information and card content to add the component tree to the view container; and update a target view container based on the view container, wherein the updated target view container contains the view container.

[0096] According to one embodiment of this application, the acquisition module 110 is further configured to: receive data in a target format sent by the smart cockpit; parse the data to obtain a card data object, wherein the card data object encapsulates card data generated by artificial intelligence.

[0097] According to one embodiment of this application, the creation module 140 is further configured to: update the preset strategy mapping relationship when there is no card type of card data object in the preset strategy mapping relationship, wherein updating the preset strategy mapping relationship includes defining a new strategy class, associating the new strategy class with a new card type, and adding it to the preset strategy mapping relationship.

[0098] According to one embodiment of this application, the view element includes at least one of flexbox type, list type, matrix type and web page type. The card creation strategy corresponding to the flexbox type includes converting card data into flexbox components, which are used to adjust the layout of their child elements. The card creation strategy corresponding to the list type includes creating a list view to realize list display. The card creation strategy corresponding to the matrix type includes creating a matrix grid layout to realize grid data display and interaction. The card creation strategy corresponding to the web page type includes creating a web page view component to realize web page content loading and interaction.

[0099] It should be noted that for details not disclosed in the card creation device of this application embodiment, please refer to the details disclosed in the card creation method of this application embodiment, which will not be repeated here.

[0100] According to the card creation apparatus of this application embodiment, the acquisition module is used to acquire the corresponding card type based on the card data object, the determination module is used to determine the card creation strategy based on the card type, the conversion module is used to convert the format of the card data object to obtain a component data object, and the creation module is used to create a corresponding target view container based on the card creation strategy and the component data object. The target view container represents the graphical interface of the card, and the graphical interface is rendered and added to the user interface. Therefore, this apparatus can achieve card creation with low code coupling, and the code structure is clear, easy to understand and maintain, optimizes performance, and provides a smoother user experience.

[0101] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0102] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0103] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0104] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0105] In this application, unless otherwise expressly specified and limited, the terms "installation," "connection," "joining," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components, unless otherwise expressly limited. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0106] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A card creation method characterized by, The method comprises: obtaining a corresponding card type based on the card data object; determining a card creation strategy based on the card type; format-converting the card data object to obtain a component data object; creating a corresponding target view container based on the card creation strategy and the component data object, wherein the target view container represents a graphical interface of a card, and the graphical interface is rendered and added to a user interface.

2. The card creation method of claim 1, wherein, The determination of the card creation strategy based on the card type comprises: determining the card creation strategy based on the card type and a preset strategy mapping relationship, wherein the preset strategy mapping relationship is used to indicate the relationship between the card type and the card creation strategy.

3. The card creation method of claim 1, wherein, The creation of the target view container based on the card creation strategy and the component data object comprises: determining card content and the card type based on the component data object; creating the target view container based on the card type, the card content, and the card creation strategy.

4. The card creation method of claim 3, wherein, The method further comprises: in the case where the card content comprises multiple view elements, creating a component tree based on the multiple view elements; determining a view container based on the card type and the card content, so as to add the component tree to the view container; updating the target view container based on the view container, wherein the updated target view container contains the view container.

5. The card creation method of claim 1, wherein, The method further comprises: receiving data in a target format sent by an intelligent cockpit; format-analyzing the data to obtain the card data object, which encapsulates card data.

6. The card creation method of claim 2, wherein, The method further comprises: in the case where the preset strategy mapping relationship does not include a card type of the card data object, updating the preset strategy mapping relationship, wherein the updating of the preset strategy mapping relationship comprises defining a new strategy class, associating the new strategy class with a new card type, and adding the new strategy class to the preset strategy mapping relationship.

7. The card creation method of claim 2, wherein, The card type comprises at least one of a flexible box type, a list type, a matrix type, and a webpage type, the card creation strategy corresponding to the flexible box type comprises converting the card data into a flexible box component, the flexible box component is used to adjust the layout of its sub-elements, the card creation strategy corresponding to the list type comprises creating a list view to realize list display, the card creation strategy corresponding to the matrix type comprises creating a matrix grid layout to realize the display and interaction of grid data, and the card creation strategy corresponding to the webpage type comprises creating a webpage view component to realize the loading and interaction of webpage content.

8. A computer-readable storage medium, characterized in that, A program is stored thereon, and the program is executed by a processor to implement the card creation method according to any one of claims 1-7.

9. A vehicle characterized by comprising: comprises: a memory, a processor, and a program stored on the memory and executable on the processor, and the processor implements the card creation method according to any one of claims 1-7 when executing the program.

10. A card creating apparatus characterized by comprising: The device comprises: an obtaining module configured to obtain a corresponding card type based on a card data object; a determining module configured to determine a card creation strategy based on the card type; A conversion module is configured to convert the card data object to obtain a component data object. A creation module is configured to create a target view container corresponding to the card based on the card creation strategy and the component data object, wherein the target view container represents a graphical interface of the card, and the graphical interface is rendered and added to the user interface.