CN114338709B - User head portrait synchronization method and device, storage medium and electronic equipment - Google Patents

User head portrait synchronization method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114338709B
CN114338709B CN202111489507.4A CN202111489507A CN114338709B CN 114338709 B CN114338709 B CN 114338709B CN 202111489507 A CN202111489507 A CN 202111489507A CN 114338709 B CN114338709 B CN 114338709B
Authority
CN
China
Prior art keywords
user
avatar
head portrait
network address
view
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.)
Active
Application number
CN202111489507.4A
Other languages
Chinese (zh)
Other versions
CN114338709A (en
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.)
Guiyang Yuwan Technology Co ltd
Original Assignee
Guiyang Yuwan Technology 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 Guiyang Yuwan Technology Co ltd filed Critical Guiyang Yuwan Technology Co ltd
Priority to CN202111489507.4A priority Critical patent/CN114338709B/en
Publication of CN114338709A publication Critical patent/CN114338709A/en
Application granted granted Critical
Publication of CN114338709B publication Critical patent/CN114338709B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a user head portrait synchronization method, a device, a storage medium and electronic equipment, wherein the method is applied to an avatar image view and is preset in a loading client and inherited to the avatar image view, and comprises the following steps: acquiring a user identification and a head portrait network address corresponding to a current user head portrait in a newly loaded display page; judging whether the target network address of the target user head portrait corresponding to the user mark in the user head portrait list is consistent with the head portrait network address or not based on the user mark and the head portrait network address corresponding to the current user head portrait, wherein the user head portrait list is positioned in the avatar View and comprises a plurality of user marks in the loaded display page and the network address of the user head portrait corresponding to each user mark; and if the user head images are inconsistent, caching the current user head images, and refreshing the user head images of the loaded display pages based on the current user head images.

Description

