Image display method, device, electronic device and storage medium for Android terminal
By adjusting the list parameters and configuring button functions of the image controller, the unified display and addition of images on Android terminals are achieved, which solves the problem of single function, reduces development costs and expands usage needs.
Patent Information
- Application Number
- CN202211171261.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-23
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-09-23
AI Technical Summary
The image display and filtering controllers of existing Android terminals have a single function and cannot meet the needs of image display and adding functions at the same time, resulting in high development costs and the inability to implement image customization operations.
By obtaining the image style properties, the list parameters of the image controller are adjusted to generate a grid list. Based on the image addition permission and operation button function configuration file, the image addition button is determined and displayed to implement custom operations and function extensions for the image.
It reduces development costs, unifies image display and added functions, expands usage requirements, and supports customized processing and diversified display of images.
Smart Images

Figure CN115495000B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of picture display on an Android terminal, and in particular relates to a picture display method, device, electronic device and storage medium for an Android terminal. Background Art
[0002] At present, the image display and filtering controllers on the market have relatively simple functions and styles. They can only display files or only add files. However, in actual development, it is often encountered that the two functions are shared. At this time, the traditional file display and filtering controller cannot meet the actual development needs and needs to be redeveloped; at the same time, in order to realize the image display and adding functions, the Android terminal needs to develop controls corresponding to the respective functions, and they must be deployed on the terminal at the same time, which further increases the development difficulty and usage cost; in addition, during the image display process, the traditional image display and filtering controller does not provide corresponding interface methods for the image operation buttons. If the user needs to make special processing on the image, the corresponding function cannot be realized. At this time, redevelopment is required, which not only has poor scalability but also increases development costs; therefore, it is urgent to provide a picture display method that can simultaneously realize the display and addition of pictures, and can realize the customization of picture click functions. Summary of the Invention
[0003] The purpose of the present invention is to provide a picture display method, device, electronic device and storage medium for an Android terminal, so as to solve the problem that in the prior art, only the picture display or picture adding function can be realized separately. When satisfying the display and adding functions at the same time, two controls need to be developed and deployed at the same time, which leads to high development costs and the problem that picture customization operations cannot be realized during the display process.
[0004] In order to achieve the above object, the present invention adopts the following technical solutions:
[0005] In a first aspect, a method for displaying images on an Android terminal is provided, comprising:
[0006] Obtaining image style attributes, and adjusting list parameters of a list adapter in an image controller based on the image style attributes to obtain an adjusted image controller, so as to generate an image list based on the adjusted image controller, wherein the image list is a grid list, and the image style attributes include an image operation button function configuration file and image addition permissions;
[0007] In response to a user selecting a picture to be displayed, obtaining parameter information of the displayed pictures in the picture list;
[0008] Based on the picture adding permission and the parameter information, determining whether the list adapter has the picture adding permission;
[0009] If so, determining a button display position in the picture list based on the parameter information, and displaying a picture adding button at the button display position;
[0010] In response to the user clicking the picture adding button, displaying the picture to be displayed at the button display position;
[0011] In response to the user selecting the next picture to be displayed, re-acquiring parameter information of the displayed pictures in the picture list until it is determined that the list adapter does not have the picture adding permission, so as to obtain the picture display list when it is determined that the list adapter does not have the picture adding permission;
[0012] Based on the picture operation button function configuration file, the click event of the function button of each picture in the picture display list is set, so that after the setting is completed, the display of all pictures to be displayed is completed, and the operation button of each picture in the picture display list is obtained, so that after the user operates the operation button of each picture, the corresponding operation function is triggered through the click event configured by each operation button to complete the functional operation of each picture.
[0013] Based on the above disclosed content, the present invention adjusts the list parameters in the existing picture controller by obtaining the picture style attributes, thereby realizing the logical reconstruction of the list and obtaining a grid-form picture list; at the same time, when the user selects the picture to be displayed, the present invention can obtain the parameter information of the displayed picture in the picture list, so as to judge whether the picture controller has the picture adding permission according to the picture adding permission and parameter information in the configured picture style attributes; if it has the picture adding permission, the display position of the button can be determined in the picture list according to the parameter information, and the picture adding button can be displayed at the determined display position, so that the user can click the picture adding button to upload the picture to be displayed; in specific applications, when the user clicks the picture adding button, the present invention will directly display the picture to be displayed on the The button is displayed at the position where the picture to be displayed is displayed. Similarly, when the next picture needs to be displayed, the above process is repeated to re-acquire the parameter information of the displayed pictures in the picture list (compared to the last time, it must have been updated due to the addition of new pictures) so as to re-judge whether the picture controller has the permission to add pictures based on the parameter information, and re-determine the button display position to complete the display of the next picture. This cycle is repeated until it is determined that the picture controller does not have the permission to add pictures. At this time, the picture adding process can be ended, and in this process, all the pictures to be displayed can be displayed in the picture list. Therefore, when it is determined that the picture controller does not have the permission to add pictures, a picture display list containing all the pictures to be displayed can be obtained.
[0014] In addition, the present invention can also configure click events for the function buttons of each picture in the picture display list according to the picture operation button function configuration file in the configured picture style attributes. Thus, the interface method of each button can be customized based on the obtained picture operation button function configuration file, thereby meeting the click requirements of different users for pictures, so as to realize the processing of pictures during the display process.
[0015] Through the above design, the present invention sets different configuration attributes for the picture controller for the two functions of displaying and adding pictures. Therefore, when displaying pictures, it can be judged whether the picture adding permission is possessed according to the set configuration attributes, thereby having both the display of the add button and the picture display function. Moreover, the present invention only requires one set of controls to realize the picture display and adding functions, which reduces the development cost compared with the traditional picture controller. At the same time, by configuring different picture style attributes, customization of different picture lists can be realized, thereby expanding the usage requirements. In addition, for special processing in the picture display process, customization of picture clicks can be realized by setting a picture operation button function configuration file in the picture style attributes, so that users can process each picture individually. Therefore, the present invention not only expands the usage requirements, but also greatly reduces the development cost, and is suitable for wide application and promotion.
[0016] In one possible design, the parameter information includes image subscripts of displayed images, where the image subscripts are sorted sequentially starting from 0 and having a maximum value of n-1, where n represents a maximum number of images to be added to the image list, and each grid in the image list is provided with a grid sequence number;
[0017] Accordingly, the button display position in the image list is determined based on the parameter information, including:
[0018] Obtaining the maximum image subscript according to the image subscripts of the displayed images;
[0019] Calculate the sum of the maximum image index and 1 to get the position number;
[0020] According to the position serial number, a grid serial number corresponding to the position serial number is matched in the picture list, so that the grid corresponding to the matched grid serial number is used as the button display position.
[0021] Based on the above-disclosed content, the present invention discloses a specific method for determining the button display position, that is, determining the button display position by the image subscript of the displayed image. The specific process is: the image subscript of the displayed image starts from 0, that is, the subscript of the first displayed image is 0, then when the second image needs to be displayed, the position serial number is 1. At this time, it is necessary to match the grid corresponding to the position serial number in the image list. At the same time, since it has been explained above that the image list is a grid list, each grid can be used as a picture display position. Therefore, it is only necessary to match the grid serial number corresponding to the position serial number, so that the grid corresponding to the matched grid serial number is used as the button display position, that is, the grid with serial number 1 is the display position of the picture add button when the second picture is added.
[0022] In one possible design, the image style attribute further includes image display permissions and image operation button style, and the image display permissions include a deletion permission field;
[0023] The step of displaying the image to be displayed at the button display position includes:
[0024] Configuring a delete button for the picture to be displayed;
[0025] Determining whether the deletion permission field is a third preset field;
[0026] If so, configure a button style for the delete button based on the image operation button style to obtain a configured delete button;
[0027] The picture to be displayed is displayed at the button display position, and the configured delete button is displayed at any position of the picture to be displayed.
[0028] Based on the above-disclosed content, the present invention discloses a display process of a picture to be displayed. The specific process is: by setting display permissions and picture operation button styles in the picture style attributes, therefore, when displaying, a delete button can be configured for the picture to be displayed first so that the user can operate the picture. At the same time, it is also necessary to determine whether the delete button has display permissions, that is, whether the delete permission field is a third preset field. If so, it means that it has display permissions. At this time, the button style (such as icon and shape) can be configured for the delete button based on the configured picture operation button style. After the configuration is completed, the picture to be displayed can be displayed at the button display position, and the configured delete button can be displayed at any position of the picture to be displayed (such as the upper right corner, upper left corner, etc.), thereby realizing the deletion operation during picture display.
[0029] In one possible design, based on the picture operation button function configuration file, a click event of the function button of each picture in the picture display list is set to obtain the operation button of each picture in the picture display list, including:
[0030] Based on the picture operation button function configuration file, a click event of the configured delete button of each picture in the picture display list is set to obtain a picture delete operation button for each picture, so that after the user operates any picture delete operation button, the picture delete function is triggered through the configured click event to delete the picture corresponding to any picture delete operation button from the picture display list; and
[0031] Based on the picture operation button function configuration file, the click event of the picture viewing button of each picture in the picture display list is set to obtain a picture viewing operation button, so that after the user operates any picture viewing operation button, the picture viewing function is triggered through the configured click event to view the picture corresponding to any picture viewing operation button.
[0032] Based on the above-disclosed content, the present invention discloses a specific process of configuring an interface method for each button in a picture display list, that is, according to a pre-set picture operation button function configuration file, a click event is configured for the delete button and the picture viewing button configured in the picture display list, so that after clicking the aforementioned operation button, according to the configured click event, different paths or interfaces are jumped to to realize different operations of different buttons; thus, the present invention can customize the interface method of each button by configuring different picture operation button function configuration files, thereby meeting the click requirements of different users for pictures.
[0033] In one possible design, the picture style attributes further include a maximum number of pictures to be added and a picture display style, wherein the picture display style includes a picture list style and a picture layout, and the picture list style is used to represent the style of the picture list, and the picture layout is used to determine the number of pictures displayed in each row of the picture list and the spacing between adjacent pictures;
[0034] The step of adjusting the list parameters of the list adapter in the picture controller based on the picture style attributes to obtain the adjusted picture controller includes:
[0035] Based on the picture list style, construct an initial picture list, wherein the initial picture list is a grid list;
[0036] According to the maximum number of pictures to be added, the list parameters of the list adapter are adjusted to obtain a processed list adapter;
[0037] Adjusting layout parameters of the processed list adapter based on the image layout to obtain an adjusted image controller after the adjustment is completed;
[0038] Accordingly, generating an image list based on the adjusted image controller includes:
[0039] The adjusted picture controller is used to adjust the list length of the initial picture list, the number of pictures displayed in each row in the initial picture list, and the spacing between pictures displayed in the initial picture list, so as to obtain the picture list after the adjustment.
[0040] Based on the above-disclosed content, the present invention discloses a specific process of a picture adjuster, namely, first constructing a grid list according to the picture list style in the picture style attribute, thereby serving as the initial picture list, which can be a nine-space style list; then, adjusting the list parameters of the initial list adapter according to the maximum number of pictures added; finally, adjusting the layout parameters of the list adapter based on the picture layout, thereby determining the number of pictures displayed in each row of the list and the spacing between the displayed pictures. After the above parameters are determined, the length of the initial picture list, the number of pictures displayed in each row, and the spacing between pictures can be adjusted according to the adjusted picture controller. After the adjustment is completed, the picture list can be obtained.
[0041] In one possible design, the parameter information includes the image index of the displayed image and the number of displayed images, and the image adding permission includes an image permission field;
[0042] Determining whether the list adapter has permission to add pictures includes:
[0043] Get the maximum number of pictures to be added to the picture list;
[0044] Obtaining the maximum image subscript according to the image subscripts of the displayed images;
[0045] Determine whether the image permission field is a first preset field, whether the number of displayed images is less than the maximum number of images to be added, and whether the displayed image corresponding to the maximum image subscript is a target image, wherein the target image is the last image in the displayed images in the image list;
[0046] If so, it is determined that the list adapter has permission to add pictures;
[0047] If the image permission field is a second preset field, the number of displayed images is equal to the maximum number of added images, and / or the displayed image corresponding to the maximum image index is not the target image, it is determined that the list adapter does not have image adding permission.
[0048] Based on the above-disclosed content, the present invention discloses a specific method for judging whether a list adapter has the permission to add pictures. When used specifically, the following three conditions must be met at the same time to determine whether it has the permission to add pictures, namely, the picture permission field must be the first preset field, the number of displayed pictures is less than the maximum number of pictures to be added, and the displayed picture corresponding to the maximum picture subscript is not the last picture in the picture list; conversely, if any one of the above three conditions is not met, it is determined that it does not have the permission to add pictures.
[0049] In one possible design, the image style attribute further includes: an image operation button style, wherein, after displaying the image add button at the button display position, the method further includes:
[0050] Based on the image operation button style, configure a button style for the add button to obtain an initial image upload button;
[0051] According to the picture operation button function configuration file, the click event of the initial picture upload button is set to obtain a picture upload button, so that after the user operates the picture upload button, the picture upload function is triggered through the configured click event to upload the picture to be displayed to the picture list for visual display.
[0052] In a second aspect, a picture display device for an Android terminal is provided, characterized in that it includes:
[0053] A picture list configuration unit, configured to obtain picture style attributes and, based on the picture style attributes, adjust list parameters of a list adapter in a picture controller to obtain an adjusted picture controller, so as to generate a picture list based on the adjusted picture controller, wherein the picture list is a grid list, and the picture style attributes include a picture operation button function configuration file and picture addition permissions;
[0054] A picture parameter acquisition unit, configured to acquire parameter information of displayed pictures in the picture list in response to a user selecting a picture to be displayed;
[0055] a permission judging unit, configured to judge whether the list adapter has permission to add pictures based on the permission to add pictures and the parameter information;
[0056] A picture display unit, configured to determine a button display position in the picture list based on the parameter information when the authority judgment unit determines that the answer is yes, and to display a picture adding button at the button display position;
[0057] A picture display unit, configured to display the picture to be displayed at the button display position in response to a user clicking the picture adding button;
[0058] A picture display unit, configured to, in response to a user selecting a next picture to be displayed, reacquire parameter information of displayed pictures in the picture list until it is determined that the list adapter does not have picture adding permission, so as to obtain a picture display list when it is determined that the list adapter does not have picture adding permission;
[0059] The button configuration unit is used to set the click event of the function button of each picture in the picture display list based on the picture operation button function configuration file, so that after the setting is completed, the display of all pictures to be displayed is completed, and the operation button of each picture in the picture display list is obtained, so that after the user operates the operation button of each picture, the corresponding operation function is triggered through the click event configured by each operation button to complete the functional operation of each picture.
[0060] On the third aspect, another picture display device for an Android terminal is provided. Taking the device as an electronic device as an example, the device includes a memory, a processor and a transceiver that are communicatively connected in sequence, wherein the memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the picture display method for the Android terminal as described in the first aspect or any possible design of the first aspect.
[0061] In a fourth aspect, a storage medium is provided, on which instructions are stored. When the instructions are run on a computer, the picture display method of the Android terminal as in the first aspect or any possible design of the first aspect is executed.
[0062] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, causes the computer to execute the picture display method of the Android terminal as in the first aspect or any possible design of the first aspect.
[0063] Beneficial effects:
[0064] (1) The present invention sets different configuration attributes for the picture controller for the two functions of displaying and adding pictures. Therefore, when displaying pictures, it can be judged whether the picture adding permission is possessed according to the set configuration attributes, thereby combining the display of the add button and the picture display function. Moreover, the present invention only requires one set of controls to realize the picture display and adding functions, which reduces the development cost compared with the traditional picture controller. At the same time, by configuring different picture style attributes, different picture lists can be customized, thereby expanding the use requirements. In addition, for special processing in the picture display process, by setting the picture operation button function configuration file in the picture style attribute, the picture click can be customized, so that the user can process each picture separately. Therefore, the present invention not only expands the use requirements, but also greatly reduces the development cost, and is suitable for wide application and promotion.
[0065] (2) The present invention can configure different styles of picture operation buttons, and can separately configure the styles of operation buttons such as add button and delete button in the picture display list. Thus, different styles of display styles can be customized, thereby improving the diversity of use. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 A schematic diagram of the steps of the picture display method of the Android terminal provided by the present invention;
[0067] Figure 2 A schematic diagram of the display effect after adding the image to be displayed to the file list provided by the present invention;
[0068] Figure 3 This is a structural diagram of the picture display device of the Android terminal provided by the present invention;
[0069] Figure 4 This is a schematic structural diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0070] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be briefly introduced below in conjunction with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0071] It should be understood that although the terms "first," "second," etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element can be referred to as a second element, and similarly, a second element can be referred to as a first element without departing from the scope of the exemplary embodiments of the present invention.
[0072] It should be understood that the term "and / or" that may appear in this document is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B may indicate three situations: A exists alone, B exists alone, and A and B exist at the same time. The term " / and" that may appear in this document describes another type of association object relationship, indicating that two relationships may exist. For example, A / and B may indicate two situations: A exists alone, and A and B exist alone. In addition, the character " / " that may appear in this document generally indicates that the previous and subsequent associated objects are in an "or" relationship.
[0073] Example:
[0074] See also Figure 1 As shown, the picture display method of the Android terminal provided in the first aspect of this embodiment adds corresponding configuration attributes to the picture controller for picture display and picture adding functions, so that when displaying pictures, one control can be used to display the add button and display the picture. At the same time, for special processing in the picture display process, the picture operation button function configuration file is set in the picture style attribute, so that the picture click can be customized, so that the user can process each picture separately, thereby meeting the usage needs of different users and greatly reducing the development cost; optionally, the method provided in this embodiment can be but not limited to running on the Android terminal side, wherein the Android terminal can be but not limited to a smart phone and / or a personal digital assistant (PDA), etc. It can be understood that the aforementioned execution subject does not constitute a limitation on the embodiment of the present application. Accordingly, the operation steps of this method can be but not limited to the following steps S1 to S7.
[0075] S1. Obtain image style attributes, and based on the image style attributes, adjust the list parameters of the list adapter in the image controller to obtain the adjusted image controller, so as to generate an image list based on the adjusted image controller, wherein the image list is a grid list, and the image style attributes include an image operation button function configuration file and image adding permissions; in specific applications, the image style attributes can be customized by the user according to usage requirements, or the default configuration of the image controller can be used. Optionally, before obtaining the image style attributes, the image controller determines whether there is a user-specified style attribute in its corresponding database. If so, the user-specified style attribute is used as the image style attribute. Otherwise, the default configuration of the image controller is used as the image style attribute; in this embodiment, the user-specified style attribute and the default configuration of the image controller contain the same configuration type, but the content of each configuration is different, such as the content of the image operation button function configuration file and the image adding permissions.
[0076] In a specific implementation, the example picture style attributes also include the maximum number of pictures to be added and the picture display style, wherein the picture display style includes the picture list style and the file layout, and the picture list style is used to characterize the style of the picture list, such as whether the picture list is a grid list or a list in other forms; in this embodiment, a grid list is preferred; the picture layout is used to determine the number of pictures displayed in each row in the picture list and the spacing between adjacent pictures, such as whether 2 pictures, 3 pictures or 5 pictures are displayed in each row, and the spacing between adjacent pictures is the spacing between two adjacent pictures on the left and right, and the spacing between two adjacent pictures on the top and bottom, etc.; of course, the above configuration can be specifically set according to actual use.
[0077] After configuring the aforementioned image display style and the maximum number of added images in the image style properties, this embodiment can adjust the image controller based on the aforementioned image style properties, which is equivalent to rebuilding the list adapter to obtain an image list. Among them, the image controller inherits from the Android native RecyclerView control (which can implement list and grid style view controls). Therefore, direct calling of various tools in the aforementioned view control can be implemented. Optionally, the adjustment process can be but is not limited to the following steps S11 to S14.
[0078] S11. Based on the picture list style, construct an initial picture list, wherein the initial picture list is a grid list. Optionally, the Android native GridLayoutManager (grid layout manager) can be used to construct the initial picture list, which is equivalent to constructing a grid list. Of course, the length of the grid list (that is, the maximum number of added pictures), the number of pictures displayed in each row, and the spacing between adjacent pictures are initial values, and subsequent adjustment of the picture controller is equivalent to adjusting the various initial values of the aforementioned grid list; wherein, the adjustment process is shown in the following steps S12 and S13.
[0079] S12. Based on the maximum number of images to be added, adjust the list parameters of the list adapter to obtain a processed list adapter. In specific applications, this step is to set the maximum number of images to be added to the grid list. Of course, the maximum number of images to be added can be set according to actual use and is not specifically limited here.
[0080] S13. Based on the image layout, the layout parameters of the processed list adapter are adjusted to obtain an adjusted image controller. In this embodiment, adjusting the layout parameters is to determine the parameters of the grid list corresponding to the list adapter, such as the number of images displayed per row and the spacing between images. After the aforementioned parameters are determined, the adjusted image controller can be used to adjust the initial image list to obtain an image list, as shown in the following step S14.
[0081] S14. Utilize the adjusted picture controller to adjust the list length of the initial picture list, the number of pictures displayed in each row of the initial picture list, and the spacing between the pictures displayed in the initial picture list, so as to obtain the picture list after the adjustment; in specific applications, it is equivalent to adjusting the length of the initial picture list to the maximum number of pictures added, such as the maximum number of pictures added is 9, then the initial picture list can display up to 9 pictures; similarly, the number of pictures displayed in each row of the list and the spacing between pictures can also be adjusted, such as each row can only display 3 pictures, the spacing between adjacent pictures on the left and right is 2cm, the spacing between adjacent pictures on the top and bottom is 2cm, etc., thus, it is equivalent to a nine-square grid style list; of course, the aforementioned parameters can be set according to the specific settings for actual use, and are not limited to the aforementioned examples.
[0082] After completing the adjustment of the corresponding configuration of the image controller, the adjusted image controller and the generated image list can be used to display images, wherein the image display process is shown in the following steps S2 to S7.
[0083] S2. In response to the user selecting a picture to be displayed, parameter information of the displayed pictures in the picture list is obtained; in specific applications, the parameter information may include, but is not limited to, the picture subscripts of the displayed pictures and the number of displayed pictures, wherein the picture subscripts are sorted sequentially starting from 0, with a maximum value of n-1, and n represents the maximum number of pictures to be added to the picture list. In this embodiment, the picture subscript of a picture is used to determine the data position of the picture in the picture list, that is, the number of pictures in the picture list; and the parameter information is used to subsequently determine whether the list adapter has the permission to add pictures, as shown in the following step S3.
[0084] S3. Based on the picture adding permission and the parameter information, determine whether the list adapter has the picture adding permission; in specific application, for example, the picture adding permission may include but is not limited to a picture permission field, such as mIsPlusSwitchOpened = true or mIsPlusSwitchOpened = false; therefore, based on the aforementioned picture permission field and parameter information, the picture adding permission can be determined, as shown in the following steps S31 to S34.
[0085] S31. Obtain the maximum number of pictures to be added to the picture list.
[0086] S32. Obtain the maximum image index according to the image indexes of the displayed images.
[0087] S33. Determine whether the image permission field is the first preset field, whether the number of displayed images is less than the maximum number of images to be added, and whether the displayed image corresponding to the maximum image subscript is the target image, wherein the target image is the last image among the displayed images in the image list; in specific applications, the first preset field is taken as true.
[0088] S34. If so, it is determined that the list adapter has the permission to add pictures; if the picture permission field is the second preset field, the number of displayed pictures is equal to the maximum number of pictures to be added and / or the displayed picture corresponding to the maximum picture index is not the target picture, it is determined that the list adapter does not have the permission to add pictures.
[0089] In specific applications, a list adapter can be determined to have the permission to add images only when the above three conditions are met, that is, the image permission field is true, the number of displayed images in the image list is less than the maximum number of images to be added, and the displayed image corresponding to the maximum image index is the last image in the image list.
[0090] Optionally, the method for determining whether the displayed image corresponding to the maximum image subscript is the target image may be, but is not limited to: using the maximum image subscript + 1 to obtain the position number; determining whether the position number is equal to the number of displayed images in the image list, if so, it means that the displayed image corresponding to the maximum image subscript is the target image, otherwise, it is not; since it has been stated above that the image subscript starts from 0 and the upper limit is n-1 (n is the maximum number of added images), the subscript of the displayed image in the image list must be 1 less than the maximum number of added images, and when the sum of the maximum image subscript and 1 is equal to the number of displayed images in the image list, it means that there is still a grid in the image list, and therefore, the grid can be used to display the add button.
[0091] Only after determining that the list adapter has the permission to add pictures can pictures be added, that is, an add button is displayed in the picture list, so that users can upload pictures to be displayed based on the add button. In this embodiment, the following position of the add button changes with the number of displayed pictures in the picture list. Therefore, it is necessary to first determine the display position of the add button, wherein the determination process is shown in the following step S4.
[0092] S4. If so, the button display position in the picture list is determined based on the parameter information, and the picture adding button is displayed at the button display position; in specific applications, a grid serial number is set for each grid in the picture list, so the display position of the adding button can be determined according to the picture subscripts of each displayed picture in the picture list, as shown in the following steps S41 to S43.
[0093] S41. Obtain the maximum image index according to the image indexes of the displayed images.
[0094] S42. Calculate the sum of the maximum image index and 1 to obtain the position number.
[0095] S43. According to the position number, a grid number corresponding to the position number is matched in the picture list, and the grid corresponding to the matched grid number is used as the button display position.
[0096] The following example illustrates the process of determining the button display position:
[0097] Assume that the grid numbers are sorted starting from 0 according to the grid position, and there are 2 displayed images in the grid list, and the image subscripts of the 2 displayed images are 0 and 1 respectively, then the maximum image subscript is 1, and the calculated position number is 1+1=2. That is to say, when adding the third image, the add button should be displayed in the grid with grid number 2. If the image list is a nine-space list, then the add button will be displayed on the third grid. See Figure 2 As shown, from Figure 2 It can be seen that when the third image is added, the add button is displayed on the third grid; of course, when the number of displayed images in the image list is different, the principle of determining the display position of the add button is the same as the above example principle, which will not be repeated here.
[0098] Accordingly, after the Add button is displayed, the user can click the Add button to upload the image to be displayed; further, in this embodiment, the example image style attribute also includes an image operation button style, so after the Add button is displayed in the image list, the following operations can also be performed:
[0099] S44. Based on the image operation button style, configure a button style for the add button to obtain an initial image upload button; in specific applications, the image operation button style may include but is not limited to button icons and shapes, such as a rectangular shape and a camera image. Of course, it can also be customized by the user and is not specifically limited here.
[0100] S45. According to the picture operation button function configuration file, the click event of the initial picture upload button is set to obtain a picture upload button, so that after the user operates the picture upload button, the picture upload function is triggered through the configured click event to upload the picture to be displayed to the picture list for visual display; in specific application, the picture operation button function configuration file includes the interface method of each operation button, that is, different click logic is customized for each operation button, so that after the click event is configured for the operation button based on the picture operation button function configuration file, each operation button jumps to a different path or interface after being clicked, thereby realizing different operations of different buttons; in this embodiment, the picture operation button function configuration file can also be customized by the user according to usage requirements. When the user does not set it, the default click event of the picture controller is used. In this embodiment, the default click event of the add button is: when the add button is clicked, the Android file manager is opened by default.
[0101] After determining the button display position in the picture list and displaying the add button, the user can upload the picture to be displayed based on the add button so that the picture to be displayed can be displayed later. The display process is shown in the following steps S5 to S7.
[0102] S5. In response to the user clicking the picture add button, the picture to be displayed is displayed at the button display position; in specific applications, for example, the picture style attribute also includes picture display permissions, and the picture display permissions include a deletion permission field. Therefore, before displaying the picture to be displayed, this embodiment also needs to determine the display style of the picture based on the picture display permissions, wherein the display process is shown in the following steps S51 to S54.
[0103] S51. Configure a delete button for the picture to be displayed.
[0104] S52. Determine whether the deletion permission field is the third preset field; in specific applications, the deletion permission field can be, but is not limited to, mIsShowDelete=1 or mIsShowDelete=0, where the third preset field is 1. Therefore, when mIsShowDelete=1, it means that the delete button can be displayed; otherwise, it will not be displayed.
[0105] S53. If so, based on the image operation button style, configure the button style for the delete button to obtain the configured delete button; in specific applications, the style configuration of the delete button is consistent with the style configuration principle of the aforementioned add button, and will not be repeated here.
[0106] S54. The image to be displayed is displayed on the button display position, and the configured delete button is displayed at any position of the image to be displayed; in specific applications, the image to be displayed is displayed on the button display position, thereby replacing the add button display; at the same time, the delete button can also be configured to be displayed at any position of the image to be displayed, such as the upper right corner, see Figure 2 As shown, Figure 2 The configured delete button is displayed in the upper right corner of the first two pictures. The button is round and the icon is "×"; of course, the display position of the configured delete button can be specifically set according to actual use, and is not limited to the above example; in addition, in this embodiment, when displaying the pictures to be displayed, the size of the pictures will be adjusted, that is, the width and height of the pictures to be displayed will be adjusted to be consistent. The height and width values can be set according to actual use and are not limited here.
[0107] In this embodiment, if the deletion permission field is the fourth preset field, the method also includes: directly displaying the picture to be displayed on the button display position without configuring the style of the delete button, and not displaying the delete button; in this embodiment, for example, the fourth preset field can be but is not limited to 0, that is, when mIsShowDelete=0, only the picture is displayed.
[0108] S6. In response to the user selecting the next picture to be displayed, the parameter information of the displayed pictures in the picture list is re-acquired until it is determined that the list adapter does not have the permission to add pictures, so as to obtain the picture display list when it is determined that the list adapter does not have the permission to add pictures; similarly, for the next picture to be displayed, the aforementioned steps S2 to S6 are repeated, that is, each time a picture to be displayed is selected, it is necessary to determine whether the permission to add pictures is possessed, and when the permission to add pictures is possessed, the display position of the add button is determined each time a picture is added, such as when adding the third picture, the add button is displayed in the third grid, and when adding the fourth picture, the add button is displayed in the fourth grid, and this cycle is repeated until it is determined that the list adapter does not have the permission to add pictures. At this time, it can be said that the pictures have reached the upper limit of the list and no more pictures can be added. What is finally obtained is a picture display list containing all the pictures to be displayed added above.
[0109] After completing the addition and display of all the pictures to be displayed, the corresponding click events can be configured for the function buttons corresponding to each picture in the picture display list to realize the customization of the function button interface method, as shown in the following step S8.
[0110] S7. Based on the picture operation button function configuration file, set the click event of the function button of each picture in the picture display list, so that after the setting is completed, the display of all pictures to be displayed is completed, and the operation button of each picture in the picture display list is obtained, so that after the user operates the operation button of each picture, the corresponding operation function is triggered through the click event configured by each operation button to complete the functional operation of each picture; in specific application, in addition to the aforementioned add button, the function button of each picture also includes a configured delete button and a picture viewing button, wherein the configuration process of the click events corresponding to the aforementioned two buttons is shown in the following steps S71 and S72.
[0111] S71. Based on the picture operation button function configuration file, set the click event of the configured delete button of each picture in the picture display list, and obtain the picture deletion operation button of each picture, so that after the user operates any picture deletion operation button, the picture deletion function is triggered through the configured click event to delete the picture corresponding to any picture deletion operation button from the picture display list.
[0112] S72. Based on the picture operation button function configuration file, set the click event of the picture viewing button of each picture in the picture display list to obtain the picture viewing operation button, so that after the user operates any picture viewing operation button, the picture viewing function is triggered through the configured click event to view the picture corresponding to any picture viewing operation button.
[0113] In specific applications, the click event of the delete button and the click event of the picture viewing button after each picture is configured can also be customized by the user; optionally, if the user has not preset the click events of the above two buttons, the default click event of the picture controller is also used to configure the above two buttons. After the above two buttons are configured using the default click event, when the delete operation button is clicked, the Android list adapter method is used to remove the picture, and when the picture viewing operation button is clicked, the Android external browser is opened by default to view the picture.
[0114] Therefore, according to the picture display method of the Android terminal described in detail in the aforementioned steps S1 to S8, the present invention sets different configuration attributes for the picture controller for the two functions of displaying and adding pictures, so that when displaying pictures, it can be judged whether the picture adding permission is possessed according to the set configuration attributes, thereby having both the display of the add button and the picture display function. Moreover, the present invention only requires one set of controls to realize the picture display and adding functions, which reduces the development cost compared with the traditional picture controller. At the same time, by configuring different picture style attributes, customization of different picture lists can be realized, thereby expanding the use requirements. In addition, for special processing in the picture display process, customization of picture clicks can be realized by setting a picture operation button function configuration file in the picture style attributes, so that users can process each picture separately. Therefore, the present invention not only expands the use requirements, but also greatly reduces the development cost, and is suitable for wide application and promotion.
[0115] like Figure 3 As shown, the second aspect of this embodiment provides a hardware device for implementing the picture display method of the Android terminal described in the first aspect of the embodiment, including:
[0116] The picture list configuration unit is used to obtain picture style attributes and adjust the list parameters of the list adapter in the picture controller based on the picture style attributes to obtain an adjusted picture controller so as to generate a picture list based on the adjusted picture controller, wherein the picture list is a grid list, and the picture style attributes include a picture operation button function configuration file and picture addition permissions.
[0117] The picture parameter obtaining unit is configured to obtain parameter information of displayed pictures in the picture list in response to a user selecting a picture to be displayed.
[0118] The permission judgment unit is used to judge whether the list adapter has the permission to add pictures based on the permission to add pictures and the parameter information.
[0119] The picture display unit is used to determine the button display position in the picture list based on the parameter information when the authority judgment unit judges that the answer is yes, and to display the picture adding button at the button display position.
[0120] The picture display unit is used to display the picture to be displayed at the button display position in response to the user clicking the picture adding button.
[0121] The picture display unit is used to re-acquire parameter information of the displayed pictures in the picture list in response to the user selecting the next picture to be displayed, until it is determined that the list adapter does not have the permission to add pictures, so as to obtain the picture display list when it is determined that the list adapter does not have the permission to add pictures.
[0122] The button configuration unit is used to set the click event of the function button of each picture in the picture display list based on the picture operation button function configuration file, so that after the setting is completed, the display of all pictures to be displayed is completed, and the operation button of each picture in the picture display list is obtained, so that after the user operates the operation button of each picture, the corresponding operation function is triggered through the click event configured by each operation button to complete the functional operation of each picture.
[0123] The working process, working details and technical effects of the device provided in this embodiment can be found in the first aspect of the embodiment and will not be described in detail here.
[0124] like Figure 4 As shown, the third aspect of this embodiment provides another picture display device for an Android terminal. Taking the device as an electronic device as an example, it includes: a memory, a processor and a transceiver that are communicatively connected in sequence, wherein the memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the picture display method for the Android terminal as described in the first aspect of the embodiment.
[0125] For example, the memory may include, but is not limited to, random access memory (RAM), read-only memory (ROM), flash memory, first-in first-out memory (FIFO), and / or first-in last-out memory (FILO); specifically, the processor may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor may be implemented in at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Furthermore, the processor may include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); and the coprocessor is a low-power processor for processing data in a standby state.
[0126] In some embodiments, the processor may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. For example, the processor may be, but is not limited to, a microprocessor of the STM32F105 series, a reduced instruction set computer (RISC) microprocessor, an X86 architecture processor, or a processor with an integrated embedded neural network processing unit (NPU); the transceiver may be, but is not limited to, a wireless fidelity (WIFI) wireless transceiver, a Bluetooth wireless transceiver, a general packet radio service technology (GPRS) wireless transceiver, a ZigBee protocol (a low-power local area network protocol based on the IEEE802.15.4 standard, ZigBee) wireless transceiver, a 3G transceiver, a 4G transceiver, and / or a 5G transceiver. In addition, the device may also include, but is not limited to, a power module, a display screen, and other necessary components.
[0127] The working process, working details and technical effects of the electronic device provided in this embodiment can be found in the first aspect of the embodiment and will not be described in detail here.
[0128] The fourth aspect of this embodiment provides a storage medium that stores instructions for the picture display method of the Android terminal described in the first aspect of the embodiment, that is, the storage medium stores instructions, and when the instructions are run on a computer, the picture display method of the Android terminal described in the first aspect is executed.
[0129] The storage medium refers to a carrier for storing data, which may include but is not limited to a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive and / or a memory stick, and the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0130] The working process, working details and technical effects of the storage medium provided in this embodiment can be found in the first aspect of the embodiment and will not be described in detail here.
[0131] The fifth aspect of this embodiment provides a computer program product containing instructions, which, when executed on a computer, enables the computer to execute the picture display method for an Android terminal as described in the first aspect of the embodiment, wherein the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0132] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A method for displaying pictures on an Android terminal, characterized in that: include: Obtaining image style attributes, and adjusting list parameters of a list adapter in an image controller based on the image style attributes to obtain an adjusted image controller, so as to generate an image list based on the adjusted image controller, wherein the image list is a grid list, and the image style attributes include an image operation button function configuration file and image addition permissions; In response to a user selecting a picture to be displayed, obtaining parameter information of the displayed pictures in the picture list; Based on the picture adding permission and the parameter information, determining whether the list adapter has the picture adding permission; If so, determining a button display position in the picture list based on the parameter information, and displaying a picture adding button at the button display position; In response to the user clicking the picture adding button, displaying the picture to be displayed at the button display position; In response to the user selecting the next picture to be displayed, re-acquiring parameter information of the displayed pictures in the picture list until it is determined that the list adapter does not have the picture adding permission, so as to obtain the picture display list when it is determined that the list adapter does not have the picture adding permission; Based on the picture operation button function configuration file, the click event of the function button of each picture in the picture display list is set, so that after the setting is completed, the display of all pictures to be displayed is completed, and the operation button of each picture in the picture display list is obtained, so that after the user operates the operation button of each picture, the corresponding operation function is triggered through the click event configured by each operation button to complete the functional operation of each picture.
2. The method according to claim 1, characterized in that The parameter information includes the image subscripts of the displayed images, wherein the image subscripts are sorted sequentially starting from 0 and the maximum value is n-1, where n represents the maximum number of images to be added to the image list, and each grid in the image list is set with a grid sequence number; Accordingly, the button display position in the image list is determined based on the parameter information, including: Obtaining the maximum image subscript according to the image subscripts of the displayed images; Calculate the sum of the maximum image index and 1 to get the position number; According to the position serial number, a grid serial number corresponding to the position serial number is matched in the picture list, so that the grid corresponding to the matched grid serial number is used as the button display position.
3. The method according to claim 1, characterized in that The image style attributes also include image display permissions and image operation button styles, and the image display permissions include a deletion permission field; The step of displaying the image to be displayed at the button display position includes: Configuring a delete button for the picture to be displayed; Determining whether the deletion permission field is a third preset field; If so, configure a button style for the delete button based on the image operation button style to obtain a configured delete button; The picture to be displayed is displayed at the button display position, and the configured delete button is displayed at any position of the picture to be displayed.
4. The method according to claim 3, characterized in that Based on the picture operation button function configuration file, setting a click event of the function button of each picture in the picture display list to obtain the operation button of each picture in the picture display list includes: Based on the picture operation button function configuration file, a click event of the configured delete button of each picture in the picture display list is set to obtain a picture delete operation button for each picture, so that after the user operates any picture delete operation button, the picture delete function is triggered through the configured click event to delete the picture corresponding to any picture delete operation button from the picture display list; and Based on the picture operation button function configuration file, the click event of the picture viewing button of each picture in the picture display list is set to obtain a picture viewing operation button, so that after the user operates any picture viewing operation button, the picture viewing function is triggered through the configured click event to view the picture corresponding to any picture viewing operation button.
5. The method according to claim 1, wherein The picture style attributes also include a maximum number of pictures to be added and a picture display style, wherein the picture display style includes a picture list style and a picture layout, and the picture list style is used to represent the style of the picture list, and the picture layout is used to determine the number of pictures displayed in each row of the picture list and the spacing between adjacent pictures; The step of adjusting the list parameters of the list adapter in the picture controller based on the picture style attributes to obtain the adjusted picture controller includes: Based on the picture list style, construct an initial picture list, wherein the initial picture list is a grid list; According to the maximum number of pictures to be added, the list parameters of the list adapter are adjusted to obtain a processed list adapter; Adjusting layout parameters of the processed list adapter based on the image layout to obtain an adjusted image controller after the adjustment is completed; Accordingly, generating an image list based on the adjusted image controller includes: The adjusted picture controller is used to adjust the list length of the initial picture list, the number of pictures displayed in each row in the initial picture list, and the spacing between pictures displayed in the initial picture list, so as to obtain the picture list after the adjustment.
6. The method according to claim 1, characterized in that The parameter information includes the image subscript of the displayed image and the number of displayed images, and the image adding permission includes an image permission field; Determining whether the list adapter has permission to add pictures includes: Get the maximum number of pictures to be added to the picture list; Obtaining the maximum image subscript according to the image subscripts of the displayed images; Determine whether the image permission field is a first preset field, whether the number of displayed images is less than the maximum number of images to be added, and whether the displayed image corresponding to the maximum image subscript is a target image, wherein the target image is the last image in the displayed images in the image list; If so, it is determined that the list adapter has permission to add pictures; If the image permission field is a second preset field, the number of displayed images is equal to the maximum number of added images, and / or the displayed image corresponding to the maximum image index is not the target image, it is determined that the list adapter does not have image adding permission.
7. The method according to claim 1, characterized in that The image style attribute further includes: an image operation button style, wherein after displaying the image add button at the button display position, the method further includes: Based on the image operation button style, configure a button style for the add button to obtain an initial image upload button; According to the picture operation button function configuration file, the click event of the initial picture upload button is set to obtain a picture upload button, so that after the user operates the picture upload button, the picture upload function is triggered through the configured click event to upload the picture to be displayed to the picture list for visual display.
8. A picture display device for an Android terminal, characterized in that: include: A picture list configuration unit, configured to obtain picture style attributes and, based on the picture style attributes, adjust list parameters of a list adapter in a picture controller to obtain an adjusted picture controller, so as to generate a picture list based on the adjusted picture controller, wherein the picture list is a grid list, and the picture style attributes include a picture operation button function configuration file and picture addition permissions; A picture parameter acquisition unit, configured to acquire parameter information of displayed pictures in the picture list in response to a user selecting a picture to be displayed; a permission judging unit, configured to judge whether the list adapter has permission to add pictures based on the permission to add pictures and the parameter information; A picture display unit, configured to determine a button display position in the picture list based on the parameter information when the authority judgment unit determines that the answer is yes, and to display a picture adding button at the button display position; A picture display unit, configured to display the picture to be displayed at the button display position in response to a user clicking the picture adding button; A picture display unit, configured to, in response to a user selecting a next picture to be displayed, reacquire parameter information of displayed pictures in the picture list until it is determined that the list adapter does not have picture adding permission, so as to obtain a picture display list when it is determined that the list adapter does not have picture adding permission; The button configuration unit is used to set the click event of the function button of each picture in the picture display list based on the picture operation button function configuration file, so that after the setting is completed, the display of all pictures to be displayed is completed, and the operation button of each picture in the picture display list is obtained, so that after the user operates the operation button of each picture, the corresponding operation function is triggered through the click event configured by each operation button to complete the functional operation of each picture.
9. An electronic device, characterized in that: include: A memory, a processor and a transceiver that are sequentially communicatively connected, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the picture display method of an Android terminal as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores instructions, and when the instructions are executed on a computer, the picture display method for an Android terminal according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Enhanced text display method based on Android system
CN114115777A
Mobile terminal and controlling method thereof
EP2835964A2