Method and system for mixed uploading or displaying pictures and documents based on mobile devices
By creating a UI component on the mobile device, the mixed display and upload of pictures and documents is realized, which solves the problem of screen resources occupied by picture and document upload in the existing technology, improves the user experience and simplifies the interface, and is suitable for limited screen devices. .
Patent Information
- Application Number
- CN202110959753.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-20
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-08-20
AI Technical Summary
Existing mobile device applications occupy screen resources respectively when uploading images and documents, resulting in poor user experience and unsuccinct interfaces, especially on mobile devices with limited screen sizes.
By creating a UI component, you can achieve mixed uploading or display of pictures and documents, use multiple cells to display files, and automatically adjust the interface layout according to the file type. It supports non-editable and editable states, and supports file upload and download operations. The interface The initial state can be hidden or minimized and adaptively adjusted according to the number of files.
It implements simple operations on pictures and documents on one component, reduces interface occupation, is suitable for mobile devices with limited screen size, improves user experience, and supports interactive operations such as zooming in, dragging, rotating, and downloading previews.
Smart Images

Figure 00000000_0000
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of mobile device application, and more specifically, to a method and system for mixed uploading or displaying pictures and documents based on mobile devices. Background Art
[0002] The Internet has provided great convenience to people in today's society, and more and more companies have launched their own applications. Applications often involve uploading pictures or documents. Traditionally, uploading pictures and files on mobile devices occupies two areas to select pictures and files for upload, and pictures and files also occupy two areas when displayed, which occupies too much of the limited screen size of mobile devices, resulting in poor user experience and not being concise and clear enough. Summary of the invention
[0003] In response to at least one defect or improvement need of the prior art, the present invention provides a method and system for mixed uploading or displaying of picture documents based on mobile devices, which can realize mixed uploading or display of picture documents on one component, is simple to operate, occupies little interface, and is particularly suitable for mobile devices with limited screen size.
[0004] To achieve the above object, according to a first aspect of the present invention, a method for mixed uploading or displaying picture documents based on a mobile device is provided, comprising the steps of:
[0005] Create a UI component, the interface of which can accommodate multiple cells, and set the state of the UI component to be either a non-editable state or an editable state;
[0006] If the UI component is in a non-editable state, the UI component is used to receive a file to be displayed, determine the category of each file in the sequence of files to be displayed, and display each file in the sequence of files to be displayed in the form of a cell in the interface of the UI component according to the category;
[0007] If the UI component is in an editable state, the UI component is used to display a default file upload entrance, and in response to operations on the file upload entrance, read the file sequence to be uploaded, determine the category of each file in the file sequence to be uploaded, display each file in the file sequence to be uploaded in the form of a cell in the interface of the UI component according to the category, and complete the uploading of the file sequence to be uploaded.
[0008] Preferably, the step of displaying each file in the to-be-displayed file sequence in the form of a cell in the interface of the UI component according to the category comprises the following steps:
[0009] For each file, if it is determined that the file is a picture, the picture address is loaded into a cell of the interface of the UI component, and the picture name is displayed at a preset position of the cell;
[0010] If the file is determined to be a document, a default background image is loaded in a cell of the interface of the UI component, and the document name is displayed at a preset position in the cell. In response to an operation on the cell, the file is downloaded and opened.
[0011] Preferably, the step of displaying each file in the sequence of files to be uploaded in the form of a cell in the interface of the UI component according to the category comprises the steps of:
[0012] For each file, if it is determined that the file is a picture, the picture is displayed in a cell of the interface of the UI component, and the picture name is displayed at a preset position of the cell;
[0013] If the file is determined to be a document, a default background image is loaded in a cell of the interface of the UI component, and the document name is displayed at a preset position in the cell. In response to an operation on the cell, the file is obtained and opened.
[0014] Preferably, the number of cells in the interface of the UI component is determined according to the total number of files in the sequence of files to be displayed or the total number of files in the sequence of files to be uploaded.
[0015] Preferably, if the UI component is in a non-editable state, the height of its interface in an initial state is zero, and in response to receiving the files to be displayed, the size of its interface is automatically adjusted according to the number of files to be displayed.
[0016] Preferably, if the UI component is in an editable state, the height of the initial state of its interface is the height of the file upload entrance, and in response to reading the files to be uploaded, the size of its interface is automatically adjusted according to the number of files to be uploaded.
[0017] Preferably, the total number of cells in each row in the interface of the UI component is predefined, and if the number of cells in the current row does not meet the needs of the files to be displayed or the files to be uploaded, cells are automatically generated in the next row.
[0018] Preferably, the cells in the interface of the component are also used to receive the user's picture interaction actions, and perform corresponding image processing on the pictures according to the picture interaction actions and then output them to the interface for display.
[0019] Preferably, the step of creating a UI component comprises the following steps:
[0020] Create a UIView class ImageScrollView using the system library control;
[0021] In the ImageScrollView class, define the collectionView instance of UICollectionView, define the arrUrl instance that carries the array of download links of image documents in a non-editable state, define the arrFiles array for adding image documents in an editable state, and define the arrDescribes array that carries the names of image files;
[0022] Set the data source of the UICollectionView.
[0023] According to a second aspect of the present invention, there is provided a system for mixed uploading or displaying pictures and documents based on a mobile device, comprising: a UI component, the interface of the UI component can accommodate a plurality of cells, and the state of the UI component is set to one of a non-editable state and an editable state;
[0024] If the UI component is in a non-editable state, the UI component is used to receive a file to be displayed, determine the category of each file in the sequence of files to be displayed, and display each file in the sequence of files to be displayed in the form of a cell in the interface of the UI component according to the category;
[0025] If the UI component is in an editable state, the UI component is used to display a default file upload entrance, and in response to operations on the file upload entrance, read the file sequence to be uploaded, determine the category of each file in the file sequence to be uploaded, display each file in the file sequence to be uploaded in the form of a cell in the interface of the UI component according to the category, and complete the uploading of the file sequence to be uploaded.
[0026] In general, compared with the prior art, the present invention is simple to operate, occupies less interface, and is particularly suitable for mobile devices with limited screen size. It has the following advantages:
[0027] (1) Images and documents can be displayed or uploaded on a UI component interface. The operation is simple, the interface is concise, and it does not take up too much interface space.
[0028] (2) The initial state of the UI component interface can be hidden or minimized according to its status, and the interface can be adaptively adjusted according to the number of files displayed or uploaded during display or upload.
[0029] (3) The UI component also supports interactive operations within the cells of the interface, such as zooming in, dragging, rotating, and long pressing to save. Documents can be downloaded and previewed with a single click, further improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1is a schematic diagram of a method for mixed uploading or displaying pictures and documents according to an embodiment of the present invention;
[0031] Figure 2 is a schematic diagram of an interface when a UI component of an embodiment of the present invention is in a non-editable state;
[0032] Figure 3 is a schematic diagram of the initial state of the interface when the UI component of the embodiment of the present invention is in an editable state;
[0033] Figure 4 It is a schematic diagram of uploading files on the interface when the UI component of the embodiment of the present invention is in an editable state. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0035] like Figure 1 As shown, a method for mixed uploading or displaying pictures and documents based on a mobile device according to an embodiment of the present invention comprises the following steps:
[0036] (1) Create a UI component, the interface of which can accommodate multiple cells, and set the state of the UI component to be either a non-editable state or an editable state.
[0037] Mobile devices include, but are not limited to, mobile phones.
[0038] Preferably, the step of creating a UI component comprises the following steps:
[0039] (1.1) Create a UIView class ImageScrollView using the system library control;
[0040] (1.2) Define the instance collectionView of UICollectionView in the ImageScrollView class, define the instance arrUrl that carries the array of download links of image documents in the non-editable state, define the array arrFiles that adds image documents in the editable state, and define the array arrDescribes that carries the names of image files. Setting the state of a UI component to either the non-editable state or the editable state is achieved by defining a bool variable isEdit, which sets whether the UI component adds images or documents or displays the image or document data returned by the server on the component.
[0041] (1.3) Set the data source of UICollectionView. In the data source method of UICollectionView, load and display pictures and documents in -(UICollectionViewCell*)collectionView(UICollectionView*)collectionViewcellForItemAtIndexPath:(NSIndexPath*)indexPath.
[0042] In the edit state, arrFiles is used to display the added images and documents on the component. In the non-editable state, arrUrls is used to display the image and document data returned by the server on the component. arrDescribes is used to display the name of each cell image or document.
[0043] When applied to an APP, the UI component is loaded on the APP, and the UI component can perform corresponding data processing according to its status.
[0044] (2) If the UI component is in a non-editable state, the UI component is used to receive files to be displayed, determine the category of each file in the sequence of files to be displayed, and display each file in the sequence of files to be displayed in the form of a cell in the interface of the UI component according to the category.
[0045] Preferably, the method of displaying each file in the sequence of files to be displayed in the interface of the UI component in the form of a cell according to the category includes the following steps: for each file, if the file is judged to be a picture, the picture address is loaded in a cell of the interface of the UI component, and the picture name is displayed in a preset position of the cell; if the file is judged to be a document, a default background picture is loaded in a cell of the interface of the UI component, and the document name is displayed in a preset position of the cell, and in response to an operation on the cell, the file is downloaded and opened.
[0046] Specifically, when the component is in a non-editable state, a set of data is returned by the server, and the mark of this set of data is the suffix of the name of the picture or document. The suffix of the name of the picture or document is converted into lowercase letters (converting to lowercase letters avoids multiple judgments, such as one or more letters in the suffix are uppercase), and it is determined whether the suffix contains .jpg, .jpeg, .png, .bmp. If it does, it means that the data is a picture, otherwise it is a document. If it is a picture, the picture download address is directly set on the component, and the name of the picture is displayed below the picture; if it is a document, a background picture is set by default on the component to indicate that it is a document, and the document name is displayed under the document background picture. Click the document background picture to download the document and automatically open it for preview.
[0047] (3) If the UI component is in an editable state, the UI component is used to display a default file upload entry, and in response to an operation on the file upload entry, read a sequence of files to be uploaded, determine the category of each file in the sequence of files to be uploaded, display each file in the sequence of files to be uploaded in the form of a cell in the interface of the UI component according to the category, and complete the uploading of the sequence of files to be uploaded.
[0048] Preferably, the method of displaying each file in the sequence of files to be uploaded in the interface of the UI component in the form of a cell according to the category includes the following steps: for each file, if the file is judged to be a picture, the picture is displayed in a cell of the interface of the UI component, and the picture name is displayed at a preset position of the cell; if the file is judged to be a document, a default background picture is loaded in a cell of the interface of the UI component, and the document name is displayed at a preset position of the cell, and in response to an operation on the cell, the file is obtained and opened.
[0049] Specifically, when the component is in the editing state, the component will display an entry to add pictures or files by default. Click the upload entry, and a selection box for selecting albums and documents will pop up. Click the album to enter the album to select pictures, and click the document to enter the file directory to select documents. The selected pictures and documents can be arranged in a matrix from left to right and from top to bottom on the component in order. The component can upload pictures and documents to the server in a unified manner.
[0050] Preferably, when the component is in the editing state, it can also display pictures and documents obtained from the server, and the user can perform editing operations such as deletion on the pictures and documents obtained from the server, and can also add other pictures and documents through the file upload entrance.
[0051] Preferably, the number of cells in the interface of the UI component is determined according to the total number of files in the file sequence to be displayed or the total number of files in the file sequence to be uploaded. The number of cells in the interface of the UI component is not fixed, but is the same as the total number of files to be displayed or the total number of files to be uploaded. As many cells as there are files, the flexible adaptation of the interface of the UI component is achieved.
[0052] Preferably, when creating a UI component, the cell layout of the interface of the UI component can be predefined, or screen size parameters can be obtained, or a method for determining the cell layout can be determined according to the screen size parameters, such as the total number of cells in each row, the size of each cell, etc.
[0053] Preferably, the total number of cells in each row in the interface of the UI component is predefined, and if the number of cells in the current row does not meet the needs of the files to be displayed or the files to be uploaded, cells are automatically generated in the next row.
[0054] Preferably, if the UI component is in a non-editable state, the height of its interface in the initial state is zero, and in response to receiving the file to be displayed, the size of its interface is automatically adjusted according to the number of files to be displayed, such as Figure 2 shown.
[0055] When the component is not editable, the initial height is zero and does not occupy any mobile device screen size. With the image file data source returned by the server, the component automatically adapts to a rectangle. It can make the most of the limited screen size of mobile devices and display images and files in a set of spaces intuitively and concisely.
[0056] Preferably, if the UI component is in an editable state, the height of the initial state of its interface is the height of the file upload entrance, such as Figure 3 As shown, in response to reading the files to be uploaded, the interface size is automatically adjusted according to the number of files to be uploaded, such as Figure 4 shown.
[0057] When the component is in editable state, the initial height is the height of the picture or file entry picture. Select pictures or files from the entry and fill them on the component. It is adapted into a rectangle according to the number of selected pictures or files, and the height of the rectangle is automatically adapted with the number of added pictures or files.
[0058] Preferably, the cells in the interface of the component are also used to receive the user's picture interaction actions, and perform corresponding image processing on the pictures according to the picture interaction actions and then output them to the interface for display.
[0059] For example, you can add single-click gestures to pictures and files. Clicking pictures can be enlarged and clicking files can be previewed. In addition, when the component is not editable, you can add a long-press gesture to the picture. Long-pressing the picture can save the picture to the album.
[0060] According to a second aspect of the present invention, there is provided a system for mixed uploading or displaying pictures and documents based on a mobile device, comprising: a UI component, the interface of the UI component can accommodate a plurality of cells, and the state of the UI component is set to one of a non-editable state and an editable state;
[0061] If the UI component is in a non-editable state, the UI component is used to receive a file to be displayed, determine the category of each file in the sequence of files to be displayed, and display each file in the sequence of files to be displayed in the form of a cell in the interface of the UI component according to the category;
[0062] If the UI component is in an editable state, the UI component is used to display a default file upload entrance, and in response to operations on the file upload entrance, read the file sequence to be uploaded, determine the category of each file in the file sequence to be uploaded, display each file in the file sequence to be uploaded in the form of a cell in the interface of the UI component according to the category, and complete the uploading of the file sequence to be uploaded.
[0063] The implementation principle and technical effects of the system are similar to the above method and will not be repeated here.
[0064] It must be noted that in any of the above embodiments, the method is not necessarily executed in sequence according to the sequence number. As long as it cannot be inferred from the execution logic that it must be executed in a certain order, it means that it can be executed in any other possible order.
[0065] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for mixed uploading or displaying pictures and documents based on a mobile device, characterized in that: Includes steps: Create a UI component, the interface of which can accommodate multiple cells, and set the state of the UI component to be either a non-editable state or an editable state; if the UI component is in a non-editable state, load pictures and documents returned by the server in the UI component interface area; if the UI component is in an editable state, upload pictures and documents to the server in the UI component interface area; if the UI component is in a non-editable state, the UI component is used to receive files to be displayed, determine the category of each file in the sequence of files to be displayed, and display each file in the sequence of files to be displayed in the form of a cell in the interface of the UI component according to the category; If the UI component is in an editable state, the UI component is used to display a default file upload entrance, and in response to operations on the file upload entrance, read the file sequence to be uploaded, determine the category of each file in the file sequence to be uploaded, display each file in the file sequence to be uploaded in the form of a cell in the interface of the UI component according to the category, and complete the uploading of the file sequence to be uploaded.
2. A method for mixed uploading or displaying pictures and documents based on a mobile device as claimed in claim 1, characterized in that: The step of displaying each file in the to-be-displayed file sequence in the form of a cell in the interface of the UI component according to the category comprises the following steps: For each file, if it is determined that the file is a picture, the picture address is loaded into a cell of the interface of the UI component, and the picture name is displayed at a preset position of the cell; If the file is determined to be a document, a default background image is loaded in a cell of the interface of the UI component, and the document name is displayed at a preset position in the cell. In response to an operation on the cell, the file is downloaded and opened.
3. A method for mixed uploading or displaying pictures and documents based on a mobile device as claimed in claim 1, characterized in that: The step of displaying each file in the sequence of files to be uploaded in the form of a cell in the interface of the UI component according to the category comprises the following steps: For each file, if it is determined that the file is a picture, the picture is displayed in a cell of the interface of the UI component, and the picture name is displayed at a preset position of the cell; If the file is determined to be a document, a default background image is loaded in a cell of the interface of the UI component, and the document name is displayed at a preset position in the cell. In response to an operation on the cell, the file is obtained and opened.
4. A method for mixed uploading or displaying pictures and documents based on a mobile device as claimed in claim 1, characterized in that: The number of cells in the interface of the UI component is determined according to the total number of files in the sequence of files to be displayed or the total number of files in the sequence of files to be uploaded.
5. A method for mixed uploading or displaying pictures and documents based on a mobile device as claimed in claim 1, characterized in that: If the UI component is in a non-editable state, the height of its interface in the initial state is zero, and in response to receiving the file to be displayed, the size of its interface is automatically adjusted according to the number of the files to be displayed.
6. A method for mixed uploading or displaying pictures and documents based on a mobile device as claimed in claim 1, characterized in that: If the UI component is in an editable state, the height of the initial state of its interface is the height of the file upload entrance, and in response to reading the files to be uploaded, the size of its interface is automatically adjusted according to the number of files to be uploaded.
7. A method for mixed uploading or displaying pictures and documents based on a mobile device as claimed in claim 1, characterized in that: The total number of cells in each row of the interface of the UI component is predefined. If the number of cells in the current row does not meet the needs of the file to be displayed or the file to be uploaded, cells are automatically generated in the next row.
8. A method for mixed uploading or displaying pictures and documents based on a mobile device as claimed in claim 1, characterized in that: The cells in the interface of the component are also used to receive the user's picture interaction actions, and perform corresponding image processing on the pictures according to the picture interaction actions and then output them to the interface for display.
9. The method for mixed uploading or displaying pictures and documents based on a mobile device as claimed in claim 1, wherein the step of creating a UI component comprises the following steps: Create a UIView class ImageScrollView using the system library control; In the ImageScrollView class, define the collectionView instance of UICollectionView, define the arrUrl instance that carries the array of download links of image documents in a non-editable state, define the arrFiles array for adding image documents in an editable state, and define the arrDescribes array that carries the names of image files; Set the data source of the UICollectionView.
10. A system for uploading or displaying mixed pictures and documents based on mobile devices, characterized in that: include: A UI component, wherein the interface of the UI component can accommodate multiple cells, and the state of the UI component is set to be one of a non-editable state and an editable state; If the UI component is in a non-editable state, the UI component is used to receive a file to be displayed, determine the category of each file in the sequence of files to be displayed, and display each file in the sequence of files to be displayed in the form of a cell in the interface of the UI component according to the category; If the UI component is in a non-editable state, load the pictures and documents returned by the server in the UI component interface area; If the UI component is in an editable state, upload pictures and documents to the server in the UI component interface area; If the UI component is in an editable state, the UI component is used to display a default file upload entrance, and in response to operations on the file upload entrance, read the file sequence to be uploaded, determine the category of each file in the file sequence to be uploaded, display each file in the file sequence to be uploaded in the form of a cell in the interface of the UI component according to the category, and complete the uploading of the file sequence to be uploaded.