User head portrait synchronization method and device, storage medium and electronic equipment
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a user head portrait synchronization method, a device, a storage medium, and an electronic apparatus.
Background
In social APP (Application), user's avatar is an important social attribute, and people often show their own features through the avatar, and show their own personalities. Multiple pages of the same user may appear in the APP, such as user list pages, user material pages, private chat pages, etc., which are often loaded only once during page presentation, and then only refreshed after page data is refreshed, or the page is re-opened, to trigger the refresh. Under the mechanism, the newly opened page can display a new head portrait of the user, and after the page returns to the last page, the new head portrait of the user is displayed, so that the user is provided with an experienced tearing sense.
At present, most of implementation schemes for keeping unified user head portraits in APP are schemes for adding APP push messages and APP internal broadcasting: after the user changes the head portrait, the server pushes the user ID of the head portrait to be changed through long links to the APP, after the APP takes the user ID, the APP sends a broadcast in the APP, pages displaying the head portrait subscribe the broadcast, and reloads the head portrait of the user, so that the consistency of the head portrait of the user in the APP is realized.
However, the existing scheme of pushing and broadcasting in APP by using a server has the following disadvantages:
(1) The large number of server pushes consumes very much server resources, increasing server costs.
(2) The APP user does not care whether the head portraits of all users are changed, if the information is pushed to all online users, the waste of server resources and the performance of the mobile phones of the users can be caused, and the duration of the mobile phones of the APP user is shortened.
(3) By adopting the broadcasting mode in the APP, the broadcasting needs to be subscribed to the page displaying the head portrait to trigger the head portrait refreshing, and certain development and maintenance cost can be increased.
Therefore, there is a need for a more efficient solution to maintain consistency of user head portraits and reduce the user's perceived tearing.
Disclosure of Invention
The embodiment of the application aims to provide a user head portrait synchronization method, a device, a storage medium and electronic equipment, so that the consistency of user head portraits in an APP is maintained in a low-cost mode without increasing the pressure and cost of a server.
In order to achieve the above object, an embodiment of the present application is achieved by:
in a first aspect, an embodiment of the present application provides a method for synchronizing a user avatar, where an avatar auxiliary class avatar inherited from an original photo display class avatar view is loaded in a client, and the method is applied to avatar image view, and includes: acquiring a user identification and a head portrait network address corresponding to a current user head portrait in a newly loaded display page; judging whether the target network address of the target user head portrait corresponding to the user mark in a user head portrait list is consistent with the head portrait network address or not based on the user mark and the head portrait network address corresponding to the current user head portrait, wherein the user head portrait list is positioned in an avatar image view and comprises a plurality of user marks in a loaded display page and the network address of the user head portrait corresponding to each user mark; and if the current user head portraits are inconsistent, caching the current user head portraits, and refreshing the user head portraits of the loaded display pages based on the current user head portraits.
In the embodiment of the application, the avatar auxiliary type avatar image view is utilized to acquire the user identifier and the avatar network address corresponding to the current user avatar in the newly loaded display page, and whether the target network address of the target user avatar corresponding to the user identifier in the user avatar list is consistent with the avatar network address is judged, so that whether the user avatar is changed is determined. And when the user head images are inconsistent, determining that the user head images are changed, and refreshing the user head images of the loaded display pages by using the cached current user head images, so that the target user head images corresponding to the target user identifications in the loaded display pages are refreshed. Therefore, the consistency of the displayed user head portraits in the APP can be maintained, the use experience of the user is improved, the server pressure and cost can not be increased while the consistency of the user head portraits in the APP is maintained, and the APP development and maintenance cost is extremely low.
With reference to the first aspect, in a first possible implementation manner of the first aspect, after the client starts, the client enters a user list page, and before obtaining a user identifier and a head portrait network address corresponding to a current user head portrait in a newly loaded display page, the method further includes: pulling user information of each user from the user list page and caching the user information as the user head portrait list, wherein the user information comprises a user identifier of each user and a network address of the user head portrait; and pulling user information of each user from each loaded display page and adding the user information to the user head portrait list.
In this implementation, the user information (including the user identifier and the network address of the user avatar) of each user is pulled from the user list page and cached as a user avatar list; and, for each loaded display page, pulling user information for each user therefrom and adding to the user avatar list. Therefore, the refreshing of the user head portrait can be realized in time for each loaded display page in the APP, so that the updated user head portrait can be displayed in the newly loaded display page and can be updated to the loaded display page in real time, the tearing feeling of the user in experience is avoided, the server is not required to carry out in-station broadcasting, and the server resources and the cost are greatly saved.
With reference to the first aspect, in a second possible implementation manner of the first aspect, based on a user identifier and a head portrait network address corresponding to the current user head portrait, determining whether a target network address of a target user head portrait corresponding to the user identifier in a user head portrait list is consistent with the head portrait network address includes: determining a target user identification consistent with the user identification corresponding to the current user head from the user head list; and comparing the target network address of the target user head portrait corresponding to the target user identifier with the head portrait network address, and judging whether the target network address is consistent with the head portrait network address.
In the implementation mode, a target user identification consistent with the user identification corresponding to the current user head portrait is determined from a user head portrait list, then a target network address of the target user head portrait corresponding to the target user identification is compared with the head portrait network address, and whether the target network address is consistent with the head portrait network address is judged. By the method, whether the user head portrait of the newly loaded display page is changed compared with the user head portrait of the loaded display page can be judged efficiently.
With reference to the first aspect, in a third possible implementation manner of the first aspect, caching the current user avatar, and refreshing the user avatar of the loaded display page based on the current user avatar includes: adding the current user head portrait into an avatar ImageView for caching; determining all target user head portraits corresponding to the target user identifications from the cache; and refreshing all target user head images based on the current user head image, so that the current user head image is loaded as the user head image in each loaded display page.
In the implementation manner, the current user head images cached by the avatar image are utilized, all target user head images corresponding to the target user identifications are determined from the cache, and all target user head images are refreshed according to the current user head images, so that the user head images in each loaded display page are updated simply and efficiently.
With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, after loading the current user avatar as the user avatar in each loaded display page, the method further includes: when the situation that the user head portrait is moved out of the display page is detected, the user head portrait of the display page cached in the avatar image view is cleared from the cache; and when the client exits any display page, the user head portrait of the display page cached in the AvatarImageView is cleared from the cache.
In this implementation, since the newly loaded display page may be consistent with the updated user avatar (since the newly loaded display page will be refreshed), the user avatar of the display page cached in the avatar imageview may be purged from the cache when the client exits any display page. And when the user head portrait is detected to be moved out of the display page, the user head portrait of the display page cached in the avatar imageview can be cleared from the cache. Therefore, the memory occupation of the avatar image view can be reduced, the data quantity detected by the avatar image view when the avatar image synchronization method is operated each time is reduced, and the operation efficiency is improved.
In a second aspect, an embodiment of the present application provides a method for constructing an avatar assistance class for user avatar synchronization, including: creating an avatar auxiliary class avatar image View inherited to the original image display class ImageView, and setting a detection function in the avatar image View, wherein the avatar image View is used for caching the avatar views, each avatar View is bound with a corresponding user identifier userID and an avatar network address showUrl, and a callback for refreshing the avatar View is set; and inserting piles in the key functions of the avatar View for loading pictures, wherein the key functions are used for triggering the avatar View to buffer the avatar View and triggering the detection function to run, so that the detection function determines the corresponding user by detecting the userID corresponding to the avatar View, and therefore all the avatar View of the user is determined in the avatar View buffered by the avatar View and the callback refresh avatar is executed.
In the implementation manner, an avatar auxiliary class avatar auxiliary View inherited from the original image display class ImageView (for caching the avatar views, each avatar View is bound with a corresponding user identifier userID and an avatar network address showUrl, and is provided with a callback for refreshing the avatar View) is created, so that data can be provided; setting a detection function in the avatar imageview, and inserting piles in a key function for loading pictures for the avatar View, triggering the avatar imageview to cache the avatar View, and triggering the detection function to run, so that the detection function determines corresponding users through userIDs corresponding to the avatar View, and determining all the avatar views of the users in the avatar views cached by the avatar imageview and executing callback to refresh the avatar. Therefore, the function of reliably synchronizing the user head images in the APP by the head image auxiliary class for synchronizing the user head images can be simply and conveniently realized.
With reference to the second aspect, in a first possible implementation manner of the second aspect, a container avatar View list is created in the avatar imageview for caching the displayed avatar View.
In a third aspect, an embodiment of the present application provides a user avatar synchronization device, for loading an avatar auxiliary class avatar auxiliary view inherited from an original photo display class ImageView preset in a client, where the device is applied to avatar ImageView, including: the acquisition module is used for acquiring a user identifier and a head portrait network address corresponding to the current user head portrait in the newly loaded display page; the judging module is used for judging whether the target network address of the target user head portrait corresponding to the user mark in the user head portrait list is consistent with the head portrait network address or not based on the user mark and the head portrait network address corresponding to the current user head portrait, wherein the user head portrait list is positioned in the avatar image view and comprises a plurality of user marks in the loaded display page and the network address of the user head portrait corresponding to each user mark; and the head portrait refreshing module is used for caching the current user head portrait when the target network address is inconsistent with the head portrait network address, and refreshing the user head portrait of the loaded display page based on the current user head portrait.
In a fourth aspect, an embodiment of the present application provides a storage medium, where the storage medium includes a stored program, where the program when executed controls a device where the storage medium is located to perform the method for user avatar synchronization according to the first aspect or any one of the possible implementation manners of the first aspect, or perform the method for building an avatar assistance class for user avatar synchronization according to the second aspect or the first possible implementation manner of the second aspect.
In a fifth aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, where the memory is configured to store information including program instructions, and the processor is configured to control execution of the program instructions, where the program instructions when loaded and executed by the processor implement the user avatar synchronization method according to the first aspect or any one of the possible implementations of the first aspect, or implement the method for building an avatar assistance class for user avatar synchronization according to the second aspect or the first possible implementation of the second aspect.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for constructing an auxiliary class of head portraits for user head portraits synchronization according to an embodiment of the present application.
Fig. 2 is a flowchart of a user head portrait synchronization method according to an embodiment of the present application.
Fig. 3 is a schematic diagram of a loaded display page and a newly loaded display page in a client according to an embodiment of the present application.
Fig. 4 is a block diagram of a user head portrait synchronization device according to an embodiment of the present application.
Fig. 5 is a block diagram of an electronic device according to an embodiment of the present application.
Icon: 10-user head portrait synchronization device; 11-an acquisition module; 12, a judging module; 13-an avatar refreshing module; 20-an electronic device; 21-a memory; a 22-communication module; a 23-bus; 24-processor.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
In order to achieve synchronization of user head portraits, the embodiment provides a user head portraits synchronization method to keep consistency of user head portraits in an APP. Because the user head portrait synchronization method provided by the scheme is realized through the preset head portrait auxiliary class avatar image view, in order to facilitate reading and understanding of the scheme, the method for constructing the head portrait auxiliary class for user head portrait synchronization provided by the scheme is introduced.
Referring to fig. 1, fig. 1 is a flowchart of a method for constructing an auxiliary class of head portraits for user head portraits synchronization according to an embodiment of the present application.
In the present embodiment, the method of constructing the avatar assistance class for user avatar synchronization may include step S11 and step S12. It should be noted that, for convenience of description, step S11 and step S12 are described based on the angle of the developer, it is understood that these descriptions may be replaced by the manner described in terms of the computer device, which is within the scope of the present application.
In order to construct the avatar assistance class for user avatar synchronization, step S11 may be performed.
Step S11: creating an avatar auxiliary class avatar image View inherited to the original image display class ImageView, and setting a detection function in the avatar image View, wherein the avatar image View is used for caching the avatar views, each avatar View is bound with a corresponding user identifier userID and an avatar network address showUrl, and a callback for refreshing the avatar View is set.
In this embodiment, since the original image display class ImageView is difficult to meet the requirement of the present scheme in user avatar synchronization, an avatar auxiliary class avatar auxiliary View inherited to ImageView is created for caching the avatar View, for example, a container avatar View list may be created in the avatar ImageView for caching the displayed avatar View.
For example, a detection function may be set within the avatar imageview to detect whether a user avatar has changed. In order to facilitate the detection and the refresh of the user head portraits in the subsequent process, the scheme is bound with a corresponding user identifier userID and a head portrait network address showUrl aiming at each head portrait View, and a callback for refreshing the head portraits View is arranged.
Then, step S12 may be performed.
Step S12: and inserting piles in the key functions of the avatar View for loading pictures, wherein the key functions are used for triggering the avatar View to buffer the avatar View and triggering the detection function to run, so that the detection function determines the corresponding user by detecting the userID corresponding to the avatar View, and therefore all the avatar View of the user is determined in the avatar View buffered by the avatar View and the callback refresh avatar is executed.
In this embodiment, instrumentation may be performed in a key function for loading pictures for an avatar View in the avatar imageview, which is used to trigger the avatar imageview to cache the avatar View, and may trigger the detection function to run.
The detection function can determine the corresponding user by detecting the userID corresponding to the avatar View, so as to determine all the avatars View of the user in the avatarImageView cached avatars View and execute the callback to refresh the avatars.
Here, the construction and functions of the avatar imageview will be described by way of an example, and the implementation of the construction of the key parts of the avatar imageview by Android code is taken as an example:
through this section, creation of a class avatar ImageView inherited from ImageView can be implemented for providing data.
Further:
through this section, the avatar imageview is made available for trigger detection.
Further:
through the part, the deletion function of the avatar of the user of the cache can be realized.
For the implementation of the auxiliary class for controlling the consistency of the user head portrait, the auxiliary class is mainly used for caching the head portrait View and detecting whether the head portrait View needs to reload pictures. The method comprises the following steps:
by the aid of the method, a function of judging whether the head portrait View is changed or not can be achieved, and reloading of the head portrait View can be triggered.
Further, for the caching and clearing of the head portrait View:
by the aid of the part, caching and clearing of the head portrait View can be achieved.
Based on this, by creating an avatar auxiliary class avatar image View inherited from the original tile display class ImageView (for caching the avatar views, each avatar View is bound with a corresponding user identifier userID and avatar network address showUrl, and is provided with a callback for refreshing the avatar View), data can be provided; setting a detection function in the avatar imageview, and inserting piles in a key function for loading pictures for the avatar View, triggering the avatar imageview to cache the avatar View, and triggering the detection function to run, so that the detection function determines corresponding users through userIDs corresponding to the avatar View, and determining all the avatar views of the users in the avatar views cached by the avatar imageview and executing callback to refresh the avatar. Therefore, the function of reliably synchronizing the user head images in the APP by the head image auxiliary class for synchronizing the user head images can be simply and conveniently realized.
After the avatar image view is obtained, the avatar image view can be preset in a client (APP) so as to realize synchronization of the user head portrait in the APP at the client and keep consistency of the user head portrait in the APP.
Based on this, a user avatar synchronization method provided by the present embodiment can be performed. Referring to fig. 2, fig. 2 is a flowchart of a user avatar synchronization method according to an embodiment of the present application, where the user avatar synchronization method is applied to an avatar auxiliary avatar image view (the avatar auxiliary image view is preset in a client, and the client is installed in an electronic device, so that the present embodiment will introduce a scheme using the electronic device as an execution subject, but not limited thereto), and the user avatar synchronization method may include step S21, step S22, and step S23.
In order to realize the synchronization of the user head portraits, the user head portraits synchronization method can be operated when the APP loads a new display page, so that the real-time synchronization of the user head portraits can be realized.
Before executing step S21, the list of user portraits to be involved is presented:
in this embodiment, after the user starts the client, the client opens a user list page first, and this page typically contains information such as head portraits, IDs, etc. of a plurality of different users. Then, the electronic device may pull the user information of each user from the user list page using the avatar image View and cache it into the avatar image View (created container avatar image for caching the displayed avatar View) as a user avatar list. The user information here includes the user identification (userID) of each user and the network address (showUrl) of the user profile. In addition, for each loaded display page, the electronic device may do this, pull user information for each user from the display page and add to the user avatar list.
Therefore, each loaded display page in the APP can be cached, refreshing of the user head portrait is realized in time when the user head portrait is changed, the updated user head portrait can be displayed in the newly loaded display page and updated to the loaded display page in real time, and accordingly tearing feeling of a user in experience is avoided.
Then, the electronic device may execute step S21 when the display page is newly loaded for the client.
Step S21: and acquiring a user identifier and a head portrait network address corresponding to the current user head portrait in the newly loaded display page.
When a client loads a new display page, the electronic device may acquire a user identifier (userID) and a header network address (showUrl) corresponding to a current user header in the newly loaded display page.
After acquiring the user identification and the avatar network address, the electronic device may execute step S22.
Step S22: and judging whether the target network address of the target user head portrait corresponding to the user mark in a user head portrait list is consistent with the head portrait network address or not based on the user mark corresponding to the current user head portrait and the head portrait network address, wherein the user head portrait list is positioned in an avatar image view and comprises a plurality of user marks in a loaded display page and the network address of the user head portrait corresponding to each user mark.
In this embodiment, the electronic device may determine, based on the user identifier and the avatar network address corresponding to the current user avatar, whether the target network address of the target user avatar corresponding to the user identifier in the user avatar list is consistent with the avatar network address.
For example, a target user identifier (which may be performed by a traversal manner) that is consistent with the user identifier corresponding to the current user avatar may be determined from the user avatar list, and then a target network address of the target user avatar corresponding to the target user identifier is compared with the avatar network address to determine whether the target network address is consistent with the avatar network address.
By the method, whether the user head portrait of the newly loaded display page is changed compared with the user head portrait of the loaded display page can be judged efficiently.
When it is determined that one of the target network addresses does not coincide with the avatar network address, it is indicated that the user avatar has been changed, and therefore step S23 may be performed.
Step S23: and caching the current user head portrait, and refreshing the user head portrait of the loaded display page based on the current user head portrait.
In this embodiment, the electronic device may cache the current user avatar, and then refresh the user avatar loaded with the display page based on the current user avatar, so as to achieve synchronization of the user avatar in the client.
The electronic device may add the current user avatar to the avatar image view for caching, determine all target user avatars corresponding to the target user identifier from the cache, and determine all target user avatars by traversing the user avatar list.
The electronic device may then refresh all target user avatars based on the current user avatar (implemented with a callback to refresh the avatar View), loading the current user avatar as the user avatar in each loaded display page. Therefore, timely synchronization of the user head portrait in the client can be completed (the user can open any display page at the client and return to the page which has been opened before, and the user head portrait in the previous display page can be synchronized as well).
And determining all target user head images corresponding to the target user identifications from the cache by using the current user head images cached by the AvatarImageView, and refreshing all target user head images according to the current user head images, so that the updating of the user head images in each loaded display page is simply and efficiently realized.
When it is determined that one target network address is consistent with the avatar network address, it is stated that other target network addresses (network addresses with the same target user identification) are also consistent, because each new page is loaded once, the user avatars in all loaded displayed pages remain consistent, and thus synchronization is not necessary when the user avatars are unchanged. Thus, the traversal process may be ended when traversing to the first target network address and determining that it is consistent with the avatar network address.
Then, step S23 executed at this time, namely, buffering the current user avatar, and adding it to the user avatar list.
After loading the current user avatar as the user avatar in each loaded display page, the electronic device may also clear the user avatar of the display page cached within the avatar imageview from the cache when detecting that the user avatar is moved out of the display page. And when the client exits any display page, the user head portrait of the display page cached in the avatar image view can be cleared from the cache.
Because the newly loaded display page can be consistent with the updated user avatar (because the newly loaded display page will be refreshed), the user avatar of the display page cached in the avatar imageview can be purged from the cache when the client exits any display page. And when the user head portrait is detected to be moved out of the display page, the user head portrait of the display page cached in the avatar imageview can be cleared from the cache. Therefore, the memory occupation of the avatar image view can be reduced, the data quantity detected by the avatar image view when the avatar image synchronization method is operated each time is reduced, and the operation efficiency is improved.
The application of the user avatar synchronization method will be described with a specific example:
referring to fig. 3, fig. 3 is a schematic diagram of a loaded display page and a newly loaded display page in a client according to an embodiment of the present application. The user list page and the private chat page are loaded display pages, and the user data page is a new loaded display page.
The user list page, private chat page, and user profile page all contain user avatars that need to be displayed (the same user, having the same user identification userID, e.g., number 111). Wherein the loaded display page: the user head portrait of the user list page and the private chat page is head portrait a, and the user identification (number 111) of the user and the network address (e.g. uila) of the corresponding user head portrait (head portrait a) are cached in the avatar imageview. And the user profile page is a newly loaded display page, the electronic device may obtain the user's user identification (number 111) and the avatar network address (e.g., uilb) of avatar B.
The electronic device may trigger the operation of the user avatar synchronization method when the user profile page loads the avatar B, thereby determining that the user avatar has been changed. Therefore, the avatar network address (for example, urlA) corresponding to the user identifier (number 111) is traversed by using the avatar cache avatar B, and the user avatar of the user list page and the user avatar of the private chat page are updated by using the preset callback for refreshing the avatar View, so that the avatar network address of the user list page and the avatar of the private chat page is updated to UrlB, and the consistency of the user avatar in the client is realized.
Therefore, the avatar auxiliary type avatar image view is utilized to acquire the user identifier and the avatar network address corresponding to the current user avatar in the newly loaded display page, and judge whether the target network address of the target user avatar corresponding to the user identifier in the user avatar list is consistent with the avatar network address, thereby determining whether the user avatar is changed. And when the user head images are inconsistent, determining that the user head images are changed, and refreshing the user head images of the loaded display pages by using the cached current user head images, so that the target user head images corresponding to the target user identifications in the loaded display pages are refreshed. Therefore, the consistency of the displayed user head portraits in the APP can be maintained, the use experience of the user is improved, the server pressure and cost can not be increased while the consistency of the user head portraits in the APP is maintained, and the APP development and maintenance cost is extremely low.
Referring to fig. 4, fig. 4 is a block diagram illustrating a user head portrait synchronization apparatus 10 according to an embodiment of the present application.
In this embodiment, the loading the avatar auxiliary class avatar image view inherited from the original tile display class image view preset in the client, the user avatar synchronization device 10 is applied to the avatar image view, and may include:
the obtaining module 11 is configured to obtain a user identifier and an avatar network address corresponding to a current user avatar in the newly loaded display page.
The judging module 12 is configured to judge, based on the user identifier and the avatar network address corresponding to the current user avatar, whether the target network address of the target user avatar corresponding to the user identifier in the user avatar list is consistent with the avatar network address, where the user avatar list is located in the avatar image view, and includes a plurality of user identifiers in the loaded display page and network addresses of the user avatars corresponding to each user identifier.
And the head portrait refreshing module 13 is used for caching the current user head portrait when the target network address is inconsistent with the head portrait network address, and refreshing the user head portrait of the loaded display page based on the current user head portrait.
In this embodiment, the client enters a user list page after being started, and the user avatar synchronization device 10 further includes a user avatar list module, configured to pull, from the user list page, user information of each user and cache the user information as the user avatar list before the obtaining module 11 obtains a user identifier and an avatar network address corresponding to a current user avatar in a newly loaded display page, where the user information includes the user identifier of each user and the network address of the user avatar; and pulling user information of each user from each loaded display page and adding the user information to the user head portrait list.
In this embodiment, the determining module 12 is specifically configured to determine, from the user avatar list, a target user identifier that is consistent with a user identifier corresponding to the current user avatar; and comparing the target network address of the target user head portrait corresponding to the target user identifier with the head portrait network address, and judging whether the target network address is consistent with the head portrait network address.
In this embodiment, the avatar refresh module 13 is specifically configured to add the current user avatar into the avatar image view for caching; determining all target user head portraits corresponding to the target user identifications from the cache; and refreshing all target user head images based on the current user head image, so that the current user head image is loaded as the user head image in each loaded display page.
In this embodiment, the user avatar synchronization device 10 further includes a user avatar clearing module, configured to clear, after the avatar refreshing module 13 loads the current user avatar as a user avatar in each loaded display page, when detecting that the user avatar is moved out of the display page, the user avatar of the display page cached in the avatar imageview from the cache; and when the client exits any display page, the user head portrait of the display page cached in the AvatarImageView is cleared from the cache.
Referring to fig. 5, fig. 5 is a block diagram illustrating a structure of an electronic device 20 according to an embodiment of the application.
In this embodiment, the electronic device 20 may be a terminal device such as a personal computer, a tablet computer, a smart phone, etc., which is not limited herein.
By way of example, the electronic device 20 may include: a communication module 22 connected to the outside through a network, one or more processors 24 for executing program instructions, a bus 23, and a different form of memory 21, such as a disk, ROM, or RAM, or any combination thereof. And the electronic device 20 also has a display screen on which the loaded display page can be presented. The memory 21, the communication module 22 and the processor 24 may be connected by a bus 23.
Illustratively, the memory 21 has a program stored therein. The processor 24 may call up and run these programs from the memory 21 so that the user avatar synchronization method or the building method of the avatar assistance class for user avatar synchronization can be implemented by running the programs.
An embodiment of the present application provides a storage medium including a stored program, where when the program runs, a device where the storage medium is controlled to execute a user avatar synchronization method in this embodiment, or execute a method for constructing an avatar assistance class for user avatar synchronization in this embodiment.
In summary, the embodiments of the present application provide a method, an apparatus, a storage medium, and an electronic device for synchronizing a user avatar, which utilize an avatar auxiliary avatar image view to obtain a user identifier and an avatar network address corresponding to a current user avatar in a newly loaded display page, and determine whether a target network address of a target user avatar corresponding to the user identifier in a user avatar list is consistent with the avatar network address, so as to determine whether the user avatar changes. And when the user head images are inconsistent, determining that the user head images are changed, and refreshing the user head images of the loaded display pages by using the cached current user head images, so that the target user head images corresponding to the target user identifications in the loaded display pages are refreshed. Therefore, the consistency of the displayed user head portraits in the APP can be maintained, the use experience of the user is improved, the server pressure and cost can not be increased while the consistency of the user head portraits in the APP is maintained, and the APP development and maintenance cost is extremely low.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The above-described embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be another division manner in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. The utility model provides a user head portrait synchronization method which is characterized in that head portrait auxiliary class avatar image view inherited from original image display class image view preset in a loading client side, and the method is applied to avatar image view and comprises the following steps:
acquiring a user identification and a head portrait network address corresponding to a current user head portrait in a newly loaded display page;
judging whether the target network address of the target user head portrait corresponding to the user mark in a user head portrait list is consistent with the head portrait network address or not based on the user mark and the head portrait network address corresponding to the current user head portrait, wherein the user head portrait list is positioned in an avatar image view and comprises a plurality of user marks in a loaded display page and the network address of the user head portrait corresponding to each user mark;
and if the current user head portraits are inconsistent, caching the current user head portraits, and refreshing the user head portraits of the loaded display pages based on the current user head portraits.
2. The method for synchronizing user's head portraits according to claim 1, wherein the client enters the user list page after being started, and before obtaining the user's identifier and the head portraits network address corresponding to the current user's head portraits in the newly loaded display page, the method further comprises:
pulling user information of each user from the user list page and caching the user information as the user head portrait list, wherein the user information comprises a user identifier of each user and a network address of the user head portrait; the method comprises the steps of,
for each loaded display page, user information of each user is pulled from the loaded display page and added to the user head portrait list.
3. The method according to claim 1, wherein determining whether a target network address of a target user profile corresponding to the user identification in a user profile list is identical to the profile network address based on the user identification and the profile network address corresponding to the current user profile, comprises:
determining a target user identification consistent with the user identification corresponding to the current user head from the user head list;
and comparing the target network address of the target user head portrait corresponding to the target user identifier with the head portrait network address, and judging whether the target network address is consistent with the head portrait network address.
4. A user avatar synchronization method as claimed in claim 3, wherein caching the current user avatar and refreshing the user avatar loaded with a display page based on the current user avatar comprises:
adding the current user head portrait into an avatar ImageView for caching;
determining all target user head portraits corresponding to the target user identifications from the cache;
and refreshing all target user head images based on the current user head image, so that the current user head image is loaded as the user head image in each loaded display page.
5. The user avatar synchronization method of claim 4, wherein after loading the current user avatar as a user avatar in each loaded display page, the method further comprises:
when the situation that the user head portrait is moved out of the display page is detected, the user head portrait of the display page cached in the avatar image view is cleared from the cache;
and when the client exits any display page, the user head portrait of the display page cached in the AvatarImageView is cleared from the cache.
6. A method for building an avatar assistance class for user avatar synchronization, comprising:
creating an avatar auxiliary class avatar image View inherited to the original image display class ImageView, and setting a detection function in the avatar image View, wherein the avatar image View is used for caching the avatar views, each avatar View is bound with a corresponding user identifier userID and an avatar network address showUrl, and a callback for refreshing the avatar View is set;
and inserting piles in the key functions of the avatar View for loading pictures, wherein the key functions are used for triggering the avatar View to buffer the avatar View and triggering the detection function to run, so that the detection function determines the corresponding user by detecting the userID corresponding to the avatar View, and therefore all the avatar View of the user is determined in the avatar View buffered by the avatar View and the callback refresh avatar is executed.
7. The method of claim 6, wherein a container avatar View list is created in the avatar image View for caching the displayed avatar views.
8. The utility model provides a user head portrait synchronization device which is characterized in that head portrait auxiliary class avatar image view inherited from original image display class ImageView preset in a loading client, the device is applied to avatar image view, and the device comprises:
the acquisition module is used for acquiring a user identifier and a head portrait network address corresponding to the current user head portrait in the newly loaded display page;
the judging module is used for judging whether the target network address of the target user head portrait corresponding to the user mark in the user head portrait list is consistent with the head portrait network address or not based on the user mark and the head portrait network address corresponding to the current user head portrait, wherein the user head portrait list is positioned in the avatar image view and comprises a plurality of user marks in the loaded display page and the network address of the user head portrait corresponding to each user mark;
and the head portrait refreshing module is used for caching the current user head portrait when the target network address is inconsistent with the head portrait network address, and refreshing the user head portrait of the loaded display page based on the current user head portrait.
9. A storage medium, wherein the storage medium is provided in a device, the storage medium comprising a stored program, wherein the device in which the storage medium is controlled to execute the user avatar synchronization method of any one of claims 1 to 5 or the building method of the avatar assistance class for user avatar synchronization of any one of claims 6 to 7 when the program is run.
10. An electronic device comprising a memory for storing information including program instructions and a processor for controlling execution of the program instructions, the program instructions when loaded and executed by the processor implementing the user avatar synchronization method of any one of claims 1-5 or implementing the method of building an avatar assistance class for user avatar synchronization of any one of claims 6-7.
CN202111489507.4A 2021-12-07 2021-12-07 User head portrait synchronization method and device, storage medium and electronic equipment Active CN114338709B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111489507.4A CN114338709B (en) 2021-12-07 2021-12-07 User head portrait synchronization method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111489507.4A CN114338709B (en) 2021-12-07 2021-12-07 User head portrait synchronization method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN114338709A CN114338709A (en) 2022-04-12
CN114338709B true CN114338709B (en) 2023-08-29

