Summary of the invention
In view of the above problems, the present invention has been proposed, in order to the method and apparatus of webpage convergent-divergent on a kind of electronic equipment that overcomes the problems referred to above or address the above problem at least in part is provided.
According to one aspect of the present invention, the method for webpage convergent-divergent on a kind of electronic equipment is provided, may further comprise the steps: obtain original convergent-divergent handler object; Generate the object of inheriting convergent-divergent processor class, described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object; Utilize described customization convergent-divergent handler object to replace original convergent-divergent handler object; After detecting zoom operations, described customization convergent-divergent handler object is operated, comprise convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, wherein in the convergent-divergent Method Of Accomplishment, webpage literal scaling is set to the demonstration scaling of web displaying control, and carries out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object.
Alternatively, on electronic equipment according to an embodiment of the invention in the method for webpage convergent-divergent, the step that described webpage literal scaling is set to the demonstration scaling of web displaying control comprises: be Android2.3.x or more under the situation of older version in the operating system of electronic equipment, reflection literal scaling object from described web displaying control, and give described literal scaling object with the value of the demonstration scaling of web displaying control; Perhaps the operating system at electronic equipment is Android4.0 or upgrades under the situation of version, reflection literal scaling object from described convergent-divergent manager object, and give described literal scaling object with the value of the demonstration scaling of web displaying control.
Alternatively, the method for webpage convergent-divergent also comprises on the electronic equipment according to an embodiment of the invention: in the convergent-divergent process approach, carry out the convergent-divergent process approach of described original convergent-divergent handler object.
Alternatively, the method for webpage convergent-divergent also comprises on the electronic equipment according to an embodiment of the invention: in the convergent-divergent start method, forbid convergent-divergent and drag simultaneously carrying out, and carry out the convergent-divergent start method of described original convergent-divergent handler object.
Alternatively, on electronic equipment according to an embodiment of the invention in the method for webpage convergent-divergent, in the described step of obtaining original convergent-divergent handler object, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment, reflection and obtain the zoom detector object from the web displaying control, and reflection and obtain original convergent-divergent handler object from described zoom detector object; Perhaps the operating system at electronic equipment is Android4.0 or upgrades under the situation of version, reflection and obtain the convergent-divergent manager object from the web displaying control, reflection and obtain the zoom detector object from described convergent-divergent manager object, and reflection and obtain original convergent-divergent handler object from described zoom detector object.
Alternatively, on electronic equipment according to an embodiment of the invention in the method for webpage convergent-divergent, the WebView control that described web displaying control is the Android system, described convergent-divergent manager object is the mZoomManager object, described convergent-divergent handler object is the mListener object, described convergent-divergent processor class is the OnScaleGestureListener class, described literal scaling is to liking the mTextWrapScale object, described zoom detector is to liking mScaleDetector object, described convergent-divergent start method, the convergent-divergent process approach, the convergent-divergent Method Of Accomplishment is respectively the onScaleBegin method of mListener object, the onScale method, the onScaleEnd method.
According to another aspect of the present invention, the device of webpage convergent-divergent on a kind of electronic equipment is provided, comprising: original convergent-divergent handler object acquisition module is suitable for obtaining original convergent-divergent handler object; Customization convergent-divergent handler object makes up module, is suitable for generating the object of inheriting convergent-divergent processor class, described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object; Replace module, be suitable for utilizing described customization convergent-divergent handler object to replace original convergent-divergent handler object; The zoom operations module, be suitable for after detecting zoom operations, utilize described customization convergent-divergent handler object to operate, comprise convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, wherein in the convergent-divergent Method Of Accomplishment, zoom operations module webpage literal scaling is set to the demonstration scaling of web displaying control, and carries out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object.
Alternatively, on electronic equipment according to an embodiment of the invention in the device of webpage convergent-divergent, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment, described zoom operations module is suitable for from described web displaying control reflection literal scaling object, and gives described literal scaling object with the value of the demonstration scaling of web displaying control; Perhaps the operating system at electronic equipment is Android4.0 or upgrades under the situation of version, described zoom operations module is suitable for from described convergent-divergent manager object reflection literal scaling object, and gives described literal scaling object with the value of the demonstration scaling of web displaying control.
Alternatively, in the method for webpage convergent-divergent, described zoom operations module is suitable in the convergent-divergent process approach, carries out the convergent-divergent process approach of described original convergent-divergent handler object on electronic equipment according to an embodiment of the invention.
Alternatively, on electronic equipment according to an embodiment of the invention in the method for webpage convergent-divergent, described zoom operations module is suitable in the convergent-divergent start method, forbids convergent-divergent and drags simultaneously carrying out, and carry out the convergent-divergent start method of described original convergent-divergent handler object.
Alternatively, on electronic equipment according to an embodiment of the invention in the method for webpage convergent-divergent, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment, described original convergent-divergent handler object acquisition module is suitable for from the web displaying control reflection and obtains the zoom detector object, and reflection and obtain original convergent-divergent handler object from described zoom detector object; Perhaps the operating system at electronic equipment is Android4.0 or upgrades under the situation of version, described original convergent-divergent handler object acquisition module is suitable for reflecting and obtaining the convergent-divergent manager object from the web displaying control, reflection and obtain the zoom detector object from described convergent-divergent manager object, and reflection and obtain original convergent-divergent handler object from described zoom detector object.
Alternatively, on electronic equipment according to an embodiment of the invention in the method for webpage convergent-divergent, the WebView control that described web displaying control is the Android system, described convergent-divergent manager object is the mZoomManager object, described convergent-divergent handler object is the mListener object, described convergent-divergent processor class is the OnScaleGestureListener class, described literal scaling is to liking the mTextWrapScale object, described zoom detector is to liking mScaleDetector object, described convergent-divergent start method, the convergent-divergent process approach, the convergent-divergent Method Of Accomplishment is respectively the onScaleBegin method of mListener object, the onScale method, the onScaleEnd method.
The invention provides the method and apparatus of webpage convergent-divergent on the above-mentioned electronic equipment.According to embodiments of the invention, can utilize customization convergent-divergent handler object to replace original convergent-divergent handler object, and in the convergent-divergent Method Of Accomplishment, webpage literal scaling is set to the demonstration scaling of web displaying control, thereby under the prerequisite of the kernel component of not revising browser or other page display routine (as the WebKit assembly of Android system), realize setting type, to make the content tiling to the function of whole screen again behind the page zoom-in and zoom-out, solved can't the display part content because of amplification problem.Simultaneously, according to embodiments of the invention, can take full advantage of the new features that the operating system of redaction is brought, for example utilize the function of hardware acceleration of Android4.0 and renewal version, scaling speed can be significantly improved, the new features such as senior web page browsing feature of Android4.0 and renewal version can also be utilized.In addition, owing to do not need to revise the kernel component of browser or other page display routine, save the storage space of electronic equipment, also avoided revising the risk that the browser kernel component is brought simultaneously.
Above-mentioned explanation only is the general introduction of technical solution of the present invention, for can clearer understanding technological means of the present invention, and can be implemented according to the content of instructions, and for above and other objects of the present invention, feature and advantage can be become apparent, below especially exemplified by the specific embodiment of the present invention.
Embodiment
Exemplary embodiment of the present disclosure is described below with reference to accompanying drawings in more detail.Though shown exemplary embodiment of the present disclosure in the accompanying drawing, yet should be appreciated that and to realize the disclosure and the embodiment that should do not set forth limits here with various forms.On the contrary, it is in order to understand the disclosure more thoroughly that these embodiment are provided, and can with the scope of the present disclosure complete convey to those skilled in the art.
Fig. 3 schematically illustrates the process flow diagram of the method 300 of webpage convergent-divergent on the electronic equipment according to an embodiment of the invention.
Principle of the present invention is applicable to any electronic equipment that comprises display unit, including, but not limited to: based on the computing machine of desktop operating systems such as Windows, Linux, Mac OS, Unix; Based on the mobile phone of Mobile operating systems such as iOS, Android, Windows Phone, Symbian, panel computer, video player, electronic reader, digital album (digital photo frame) etc.Hereinafter, will be example with the electronic equipment based on the Android system, principle of the present invention is exemplarily described.Yet just in order to describe the present invention with concrete example, to help reader understanding's principle of the present invention, scope of the present invention is not limited thereto for this, but go for anyly comprising display unit, based on the electronic equipment of any operating system.
In the following description, " convergent-divergent " all refers to " dwindle or amplify ".
According to embodiments of the invention, web page contents not only can comprise word content, also can comprise other contents such as picture, video.
As shown in Figure 3, the method 300 of webpage convergent-divergent starts from step S301 on the electronic equipment according to an embodiment of the invention, in step S301, obtains original convergent-divergent handler object.
According to embodiments of the invention, the operating system of electronic equipment be Android2.3.x(for example, Android2.3.7) or more under the situation of older version, can from the web displaying control, reflect and obtain the zoom detector object, and reflection and obtain original convergent-divergent handler object from described zoom detector object.According to embodiments of the invention, described web displaying control for example can be the WebView control of Android system, scope of the present invention is not limited thereto, and the web displaying control can be any control that can realize the web displaying function, for example UIWebView control of iOS system etc.Alternatively, for the Android system, described convergent-divergent handler object can be the mListener object, described zoom detector object can be the mScaleDetector object, it belongs to the ScaleGestureDetector class, certainly, these just are used for the illustration example the principles of the invention, and scope of the present invention is not limited thereto.
According to embodiments of the invention, described convergent-divergent handler object is the module of calling when carrying out zoom operations at a certain control, convergent-divergent handler object-the mListener of Android system is to liking the object of convergent-divergent processor class-OnScaleGestureListener class, it comprises convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, for the mListener object, they are respectively onScaleBegin method, onScale method and onScaleEnd method.The scene of utilizing two fingers to carry out convergent-divergent in the touch screen of electronic equipment with the user is example, when the user prepares twoly when referring to convergent-divergent, also namely when the user puts down two fingers and begins to drag, calls the convergent-divergent start method of convergent-divergent handler object; In the process of user's convergent-divergent, call the convergent-divergent process approach of convergent-divergent handler object; Unclamp at least one finger in two the finger the user, when the indication convergent-divergent is finished, call the convergent-divergent Method Of Accomplishment of convergent-divergent handler object.Each supports the control of convergent-divergent can realize one's own convergent-divergent handler object, and the WebView control namely is one.
In addition, for reflective operation, the reflex mechanism that can adopt Java language .Net language etc. to provide is operated, and method or object is become publicly-owned attribute from privately owned attribute temporarily, for directly using and revising.It will be appreciated by those skilled in the art that the programming language that can adopt other equally, in a similar manner method or object are become publicly-owned attribute from privately owned attribute temporarily, to reach the purpose of reflective operation.
For the Android system, can be by obtaining the version number that the Build.VERSION.SDK_INT object obtains the Android system.
According to embodiments of the invention, operating system at electronic equipment is Android4.0 or upgrades under the situation of version, can from the web displaying control, reflect and obtain the convergent-divergent manager object, reflection and obtain the zoom detector object from described convergent-divergent manager object, and reflection and obtain original convergent-divergent handler object from described zoom detector object.Wherein, for the Android system, described convergent-divergent manager object can be the mZoomManager object, this object can be called by the WebView control directly or indirectly, so just can be with zoom operations from just detaching out the complex Web View control very much originally, become comparatively independently module, and used by WebView control (even other control).Wherein, at Android2.3.x or more in the older version, this java class is exactly the WebView control class, i.e. the WebView class; And at Android3.0 and later version, this object be the WebView control the object of a java class directly using, i.e. the object of ZoomManager class.
After step S301, execution in step S303 wherein, generates the object of inheriting convergent-divergent processor class, described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object.Afterwards, execution in step S305 wherein, utilizes described customization convergent-divergent handler object to replace original convergent-divergent handler object.
According to embodiments of the invention, in step S303, can generate an object, it is inherited convergent-divergent processor class, in the Android system, convergent-divergent processor class is the OnScaleGestureListener class, like this, this object just can be realized its oneself convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, then, needs described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object, like this, after using customization convergent-divergent handler object, original convergent-divergent handler object of all right calling system.In step S305, to utilize after described customization convergent-divergent handler object replaces original convergent-divergent handler object, the value of can variable " whether supporting the convergent-divergent handler object " is set to true.
After step S305, execution in step S307, wherein, after detecting zoom operations, described customization convergent-divergent handler object is operated, and comprises convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, wherein in the convergent-divergent Method Of Accomplishment, webpage literal scaling is set to the demonstration scaling of web displaying control, and carries out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object.
According to embodiments of the invention, webpage literal scaling in step S307 is set in the step of demonstration scaling of web displaying control, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment, reflection literal scaling object from described web displaying control, and give described literal scaling object with the value of the demonstration scaling of web displaying control; And be Android4.0 or upgrade under the situation of version in the operating system of electronic equipment, reflection literal scaling object from described convergent-divergent manager object, and give described literal scaling object with the value of the demonstration scaling of web displaying control.
According to embodiments of the invention, in the Android system, described literal scaling is to liking the mTextWrapScale object.Give described literal scaling object with the demonstration scaling of web displaying control, that is, make the value of the literal scaling of literal scaling object equal the value of the demonstration scaling of web displaying control.Wherein, the literal scaling refers to " web width "/" textwidth ", shows that scaling refers to " web width "/" screen width ".When the value of literal scaling equaled to show the value of scaling, textwidth just equaled web width, and the text just can full screen display.For instance, if the literal scaling is 2, and the demonstration scaling of WebView control is 1, and the ratio of the shared screen of expression literal is 1/2; And if the displaying ratio of WebView control and literal scaling are 1, represent that then the shared screen proportion of literal is 1/1, also be full screen display.In addition, even the user in use shifts out screen by touch operation slip screen with word segment and (for example slides into the rightmost side, all shift out screen up to literal), because the literal scaling does not change, so when the user slides literal return by touch operation, in case when the left frame of literal alignd with the left frame of electronic equipment screen, then literal must be paved with full frame.
According to embodiments of the invention, the method 300 of webpage convergent-divergent can also may further comprise the steps on the described electronic equipment: in the convergent-divergent start method of step S307, forbid convergent-divergent and drag simultaneously carrying out, and carry out the convergent-divergent start method of described original convergent-divergent handler object.Wherein, operating system at electronic equipment is Android2.3.x or upgrades under the situation of version, obtain mAllowPanAndScale object in the described convergent-divergent manager object by reflection, and the value of described mAllowPanAndScale object is set to false.The mAllowPanAndScale object is used for representing whether to allow to change the central point of convergent-divergent, for example in the process of two finger convergent-divergents, drag two the finger, then can mobile whole contents, its value is made as false represents to forbid this function, can guarantee can not deflect in the convergent-divergent process.
According to embodiments of the invention, the method 300 of webpage convergent-divergent can also may further comprise the steps on the described electronic equipment: in the convergent-divergent process approach of step S307, carry out the convergent-divergent process approach of described original convergent-divergent handler object.
According to embodiments of the invention, the method 300 of webpage convergent-divergent can also may further comprise the steps on the described electronic equipment: in the convergent-divergent Method Of Accomplishment of step S307, judge whether to support zoom function.
Fig. 4 schematically shows the process flow diagram of convergent-divergent Method Of Accomplishment according to an embodiment of the invention, is described for each optional step in the convergent-divergent Method Of Accomplishment below in conjunction with Fig. 4.
As shown in Figure 4, alternatively, this judges whether to support the step of zoom function to realize in the following way: can obtain the WebView control " whether supporting convergent-divergent " variable in the module (the WebSettings object in the Android system) is set, this variable is Boolean, if true then expresses support for, proceed next step judgement, if false, then zoom function is not supported in expression.Then, reflection " the minimum zoom ratio of current web page " object and " the maximum zoom ratio of current web page " object obtain operation to finish from the convergent-divergent manager object, and they are respectively mMinZoomScale object and mMaxZoomScale object in the Android system.Generally, in the source code (invisible to the user) of webpage, understand the scaling scope that some is used for informing this webpage, this value is generally underground, so need obtain by reflection; Then, whether the value that can compare " the minimum zoom ratio of current web page " object equates with the value of " the maximum zoom ratio of current web page " object, if equate, then directly return false, represent that this webpage do not support zoom function, if unequal, then return true, the value of expression " whether supporting zoom function " variable is true, and this webpage is supported zoom function.
Do not support at webpage under the situation of zoom function, can directly carry out the convergent-divergent Method Of Accomplishment of original convergent-divergent handler object.
Support at webpage to determine the version of Android system under the situation of zoom function.
As shown in Figure 4, be 4.0 or upgrade under the situation of version in the Android system, the reflex mechanism that provides by Java obtains " whether animation is arranged during convergent-divergent " object (being the mPinchToZoomAnimating object in the Android system) in the convergent-divergent manager object, the value of this object is Boolean, if its value is false, then can directly carry out the convergent-divergent Method Of Accomplishment of original convergent-divergent handler object; If its value is then carried out the step that webpage literal scaling is set to the demonstration scaling of web displaying control, and is carried out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object for true.
As shown in Figure 4, be 2.3.x or more under the situation of older version, reflection " whether preview zooming effect " object obtains operation to finish from the convergent-divergent manager object in the Android system, this object is the mPreviewZoomOnly object in the Android system.If the value of this object is true, then carries out the step that webpage literal scaling is set to the demonstration scaling of web displaying control, and carry out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object; If the value of this object is false, then directly carry out the convergent-divergent Method Of Accomplishment of original convergent-divergent handler object.
The invention provides the method for webpage convergent-divergent on a kind of electronic equipment.According to embodiments of the invention, can utilize customization convergent-divergent handler object to replace original convergent-divergent handler object, and in the convergent-divergent Method Of Accomplishment, webpage literal scaling is set to the demonstration scaling of web displaying control, thereby under the prerequisite of the kernel component of not revising browser or other page display routine (as the WebKit assembly of Android system), realize setting type, to make the content tiling to the function of whole screen again behind the page zoom-in and zoom-out, solved can't the display part content because of amplification problem.Simultaneously, according to embodiments of the invention, can take full advantage of the new features that the operating system of redaction is brought, for example utilize the function of hardware acceleration of Android4.0 and renewal version, scaling speed can be significantly improved, the new features such as senior web page browsing feature of Android4.0 and renewal version can also be utilized.In addition, owing to do not need to revise the kernel component of browser or other page display routine, save the storage space of electronic equipment, also avoided revising the risk that the browser kernel component is brought simultaneously.
Corresponding with above-mentioned method 300, the present invention also provides the device 500 of webpage convergent-divergent on a kind of electronic equipment.Fig. 5 schematically illustrates the block diagram of the device 500 of webpage convergent-divergent on the electronic equipment according to an embodiment of the invention.
Referring to Fig. 5, the device 500 of webpage convergent-divergent comprises that original convergent-divergent handler object acquisition module 501, customization convergent-divergent handler object make up module 503, replace module 505, zoom operations module 507 on the described electronic equipment.
According to embodiments of the invention, original convergent-divergent handler object acquisition module 501 is suitable for obtaining original convergent-divergent handler object; Customization convergent-divergent handler object makes up module 503 and is suitable for generating the object of inheriting convergent-divergent processor class, described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object; Replacing module 505 is suitable for utilizing described customization convergent-divergent handler object to replace original convergent-divergent handler object; Zoom operations module 507 is suitable for after detecting zoom operations, utilize described customization convergent-divergent handler object to operate, comprise convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, wherein in the convergent-divergent Method Of Accomplishment, webpage literal scaling is set to the demonstration scaling of web displaying control, and carries out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object.
According to embodiments of the invention, at first, original convergent-divergent handler object acquisition module 501 obtains original convergent-divergent handler object.
According to embodiments of the invention, the operating system of electronic equipment be Android2.3.x(for example, Android2.3.7) or more under the situation of older version, original convergent-divergent handler object acquisition module 501 can reflect from the web displaying control and obtain the zoom detector object, and reflection and obtain original convergent-divergent handler object from described zoom detector object.According to embodiments of the invention, described web displaying control for example can be the WebView control of Android system, scope of the present invention is not limited thereto, and the web displaying control can be any control that can realize the web displaying function, for example UIWebView control of iOS system etc.Alternatively, for the Android system, described convergent-divergent handler object can be the mListener object, described zoom detector object can be the mScaleDetector object, it belongs to the ScaleGestestureDetector class, certainly, these just are used for the illustration example the principles of the invention, and scope of the present invention is not limited thereto.
According to embodiments of the invention, described convergent-divergent handler object is the module of calling when carrying out zoom operations at a certain control, convergent-divergent handler object-the mListener of Android system is to liking the object of convergent-divergent processor class-OnScaleGestureListener class, it comprises convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, for the mListener object, they are respectively onScaleBegin method, onScale method and onScaleEnd method.The scene of utilizing two fingers to carry out convergent-divergent in the touch screen of electronic equipment with the user is example, when the user prepares two when referring to convergent-divergent, also namely put down two refer to and when beginning to drag, zoom operations module 507 is called the convergent-divergent start method of convergent-divergent handler object as the user; In the process of user's convergent-divergent, zoom operations module 507 is called the convergent-divergent process approach of convergent-divergent handler object; Unclamp at least one finger in two the finger the user, when the indication convergent-divergent was finished, zoom operations module 507 was called the convergent-divergent Method Of Accomplishment of convergent-divergent handler object.Each supports the control of convergent-divergent can realize one's own convergent-divergent handler object, and the WebView control namely is one.
In addition, for reflective operation, the reflex mechanism that original convergent-divergent handler object acquisition module 501 can adopt Java language .Net language etc. to provide is operated, and method or object is become publicly-owned attribute from privately owned attribute temporarily, for directly using and revising.It will be appreciated by those skilled in the art that the programming language that can adopt other equally, in a similar manner method or object are become publicly-owned attribute from privately owned attribute temporarily, to reach the purpose of reflective operation.
For the Android system, original convergent-divergent handler object acquisition module 501 can be by obtaining the version number that the Build.VERSION.SDK_INT object obtains the Android system.
According to embodiments of the invention, operating system at electronic equipment is Android4.0 or upgrades under the situation of version, original convergent-divergent handler object acquisition module 501 can reflect and obtain the convergent-divergent manager object from the web displaying control, reflection and obtain the zoom detector object from described convergent-divergent manager object, and reflection and obtain original convergent-divergent handler object from described zoom detector object.Wherein, for the Android system, described convergent-divergent manager object can be the mZoomManager object, this object can be called by the WebView control directly or indirectly, so just can be with zoom operations from just detaching out the complex Web View control very much originally, become comparatively independently module, and used by WebView control (even other control).Wherein, at Android2.3.x or more in the older version, this java class is exactly the WebView control class, i.e. the WebView class; And at Android3.0 and later version, this object be the WebView control the object of a java class directly using, i.e. the object of ZoomManager class.
Subsequently, customization convergent-divergent handler object makes up module 503 and can generate the object of inheriting convergent-divergent processor class, described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object.Afterwards, replacing module 505 utilizes described customization convergent-divergent handler object to replace original convergent-divergent handler object.
According to embodiments of the invention, customization convergent-divergent handler object makes up module 503 and can generate an object, it is inherited convergent-divergent processor class, in the Android system, convergent-divergent processor class is the OnScaleGestureListener class, like this, this object just can be realized its oneself convergent-divergent start method, the convergent-divergent process approach, and convergent-divergent Method Of Accomplishment, then, customization convergent-divergent handler object makes up module 503 to be needed described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object, like this, zoom operations module 507 after using customization convergent-divergent handler object, original convergent-divergent handler object that can also calling system.Utilizing after described customization convergent-divergent handler object replaces original convergent-divergent handler object and replace module 505, the value of can variable " whether supporting the convergent-divergent handler object " is set to true.
After this, zoom operations module 507 is after detecting zoom operations, utilize described customization convergent-divergent handler object to operate, comprise convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, wherein in the convergent-divergent Method Of Accomplishment, zoom operations module 507 webpage literal scalings are set to the demonstration scaling of web displaying control, and carry out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object.
According to embodiments of the invention, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment, zoom operations module 507 can reflect literal scaling object from described web displaying control, and gives described literal scaling object with the value of the demonstration scaling of web displaying control; And be Android4.0 or upgrade under the situation of version in the operating system of electronic equipment, zoom operations module 507 can reflect literal scaling object from described convergent-divergent manager object, and gives described literal scaling object with the value of the demonstration scaling of web displaying control.
According to embodiments of the invention, in the Android system, described literal scaling is to liking the mTextWrapScale object.Zoom operations module 507 is given described literal scaling object with the demonstration scaling of web displaying control, that is, make the value of the literal scaling of literal scaling object equal the value of the demonstration scaling of web displaying control.Wherein, the literal scaling refers to " web width "/" textwidth ", shows that scaling refers to " web width "/" screen width ".When the value of literal scaling equaled to show the value of scaling, textwidth just equaled web width, and the text just can full screen display.For instance, if the literal scaling is 2, and the demonstration scaling of WebView control is 1, and the ratio of the shared screen of expression literal is 1/2; And if the displaying ratio of WebView control and literal scaling are 1, represent that then the shared screen proportion of literal is 1/1, also be full screen display.In addition, even the user in use shifts out screen by touch operation slip screen with word segment and (for example slides into the rightmost side, all shift out screen up to literal), because the literal scaling does not change, so when the user slides literal return by touch operation, in case when the left frame of literal alignd with the left frame of electronic equipment screen, then literal must be paved with full frame.
According to embodiments of the invention, in the convergent-divergent start method, zoom operations module 507 can forbid convergent-divergent and drag simultaneously carrying out, and carries out the convergent-divergent start method of described original convergent-divergent handler object.Wherein, operating system at electronic equipment is Android2.3.x or upgrades under the situation of version, zoom operations module 507 can be obtained mAllowPanAndScale object in the described convergent-divergent manager object by reflection, and the value of described mAllowPanAndScale object is set to false.The mAllowPanAndScale object is used for representing whether to allow to change the central point of convergent-divergent, for example in the process of two finger convergent-divergents, drag two the finger, then can mobile whole contents, its value is made as false represents to forbid this function, can guarantee can not deflect in the convergent-divergent process.
According to embodiments of the invention, in the convergent-divergent process approach, zoom operations module 507 can be carried out the convergent-divergent process approach of described original convergent-divergent handler object.
According to embodiments of the invention, in the convergent-divergent Method Of Accomplishment, zoom operations module 507 can judge whether webpage supports zoom function.
Still with reference to Fig. 4, alternatively, zoom operations module 507 can be carried out above-mentioned judgement in the following way: zoom operations module 507 can be obtained the WebView control " whether supporting convergent-divergent " variable in the module (the WebSettings object in the Android system) is set, this variable is Boolean, if true then expresses support for, if false, then zoom function is not supported in expression, finishes this judgement; Zoom operations module 507 reflects " the minimum zoom ratio of current web page " object from the convergent-divergent manager object and " the maximum zoom ratio of current web page " object obtains operation to finish, and they are respectively mMinZoomScale object and mMaxZoomScale object in the Android system.Generally, in the source code (invisible to the user) of webpage, understand the scaling scope that some is used for informing this webpage, this value is generally underground, so need obtain by reflection; Then, whether the value that zoom operations module 507 can compare " the minimum zoom ratio of current web page " object equates with the value of " the maximum zoom ratio of current web page " object, if equate, then directly return false, represent that this webpage do not support zoom function, if unequal, then return true, the value of expression " whether supporting zoom function " variable is true, and this webpage is supported zoom function.
Do not support at webpage under the situation of zoom function that zoom operations module 507 can directly be carried out the convergent-divergent Method Of Accomplishment of original convergent-divergent handler object.
Support at webpage under the situation of zoom function that zoom operations module 507 is determined the version of Android system.
Be 4.0 or upgrade under the situation of version in the Android system, zoom operations module 507 can be obtained " whether animation is arranged during convergent-divergent " object (being the mPinchToZoomAnimating object in the Android system) in the convergent-divergent manager object by the reflex mechanism that Java provides, the value of this object is Boolean, if its value is false, then zoom operations module 507 can directly be carried out the convergent-divergent Method Of Accomplishment of original convergent-divergent handler object; If its value is true, then zoom operations module 507 webpage literal scalings are set to the demonstration scaling of web displaying control, and carry out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object.
Be 2.3.x or more under the situation of older version in the Android system, zoom operations module 507 can reflect " whether preview zooming effect " object and obtain operation to finish from the convergent-divergent manager object, this object is the mPreviewZoomOnly object in the Android system.If the value of this object is true, then zoom operations module 507 webpage literal scalings are set to the demonstration scaling of web displaying control, and carry out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object; If the value of this object is false, then zoom operations module 507 is directly carried out the convergent-divergent Method Of Accomplishment of original convergent-divergent handler object.
Because above-mentioned each equipment (device) embodiment is corresponding with aforementioned approaches method embodiment, therefore no longer each device embodiment is described in detail.
Intrinsic not relevant with any certain computer, virtual system or miscellaneous equipment with demonstration at this algorithm that provides.Various general-purpose systems also can be with using based on the teaching at this.According to top description, it is apparent constructing the desired structure of this type systematic.In addition, the present invention is not also at any certain programmed language.Should be understood that and to utilize various programming languages to realize content of the present invention described here, and the top description that language-specific is done is in order to disclose preferred forms of the present invention.
In the instructions that provides herein, a large amount of details have been described.Yet, can understand, embodiments of the invention can be put into practice under the situation of these details not having.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand one or more in each inventive aspect, in the description to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes in the above.Yet the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires the more feature of feature clearly put down in writing than institute in each claim.Or rather, as following claims reflected, inventive aspect was to be less than all features of the disclosed single embodiment in front.Therefore, follow claims of embodiment and incorporate this embodiment thus clearly into, wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and can adaptively change and they are arranged in one or more devices different with this embodiment the module in the device among the embodiment.Can become the some module combinations among the embodiment module or unit or assembly, and can be divided into a plurality of submodules or subelement or sub-component to them in addition.In such feature and/or process or module at least some are mutually repelling, and can adopt any combination to disclosed all features in this instructions (comprising claim, summary and the accompanying drawing followed) and so all processes or the unit of disclosed any method or equipment make up.Unless clearly statement in addition, disclosed each feature can be by providing identical, being equal to or similar purpose alternative features replaces in this instructions (comprising claim, summary and the accompanying drawing followed).
In addition, those skilled in the art can understand, although embodiment more described herein comprise some feature rather than further feature included among other embodiment, the combination of features of different embodiment means and is within the scope of the present invention and forms different embodiment.For example, in claims, the one of any of embodiment required for protection can be used with array mode arbitrarily.
Each device embodiment of the present invention can realize with hardware, perhaps realizes with the software module of moving at one or more processor, and perhaps the combination with them realizes.It will be understood by those of skill in the art that and to use microprocessor or digital signal processor (DSP) to realize according to some or all some or repertoire of modules in the device of the embodiment of the invention in practice.The present invention can also be embodied as for part or all the device program (for example, computer program and computer program) of carrying out method as described herein.Such realization program of the present invention can be stored on the computer-readable medium, perhaps can have the form of one or more signal.Such signal can be downloaded from internet website and obtain, and perhaps provides at carrier signal, perhaps provides with any other form.
It should be noted above-described embodiment the present invention will be described rather than limit the invention, and those skilled in the art can design alternative embodiment under the situation of the scope that does not break away from claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and is not listed in element or step in the claim.Being positioned at word " " before the element or " one " does not get rid of and has a plurality of such elements.The present invention can realize by means of the hardware that includes some different elements and by means of the computing machine of suitably programming.In having enumerated the unit claim of some devices, several in these devices can be to come imbody by same hardware branch.Any order is not represented in the use of word first, second and C grade.Can be title with these word explanations.
Embodiments of the invention disclose the method for webpage convergent-divergent on A1. electronic equipment, may further comprise the steps: obtain original convergent-divergent handler object; Generate the object of inheriting convergent-divergent processor class, described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object; Utilize described customization convergent-divergent handler object to replace original convergent-divergent handler object; After detecting zoom operations, described customization convergent-divergent handler object is operated, comprise convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, wherein in the convergent-divergent Method Of Accomplishment, webpage literal scaling is set to the demonstration scaling of web displaying control, and carries out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object.A2. as the described method of A1, the step that wherein said webpage literal scaling is set to the demonstration scaling of web displaying control comprises: be Android2.3.x or more under the situation of older version in the operating system of electronic equipment, reflection literal scaling object from described web displaying control, and give described literal scaling object with the value of the demonstration scaling of web displaying control; Perhaps the operating system at electronic equipment is Android4.0 or upgrades under the situation of version, reflection literal scaling object from described convergent-divergent manager object, and give described literal scaling object with the value of the demonstration scaling of web displaying control.A3. as the described method of A1, also comprise step: in the convergent-divergent process approach, carry out the convergent-divergent process approach of described original convergent-divergent handler object.A4. as the described method of A1, also comprise step: in the convergent-divergent start method, forbid convergent-divergent and drag simultaneously carrying out, and carry out the convergent-divergent start method of described original convergent-divergent handler object.A5. as each the described method among the A1 to A4, wherein in the described step of obtaining original convergent-divergent handler object, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment, reflection and obtain the zoom detector object from the web displaying control, and reflection and obtain original convergent-divergent handler object from described zoom detector object; Perhaps the operating system at electronic equipment is Android4.0 or upgrades under the situation of version, reflection and obtain the convergent-divergent manager object from the web displaying control, reflection and obtain the zoom detector object from described convergent-divergent manager object, and reflection and obtain original convergent-divergent handler object from described zoom detector object.A6. as each the described method among the A1 to A4, the WebView control that wherein said web displaying control is the Android system, described convergent-divergent manager object is the mZoomManager object, described convergent-divergent handler object is the mListener object, described convergent-divergent processor class is the OnScaleGestureListener class, described literal scaling is to liking the mTextWrapScale object, described zoom detector is to liking mScaleDetector object, described convergent-divergent start method, the convergent-divergent process approach, the convergent-divergent Method Of Accomplishment is respectively the onScaleBegin method of mListener object, the onScale method, the onScaleEnd method.
Embodiments of the invention also disclose the device of webpage convergent-divergent on B7. electronic equipment, comprising: original convergent-divergent handler object acquisition module is suitable for obtaining original convergent-divergent handler object; Customization convergent-divergent handler object makes up module, is suitable for generating the object of inheriting convergent-divergent processor class, described original convergent-divergent handler object is delivered to wherein, to make up customization convergent-divergent handler object; Replace module, be suitable for utilizing described customization convergent-divergent handler object to replace original convergent-divergent handler object; The zoom operations module, be suitable for after detecting zoom operations, utilize described customization convergent-divergent handler object to operate, comprise convergent-divergent start method, convergent-divergent process approach and convergent-divergent Method Of Accomplishment, wherein in the convergent-divergent Method Of Accomplishment, zoom operations module webpage literal scaling is set to the demonstration scaling of web displaying control, and carries out the convergent-divergent Method Of Accomplishment of described original convergent-divergent handler object.B8. as the described device of B7, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment wherein, described zoom operations module is suitable for from described web displaying control reflection literal scaling object, and gives described literal scaling object with the value of the demonstration scaling of web displaying control; Perhaps the operating system at electronic equipment is Android4.0 or upgrades under the situation of version, described zoom operations module is suitable for from described convergent-divergent manager object reflection literal scaling object, and gives described literal scaling object with the value of the demonstration scaling of web displaying control.B9. as the described device of B7, wherein said zoom operations module is suitable in the convergent-divergent process approach, carries out the convergent-divergent process approach of described original convergent-divergent handler object.B10. as the described device of B7, wherein said zoom operations module is suitable in the convergent-divergent start method, forbids convergent-divergent and drags simultaneously carrying out, and carry out the convergent-divergent start method of described original convergent-divergent handler object.B11. as each the described device among the B7 to B10, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment wherein, described original convergent-divergent handler object acquisition module is suitable for from the web displaying control reflection and obtains the zoom detector object, and reflection and obtain original convergent-divergent handler object from described zoom detector object; Perhaps the operating system at electronic equipment is Android4.0 or upgrades under the situation of version, described original convergent-divergent handler object acquisition module is suitable for reflecting and obtaining the convergent-divergent manager object from the web displaying control, reflection and obtain the zoom detector object from described convergent-divergent manager object, and reflection and obtain original convergent-divergent handler object from described zoom detector object.B12. as each the described device among the B7 to B10, the WebView control that wherein said web displaying control is the Android system, described convergent-divergent manager object is the mZoomManager object, described convergent-divergent handler object is the mListener object, described convergent-divergent processor class is the OnScaleGestureListener class, described literal scaling is to liking the mTextWrapScale object, described zoom detector is to liking mScaleDetector object, described convergent-divergent start method, the convergent-divergent process approach, the convergent-divergent Method Of Accomplishment is respectively the onScaleBegin method of mListener object, the onScale method, the onScaleEnd method.