Disclosure of Invention
The present invention provides a method and system for displaying a list page, a computer program product and a storage medium, which at least partially solve the above technical drawbacks of the prior art.
The invention provides a list page display method, which comprises the following steps:
setting a spacing bar object in a list page, and acquiring a corresponding pattern of the spacing bar object in a preset pattern table corresponding to the spacing bar object based on information of currently displayed services of the list page; or setting a corresponding style of the spacer object based on a custom attribute;
based on the corresponding style, carrying out layout and drawing to generate an adaptive style of the spacer bar object;
rendering the adapted style into a page of the list page.
According to the method for displaying the list page in the embodiment of the present invention, the step of displaying, by using the spacer object preset in the list page, the corresponding style of the spacer object in the preset style sheet corresponding to the preset spacer object based on the information of the currently displayed service of the list page specifically includes:
setting the spacer object in the list page, and judging whether the information of the current service is received;
and responding to the received information of the current service, and acquiring a corresponding style from a preset style sheet corresponding to the preset spacer object.
According to the method for displaying the list page in the embodiment of the present invention, in response to receiving the information of the current service, acquiring a corresponding style from a preset style sheet corresponding to the preset spacer object includes:
in response to the received information of the current service, judging whether a pattern corresponding to the information of the current service exists in a preset pattern table corresponding to the preset spacer object;
and responding to the existence of the style corresponding to the information of the current service, and acquiring a corresponding style from a preset style sheet corresponding to the preset spacer object.
According to the method for displaying the list page in the embodiment of the invention, the setting of the corresponding style of the spacer bar object based on the customized attribute comprises the following steps:
in response to the fact that the style name of the current service is not received, judging whether the spacer object has a customized attribute;
in response to a custom attribute, a corresponding style of the spacer object is set based on the custom attribute.
According to the method for displaying the list page in the embodiment of the present invention, the step of displaying, by using the spacer object preset in the list page, the corresponding style of the spacer object in the preset style sheet corresponding to the preset spacer object based on the information of the currently displayed service of the list page specifically includes:
and in response to the fact that the style name of the current service is not received and no attribute is customized, or when the preset interval bar does not need to be adapted to the current service, acquiring a default style as a corresponding style in the preset style sheet.
According to the list page display method provided by the embodiment of the invention, the preset style sheet is obtained in the following way:
creating a preset style sheet, and establishing a basic style in the preset style sheet, wherein the basic style comprises a default style and a style aiming at a service;
and iteratively updating the basic style in the preset style sheet.
According to the method for displaying the list page in the embodiment of the invention, the step of iteratively updating the basic style in the preset style sheet specifically comprises the following steps:
and newly adding a basic style or removing the basic style in the preset style sheet.
The invention also provides a list page display system, which comprises:
the corresponding style acquisition module is used for setting a spacing bar object in a list page and acquiring a corresponding style of the spacing bar object in a preset style sheet corresponding to the spacing bar object based on the information of the currently displayed service of the list page; or setting a corresponding style of the spacer object based on a custom attribute;
the adaptive style determining module is used for carrying out layout and drawing based on the corresponding style and generating an adaptive style of the spacer bar object;
and the rendering module is used for rendering the adaptation styles into pages of the list pages.
The invention also provides a computer program product comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of any of the above list page display methods when executing the program.
The present invention also provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the menu bar implementation method.
The embodiment of the invention obtains a corresponding pattern in a preset pattern table corresponding to a preset spacing bar based on the pattern name of the current service through the preset spacing bar in a list page; or setting a corresponding style based on the customized attribute, then dynamically arranging and drawing, and finally rendering to a list, wherein any condition can be adapted through a set of spacer bar codes, the problem of non-uniform UI specification can be solved through spacer bar adaptation, new card insertion of any requirement can be adapted, the card interval is convenient to adjust, and the compatibility and the expansibility are good.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a list page display method, which is shown in figure 1 and comprises the following steps:
s1, setting a spacer object in a list page, and acquiring a corresponding pattern of the spacer object in a preset pattern table corresponding to the spacer object based on the information of the currently displayed service of the list page; or setting a corresponding style of the spacer object based on a custom attribute;
in the initialization stage of the list page, one or more spacer objects are inserted into the list page according to requirements, and services which need to be adapted to each spacer object are set or the attributes of the spacers are directly customized; the information of the currently displayed service on the list page includes a style name, or other various information, such as a service ID.
It will be appreciated by those skilled in the art that in embodiments of the present application, a plurality of data modules (sections) may be presented in a list page, with different data modules corresponding to different services, and a spacer object may be inserted between the data modules. The list page sets services needing adaptation for the spacer bar object, transmits service information to the spacer bar object, and acquires a corresponding style in the style sheet based on the service information; or directly setting the customized attribute for the corresponding style of the spacer bar object without setting the service which needs to be adapted for the spacer bar object.
S2, carrying out layout and drawing based on the corresponding style, and generating an adaptive style of the spacer bar object;
in the list page drawing phase, the list page delivers the displayed business to the spacer objects. And the spacer object obtains a corresponding style from the style sheet according to the key of the current service, performs layout and drawing, and generates an adaptive style of the spacer object, wherein the key of the current service is the style name of the current service.
S3, rendering the adaptation styles into the pages of the list page.
In the embodiment of the application, after the corresponding pattern of the spacer object is obtained at S1, the spacer object is laid out and drawn according to the obtained corresponding pattern through S2, for example, the distance between the spacer and an adjacent data module in the list page, the color of the spacer, the width of the spacer, and the like are determined, an adaptation pattern of the spacer object is drawn, and the adaptation pattern is rendered into the page of the list page through S3, so that the spacer displayed on the page of the list page is obtained. The embodiment of the invention obtains a corresponding pattern in a preset pattern table corresponding to a preset spacing bar based on the pattern name of the current service through the preset spacing bar in a list page; or setting a corresponding style based on the customized attribute, then dynamically arranging and drawing, and finally rendering to a list, wherein any condition can be adapted through a set of spacer bar codes, the problem of non-uniform UI specification can be solved through spacer bar adaptation, new card insertion of any requirement can be adapted, the card interval is convenient to adjust, and the compatibility and the expansibility are good.
The working principle of the list page display method of the embodiment of the invention is as follows:
judging whether a style name of the current service is received or not through a preset spacing bar in a list page;
then, according to the judgment result, the following three adaptation processes are divided:
and if the style name of the current service is received, continuously judging whether the preset spacing bar needs to be adapted to the current service. When the preset interval bar needs to be adapted to the current service, continuously judging whether a style corresponding to the style name of the current service exists in a preset style sheet corresponding to the preset interval bar, wherein the service types displayed by all sections in the page are the service types of the current page; and if the style corresponding to the style name of the current service exists, acquiring a corresponding style from a preset style sheet corresponding to the preset spacing bar. Then, based on the corresponding style, carrying out dynamic layout and drawing to generate an adaptive style; and rendering the adaptation styles into pages of a list page.
The current page only has one service state at the same time, the spacer object searches for adaptation in the style sheet according to the service of the current page, if the style of the service is set in the style sheet, the style is used, and if the style of the service is not set in the style sheet, the default style is used (if the default service state exists in the page, the default style can be hit in the state). The spacer bar has a default style in the style sheet, and the default style can also be set. Each spacer object may be customizable, i.e. the style of two different spacer objects under the same service may be different, depending on the upper and lower sections. For example, in the service M, the height of the spacer between the a and B sections is 10, the height of the spacer between the C and D sections is 5, the height of the spacer between the a and B sections in the service N is 15, and the height of the spacer between the C and D sections is 20.
And if the style name of the current service is not received, continuously judging whether the customized attribute exists. And if the custom attribute exists, setting a corresponding style based on the custom attribute. Then, based on the corresponding style, carrying out dynamic layout and drawing to generate an adaptive style; and rendering the adaptation styles into pages of a list page.
When the style name of the current service is not received and the attribute is not customized, or the judgment result of judging whether the preset spacing bar needs to be adapted to the current service is as follows: and when the preset spacing bar does not need to be adapted to the current service, acquiring a default pattern as a corresponding pattern in the preset pattern table under any of the two conditions. Then based on the corresponding style, carrying out dynamic layout and drawing to generate an adaptive style; and rendering the adaptation styles into pages of a list page.
That is, the fitting procedure of the spacer is as follows:
in the list initialization stage, a plurality of spacing bars are inserted into the list according to the requirements to find objects, different service scenes needing to be adapted to each spacing bar are set, or the attributes of the spacing bars are directly customized;
in the list drawing stage, the list informs the partition bar of the currently displayed service type, the partition bar obtains a corresponding pattern from the pattern list according to the current service key, and performs dynamic layout and drawing, and finally renders the pattern into the list.
The style sheet maintenance is divided into two processes of initialization and iteration. The initialization process is responsible for creating a style sheet and establishing a basic style; and (3) an iteration process, namely expanding the styles in the style sheet according to the root business requirements, then iteratively updating the existing styles and removing the waste styles. Thus, the iteration or update of the style sheet makes it possible to adapt to any required new card insertion.
The base pattern includes a default pattern and a service pattern-specific pattern, which is a pattern customized for each spacer bar for different service scenarios. For example, a second-hand service, a new-house service, a renting service, and the like may be displayed on the same house source page, different types are required for different partition bars between different sections in each service scenario, a respective set of style sheet is set for each partition bar, and when a service is executed, the partition bars are automatically adapted according to the service displayed on the current page.
According to the list page display method provided by the embodiment of the invention, the preset style sheet is obtained in the following way:
creating a preset style sheet, and establishing a basic style in the preset style sheet, wherein the basic style comprises a general style, a fixed style and an adjustable style;
and iteratively updating the basic style in the preset style sheet.
Referring to fig. 2, a service scene pattern that the spacer needs to be adapted is stored in a pattern table of each spacer, the pattern table exists in the form of map, key is a pattern name, and value is a corresponding pattern, for example, a pattern name of a certain service is "yezhufufei", and a spacer pattern in this service scene is a value in a value corresponding to "yezhufefei" in the pattern table; the specific configuration of the DEFAULT pattern "DEFAULT" of gray, which is preset in the style sheet at a height of 10dp (device independent pixels), may also be modified by a constructor. After the corresponding style of the spacer object is obtained, setting the current style name parameter of the spacer object, wherein the parameter is the style name of the style which needs to be adapted to the spacer object at present, and the class responsible for the spacer adaptation logic searches the specific parameters of the adaptation style, such as the height, the color and the like of the spacer object, in the style list according to the current style name parameter.
According to the method for displaying the list page in the embodiment of the invention, the step of iteratively updating the basic style in the preset style sheet specifically comprises the following steps:
adding new styles for services or removing useless styles in the preset style sheet.
The style sheet maintenance is divided into two processes of initialization and iteration. The initialization process is responsible for creating a style sheet and establishing a basic style; and (3) an iteration process, namely expanding the styles in the style sheet according to the root business requirements, then iteratively updating the existing styles and removing the waste styles. Thus, the iterative updating of the style sheet makes it possible to adapt to any required new card insertion.
According to the method for displaying the list page in the embodiment of the present invention, the obtaining, by using a preset interval bar in the list page, a corresponding style in a preset style sheet corresponding to the preset interval bar based on the style name of the current service specifically includes:
judging whether a style name of the current service is received or not through a preset spacing bar in a list page;
if the style name of the current service is received, when the preset spacing bar needs to be adapted to the current service, continuously judging whether a style corresponding to the style name of the current service exists in a preset style sheet corresponding to the preset spacing bar;
and if the style corresponding to the style name of the current service exists, acquiring a corresponding style from a preset style sheet corresponding to the preset spacing bar.
According to the method for displaying the list page, the setting of the corresponding style based on the customized attribute comprises the following steps:
when the style name of the current service is not received, judging whether a customized attribute exists;
and if the custom attribute exists, setting a corresponding style based on the custom attribute.
According to the method for displaying the list page in the embodiment of the present invention, the obtaining, by using a preset interval bar in the list page, a corresponding style in a preset style sheet corresponding to the preset interval bar based on the style name of the current service specifically includes:
and when the style name of the current service is not received and the attribute is not customized, acquiring a default style from the preset style sheet as a corresponding style.
In order to further explain the list page display method, referring to fig. 3-4, the embodiment of the present invention further provides a specific spacer bar adaptation process and a spacer bar internal processing process.
The adaptation process of the spacing bar is as follows:
in the list initialization stage, a plurality of spacing bars are inserted into the list according to the requirements to find objects, different service scenes needing to be adapted to each spacing bar are set, or the attributes of the spacing bars are directly customized;
in the list drawing stage, the list informs the partition bar of the currently displayed service type, the partition bar obtains a corresponding pattern from the pattern list according to the current service key, and performs dynamic layout and drawing, and finally renders the pattern into the list.
The internal treatment process of the spacing bar is as follows:
at the beginning, the style name of the current service or the custom attribute is received (or the style name of the current service or the custom attribute is not sent to the spacer object);
judging whether a style name of the current service is received or not through a preset spacing bar in a list page;
and if the style name of the current service is received, continuously judging whether the preset spacing bar needs to be adapted to the current service. When the preset spacing bar needs to be adapted to the current service, continuously judging whether a pattern corresponding to the pattern name of the current service exists in a preset pattern table corresponding to the preset spacing bar; and if the style corresponding to the style name of the current service exists, acquiring a corresponding style from a preset style sheet corresponding to the preset spacing bar. Then, based on the corresponding style, carrying out dynamic layout and drawing to generate an adaptive style; and rendering the adaptation styles into pages of a list page.
And if the style name of the current service is not received, continuously judging whether the customized attribute exists. And if the custom attribute exists, setting a corresponding style based on the custom attribute. Then, based on the corresponding style, carrying out dynamic layout and drawing to generate an adaptive style; and rendering the adaptation styles into pages of a list page.
When the style name of the current service is not received and the attribute is not customized, or the judgment result of judging whether the preset spacing bar needs to be adapted to the current service is as follows: and when the preset spacing bar does not need to be adapted to the current service, acquiring a default pattern as a corresponding pattern in the preset pattern table under any of the two conditions. Then, based on the corresponding style, carrying out dynamic layout and drawing to generate an adaptive style; and rendering the adaptation styles into pages of a list page.
It should be noted that the meaning of the preset style sheet in the embodiment of the present invention is consistent with that of the style sheet and the style sheet in the drawing, and both of them represent preset style sheets.
The method comprises the steps of adapting to a spacing bar, setting a style sheet and adjusting the height of the spacing bar to adapt to the condition that two sections have an inner distance, such as AB two sections, wherein the distance is required to be 20 under an X service, the distance is required to be 30 under a Y service, if two modules do not have the inner distance, directly setting a style sheet c:20d:30 of the spacing bar, wherein c:20 is a spacing bar style under the X service; d, 30 represents the space bar pattern under the Y service, c and X are a key, d and Y are a key and point to the same service; however, if the inner edge distance exists, a style sheet c is set, wherein the inner edge distance is between 20 and A and B, and the inner edge distance is between 30 and A, so that the problem that the interval between data modules is not uniform due to the fact that the data modules have the upper inner edge distance and the lower inner edge distance caused by the non-uniform UI (User Interface) is solved.
The embodiment of the invention discloses a list page display system, which is shown in figure 5 and comprises the following components:
a corresponding style obtaining module 10, configured to set a spacer object in a list page, and obtain a corresponding style of the spacer object in a preset style sheet corresponding to the spacer object based on information of a currently displayed service of the list page; or setting a corresponding style of the spacer object based on a custom attribute;
in the list initialization stage, a plurality of spacing bars are inserted into the list according to the requirements to find objects, different service scenes needing to be adapted to each spacing bar are set, or the attributes of the spacing bars are directly customized;
in the list drawing stage, the list informs the partition bar of the currently displayed service type, and the partition bar obtains the corresponding style from the style sheet according to the current service key.
An adaptation style determining module 20, configured to perform layout and drawing based on the corresponding style, and generate an adaptation style of the spacer object;
and dynamically laying out and drawing based on the corresponding style.
A rendering module 30, configured to render the adaptation style into a page of the list page.
And finally rendering into a list.
The working principle of the list page display system of the embodiment of the invention is as follows:
judging whether a style name of the current service is received or not by using a corresponding style acquisition module 10 through a preset spacing bar in a list page;
and if the style name of the current service is received, continuously judging whether the preset spacing bar needs to be adapted to the current service. When the preset spacing bar needs to be adapted to the current service, continuously judging whether a pattern corresponding to the pattern name of the current service exists in a preset pattern table corresponding to the preset spacing bar; and if the style corresponding to the style name of the current service exists, acquiring a corresponding style from a preset style sheet corresponding to the preset spacing bar. Then, based on the corresponding style, the dynamic layout and drawing are performed through the adaptation style determination module 20 and the rendering module 30, respectively, so as to generate an adaptation style; and rendering the adaptation styles into pages of a list page.
And if the style name of the current service is not received, continuously judging whether the customized attribute exists. And if the custom attribute exists, setting a corresponding style based on the custom attribute. Then, based on the corresponding style, the dynamic layout and drawing are performed through the adaptation style determination module 20 and the rendering module 30, respectively, so as to generate an adaptation style; and rendering the adaptation styles into pages of a list page.
When the style name of the current service is not received and the attribute is not customized, or the judgment result of judging whether the preset spacing bar needs to be adapted to the current service is as follows: and when the preset spacing bar does not need to be adapted to the current service, acquiring a default pattern as a corresponding pattern in the preset pattern table under any of the two conditions. Then, based on the corresponding style, the dynamic layout and drawing are performed through the adaptation style determination module 20 and the rendering module 30, respectively, so as to generate an adaptation style; and rendering the adaptation styles into pages of a list page.
The list page display system according to the embodiment of the present invention further includes:
the device comprises a preset style sheet creating module, a setting module and a setting module, wherein the preset style sheet creating module is used for creating a preset style sheet and creating a basic style in the preset style sheet, and the basic style comprises a general style, a fixed style and an adjustable style;
the method includes the steps that a service scene pattern which needs to be adapted to each spacer is stored in a pattern table of each spacer, the pattern table exists in a map mode, key is a pattern name, value is a corresponding pattern, for example, the pattern name of a certain service is 'yezhuffei', and the pattern of the spacer in the service scene is a value in the value corresponding to the key 'yezhuffei' in the pattern table; a general style 'DEFAULT' with the height of 10dp and gray is preset in the style sheet, the 'DEFAULT' represents a fixed style which is fixed in style and does not adapt to the style of the service, and the 'DEFAULT' represents an adjustable style of which the style can be modified by a constructor; the currstylname parameter is the name of the current pattern, i.e. the service that the compartment bar needs to be adapted currently, and the class responsible for the compartment bar adaptation logic will look up the adaptation pattern in the pattern table according to the currstylname parameter.
And the iteration updating module is used for performing iteration updating on the basic style in the preset style sheet.
The style sheet maintenance is divided into two processes of initialization and iteration. The initialization process is responsible for creating a style sheet and establishing a basic style; and (3) an iteration process, namely expanding the styles in the style sheet according to the root business requirements, then iteratively updating the existing styles and removing the waste styles. Thus, the iterative updating of the style sheet makes it possible to adapt to any required new card insertion.
According to the list page display system of the embodiment of the present invention, the corresponding style obtaining module 10 is specifically configured to:
judging whether a style name of the current service is received or not through a preset spacing bar in a list page;
if the style name of the current service is received, when the preset spacing bar needs to be adapted to the current service, continuously judging whether a style corresponding to the style name of the current service exists in a preset style sheet corresponding to the preset spacing bar;
and if the style corresponding to the style name of the current service exists, acquiring a corresponding style from a preset style sheet corresponding to the preset spacing bar.
According to the list page display system of the embodiment of the present invention, the corresponding style obtaining module 10 is specifically configured to:
when the style name of the current service is not received, judging whether a customized attribute exists;
and if the custom attribute exists, setting a corresponding style based on the custom attribute.
According to the list page display system of the embodiment of the present invention, the corresponding style obtaining module 10 is specifically configured to:
and when the style name of the current service is not received and the attribute is not customized, acquiring a default style from the preset style sheet as a corresponding style.
Fig. 6 illustrates a physical schematic of a computer program product, which may include: a processor (processor)310, a communication Interface (communication Interface)320, a memory (memory)330 and a communication bus 340, wherein the processor 310, the communication Interface 320 and the memory 330 communicate with each other via the communication bus 340. The processor 310 may call logic instructions in the memory 330 to perform a list page presentation method comprising:
s1, setting a spacer object in a list page, and acquiring a corresponding pattern of the spacer object in a preset pattern table corresponding to the spacer object based on the information of the currently displayed service of the list page; or setting a corresponding style of the spacer object based on a custom attribute;
s2, carrying out layout and drawing based on the corresponding style, and generating an adaptive style of the spacer bar object;
s3, rendering the adaptation styles into the pages of the list page.
In addition, the logic instructions in the memory may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, the computer is capable of performing a list page presentation method comprising:
s1, setting a spacer object in a list page, and acquiring a corresponding pattern of the spacer object in a preset pattern table corresponding to the spacer object based on the information of the currently displayed service of the list page; or setting a corresponding style of the spacer object based on a custom attribute;
s2, carrying out layout and drawing based on the corresponding style, and generating an adaptive style of the spacer bar object;
s3, rendering the adaptation styles into the pages of the list page.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program that, when executed by a processor, is implemented to perform a method of list page presentation, the method comprising:
s1, setting a spacer object in a list page, and acquiring a corresponding pattern of the spacer object in a preset pattern table corresponding to the spacer object based on the information of the currently displayed service of the list page; or setting a corresponding style of the spacer object based on a custom attribute;
s2, carrying out layout and drawing based on the corresponding style, and generating an adaptive style of the spacer bar object;
s3, rendering the adaptation styles into the pages of the list page.
The above-described system embodiments are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.