Vehicle infotainment system theme switching method, device, computer device and storage medium
By pre-defined annotated controls and resource packages in the car computer system, using the JavaPoet library to generate code templates and inject them into the theme manager, the problem of restarting the application when switching the car computer theme is solved, and the user experience and the continuity of the application process is improved.
Patent Information
- Application Number
- CN202410610708.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2044-05-16
AI Technical Summary
The existing car and computer systems need to restart the application when switching themes, resulting in poor user experience, especially the problem of interrupting the process in applications such as navigation.
By pre-defined controls and resource packages for the annotations corresponding to the car computer theme, use the JavaPoet library to generate code templates, inject this information into the theme manager, and directly update the control resources during switching, without restarting the application.
It realizes that there is no need to restart the application during the switching of the car-machine theme, improves the user experience and ensures the continuity and stability of the application process.
Smart Images

Figure CN118363570B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the technical field of intelligent vehicle machines, and in particular, to a method, device, computer device, and storage medium for switching vehicle machine themes. Background Art
[0002] Currently, most vehicle machines support theme switching. Generally, in addition to the common day and night themes, there are also some customized themes. The Android system currently only supports day and night theme switching by default, and the number of themes is small. Moreover, when switching themes on Android, it is necessary to restart applications (such as maps, music, etc.) and reload resources. Restarting the application will cause the application to exit during use, which is inconvenient for users. For example, restarting the map application will interrupt the navigation process, and the user experience is not good. Summary of the Invention
[0003] In view of this, to solve the above technical problems or some of the technical problems, embodiments of the present invention provide a method, device, computer device, and storage medium for switching vehicle machine themes.
[0004] In a first aspect, embodiments of the present invention provide a method for switching vehicle machine themes, including:
[0005] Pre-defining the controls corresponding to the annotations of all vehicle machine themes respectively and writing a code template for compiling and generating code;
[0006] Based on the code template, retrieving the annotations, and injecting the controls corresponding to the annotations of all vehicle machine themes and their resource packages into the theme manager;
[0007] In response to a theme switching instruction, determining the target vehicle machine theme to be switched and all corresponding target controls in the theme manager;
[0008] Based on the resource packages corresponding to all the target controls, switching the current vehicle machine theme to the target vehicle machine theme.
[0009] In a possible implementation manner, the method further includes:
[0010] Defining the annotation format based on the code template using the JavaPoet library;
[0011] Adding annotations to the controls corresponding to all vehicle machine themes respectively according to the annotation format and setting the ID information of all the controls.
[0012] In a possible implementation manner, the method further includes:
[0013] Executing the code template based on the category of the annotation using the JavaPoet library to generate template code corresponding to each control defining the annotation;
[0014] Inject the controls with annotations corresponding to all the in-vehicle unit themes respectively and their corresponding resource packages into the theme manager, where the theme manager contains all the in-vehicle unit themes and the ID information of each in-vehicle unit theme.
[0015] In a possible implementation, the method further includes:
[0016] In response to a theme switching instruction, determine the target in-vehicle unit theme to be switched in the theme manager;
[0017] Based on the target in-vehicle unit theme, determine all the target controls to be switched.
[0018] In a possible implementation, the method further includes:
[0019] Query the ID information of all the target controls and the resource package corresponding to each target control in the theme manager;
[0020] Based on the resource package, update the current states of all the target controls and switch the current in-vehicle unit theme to the target in-vehicle unit theme.
[0021] In a possible implementation, the method further includes:
[0022] Set the control ID and resource package corresponding to each target control as specific resources to be switched according to the theme ID corresponding to the theme to be switched;
[0023] Switch the specific resources to be switched to the resource state corresponding to the target in-vehicle unit theme.
[0024] In a second aspect, an in-vehicle unit theme switching device provided by an embodiment of the present invention includes:
[0025] A definition module, configured to pre-define the controls with annotations corresponding to all the in-vehicle unit themes respectively and write a code template for compiling and generating code;
[0026] A storage module, configured to retrieve annotations based on the code template, and inject the controls with annotations corresponding to all the in-vehicle unit themes respectively and their resource packages into the theme manager;
[0027] A determination module, configured to, in response to a theme switching instruction, determine the target in-vehicle unit theme to be switched and all the corresponding target controls in the theme manager;
[0028] A control module, configured to switch the current in-vehicle unit theme to the target in-vehicle unit theme based on the resource packages corresponding to all the target controls.
[0029] Optionally, the definition module is further configured to define an annotation format based on the code template using the JavaPoet library; add annotations to the controls corresponding to all in-vehicle infotainment system themes according to the annotation format, and set the ID information of all controls.
[0030] In a third aspect, an embodiment of the present invention provides a computer device, including: a processor and a memory, where the processor is configured to execute the in-vehicle infotainment system theme switching program stored in the memory to implement the in-vehicle infotainment system theme switching method described in the first aspect above.
[0031] In a fourth aspect, an embodiment of the present invention provides a storage medium, including: the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the in-vehicle infotainment system theme switching method described in the first aspect above.
[0032] The in-vehicle infotainment system theme switching solution provided by the embodiment of the present invention includes: pre-defining the controls with annotations corresponding to all in-vehicle infotainment system themes respectively and writing a code template for compiling and generating code; retrieving annotations based on the code template, and injecting the controls with annotations corresponding to all in-vehicle infotainment system themes respectively and their resource packages into the theme manager; in response to a theme switching instruction, determining the target in-vehicle infotainment system theme to be switched and all corresponding target controls in the theme manager; and switching the current in-vehicle infotainment system theme to the target in-vehicle infotainment system theme based on the resource packages corresponding to all the target controls. This solution pre-loads all in-vehicle infotainment system theme resources into a unified theme manager in advance. When switching themes, first find the controls, and then match the corresponding theme resources to directly reset the control resources, without restarting the application to interrupt the application process, improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a schematic flowchart of an in-vehicle infotainment system theme switching method provided by an embodiment of the present invention;
[0034] Figure 2 It is a schematic flowchart of another in-vehicle infotainment system theme switching method provided by an embodiment of the present invention;
[0035] Figure 3 It is a schematic flowchart of an in-vehicle infotainment system theme switching device provided by an embodiment of the present invention;
[0036] Figure 4 It is a schematic structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0038] For ease of understanding of the embodiments of the present invention, the following will further explain and illustrate with specific embodiments in conjunction with the accompanying drawings. The embodiments do not constitute a limitation to the embodiments of the present invention.
[0039] Figure 1 The following is a schematic flowchart of a method for switching in-vehicle infotainment (IVI) themes provided by an embodiment of the present invention. As Figure 1 shown, the method specifically includes:
[0040] S11. Pre-define the controls corresponding to the annotations of all IVI themes respectively and write a code template for compiling and generating code.
[0041] In the method for switching IVI themes according to the embodiment of the present invention, all theme resources are pre-loaded in a unified manager. When switching themes, the controls are preferentially found in the theme manager, and then the corresponding theme resources are matched to directly reset the resources of the controls (such as text, buttons, etc.). Time is traded for space to achieve fast switching.
[0042] Specifically, first, define the metadata of the annotation: BindTextColor, BindBackgroud, BindSrc, which are used to mark the controls (Views) that need to follow the theme switch.
[0043] Furthermore, write the code template generated when the system is compiled:
[0044] BindTextColor: Corresponds to the annotation of the text color resource. For example:
[0045] @BindTextColor(id = R.id.text1,
[0046] value = {R.color.text_color1, R.color.text_color2,
[0047] R.color.text_color3, R.color.text_color4, R.color.text_color5})
[0048] public TextView textView;
[0049] BindBackgroud: Annotation for background resources corresponding to various controls (text, images, buttons, etc.). Example:
[0050] @BindBackgroud(id = R.id.bg,
[0051] value = {R.drawable.bg1, R.drawable.bg2,
[0052] R.drawable.bg3, R.drawable.bg4, R.drawable.bg5})
[0053] public View view;
[0054] BindSrc: Annotation for image resources. Example:
[0055] @BindSrc(id = R.id.imageView,
[0056] value = {R.drawable.image1, R.drawable.image2,
[0057] R.drawable.image3, R.drawable.image4, R.drawable.image5})
[0058] public ImageView imageView;
[0059] According to the above code template, the code format can be defined through the JavaPoet library, including the execution process, etc. Among them, color and drawable are resource files already defined in Android natively, and the corresponding resources need to be placed in the corresponding folders in advance.
[0060] For controls that need to switch with the theme, add annotations according to the above code format, and set the ID of the control and the value resources (text color, background, image) of the corresponding theme.
[0061] S12. Retrieve annotations based on the code template, and inject the controls and their resource packages corresponding to the annotations of all in-vehicle themes into the theme manager.
[0062] When the code is compiled, the compiler will automatically retrieve the annotations. According to different categories of BindTextColor, BindBackgroud, and BindSrc, it will execute according to the defined code logic through the JavaPoet library, and finally generate the template code. Each control with an added annotation will be included in the generated code, and the control and its resource package will be injected into the theme manager.
[0063] S13. In response to the theme switching instruction, determine the target in-vehicle theme to be switched and all corresponding target controls in the theme manager.
[0064] When the user triggers the theme switching instruction, when the in-vehicle system responds to the theme switching instruction and runs the code, there is a one-to-one correspondence between the themes and theme IDs in the theme manager. When switching themes, find all the target controls to be switched in the theme manager.
[0065] S14. Based on the resource packages corresponding to all the target controls, switch the current in-vehicle theme to the target in-vehicle theme.
[0066] The theme manager contains the ID information and resource packages of the controls, and sets them into specific resources according to the theme ID, thus completing the theme resource switching. For example, when switching to theme 2, the corresponding theme resources are switched to R.color.text_color2, R.drawable.bg2, R.drawable.image2, etc.
[0067] The in-vehicle theme switching method provided by the embodiments of the present invention includes: by pre-defining the controls with annotations corresponding to all in-vehicle themes respectively and writing a code template for compiling and generating code; retrieving the annotations based on the code template, and injecting the controls with annotations corresponding to all in-vehicle themes respectively and their resource packages into the theme manager; in response to the theme switching instruction, determine the target in-vehicle theme to be switched and all corresponding target controls in the theme manager; based on the resource packages corresponding to all the target controls, switch the current in-vehicle theme to the target in-vehicle theme. This method loads all the in-vehicle theme resources into a unified theme manager in advance. When switching themes, first find the controls, and then match the corresponding theme resources to directly reset the control resources without restarting the application to interrupt the application process, improving the user experience.
[0068] Figure 2 It is a schematic flowchart of another in-vehicle theme switching method provided by the embodiments of the present invention, as Figure 2 shown, and the method specifically includes:
[0069] S21. Define the annotation format using the JavaPoet library based on the code template.
[0070] S22. Add annotations to the controls corresponding to all in-vehicle themes in the annotation format and set the ID information for all controls.
[0071] In the embodiment of the present invention, first, define the metadata of the annotation: BindTextColor, BindBackgroud, BindSrc, which are used to mark the controls (Views) that need to switch with the theme.
[0072] Further, write the code template generated when the system is compiled:
[0073] BindTextColor: Corresponding to the annotation of the text color resource, for example:
[0074] @BindTextColor(id = R.id.text1,
[0075] value = {R.color.text_color1, R.color.text_color2,
[0076] R.color.text_color3, R.color.text_color4, R.color.text_color5})
[0077] public TextView textView;
[0078] BindBackgroud: Corresponding to the background resource annotation of various controls (text, pictures, buttons, etc.), for example:
[0079] @BindBackgroud(id = R.id.bg,
[0080] value = {R.drawable.bg1, R.drawable.bg2,
[0081] R.drawable.bg3, R.drawable.bg4, R.drawable.bg5})
[0082] public View view;
[0083] BindSrc: Corresponding to the picture resource annotation, for example:
[0084] @BindSrc(id = R.id.imageView,
[0085] value = {R.drawable.image1, R.drawable.image2,
[0086] R.drawable.image3, R.drawable.image4, R.drawable.image5}
[0087] public ImageView imageView;
[0088] Based on the above code template, use the JavaPoet library to define the annotation format, and add annotations to all the controls corresponding to each in-vehicle theme according to the annotation format. Furthermore, set the corresponding ID information for all the controls with added annotations. The role of adding annotations is that when the theme is switched, the code generator parses the annotations to generate the corresponding theme switching code.
[0089] S23. Based on the category of the annotation, use the JavaPoet library to execute the code template to generate the template code corresponding to each control with a defined annotation.
[0090] During code compilation, the compiler will automatically retrieve the annotations. According to different categories of BindTextColor, BindBackgroud, and BindSrc, it will execute according to the defined code logic through the JavaPoet library, and finally generate the template code corresponding to each control with a defined annotation.
[0091] Specifically, write an annotation processor using the JavaPoet library, which will scan all fields with annotations during compilation and generate template code.
[0092] S24. Inject the controls with annotations corresponding to each in-vehicle theme and their corresponding resource packages into the theme manager, where the theme manager contains all in-vehicle themes and the ID information of each in-vehicle theme.
[0093] Each control with an added annotation will be included in the generated template code, and the controls with annotations corresponding to each in-vehicle theme and their corresponding resource packages will be injected into the theme manager.
[0094] There is a one-to-one correspondence between the in-vehicle themes and the in-vehicle theme ID information in the theme manager.
[0095] S25. In response to a theme switching instruction, determine the target in-vehicle theme to be switched in the theme manager.
[0096] When the user triggers a theme switching instruction, when the in-vehicle system responds to the theme switching instruction and runs the code, there is a one-to-one correspondence between the themes and the theme IDs in the theme manager. Determine the target in-vehicle theme to be switched corresponding to the theme switching instruction in the theme manager.
[0097] S26. Determine all the target controls to be switched based on the target in-vehicle theme.
[0098] Based on the determined target in-vehicle theme, when switching the theme, find all target controls to be switched in the theme manager.
[0099] S27. Query the ID information of all target controls and the resource package corresponding to each target control in the theme manager.
[0100] S28. Update the current state of all target controls based on the resource package, and switch the current in-vehicle theme to the target in-vehicle theme.
[0101] The theme manager contains the ID information and resource package of the controls, and sets them into specific resources according to the theme ID, so as to complete the theme resource switching.
[0102] Specifically, the theme manager needs to maintain a mapping to associate the ID information of the controls with the corresponding theme resources. At runtime, when switching the theme, the theme manager will traverse all registered controls and update their resources.
[0103] For example, when switching to Theme 2, the corresponding theme resources are switched to R.color.text_color2, R.drawable.bg2, R.drawable.image2, etc.
[0104] The in-vehicle theme switching method provided by the embodiment of the present invention includes: pre-defining the controls annotated for each in-vehicle theme respectively and writing a code template for compiling and generating code; retrieving the annotations based on the code template, and injecting the controls annotated for each in-vehicle theme respectively and their resource packages into the theme manager; in response to a theme switching instruction, determining the target in-vehicle theme to be switched and all corresponding target controls in the theme manager; and switching the current in-vehicle theme to the target in-vehicle theme based on the resource packages corresponding to all target controls. By pre-loading all in-vehicle theme resources into a unified theme manager, when switching the theme, first find the controls, and then match the corresponding theme resources to directly reset the control resources, without restarting the application to interrupt the application process, thus improving the user experience.
[0105] The embodiment of the present application also provides an implementation process for dynamic loading of in-vehicle themes. The specific steps are as follows: First, receive a file creation request, and in response to the file creation request, create a theme configuration file, which can be a text file, an XML file, or other suitable formats.
[0106] Secondly, define the information of themes and controls in the configuration file, including theme names, theme styles, control names, control styles, etc. And add a first preset method in the code of the theme manager. The first preset method is used to read the configuration file and load the themes and controls. The first preset method can accept the configuration file path as a parameter, and then use a file parser to parse the information in the configuration file. Then, call the above method in the initialization method of the theme manager, passing in the configuration file path, so as to load the themes and controls when the system starts. And obtain the information of the currently used themes and controls by calling the methods provided by the theme manager. This information can be used for style setting, rendering, and display.
[0107] Subsequently, when it is necessary to modify the theme or control, only the configuration file needs to be modified, rather than the source code. The corresponding changes can be achieved by adding, modifying, or deleting the theme and control information in the configuration file. Then restart the system, and the theme manager will reload the themes and controls according to the new information in the configuration file.
[0108] Through the above steps, the dynamic loading function of the theme manager can be achieved. The theme and control information in the configuration file can be flexibly adjusted according to requirements without modifying the source code. This can facilitate the addition, modification, and deletion of themes and controls, improving the maintainability and customizability of the system.
[0109] The embodiments of this application can also implement a caching mechanism in the theme manager, and the specific steps are as follows: First, determine the storage method and update strategy of the cache. For example: choose to cache the theme resource package in the local file system or memory to improve the reading speed. Secondly, construct a cache manager for managing the cache of the theme resource package. This manager needs to provide functions for loading, obtaining, updating, and deleting the cache.
[0110] Then, add a second preset method for loading the theme resource package in the theme manager. This method will first check whether there is a cache. If there is a cache, it will directly return the cached resource package. Otherwise, it is necessary to load the resource package from the network or the local file system. Implement a third preset method for obtaining the theme resource package in the theme manager. This method will first check whether the required resource package exists in the cache. If it exists, it will directly return the cached resource package. Otherwise, it is necessary to load the resource package and add it to the cache. Add a fourth method for updating the theme resource package in the theme manager. This method will, according to the incremental update mechanism, check the changed resource package, download and load it, and then update the corresponding resource package in the cache. Implement a method for deleting the theme resource package in the theme manager. This method will delete the specified resource package in the cache. Finally, use the theme resource package obtained by the theme manager in the application to switch and update the interface.
[0111] Figure 3The flowchart of a vehicle-mounted device for theme switching provided by an embodiment of the present invention is as follows Figure 3 As shown, the device specifically includes:
[0112] A definition module 301, configured to pre-define the controls corresponding to all vehicle-mounted themes respectively and write a code template for compiling and generating code;
[0113] A storage module 302, configured to retrieve annotations based on the code template, and inject the controls corresponding to the annotations of all vehicle-mounted themes respectively and their resource packages into the theme manager;
[0114] A determination module 303, configured to, in response to a theme switching instruction, determine the target vehicle-mounted theme to be switched and all corresponding target controls in the theme manager;
[0115] A control module 304, configured to switch the current vehicle-mounted theme to the target vehicle-mounted theme based on the resource packages corresponding to all target controls.
[0116] In a possible implementation manner, the definition module 301 is specifically configured to define the annotation format based on the code template using the JavaPoet library; add annotations to the controls corresponding to all vehicle-mounted themes respectively according to the annotation format, and set the ID information of all controls.
[0117] In a possible implementation manner, the storage module 302 is specifically configured to execute the code template using the JavaPoet library based on the category of annotations to generate template code corresponding to each control defining an annotation; inject the controls corresponding to the annotations of all vehicle-mounted themes respectively and their corresponding resource packages into the theme manager, and the theme manager contains all vehicle-mounted themes and the ID information of each vehicle-mounted theme.
[0118] In a possible implementation manner, the determination module 303 is specifically configured to, in response to a theme switching instruction, determine the target vehicle-mounted theme to be switched in the theme manager; determine all target controls to be switched based on the target vehicle-mounted theme.
[0119] In a possible implementation manner, the control module 304 is specifically configured to query the ID information of all target controls and the resource package corresponding to each target control in the theme manager; update the current state of all target controls based on the resource package, and switch the current vehicle-mounted theme to the target vehicle-mounted theme.
[0120] In a possible implementation manner, the control module 304 is further configured to set the control ID and resource package corresponding to each target control as specific resources to be switched according to the theme ID corresponding to the theme to be switched; switch the specific resources to be switched to the resource state corresponding to the target vehicle-mounted theme.
[0121] The vehicle-mounted theme switching device provided by this embodiment may be as followsFigure 3 The in-vehicle head unit theme switching device shown can execute all steps of the in-vehicle head unit theme switching method as shown in Figure 1-2 and thus achieve the technical effects of the in-vehicle head unit theme switching method shown in Figure 1-2 . For specific reference, please refer to Figure 1-2 the relevant description. For the sake of concise description, it will not be elaborated here.
[0122] Figure 4 FIG. is a schematic structural diagram of a computer device provided by an embodiment of the present invention. Figure 4 The computer device 400 shown includes: at least one processor 401, a memory 402, at least one network interface 404, and other user interfaces 403. Each component in the computer device 400 is coupled together through a bus system 405. It can be understood that the bus system 405 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 405 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, in Figure 4 all kinds of buses are labeled as the bus system 405.
[0123] Among them, the user interface 403 may include a display, a keyboard, or a pointing device (such as a mouse, a trackball, a touchpad, or a touch screen, etc.).
[0124] It can be understood that the memory 402 in the embodiments of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synch link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM). The memory 402 described herein is intended to include but not be limited to these and any other suitable types of memory.
[0125] In some embodiments, the memory 402 stores the following elements, executable units or data structures, or subsets or supersets thereof: an operating system 4021 and an application program 4022.
[0126] Among them, the operating system 4021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., and is used to implement various basic services and process hardware-based tasks. The application program 4022 includes various application programs, such as a media player and a browser, etc., and is used to implement various application services. The program for implementing the method of the embodiments of the present invention can be included in the application program 4022.
[0127] In the embodiments of the present invention, by calling the programs or instructions stored in the memory 402, specifically, the programs or instructions stored in the application program 4022, the processor 401 is used to execute the method steps provided in each method embodiment, for example, including:
[0128] Pre-define the controls corresponding to the annotations of all in-vehicle unit themes respectively and write a code template for compiling and generating code; retrieve the annotations based on the code template, and inject the controls corresponding to the annotations of all in-vehicle unit themes and their resource packages into the theme manager; in response to a theme switching instruction, determine the target in-vehicle unit theme to be switched and all corresponding target controls in the theme manager; switch the current in-vehicle unit theme to the target in-vehicle unit theme based on the resource packages corresponding to all the target controls.
[0129] In a possible implementation, define the annotation format using the JavaPoet library based on the code template; add annotations to the controls corresponding to all in-vehicle unit themes respectively according to the annotation format, and set the ID information of all the controls.
[0130] In a possible implementation, execute the code template using the JavaPoet library based on the category of the annotations to generate the template code corresponding to each control with a defined annotation; inject the controls corresponding to the annotations of all in-vehicle unit themes respectively and their corresponding resource packages into the theme manager, where the theme manager contains all in-vehicle unit themes and the ID information of each in-vehicle unit theme.
[0131] In a possible implementation, in response to a theme switching instruction, determine the target in-vehicle unit theme to be switched in the theme manager; determine all the target controls to be switched based on the target in-vehicle unit theme.
[0132] In a possible implementation, query the ID information of all the target controls and the resource package corresponding to each target control in the theme manager; update the current state of all the target controls based on the resource package, and switch the current in-vehicle unit theme to the target in-vehicle unit theme.
[0133] In a possible implementation, set the control ID and resource package corresponding to each target control as the specific resources to be switched according to the theme ID corresponding to the theme to be switched; switch the specific resources to be switched to the resource state corresponding to the target in-vehicle unit theme.
[0134] The method disclosed in the embodiments of the present invention above can be applied to the processor 401 or implemented by the processor 401. The processor 401 may be an integrated circuit chip with signal processing capabilities. During implementation, the steps of the above method can be completed by the integrated logic circuit in hardware or instructions in software form in the processor 401. The above-mentioned processor 401 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software units in the decoding processor. The software unit may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 402, and the processor 401 reads the information in the memory 402 and combines its hardware to complete the steps of the above method.
[0135] It can be understood that these embodiments described herein can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or a combination thereof.
[0136] For a software implementation, the techniques described herein can be implemented by units that execute the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented within the processor or external to the processor.
[0137] The computer device provided in this embodiment may be the computer device shown in Figure 4 , and can execute all steps of the vehicle-mounted theme switching method such as Figure 1-2 , thereby realizing the technical effect of the vehicle-mounted theme switching method shown in Figure 1-2 . For specific details, please refer to Figure 1-2 for relevant descriptions. For the sake of brevity, it will not be elaborated here.
[0138] The embodiment of the present invention also provides a storage medium (computer-readable storage medium). One or more programs are stored in the storage medium here. Among them, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk or solid-state drive; the memory may also include a combination of the above types of memory.
[0139] When one or more programs in the storage medium can be executed by one or more processors to implement the vehicle-mounted theme switching method executed on the computer device side as described above.
[0140] The processor is used to execute the vehicle-mounted theme switching program stored in the memory to implement the following steps of the vehicle-mounted theme switching method executed on the computer device side:
[0141] Pre-define the controls corresponding to the annotations of all vehicle-mounted themes respectively and the code templates for writing and compiling to generate code; retrieve the annotations based on the code templates, and inject the controls corresponding to the annotations of all vehicle-mounted themes respectively and their resource packages into the theme manager; in response to the theme switching instruction, determine the target vehicle-mounted theme to be switched and all corresponding target controls in the theme manager; switch the current vehicle-mounted theme to the target vehicle-mounted theme based on the resource packages corresponding to all the target controls.
[0142] In a possible implementation manner, define the annotation format using the JavaPoet library based on the code template; add annotations to the controls corresponding to all vehicle-mounted themes respectively according to the annotation format, and set the ID information of all controls.
[0143] In a possible implementation manner, execute the code template using the JavaPoet library based on the category of the annotation to generate the template code corresponding to each control defining the annotation; inject the controls corresponding to the annotations of all vehicle-mounted themes respectively and their corresponding resource packages into the theme manager, and the theme manager contains all vehicle-mounted themes and the ID information of each vehicle-mounted theme.
[0144] In a possible implementation manner, in response to the theme switching instruction, determine the target vehicle-mounted theme to be switched in the theme manager; determine all target controls to be switched based on the target vehicle-mounted theme.
[0145] In a possible implementation, query the ID information of all the target controls and the resource package corresponding to each target control in the theme manager; update the current states of all the target controls based on the resource package, and switch the current in-vehicle theme to the target in-vehicle theme.
[0146] In a possible implementation, set the control ID and the resource package corresponding to each target control as specific resources to be switched according to the theme ID corresponding to the theme to be switched; switch the specific resources to be switched to the resource state corresponding to the target in-vehicle theme.
[0147] Those skilled in the art should also be able to further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0148] The steps of the methods or algorithms described in combination with the embodiments disclosed herein can be implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal 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 technical field.
[0149] The specific embodiments described above further elaborate on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for switching the in-vehicle infotainment system theme, characterized in that, including: pre - defining controls corresponding to annotations of all in - vehicle infotainment system themes respectively and a code template for writing, compiling and generating code; retrieving annotations based on the code template, and injecting controls corresponding to annotations of all in - vehicle infotainment system themes respectively and their resource packages into a theme manager; responding to a theme switching instruction, determining a target in - vehicle infotainment system theme to be switched and all corresponding target controls in the theme manager; switching the current in - vehicle infotainment system theme to the target in - vehicle infotainment system theme based on the resource packages corresponding to all the target controls; the pre - defining controls corresponding to annotations of all in - vehicle infotainment system themes respectively and a code template for writing, compiling and generating code includes: defining an annotation format using the JavaPoet library based on the code template; adding annotations to controls corresponding to all in - vehicle infotainment system themes respectively according to the annotation format, and setting ID information of all controls; the retrieving annotations based on the code template, and injecting controls corresponding to annotations of all in - vehicle infotainment system themes respectively and their resource packages into a theme manager includes: executing the code template using the JavaPoet library based on the category of the annotation to generate template code corresponding to each control with a defined annotation; injecting controls corresponding to annotations of all in - vehicle infotainment system themes respectively and their corresponding resource packages into the theme manager, where the theme manager contains all in - vehicle infotainment system themes and ID information of each in - vehicle infotainment system theme.
2. The method according to claim 1, characterized in that the responding to a theme switching instruction, determining a target in - vehicle infotainment system theme to be switched and all corresponding target controls in the theme manager includes: responding to a theme switching instruction, determining a target in - vehicle infotainment system theme to be switched in the theme manager; determining all target controls to be switched based on the target in - vehicle infotainment system theme.
3. The method according to claim 2, wherein the switching the current in - vehicle infotainment system theme to the target in - vehicle infotainment system theme based on the resource packages corresponding to all the target controls includes: querying ID information of all the target controls and resource packages corresponding to each target control in the theme manager; updating the current states of all the target controls based on the resource packages, and switching the current in - vehicle infotainment system theme to the target in - vehicle infotainment system theme.
4. The method according to claim 3, characterized in that the updating the current states of all the target controls based on the resource packages, and switching the current in - vehicle infotainment system theme to the target in - vehicle infotainment system theme includes: setting the control ID and resource package corresponding to each target control as specific resources to be switched according to the theme ID corresponding to the theme to be switched; switching the specific resources to be switched to the resource state corresponding to the target in - vehicle infotainment system theme.
5. A vehicle-mounted machine theme switching device, characterized in that, including: a definition module for pre - defining controls corresponding to annotations of all in - vehicle infotainment system themes respectively and a code template for writing, compiling and generating code; a storage module for retrieving annotations based on the code template, and injecting controls corresponding to annotations of all in - vehicle infotainment system themes respectively and their resource packages into a theme manager; a determination module for responding to a theme switching instruction, determining a target in - vehicle infotainment system theme to be switched and all corresponding target controls in the theme manager; a control module for switching the current in - vehicle infotainment system theme to the target in - vehicle infotainment system theme based on the resource packages corresponding to all the target controls; The defined module is further configured to define an annotation format based on the code template using the JavaPoet library; add annotations to the controls corresponding to all in-vehicle unit themes according to the annotation format, and set the ID information of all controls. The storage module is configured to execute the code template using the JavaPoet library based on the category of the annotation, generate template code corresponding to each control with a defined annotation; inject the controls with annotations corresponding to all in-vehicle unit themes and their corresponding resource packages into a theme manager, where the theme manager contains all in-vehicle unit themes and the ID information of each in-vehicle unit theme.
6. A computer device, characterized in that, Comprising: A processor and a memory, the processor is configured to execute the in-vehicle unit theme switching program stored in the memory to implement the method according to any one of claims 1 to 4.
7. A storage medium, characterized in that, The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
User interface theme updating method, device and system, vehicle machine and vehicle
CN110018866A
Theme resource replacement method, device and equipment, and readable storage medium
CN112394933A