CN114528046A - View loading method, system, computer and readable storage medium - Google Patents

View loading method, system, computer and readable storage medium Download PDF

Info

Publication number
CN114528046A
CN114528046A CN202210150685.2A CN202210150685A CN114528046A CN 114528046 A CN114528046 A CN 114528046A CN 202210150685 A CN202210150685 A CN 202210150685A CN 114528046 A CN114528046 A CN 114528046A
Authority
CN
China
Prior art keywords
view
layout
loading
new
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210150685.2A
Other languages
Chinese (zh)
Inventor
赵程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202210150685.2A priority Critical patent/CN114528046A/en
Publication of CN114528046A publication Critical patent/CN114528046A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention provides a view loading method, a view loading system, a computer and a readable storage medium, wherein the method comprises the following steps: acquiring a view according to the target segment, and removing the view from the parent layout of the view to obtain a new parent layout; establishing a frame layout, acquiring view layout parameters in a view, and setting the view layout parameters in the frame layout to form a new frame layout; creating a view loading layout through a layout service, and acquiring a loading layout view according to the view loading layout; and after adding the view and the loading layout view to the new frame layout, setting the new frame layout to the new parent layout to form a target view so that a user can load the view according to the target view. According to the method and the device, the frame layout is created, the loading layout view is added at the same level of the view, so that a user can load the view according to the target view, the loading display requirements of a plurality of segments in one page are perfectly met, and the operation that the user clicks other segments is not blocked. Meanwhile, the invention also relates to a block chain technology.

Description

