Summary of the invention
Because in this, the embodiment of the present invention provides a kind of starting method and device of application software homepage, can accelerate the displaying of application software homepage.
On the one hand, the embodiment of the present invention provides a kind of starting method of application software homepage, comprising:
Receive the instruction that starts application software;
Create the main thread of described application software;
By described main thread, according to predefined order, the assembly of the user interface of described application software is carried out to initialization.
Alternatively, by described main thread, according to predefined order, the assembly of the user interface of described application software is carried out to initialization and comprise: by described main thread, according to predefined order, first user interface assembly is carried out to initialization; After the initialization of described first user interface assembly completes, the second user interface components is carried out to initialization.
Alternatively, described predefined order comprises: the initialization order of the assembly of the user interface by the predefined described application software of ViewStub.
Alternatively, after the main thread of the described application software of described establishment, also comprise: by described main thread, be that described application software creates an asynchronous thread; By described asynchronous thread, load the needed data of described application software; After described data have been loaded, described asynchronous thread notifies described main thread to carry out initialization to the user interface of described application software.
Alternatively, describedly by described asynchronous thread, load the needed data of described application software and comprise: by described asynchronous thread, the priority of needed data, loads the needed data of institute's application software successively when starting described application software.
Alternatively, described application software is browser.
The starting method of the application software homepage of the embodiment of the present invention, by the main thread of this application software, according to predefined order, the assembly of the user interface of this application software is carried out to initialization, like this, avoided because of the synchronous initiation to the assembly of the user interface of this application software, and the initialization time causing is long, thereby can accelerates the displaying of application software homepage.
On the other hand, the embodiment of the present invention provides a kind of starter gear of application software homepage, comprising:
Receiving element, for receiving the instruction that starts application software;
The first creating unit, for creating the main thread of described application software;
Initialization unit, for by described main thread, according to predefined order, carries out initialization to the assembly of the user interface of described application software.
Alternatively, described initialization unit comprises: the first initialization module, for by described main thread, according to predefined order, carries out initialization to first user interface assembly; The second initialization module, after initialization completes to described first user interface assembly at described the first initialization module, carries out initialization to the second user interface components.
Alternatively, described predefined order comprises: the initialization order of the assembly of the user interface by the predefined described application software of ViewStub.
Alternatively, the starter gear of described application software homepage also comprises: the second creating unit, for by described main thread being an asynchronous thread of described application software establishment; Data loading unit, for loading the needed data of described application software by described asynchronous thread; Notification unit, for after described data have been loaded, notifies described initialization unit to carry out initialization to the user interface of described application software; Described initialization unit, also for carrying out initialization according to the data of described loading to the user interface of described application software.
Alternatively, the starter gear of described application software homepage also comprises: Loading Control unit, for passing through described asynchronous thread, during according to the described application software of startup, the priority of needed data, controls described data loading unit and loads successively the needed data of institute's application software.
Alternatively, described application software is browser.
The starter gear of the application software homepage of the embodiment of the present invention, initialization unit is by the main thread of this application software, according to predefined order, the assembly of the user interface of this application software is carried out to initialization, avoided like this because of the synchronous initiation to the assembly of the user interface of this application software, and the initialization time causing is long, thereby can accelerate the displaying of application software homepage.
Embodiment
Below in conjunction with accompanying drawing, starting method and the starter gear of a kind of application software homepage of the embodiment of the present invention are described in detail.
Should be clear and definite, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making all other embodiment that obtain under creative work prerequisite, belong to the scope of protection of the invention.
Shown in Fig. 1, the embodiment of the starting method of a kind of application software homepage of the present invention, comprising:
S1, reception start the instruction of application software;
Instruction according to the startup application software receiving, can start described application software.
S2, create the main thread of described application software;
When starting described application software, create the main thread of described application software.
S3, by described main thread, according to predefined order, the assembly of the user interface of described application software is carried out to initialization.
The starting method of the application software homepage of the embodiment of the present invention, by the main thread of this application software, according to predefined order, the assembly of the user interface of this application software is carried out to initialization, avoided like this because of the synchronous initiation to the assembly of the user interface of this application software, and the initialization time causing is long, thereby can accelerate the displaying of application software homepage.
In the present embodiment, the assembly of described user interface can be address field, the title block of above-mentioned application software, menu bar, toolbar, window, back/forward button or bookmark directory etc.
In the embodiment of the starting method of aforementioned applications software home page, alternatively, as shown in Figure 2, by described main thread, according to predefined order, the assembly of the user interface of described application software is carried out to initialization (S3), can comprise:
S31, by described main thread, according to predefined order, first user interface assembly is carried out to initialization; S32, after the initialization of described first user interface assembly completes, the second user interface components is carried out to initialization.
Preferably, described first user interface assembly can be the family interface assembly of required loading while starting described application software, and the second user interface components is the family interface assembly that described user interface loads as required after startup.Or above-mentioned first user interface assembly can be for showing the assembly of the user interface that the homepage of described application software need to load; Above-mentioned the second user interface components can be the assembly of the user interface that need to not show in the homepage of described application software.
For example, the preferential initialization user interface components relevant to the homepage of this application software, after homepage loads and is over, if user passes through slide, make the user interface of application software be switched to another page, again the user interface components relevant to this page carried out to initialization.
Like this, avoided the loading of the disposable all user interface components that complete this application software and load time of causing long, thereby accelerated the displaying of application software homepage.
In the embodiment of the starting method of aforementioned applications software home page, alternatively, the predefined order in described S3 or S31, can be the initialization order of the assembly of the user interface by the predefined described application software of ViewStub.
In the present embodiment, ViewStub can be a view object.It can be controlled in the user interface of application software to show which kind of layout, and the layout of user interface is to organize by the assembly of user interface.Therefore, in an embodiment of the present invention, can to the assembly of the user interface of this application software, divide into groups in advance, and encapsulate by ViewStub; The layout order showing according to ViewStub, the assembly of the corresponding user interface of initialization, thus realized the asynchronously initializing of assembly of the user interface of this application program, accelerated the displaying of application software homepage.
In the embodiment of the starting method of aforementioned applications software home page, alternatively, as shown in Figure 3, the main thread (S2) of the described application software of described establishment afterwards, can also comprise:
S2A, be that described application software creates an asynchronous thread;
S2B, by described asynchronous thread, load the needed data of described application software;
In the embodiment of the present invention, the needed data of this application software comprise picture and/or the database data resource of these application software homepage needs.
S2C, after described data have been loaded, described asynchronous thread notifies described main thread to carry out initialization to the user interface of described application software.
In the present embodiment, only create an asynchronous thread and load the needed data of described application software, can on the basis of asynchronously initializing user interface components, avoid between a plurality of asynchronous threads, switching brought time loss like this, further reduced the start-up time of application software.
In the embodiment of the starting method of aforementioned applications software home page, alternatively, describedly by described asynchronous thread, load the needed data of described application software (S2B), can comprise:
By described asynchronous thread, during according to the described application software of startup, the priority of needed data, loads the needed data of institute's application software successively.
In the present embodiment, create after an asynchronous thread, the data that need during this application software of startup detach to be out put on this asynchronous thread to be carried out according to the priority orders of data, for example, the data that need described in preferential this application software homepage of loading displaying, thus the homepage of quickening application software is shown.
Shown in Fig. 4, the embodiment of the starter gear of a kind of application software homepage of the present invention, comprising: receiving element 1, for receiving the instruction that starts application software; The first creating unit 2, for creating the main thread of described application software; Initialization unit 3, for by described main thread, according to predefined order, carries out initialization to the assembly of the user interface of described application software.
The starter gear of the application software homepage of the embodiment of the present invention, initialization unit 3 is by the main thread of this application software, according to predefined order, the assembly of the user interface of this application software is carried out to initialization, avoided like this because of the synchronous initiation to the assembly of the user interface of this application software, and the initialization time causing is long, thereby can accelerate the displaying of application software homepage.
In the present embodiment, the assembly of described user interface can be address field, the title block of above-mentioned application software, menu bar, toolbar, window, back/forward button or bookmark directory etc.
Shown in Fig. 5, in the embodiment of the starter gear of aforementioned applications software home page, described initialization unit 3, can comprise: the first initialization module 31, for by described main thread, according to predefined order, first user interface assembly is carried out to initialization; The second initialization module 32, after completing in the initialization of 31 pairs of described first user interface assemblies of described the first initialization module, carries out initialization to the second user interface components.
Preferably, described first user interface assembly can be the family interface assembly of required loading while starting described application software, and the second user interface components is the family interface assembly that described user interface loads as required after startup.Or above-mentioned first user interface assembly can be for showing the assembly of the user interface that the homepage of described application software need to load; Above-mentioned the second user interface components can be the assembly of the user interface that need to not show in the homepage of described application software.
For example, the preferential initialization user interface components relevant to the homepage of this application software, after homepage loads and is over, if user passes through slide, make the user interface of application software be switched to another page, again the user interface components relevant to this page carried out to initialization.
Like this, avoided the loading of the disposable all user interface components that complete this application software and load time of causing long, thereby accelerated the displaying of application software homepage.
Shown in Fig. 6, in the embodiment of the starter gear of aforementioned applications software home page, alternatively, described predefined order, can comprise: the initialization order of the assembly of the user interface by the predefined described application software of ViewStub.
In the present embodiment, ViewStub can be a view object.It can be controlled in the user interface of application software to show which kind of layout, and the layout of user interface is to organize by the assembly of user interface.Therefore, in an embodiment of the present invention, can to the user interface components of this application software, divide into groups in advance, and encapsulate by ViewStub; The layout order showing according to ViewStub, the assembly of corresponding this user interface of initialization, thus realized the asynchronously initializing of assembly of the user interface of this application program, accelerated the displaying of application software homepage.
In the embodiment of the starter gear of aforementioned applications software home page, alternatively, the starter gear of described application software homepage, can also comprise: the second creating unit 4, for being that described application software creates an asynchronous thread by described main thread; Data loading unit 5, for loading the needed data of described application software by described asynchronous thread; In the embodiment of the present invention, the needed data of this application software comprise picture and/or the database data resource of these application software homepage needs.Notification unit 6, for after described data have been loaded, the user interface of 3 pairs of described application software of notice initialization unit is carried out initialization; Initialization unit 3, also for carrying out initialization according to the data of described loading to the user interface of described application software.
In the present embodiment, only create an asynchronous thread and load the needed data of described application software, can on the basis of asynchronously initializing user interface components, avoid switching brought time loss between a plurality of asynchronous threads like this, further reduced the start-up time of application software.
In the embodiment of the starter gear of aforementioned applications software home page, alternatively, the starter gear of described application software homepage, can also comprise: Loading Control unit 7, for passing through described asynchronous thread, during according to the described application software of startup, the priority of needed data, controls described data loading unit 5 and loads successively the needed data of institute's application software.
In the present embodiment, create after an asynchronous thread, the data that need during this application software of startup detach to be out put on this asynchronous thread to be carried out according to the priority orders of data, for example, the data that need described in preferential this application software homepage of loading displaying, thus the homepage of quickening application software is shown.
Starting method and the starter gear of the application software homepage described in the embodiment of the present invention, be applicable to the startup of browser homepage, but the invention is not restricted to this, also applicable to other application software.
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method, to come the hardware that instruction is relevant to complete by computer program, described program can be stored in a computer read/write memory medium, this program, when carrying out, can comprise as the flow process of the embodiment of above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or random store-memory body (RandomAccess Memory, RAM) etc.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claim.