Family

ID=81050312

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111489507.4A Active CN114338709B (en) 2021-12-07 2021-12-07 User head portrait synchronization method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114338709B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004166279A (en) * 2003-11-11 2004-06-10 Bandai Co Ltd Image distribution system and method thereof
CN103118355A (en) * 2013-01-17 2013-05-22 北京奇虎科技有限公司 Display method of mobile terminal user information, mobile terminals and service system
WO2015043463A1 (en) * 2013-09-27 2015-04-02 Tencent Technology (Shenzhen) Company Limited Synchronizing customized user information
CN105554064A (en) * 2015-12-03 2016-05-04 小米科技有限责任公司 Method and device for setting head portrait
CN107247796A (en) * 2017-06-23 2017-10-13 泰康保险集团股份有限公司 Client's head portrait loading method, device and terminal device
CN107545006A (en) * 2016-06-28 2018-01-05 百度在线网络技术(北京)有限公司 A kind of method, equipment and system for being used to establishing or updating image positional data storehouse
CN109562298A (en) * 2016-06-30 2019-04-02 索尼互动娱乐股份有限公司 Automaticmanual intelligence (AI) personal assistant method
WO2020226785A1 (en) * 2019-05-06 2020-11-12 Apple Inc. Avatar integration with multiple applications
CN111930473A (en) * 2020-09-25 2020-11-13 亮风台(上海)信息科技有限公司 Method and apparatus for deploying image recognition service on container cloud
CN112422407A (en) * 2020-10-27 2021-02-26 广州趣丸网络科技有限公司 Voice room following method, device, equipment and storage medium
CN112965690A (en) * 2020-12-17 2021-06-15 贵阳语玩科技有限公司 UI resource dynamic updating method and device, storage medium and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FI20185300A1 (en) * 2018-03-29 2019-09-30 Ownsurround Ltd An arrangement for generating head related transfer function filters

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004166279A (en) * 2003-11-11 2004-06-10 Bandai Co Ltd Image distribution system and method thereof
CN103118355A (en) * 2013-01-17 2013-05-22 北京奇虎科技有限公司 Display method of mobile terminal user information, mobile terminals and service system
WO2015043463A1 (en) * 2013-09-27 2015-04-02 Tencent Technology (Shenzhen) Company Limited Synchronizing customized user information
CN105554064A (en) * 2015-12-03 2016-05-04 小米科技有限责任公司 Method and device for setting head portrait
CN107545006A (en) * 2016-06-28 2018-01-05 百度在线网络技术(北京)有限公司 A kind of method, equipment and system for being used to establishing or updating image positional data storehouse
CN109562298A (en) * 2016-06-30 2019-04-02 索尼互动娱乐股份有限公司 Automaticmanual intelligence (AI) personal assistant method
CN107247796A (en) * 2017-06-23 2017-10-13 泰康保险集团股份有限公司 Client's head portrait loading method, device and terminal device
WO2020226785A1 (en) * 2019-05-06 2020-11-12 Apple Inc. Avatar integration with multiple applications
CN111930473A (en) * 2020-09-25 2020-11-13 亮风台(上海)信息科技有限公司 Method and apparatus for deploying image recognition service on container cloud
CN112422407A (en) * 2020-10-27 2021-02-26 广州趣丸网络科技有限公司 Voice room following method, device, equipment and storage medium
CN112965690A (en) * 2020-12-17 2021-06-15 贵阳语玩科技有限公司 UI resource dynamic updating method and device, storage medium and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Android平台下快速加载图文信息的研究与实现;王结;魏振钢;;计算机系统应用(第12期);全文 *