View loading method, system, computer and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and a system for loading a view, a computer, and a readable storage medium.
Background
The Loading has a use scene in any APP, and is mainly used for processing the problem that the application requests a network interface to acquire data and prevents a user from clicking to cause page abnormity. The application is more harmonious when time-consuming operation is processed, and the use experience of a user is improved without interruption.
The existing Loading basically covers the whole page, so that the abnormal operation of a user is effectively interrupted, at that time, the whole page cannot be clicked, and the page can be operated only by closing the Loading after time-consuming operation (such as after the network request is finished) is waited. However, in the current APP, the content of a page is basically presented through one page and then a plurality of fragments are loaded, for example, panning, tabs such as a home page, a shopping cart and the like are switched by clicking at the bottom, but at this time, if the Loading is still implemented by using Dialog, it is obvious that the clicking of the four buttons at the bottom is invalid. And only after the Loading is closed, other buttons can be continuously clicked to switch the content desired by the user.
Disclosure of Invention
In view of the foregoing, the present invention provides a view loading method, system, computer and readable storage medium to solve at least the above-mentioned deficiencies in the related art.
In order to achieve the above object, the present invention provides a view loading method, including:
acquiring a corresponding view according to a target segment, and removing the view from a parent layout of the view to obtain a new parent layout;
creating a frame layout, acquiring view layout parameters in the view, and setting the view layout parameters in the frame layout to form a new frame layout;
creating a view loading layout through a layout service, and acquiring a loading layout view according to the view loading layout;
and after the view and the loading layout view are added to the new frame layout, setting the new frame layout into the new parent layout to form a target view so that a user can load the view according to the target view.
Preferably, the step of removing the view from the parent layout of the view to obtain a new parent layout comprises:
calling a father node function to obtain the father layout of the view;
and calling a view removing function of the parent layout to remove the view from the parent layout to obtain a new parent layout.
Preferably, the step of creating a frame layout, acquiring view layout parameters in the view, and setting the view layout parameters in the frame layout to form a new frame layout further includes:
establishing frame layout through keywords, and calling a view layout parameter acquisition function to acquire view layout parameters in the view;
and calling a parameter layout function to set the view layout parameters in the frame layout to form a new frame layout.
Preferably, the method further comprises:
when a view loading instruction of the target view is received, if the target view is of a display type, analyzing a view loading layout in the target view, and setting a visibility attribute in the view loading layout as a visible view attribute so as to load the target view in a visible form;
if the target view is of a hidden type, analyzing a view loading layout in the target view, and setting a visibility attribute in the view loading layout as a hidden view attribute so as to hide the target view.
Preferably, the method further comprises:
creating a mapping list array, and loading and adding a plurality of views of the target view into the mapping list array through hash codes of a plurality of target fragments;
when a new target segment is obtained and the new target segment is of a display loading type, searching whether view loading of a target view corresponding to the new target segment exists in the mapping list array through a hash code of the new target segment;
if the mapping list array has view loading of a target view corresponding to the new target segment, directly calling the view loading of the corresponding target view to carry out view loading on the new target segment;
and if the mapping list array does not have the view loading of the target view corresponding to the new target fragment, re-creating a new view loading according to the new target fragment, and adding the new view loading into the mapping list array.
Preferably, the method further comprises:
when a new target segment is acquired and the new target segment is of a hidden type, searching a corresponding view load in the mapping list array through the hash code of the new target segment, and directly closing the view load to hide the new target segment.
To achieve the above object, the present invention further provides a view loading system, including:
the acquisition module is used for acquiring a corresponding view according to a target segment, and removing the view from a parent layout of the view to obtain a new parent layout;
the first establishing module is used for establishing a frame layout, acquiring view layout parameters in the view, and setting the view layout parameters in the frame layout to form a new frame layout;
the second creation module is used for creating a view loading layout through a layout service and acquiring a loading layout view according to the view loading layout;
and the loading module is used for setting the new frame layout into the new parent layout after adding the view and the loading layout view into the new frame layout, and forming a target view so that a user can load the view according to the target view.
Preferably, the obtaining module includes:
the first calling unit is used for calling a father node function to obtain the father layout of the view;
and the second calling unit is used for calling a view removing function of the parent layout to remove the view from the parent layout to obtain a new parent layout.
Preferably, the first creating module includes:
the third calling unit is used for establishing frame layout through keywords and calling a view layout parameter acquisition function to acquire view layout parameters in the view;
and the fourth calling unit is used for calling a parameter layout function to set the view layout parameters in the frame layout to form a new frame layout.
Preferably, the system further comprises:
the analysis module is used for analyzing a view loading layout in the target view and setting a visibility attribute in the view loading layout as a visible view attribute so as to load the target view in a visible form if the target view is of a display type when receiving a view loading instruction of the target view;
the first processing module is configured to, if the target view is of a hidden type, parse out a view loading layout in the target view, and set a visibility attribute in the view loading layout to a hidden view attribute, so as to hide the target view.
Preferably, the system further comprises:
a third creating module, configured to create a mapping list array, and add views of multiple target views to the mapping list array through hash codes of multiple target segments;
the searching module is used for searching whether view loading of a target view corresponding to a new target segment exists in the mapping list array through the hash code of the new target segment when the new target segment is obtained and the new target segment is of a display loading type;
the second processing module is used for directly calling the view loading of the corresponding target view to carry out view loading on the new target segment if the mapping list array has the view loading of the target view corresponding to the new target segment;
and the third processing module is used for recreating a new view load according to the new target fragment and adding the new view load into the mapping list array if the mapping list array does not have the view load of the target view corresponding to the new target fragment.
Preferably, the system further comprises:
and the fourth processing module is used for searching for corresponding view loading in the mapping list array through the hash code of the new target segment when the new target segment is acquired and is of a hidden type, and directly closing the view loading to hide the new target segment.
To achieve the above object, the present invention also provides a computer comprising a memory and a processor, wherein the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, cause the processor to execute the steps of the above view loading method.
To achieve the above object, the present invention also provides a computer readable storage medium storing computer readable instructions, which when executed by a processor, implement the steps of the above view loading method.
The invention provides a view loading method, a system, a computer and a readable storage medium, wherein a new frame layout is created, then an incoming view is wrapped, and a loading layout view is added at the same level of the view to produce a target view, so that a user can load the view according to the target view; the view loading of the target view supports loading display at a fragment level, loading can be added to all fragments, and the loading display requirement of a plurality of fragments in one page is perfectly met, so that the operation of clicking other fragments by a user is not blocked; all view loads are managed through a loading tool class, and only one load exists in any fragment, so that the phenomenon that a plurality of loads are displayed simultaneously is avoided; and by recording the hash codes of the segments, the memory overhead caused by loading is greatly optimized, one segment only has one loading, the first creation and the repeated use can be realized, the memory overhead is greatly reduced, and the use experience is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a diagram of an application environment of a view loading method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a view loading method according to an embodiment of the present invention;
fig. 3 is a detailed flowchart of step S101 in fig. 2;
fig. 4 is a detailed flowchart of step S102 in fig. 2;
FIG. 5 is another flow chart of a view loading method in an embodiment of the invention;
FIG. 6 is another flow chart of a view loading method in an embodiment of the invention;
FIG. 7 is a schematic diagram of the structure of a view loading system according to an embodiment of the present invention;
FIG. 8 is a diagram of a computer according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The application provides a view Loading method, which is Loading realized based on layout in Fragment, because Fragment in Android usually has a father layout, the layout is set by a user, the layout is very easy to take, and then Loading of Loading is carried out on the layout, so that Loading can be perfectly displayed in a corresponding module (Fragment) for a diversified APP top page (the current mainstream APP top page is basically formed by a plurality of fragments). The attempted loading method of the application has the following innovation points:
firstly, View loading is realized based on the Fragment layout View, that is, only the Fragment to be displayed and the layout View of the Fragment need to be transmitted.
1. A ViewLoading class is created and a construction method for the ViewLoading is created. The construction method has two parameters Fragment and View, namely: void ViewLoading (Fragment, View View).
2. getPart () is called to get the parent layout of the View, and then the View is removed from the parent layout by calling the removeView (View) method of the parent layout. (since any child View in the Android system can only have one parent layout, the lock needs to remove the parent layout of the View in order to add the loadingLayoutView).
3. FrameLayout is created by new key, and then obtained by calling view. The characteristics of the view, such as layout constraints, are mainly set to the newly created container.
4. The FrameLayout is then set to the parent layout of view, i.e., the parent's addView method is called. And establishing a ViewLoading layout by a form method of the layout, acquiring a loadingLayoutView, and finally sequentially calling the view and the loadingLayoutView to be added into the FrameLayout layout by an addView method.
5. The final assembly is a new FrameLayout, then wraps the incoming View, and adds a loadinglayout View to the View peer. So that the Loading lid is above the View, and thus is shown above.
Method for creating showLoading and hideLoading
1. After the ViewLoading is created in the first step, the view loading needs to be controlled to be displayed and hidden. There are mainly 2 methods, one is display and one is hide. Respectively showLoding, acquiring loadLayoutView mainly through ViewLoading, and setting the visibility attribute to View. GONE, only needs to be set to visibility for visibility in case of hideLoading.
And thirdly, the loadingUtils manages all ViewLoading, and only one loadingUtils is created by one View.
1. A loadingMapList array needs to be created, and must be added each time ViewLoading is created, and the hashCode through Fragment is used as key, and ViewLoading is stored as value in Map for management.
2. Creating showLoading method, in the method, directly using the hashCode of the incoming Fragment as the loadable MapList to find whether there is created viewLoading. And if so, directly calling a showLoading method of the ViewLoading to display the Loading. If not, a completely new ViewLoading is created and added to the loadingMapList array.
3. And creating a hideLoading method, wherein in the method, the hashCode which is transmitted into the Fragment is directly used as a loadable MapList to search the corresponding ViewLoading, and the hideLoading method of the ViewLoading is directly called to close the ViewLoading.
4. In the whole process, only one Loading exists in one Fragment, so that the memory overhead is reduced, the Loading is multiplexed, and the user experience is improved. The strange phenomenon of 2 Loading is not possible to occur in one page.
The view loading method has the following beneficial effects:
1. ViewLoading supports Fragment level Loading exposure, and Loading can be added to any Fragment. The method perfectly solves the problem that the Loading display requirements of a plurality of fragments exist in one page, so that the operation of clicking other fragments by a user is not blocked.
2. All ViewLoading are managed through LoadingUtils, and any Fragment only has one Loading, so that a plurality of Loadings cannot be displayed at the same time.
3. Because the hash code of the Fragment is recorded, the memory overhead caused by Loadinbg is greatly optimized, and only one Loading can be created by one Fragment, so that the effects of first-time creation and later repeated use can be achieved. Memory overhead is greatly reduced, and APP use experience is optimized.
The view loading method provided by the application can be applied to a computer as shown in fig. 1, wherein the computer can communicate with a server through a network. Including but not limited to various personal computers, laptops, smartphones, tablets, and portable wearable devices, among others. The server may be implemented as a stand-alone server or as a server cluster consisting of a plurality of servers.
In an embodiment, as shown in fig. 2, a view loading method is provided, which is described by taking the method as an example applied to the computer in fig. 1, and includes the following steps S101 to S104.
S101, acquiring a corresponding view according to a target segment, and removing the view from a parent layout of the view to obtain a new parent layout;
referring to fig. 3, step S101 specifically includes steps S1011 to S1012.
S1011, calling a father node function to obtain the father layout of the view;
s1012, calling a view removing function of the parent layout to remove the view from the parent layout to obtain a new parent layout.
It should be noted that the View (View) is a rectangular area, which is responsible for drawing and event processing in this area. The view class is one of the basic classes of the Android user interface. The application provides Loading realized based on layout in Fragment, because Fragment in Android often has a father layout, Loading of the Loading is developed aiming at the father layout, and the Loading can be perfectly displayed in a corresponding module for a diversified APP home page.
The following are illustrative of the present application:
the user has 4 buttons in the bottom when using panning, and above-mentioned 4 are 4 modules of different functions respectively, if realize with Dialog, Loading can cover 4 buttons of bottom simultaneously in Loading process, and the user can't switch. In this technique, the present application uses Fragment for Loading, for example, the "top page" is Loading, and the Loading of the present application is only loaded on the top page, and does not affect the operation of the bottom 4 buttons, nor the operation of the remaining 3 modules.
The method and the device realize ViewLoading based on the Fragment layout view only by inputting the Fragment to be displayed and the Fragment layout view.
Android runs in various devices, including small-screen mobile phones, ultra-large-screen flat-panel televisions. In many cases, a set of apps is developed for a mobile phone, and then one App is copied and the layout is modified to adapt to super large-screen devices such as a flat panel. At present, one App can not be adapted to a mobile phone and a tablet computer at the same time. Fragment was presented to solve such a problem. Fragment can be regarded as a component of an interface of Activity, even the interface of Activity can completely have different Fragment components, and more importantly, Fragment has its own life cycle and receives and processes user's event, so that it is unnecessary to write a stack of event processing codes of control in Activity. Moreover, the user can also dynamically add, replace, and remove a Fragment. Fragment must exist depending on Activity, so the Activity lifecycle directly affects the Fragment lifecycle.
In specific implementation, firstly, a ViewLoading class needs to be created, and a construction method of the ViewLoading class needs to be created. The construction method has two parameters Fragment and View, namely: void, ViewLoading (Fragment, View View).
getPart () is called to get the parent layout of the View, and then the View is removed from the parent layout by calling the removeView (View) method of the parent layout. (since any child View in the Android system can only have one parent layout, in order to add a loadingLayoutView, the parent layout of the View needs to be removed first).
S102, establishing a frame layout, acquiring view layout parameters in the view, and setting the view layout parameters in the frame layout to form a new frame layout;
referring to fig. 4, step S102 specifically includes steps S1021 to S1022.
S1021, creating a frame layout through the keywords, and calling a view layout parameter acquisition function to acquire view layout parameters in the view;
s1022, calling a parameter layout function to set the view layout parameters in the frame layout to form a new frame layout.
In specific implementation, FrameLayout is created through a new keyword, and then obtained by calling view.
It should be noted that, LayoutParams is an internal class of the view group, which is a base class, for example, FrameLayout, linear layout, and the like, and there is a LayoutParams inside the laoutparams, and the purpose of obtaining the LayoutParams is also to create a required layout, and then the style, constraint, position, and the like of the layout need to be consistent with the original layout, so that the original page layout is not affected when Loading the Loading, thereby ensuring visual consistency.
The Layout of. Assuming that an area on the screen is occupied by a Layout, if a View is added to a Layout, the Layout desired by the user of Layout needs to be passed, i.e., a recognized Layout is passed in.
Colloquially, the LayoutParams class is one thing used for child views to convey their intentions to parent views. For example, the child view and the parent view may be simply understood as a relationship between LinearLayout and a TextView inside the LinearLayout, respectively, which is a child view of LinearLayout. It should be noted that the layout params is only an internal class of the view group, i.e. the layout params class of the view group is a layout params subclass of the base class, and actually each different view group has its own layout params subclass. Such as abslistview, layout params, absolutelayout, layout params, gallery, layout params, viewgroup, marginlayout layout params, windowman, layout params, etc.
The layout type of the view is also corresponding to linear layout.
As can be appreciated, this step is primarily to set the properties of the view, such as layout constraints, to the newly created container.
S103, creating a view loading layout through a layout service, and acquiring a loading layout view according to the view loading layout;
in specific implementation, the addView method of parent is called, the FrameLayout is set to the parent layout of view, then the corresponding ViewLoading layout is created through the form method of LayoutInflatter, and the loadingLayoutView is obtained.
S104, after the view and the loading layout view are added to the new frame layout, the new frame layout is set in the new parent layout to form a target view so that a user can load the view according to the target view.
In specific implementation, the view and loadinglayout view are sequentially called and added to the FrameLayout layout by an addView method.
The final assembly is a new FrameLayout, then wraps the incoming View, and adds a loadinglayout View to the View peer. With the Loading lid above the View, so it is shown above.
In the present application, after the generation of the target view is completed, the ViewLoading is controlled to be displayed and hidden. The method comprises the steps of showLoding and hidLoding respectively, wherein loadLayoutView is obtained mainly through ViewLoding, and the visibility attribute is set to View. GONE, only needs to be set to visibility for visibility in case of hideLoading.
It should be noted that only one LoadingUtils is created for one View, and all ViewLoading is managed through the LoadingUtils.
The previously created loadingMapList array must be added each time the ViewLoading is created, and the hashCode through Fragment is used as key and the ViewLoading is stored as value in Map for management.
In the application, in the showLoding method, it is directly determined whether there is a created viewLoding by using the hashCode passed into Fragment as a loadingMapList. And if so, directly calling a showLoading method of the ViewLoading to display the Loading. If not, a completely new ViewLoading is created and added to the loadingMapList array.
In the method for creating hideLoading, directly using hashCode transmitted into Fragment as the map List capable of unloading to search the corresponding ViewLoading, and directly calling the hideLoading method of the ViewLoading to close the ViewLoading.
It can be understood that, through the above setting, only one Loading will exist in one Fragment, reducing memory overhead, multiplexing Loading, and improving user experience. The strange phenomenon of 2 Loading is not possible to occur in one page.
According to the invention, the new frame layout is created, then the transmitted view is wrapped, and a loading layout view is added at the same level of the view, so that the target view is produced, and a user can load the view according to the target view; the view loading of the target view supports loading display at a fragment level, loading can be added to all fragments, and the loading display requirement of multiple fragments in one page is perfectly met, so that the operation of clicking other fragments by a user is not blocked.
According to the view loading method, a target view is produced by creating a new frame layout, wrapping the incoming view and adding a loading layout view at the same level of the view, so that a user can load views according to the target view; the view loading of the target view supports loading display at a fragment level, loading can be added to all fragments, and the loading display requirement of a plurality of fragments in one page is perfectly met, so that the operation of clicking other fragments by a user is not blocked; all view loads are managed through a loading tool class, and only one load exists in any fragment, so that the phenomenon that a plurality of loads are displayed simultaneously is avoided; and by recording the hash codes of the segments, the memory overhead caused by loading is greatly optimized, one segment only has one loading, the first creation and the repeated use can be realized, the memory overhead is greatly reduced, and the use experience is improved.
In addition, as a specific example, referring to fig. 5, the method further includes:
s201, when a view loading instruction of the target view is received, if the target view is of a display type, analyzing a view loading layout in the target view, and setting a visibility attribute in the view loading layout as a visible view attribute so as to load the target view in a visible form;
s202, if the target view is of a hidden type, analyzing a view loading layout in the target view, and setting a visibility attribute in the view loading layout as a hidden view attribute so as to hide the target view.
In specific implementation, before a user needs to load a view according to the target view, a showling and hideLoading need to be created for the target view to control whether the view is loaded in a visible form or a hidden form, and in a showling creating method, whether the created ViewLoading exists is directly searched by using a hashCode which is transmitted into Fragment as a loadingMapList. And if so, directly calling a showLoading method of the ViewLoading to display the Loading. If not, a completely new ViewLoading is created and added to the loadingMapList array.
In the method for creating hideLoading, directly using hashCode transmitted into Fragment as the map List capable of unloading to search the corresponding ViewLoading, and directly calling the hideLoading method of the ViewLoading to close the ViewLoading.
And when a user needs to load a view according to the target view, acquiring the loadLayoutView through ViewLoading, if the target view is of a display loading type, setting the visibility attribute in the loadLayoutView as VIEW.
In addition, as a specific example, referring to fig. 6, the method further includes:
s301, creating a mapping list array, and loading and adding a plurality of views of the target view into the mapping list array through hash codes of a plurality of target fragments;
s302, when a new target segment is obtained and the new target segment is of a display loading type, searching whether view loading of a target view corresponding to the new target segment exists in the mapping list array through the hash code of the new target segment;
s303, if the mapping list array has view loading of a target view corresponding to the new target segment, directly calling the view loading of the corresponding target view to carry out view loading on the new target segment;
s304, if the mapping list array does not have view loading of the target view corresponding to the new target segment, re-creating new view loading according to the new target segment, and adding the new view loading to the mapping list array;
s305, when a new target segment is acquired and the new target segment is of a hidden type, searching a corresponding view load in the mapping list array through the hash code of the new target segment, and directly closing the view load to hide the new target segment.
It should be noted that Android can be developed by using Java, Java Object is a method with hashCode acquisition itself, and can be directly acquired by directly calling getHashCode () method, and is unique.
In specific implementation, view loads of a plurality of target views are added to a mapping list array by creating the mapping list array, when a new target segment is acquired, a hash code of the new target segment and a visualization attribute in a view of the new target segment are firstly analyzed, if the visualization attribute is a visible view attribute, whether the view load of the corresponding target view exists in the mapping list array is searched according to the hash code of the new target segment, if the view load of the target view exists, the view load of the target view is directly called to try to load the new target segment, if the view load does not exist, a new view load is created for the new target segment again according to the steps S101 to S104, and the view load is added to the mapping list array so as to be repeatedly used.
If the visual attribute is a hidden view attribute, searching a corresponding view load of the target view in the mapping list array according to the hash code of the new target segment, and directly closing the view load according to the view load of the corresponding target view so as to hide the new target segment.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In an alternative embodiment, it is also possible to: and uploading the result of the view loading method to the block chain.
Specifically, the corresponding summary information is obtained based on the result of the view loading method, and specifically, the summary information is obtained by hashing the result of the view loading method, for example, by using the sha256s algorithm. Uploading summary information to the blockchain can ensure the safety and the fair transparency of the user. The user may download the summary information from the blockchain to verify that the results of the view loading method have been tampered with. The blockchain referred to in this example is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
In an embodiment, a view loading system is provided, and the view loading system corresponds to the view loading method in the above embodiments one to one. As shown in fig. 7, the view loading system 100 includes an obtaining module 11, a first creating module 12, a second creating module 13, and a loading module 14. The functional modules are explained in detail as follows:
the acquisition module 11 is configured to acquire a corresponding view according to a target segment, and remove the view from a parent layout of the view to obtain a new parent layout;
a first creating module 12, configured to create a frame layout, acquire view layout parameters in the view, and set the view layout parameters in the frame layout to form a new frame layout;
a second creating module 13, configured to create a view loading layout through a layout service, and obtain a loading layout view according to the view loading layout;
and a loading module 14, configured to set the new frame layout in the new parent layout after the view and the loading layout view are added to the new frame layout, so as to form a target view, and enable a user to perform view loading according to the target view.
In this embodiment, the obtaining module 11 includes:
the first calling unit is used for calling a father node function to obtain the father layout of the view;
and the second calling unit is used for calling a view removing function of the parent layout to remove the view from the parent layout to obtain a new parent layout.
In this embodiment, the first creating module 12 includes:
the third calling unit is used for establishing frame layout through keywords and calling a view layout parameter acquisition function to acquire view layout parameters in the view;
and the fourth calling unit is used for calling a parameter layout function to set the view layout parameters in the frame layout to form a new frame layout.
In an optional embodiment, the system further comprises:
the analysis module is used for analyzing a view loading layout in the target view and setting a visibility attribute in the view loading layout as a visible view attribute so as to load the target view in a visible form if the target view is of a display type when receiving a view loading instruction of the target view;
the first processing module is configured to, if the target view is of a hidden type, parse out a view loading layout in the target view, and set a visibility attribute in the view loading layout to a hidden view attribute, so as to hide the target view.
In an optional embodiment, the system further comprises:
a third creating module, configured to create a mapping list array, and load and add views of multiple target views to the mapping list array through hash codes of multiple target segments;
the searching module is used for searching whether view loading of a target view corresponding to a new target segment exists in the mapping list array through the hash code of the new target segment when the new target segment is obtained and the new target segment is of a display loading type;
the second processing module is used for directly calling the view loading of the corresponding target view to carry out view loading on the new target segment if the mapping list array has the view loading of the target view corresponding to the new target segment;
and the third processing module is used for recreating a new view load according to the new target fragment and adding the new view load into the mapping list array if the mapping list array does not have the view load of the target view corresponding to the new target fragment.
In an optional embodiment, the system further comprises:
and the fourth processing module is used for searching for corresponding view loading in the mapping list array through the hash code of the new target segment when the new target segment is acquired and is of a hidden type, and directly closing the view loading to hide the new target segment.
By the view loading system provided by the embodiment, the target view is produced by creating a new frame layout, wrapping the incoming view and adding a loading layout view at the same level of the view, so that a user can load the view according to the target view; the view loading of the target view supports loading display at a fragment level, loading can be added to all fragments, and the loading display requirement of a plurality of fragments in one page is perfectly met, so that the operation of clicking other fragments by a user is not blocked; all view loads are managed through a loading tool class, and only one load exists in any fragment, so that the phenomenon that a plurality of loads are displayed simultaneously is avoided; and by recording the hash codes of the segments, the memory overhead caused by loading is greatly optimized, one segment only has one loading, the first creation and the repeated use can be realized, the memory overhead is greatly reduced, and the use experience is improved.
The meaning of "first" and "second" in the above modules/units is only to distinguish different modules/units, and is not used to define which module/unit has higher priority or other defining meanings. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to such process, method, article, or apparatus, and such that a division of modules presented in this application is merely a logical division and may be implemented in a practical application in a further manner.
For specific limitations of the view loading system, reference may be made to the above limitations of the view loading method, which is not described herein again. The various modules in the view loading system described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in a computer, and can also be stored in a memory in the computer in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 8. The computer comprises a processor, a memory, a network interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the computer is configured to provide computational and control capabilities. The memory of the computer comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer is used for communicating with an external server through network connection. The computer program is executed by a processor to implement a view loading method.
In one embodiment, a computer is provided, which includes a memory, a processor and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the steps of the view loading method in the above embodiments are implemented, for example, the steps S101 to S104 shown in fig. 2 and other extensions of the method and related steps. Alternatively, the processor, when executing the computer program, implements the functions of the modules/units of the view loading system in the above-described embodiments, such as the functions of the modules 11 to 14 shown in fig. 7. To avoid repetition, further description is omitted here.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like which is the control center for the computer device and which connects the various parts of the overall computer device using various interfaces and lines.
The memory may be used to store the computer programs and/or modules, and the processor may implement various functions of the computer device by running or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, video data, etc.) created according to the use of the cellular phone, etc.
The memory may be integrated in the processor or may be provided separately from the processor.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the steps of the view loading method in the above embodiments, such as the steps S101 to S104 shown in fig. 2 and extensions of other extensions and related steps of the method. Alternatively, the computer program, when executed by the processor, implements the functions of the modules/units of the view loading system in the above-described embodiments, such as the functions of the modules 11 to 14 shown in fig. 7. To avoid repetition, further description is omitted here.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above-mentioned embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. A method for loading a view, comprising:
acquiring a corresponding view according to a target segment, and removing the view from a parent layout of the view to obtain a new parent layout;
creating a frame layout, acquiring view layout parameters in the view, and setting the view layout parameters in the frame layout to form a new frame layout;
creating a view loading layout through a layout service, and acquiring a loading layout view according to the view loading layout;
and after the view and the loading layout view are added to the new frame layout, setting the new frame layout into the new parent layout to form a target view so that a user can load the view according to the target view.
2. The view loading method of claim 1, wherein removing the view from the parent layout of the view to obtain a new parent layout comprises:
calling a father node function to obtain the father layout of the view;
and calling a view removing function of the parent layout to remove the view from the parent layout to obtain a new parent layout.
3. The view loading method according to claim 1, wherein the step of creating a frame layout and obtaining view layout parameters in the view, and setting the view layout parameters in the frame layout to form a new frame layout further comprises:
establishing frame layout through keywords, and calling a view layout parameter acquisition function to acquire view layout parameters in the view;
and calling a parameter layout function to set the view layout parameters in the frame layout to form a new frame layout.
4. The view loading method of claim 1, wherein the method further comprises:
when a view loading instruction of the target view is received, if the target view is of a display type, analyzing a view loading layout in the target view, and setting a visibility attribute in the view loading layout as a visible view attribute so as to load the target view in a visible form;
if the target view is of a hidden type, analyzing a view loading layout in the target view, and setting a visibility attribute in the view loading layout as a hidden view attribute so as to hide the target view.
5. The view loading method of claim 1, wherein the method further comprises:
creating a mapping list array, and loading and adding a plurality of views of the target views into the mapping list array through hash codes of a plurality of target fragments;
when a new target segment is obtained and the new target segment is of a display loading type, searching whether view loading of a target view corresponding to the new target segment exists in the mapping list array through a hash code of the new target segment;
if the mapping list array has view loading of a target view corresponding to the new target segment, directly calling the view loading of the corresponding target view to carry out view loading on the new target segment;
and if the mapping list array does not have the view loading of the target view corresponding to the new target segment, re-creating a new view loading according to the new target segment, and adding the new view loading into the mapping list array.
6. The view loading method of claim 5, wherein the method further comprises:
when a new target segment is acquired and the new target segment is of a hidden type, searching a corresponding view load in the mapping list array through the hash code of the new target segment, and directly closing the view load to hide the new target segment.
7. A view loading system, comprising:
the acquisition module is used for acquiring a corresponding view according to a target fragment and removing the view from a parent layout of the view to obtain a new parent layout;
the first establishing module is used for establishing a frame layout, acquiring view layout parameters in the view, and setting the view layout parameters in the frame layout to form a new frame layout;
the second creation module is used for creating a view loading layout through a layout service and acquiring a loading layout view according to the view loading layout;
and the loading module is used for setting the new frame layout into the new parent layout after adding the view and the loading layout view into the new frame layout, and forming a target view so that a user can load the view according to the target view.
8. The view loading system of claim 7, wherein the obtaining module comprises:
the first calling unit is used for calling a father node function to obtain the father layout of the view;
and the second calling unit is used for calling a view removing function of the parent layout to remove the view from the parent layout to obtain a new parent layout.
9. A computer comprising a memory and a processor, the memory having stored therein computer-readable instructions, which, when executed by the processor, cause the processor to perform the steps of the view loading method of any of claims 1 to 6.
10. A readable storage medium storing computer readable instructions, which when executed by a processor implement the steps of the view loading method according to any one of claims 1 to 6.
CN202210150685.2A 2022-02-18 2022-02-18 View loading method, system, computer and readable storage medium Pending CN114528046A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210150685.2A CN114528046A (en) 2022-02-18 2022-02-18 View loading method, system, computer and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210150685.2A CN114528046A (en) 2022-02-18 2022-02-18 View loading method, system, computer and readable storage medium