Also Published As

Publication number Publication date
CN114338709A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
KR102255138B1 (en) Message processing method and device, storage medium, and computer device
CN110515572B (en) Screen projection method and device, storage medium and computer equipment
CN110515573B (en) Screen projection method, device and system and computer equipment
US20220261129A1 (en) Display controlling method, terminal, information processing apparatus, and storage medium
US8943164B2 (en) Apparatus and methods for retrieving/ downloading content on a communication device
CN110263275A (en) A kind of method, apparatus, mobile terminal and storage medium accessing webpage
CN106168874B (en) webpage-based multimedia message editing method and device
WO2021147414A1 (en) Video message generation method and apparatus, electronic device, and storage medium
WO2021218221A1 (en) Webpage display method and apparatus, and client and storage medium
WO2023087897A1 (en) Page display method and device
CN113157366A (en) Animation playing method and device, electronic equipment and storage medium
CN107707985B (en) Bullet screen control method, mobile terminal and server
CN113868575A (en) Webpage same-screen method and system
CN114338709B (en) User head portrait synchronization method and device, storage medium and electronic equipment
JP2010182074A (en) File sharing system, file sharing method and its program
CN110971974B (en) Configuration parameter creating method, device, terminal and storage medium
US20150149586A1 (en) Information processing apparatus, information processing method, and information processing system
US9942287B2 (en) Information processing system, terminal device, and method
CN113254753B (en) Page rollback method, device, electronic equipment and storage medium
CN110704157B (en) Application starting method, related device and medium
CN114090925A (en) Switching method and device of visual theme, electronic equipment and storage medium
CN114519155A (en) Data processing method, device, client and storage medium
CN113568687A (en) Method for displaying Web page, related equipment and computer readable storage medium
CN112861041B (en) Media content display method and device, electronic equipment and storage medium
CN114970449B (en) Font processing method applied to on-screen communication

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
GR01 Patent grant
GR01 Patent grant