Publications (1)

Publication Number Publication Date
CN114528046A true CN114528046A (en) 2022-05-24

Family

ID=81622542

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210150685.2A Pending CN114528046A (en) 2022-02-18 2022-02-18 View loading method, system, computer and readable storage medium

Country Status (1)

Country Link
CN (1) CN114528046A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704241A (en) * 2017-09-26 2018-02-16 广州优视网络科技有限公司 A kind of display methods and device of page status switching
US20190121623A1 (en) * 2017-10-23 2019-04-25 Open Text Sa Ulc Universal application framework for streamlined frontend development of user interface applications
CN111552531A (en) * 2020-04-23 2020-08-18 北京字节跳动网络技术有限公司 Page display method, device, terminal and storage medium
CN112711728A (en) * 2020-12-31 2021-04-27 百果园技术(新加坡)有限公司 Page layout frame, page loading method, device, equipment and storage medium
CN113127775A (en) * 2019-12-30 2021-07-16 武汉斗鱼鱼乐网络科技有限公司 Page loading method, device, equipment and storage medium
CN113360211A (en) * 2021-06-22 2021-09-07 平安普惠企业管理有限公司 Loading display method based on control and related equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704241A (en) * 2017-09-26 2018-02-16 广州优视网络科技有限公司 A kind of display methods and device of page status switching
US20190121623A1 (en) * 2017-10-23 2019-04-25 Open Text Sa Ulc Universal application framework for streamlined frontend development of user interface applications
CN113127775A (en) * 2019-12-30 2021-07-16 武汉斗鱼鱼乐网络科技有限公司 Page loading method, device, equipment and storage medium
CN111552531A (en) * 2020-04-23 2020-08-18 北京字节跳动网络技术有限公司 Page display method, device, terminal and storage medium
CN112711728A (en) * 2020-12-31 2021-04-27 百果园技术(新加坡)有限公司 Page layout frame, page loading method, device, equipment and storage medium
CN113360211A (en) * 2021-06-22 2021-09-07 平安普惠企业管理有限公司 Loading display method based on control and related equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
BILLY: ""我们经常用的 Loading动画居然还有这种姿势"", pages 1 - 7, Retrieved from the Internet <URL:https://zhuanlan.zhihu.com/p/60201825?utm_id=0> *

Similar Documents

Publication Publication Date Title
CN110020323B (en) Page switching method and system for hybrid application, computer equipment and storage medium
US11853820B2 (en) Cross-process communication method, apparatus, and device
CN106569856B (en) A kind of loading method and device of application view resource file
CN107085580B (en) Method for displaying page by client and client
CN107463400B (en) Hot updating method of mobile application and terminal equipment
US10469611B2 (en) Reduced page load time utilizing cache storage
CN108804188A (en) Changing an interface skin method and device
CN109522500B (en) Webpage display method, device, terminal and storage medium
CN106469071B (en) Application theme changing method and device
CN111666516A (en) Page loading method and device, electronic equipment and storage medium
KR20110044210A (en) Method, apparatus and computer program product for providing context triggered distribution of context models
CN112035114A (en) Page rollback method, device, equipment and medium
CN112395584A (en) Verification mode switching method and device, computer equipment and storage medium
CN114138781A (en) Policy data updating method and device, computer equipment and readable storage medium
CN114138849A (en) Multi-tenant data authority control method and device, computer and readable storage medium
CN106293790B (en) application program upgrading method and device based on Firefox operating system
CN114528046A (en) View loading method, system, computer and readable storage medium
CN116126330A (en) Access request processing method, device, computer equipment and storage medium
US9384284B2 (en) Value-added usage of process-oriented extension fields in business mashups
CN114461349A (en) Processing method and device for application program jumping applet and computer equipment
CN106775790B (en) Control calling method and device
CN114064307A (en) Method, related device and system for realizing application program sharing of cloud mobile phone
CN111221651B (en) Load balancing configuration method, device, server and readable storage medium
CN117992991B (en) Database data encryption method and device based on multiple granularities
CN104809208A (en) Homepage displaying method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination