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: inherit the web displaying control, to make up customization touch event method; Whether judgement is to unclamp n the touch point of the n-1 in the touch point to trigger the touch event method to the operation of electronic equipment, and wherein n is the integer more than or equal to 2; Be under the situation that is in judged result, webpage literal scaling is set to the demonstration scaling of web displaying control; Reflection arranges and enables the scaling method to call from the convergent-divergent manager object; And the touch event method of carrying out heritable web displaying control.
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, on electronic equipment according to an embodiment of the invention in the method for webpage convergent-divergent, whether be to unclamp n the touch point of the n-1 in the touch point to trigger in the step of touch event method in described judgement to the operation of electronic equipment, utilize ACTION_POINTER_UP object or ACTION_POINTER_n_UP object to judge whether to trigger the touch event method for unclamping n the touch point of the n-1 in the touch point.
Alternatively, the method of webpage convergent-divergent also comprises step on the electronic equipment according to an embodiment of the invention: be set at described webpage literal scaling before the step of demonstration scaling of web displaying control, judge whether the operating system of electronic equipment supports the convergent-divergent handler object, under unsupported situation, carry out described webpage literal scaling be set to the web displaying control the demonstration scaling step and described from the convergent-divergent manager object reflection arrange and enable the scaling method with the step of the touch event method of calling and carry out heritable web displaying control; Under situation about supporting, carry out the step of the touch event method of described heritable web displaying control.
Alternatively, the method of webpage convergent-divergent also comprises step on the electronic equipment according to an embodiment of the invention: be set at described webpage literal scaling before the step of demonstration scaling of web displaying control, whether enable widescreen and browse the value of object and be set to false; And described from the convergent-divergent manager object reflection arrange and enable the scaling method with the step of calling after, whether enable widescreen and browse the value of object and be set to true.
Alternatively, on electronic equipment according to an embodiment of the invention in the method for webpage convergent-divergent, described from the convergent-divergent manager object reflection arrange and enable the scaling method with the step of calling in, the parameter of transmitting when calling comprise the demonstration scaling that is set to the web displaying control webpage literal scaling, allow text composition and allow to force text composition.
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 literal scaling is to liking the mTextWrapScale object, described touch event method comprises onTouchEvent method and dispatchTouchEvent method, described setting and to enable the scaling method be setZoomScale method or setNewZoomScale method, described whether enable widescreen browse to as if the setUseWideViewPort object.
According to another aspect of the present invention, the device of webpage convergent-divergent on a kind of electronic equipment is provided, comprising: customization touch event method makes up module, is suitable for inheriting the web displaying control, to make up customization touch event method; The touch point judge module is suitable for judging whether the operation to electronic equipment is to unclamp n the touch point of the n-1 in the touch point to trigger the touch event method, and wherein n is the integer more than or equal to 2; Webpage literal scaling arranges module, and being suitable in judged result is under the situation that is, webpage literal scaling is set to the demonstration scaling of web displaying control; The scaling calling module is suitable for reflecting setting and enable the scaling method to call from the convergent-divergent manager object; And touch event method execution module, be suitable for carrying out the touch event method of heritable web displaying control.
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 webpage literal scaling arranges module and 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 webpage literal scaling arranges module and 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 device of webpage convergent-divergent, described touch point judge module is suitable for utilizing ACTION_POINTER_UP object or ACTION_POINTER_n_UP object to judge whether to trigger the touch event method for unclamping n the touch point of the n-1 in the touch point on electronic equipment according to an embodiment of the invention.
Alternatively, the device of webpage convergent-divergent also comprises on the electronic equipment according to an embodiment of the invention: the convergent-divergent processor is supported judge module, be suitable for arranging before module webpage literal scaling is set to the demonstration scaling of web displaying control at described webpage literal scaling, judge whether the operating system of electronic equipment supports the convergent-divergent handler object, under unsupported situation, described webpage literal scaling arranges the demonstration scaling that module webpage literal scaling is set to the web displaying control, the scaling calling module reflects from the convergent-divergent manager object and arranges and enable the scaling method calling, and touch event method execution module is carried out the touch event method of heritable web displaying control; Under situation about supporting, touch event method execution module is carried out the touch event method of described heritable web displaying control.
Alternatively, the device of webpage convergent-divergent also comprises on the electronic equipment according to an embodiment of the invention: enable widescreen and browse object module is set, be suitable for arranging before module webpage literal scaling is set to the demonstration scaling of web displaying control at described webpage literal scaling, whether enabling widescreen browses the value of object and is set to false, and be suitable for reflecting from the convergent-divergent manager object at described scaling calling module and arrange and enable the scaling method with after calling, whether enable widescreen and browse the value of object and be set to true.
Alternatively, on electronic equipment according to an embodiment of the invention in the device of webpage convergent-divergent, reflect from the convergent-divergent manager object at described scaling calling module and to arrange and to enable the scaling method when calling, the parameter of transmitting when calling comprise the demonstration scaling that is set to the web displaying control webpage literal scaling, allow text composition and allow to force text composition.
Alternatively, on electronic equipment according to an embodiment of the invention in the device of 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 literal scaling is to liking the mTextWrapScale object, described touch event method comprises onTouchEvent method and dispatchTouchEvent method, described setting and to enable the scaling method be setZoomScale method or setNewZoomScale method, described whether enable widescreen browse to as if the setUseWideViewPort object.
The invention provides the method and apparatus of webpage convergent-divergent on a kind of electronic equipment.According to embodiments of the invention, inherit the web displaying control, to make up customization touch event method, judging that touch operation is to unclamp n the touch point of the n-1 in the touch point to trigger under the situation of touch event method, webpage literal scaling is set to the demonstration scaling of web displaying control, and reflection arranges and enables the scaling method to call from the convergent-divergent manager object, 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 again behind the page zoom-in and zoom-out, make content tiling to the function of whole screen, solved can't the display part content because of amplification problem.And embodiments of the invention are not supported the electronic equipment of convergent-divergent handler object for operating system, can realize equally the function of setting type again behind the above-mentioned convergent-divergent so just having realized the support for nearly all electronic equipment.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, inherits the web displaying control, to make up customization touch event method.
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.
According to embodiments of the invention, the touch event method for example can be onTouchEvent method and/or the dispatchTouchEvent method of Android system, the user is to any touch operation of a certain control, the Android system all can trigger touch place director's part of this control, onTouchEvent method and parameter of dispatchTouchEvent method band, be used for describing the situation of the current touch of user, it is the MotionEvent object in the Android system, it is used for describing for example quantity of the current touch point of user, corresponding coordinate, and the state that touches, as " when moving ", " when pressing ", " when unclamping " etc.
According to embodiments of the invention, in above-mentioned steps S301, can generate an object, allow it inherit web displaying control, to make up its oneself customization touch event method, for example onTouchEvent method and dispatchTouchEvent method.
After step S301, execution in step S303 wherein, judges whether the operation to electronic equipment is to unclamp n the touch point of the n-1 in the touch point to trigger the touch event method, and wherein n is the integer more than or equal to 2.
Situation with n=2 is example,, supposes that the user with the touch screen of two finger touch electronic equipments, when a finger unclamps therein, will trigger touch place director's part method that is.
According to embodiments of the invention, in step S303, for the Android system, can utilize ACTION_POINTER_UP object or ACTION_POINTER_n_UP object to judge whether to trigger the touch event method for unclamping n the touch point of the n-1 in the touch point.
Next, execution in step S305, wherein, the judged result in step S303 is under the situation that is, webpage literal scaling is set to the demonstration scaling of web displaying control.
According to embodiments of the invention, in step S305, 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.
According to embodiments of the invention, 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.
In addition, 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, in the Android system, described literal scaling is to liking the mTextWrapScale object.Give described literal scaling object with the value of 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.
In step S305, 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.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 S305, can execution in step S307, wherein, reflection arranges and enables the scaling method calling from the convergent-divergent manager object, and execution in step S309, wherein carries out the touch event method of heritable web displaying control.In addition, the judged result in step S303 can directly be carried out above-mentioned steps S309 under the situation not, namely carries out the touch event method of heritable web displaying control.
According to embodiments of the invention, for the Android system, described setting and to enable the scaling method can be setZoomScale method or setNewZoomScale method, and the parameter of transmitting when calling in step S307 can comprise: be set to the demonstration scaling of web displaying control webpage literal scaling, allow text composition (being set to true) and allow to force text composition (being set to true).
In step S307, called and arranged and enable after the scaling method, just can execution in step S109, namely, carry out the touch event method of heritable web displaying control, it is original touch event method, for the Android system, just call onTouchEvent method and the dispatchTouchEvent method of its parent.Like this, just can realize setting type again, making behind the page zoom-in and zoom-out content tiling to the function of whole screen.
Fig. 4 schematically illustrates the process flow diagram of the method for webpage convergent-divergent on the electronic equipment that comprises each optional step according to an embodiment of the invention.Below in conjunction with each optional step in Fig. 4 describing method 100.
As shown in Figure 4, alternatively, according to embodiments of the invention, the method 300 of webpage convergent-divergent can also comprise step S304 on the described electronic equipment: before step S305, judge whether the operating system of electronic equipment supports the convergent-divergent handler object.
For the Android system, described convergent-divergent handler object can be the mListener object, should be to liking the module of when carrying out zoom operations at a certain control, calling, 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 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.
As shown in Figure 4, in step S304, be judged as under the unsupported situation, can carry out above-mentioned steps S305, step S307 and step S309, be about to the demonstration scaling that webpage literal scaling is set to the web displaying control, and reflection arranges and enables the scaling method calling from the convergent-divergent manager object, and carries out the touch event method of heritable web displaying control.
And be judged as under the situation of support, as shown in Figure 4, the direct step of the touch event method of the described heritable web displaying control of execution among the execution in step S309.
As shown in Figure 4, alternatively, according to embodiments of the invention, the method 300 of webpage convergent-divergent can also comprise step S304 ' on the described electronic equipment: before step S305, whether enable widescreen and browse the value of object and be set to false.For the Android system, the described widescreen of whether enabling is browsed liking the setUseWideViewPort object, its value is present in the WebView control and arranges in the module (the WebSettings object in the Android system), by the operation among the step S304 ', can avoid that the user comes mobile webpage by the screen that touches electronic equipment after amplifying displaying ratio.
As shown in Figure 4, alternatively, according to embodiments of the invention, the method 300 of webpage convergent-divergent can also comprise step S308 on the described electronic equipment: the reflection from the convergent-divergent manager object in step S307 arranges also enables the scaling method with after the step of calling, and whether enables widescreen and browses the value of object and be set to true.By the operation of step S308, can after setting type again, literal recover to move by touch operation the function of webpage.
As shown in Figure 4, in addition, alternatively, the method 300 of webpage convergent-divergent is before above-mentioned steps S303 on the described electronic equipment, can also comprise that the quantity of judging current touch point is whether greater than 1 step S302-1 and judge whether webpage supports the step S302-2 of zoom function, in these two steps, if wherein the judged result of arbitrary step is for denying, just do not do further processing, directly the step of the touch event method of the described heritable web displaying control of execution among the execution in step S309.
Alternatively, judge whether webpage supports the step S302-2 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 express support for, if false, then zoom function is not supported in expression, finishes this determining step; 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.
The invention provides the method for webpage convergent-divergent on a kind of electronic equipment.According to embodiments of the invention, inherit the web displaying control, to make up customization touch event method, judging that touch operation is to unclamp n the touch point of the n-1 in the touch point to trigger under the situation of touch event method, webpage literal scaling is set to the demonstration scaling of web displaying control, and reflection arranges and enables the scaling method to call from the convergent-divergent manager object, 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 again behind the page zoom-in and zoom-out, make content tiling to the function of whole screen, solved can't the display part content because of amplification problem.And embodiments of the invention are not supported the electronic equipment of convergent-divergent handler object for operating system, can realize equally the function of setting type again behind the above-mentioned convergent-divergent so just having realized the support for nearly all electronic equipment.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 mainly customization touch event method structure module 501, touch point judge module 503, webpage literal scaling arrange module 505, scaling calling module 507 and touch event method execution module 509 on the described electronic equipment.
According to embodiments of the invention, customization touch event method makes up module 501 and is suitable for inheriting the web displaying control, to make up customization touch event method; Touch point judge module 503 is suitable for judging whether the operation to electronic equipment is to unclamp n the touch point of the n-1 in the touch point to trigger the touch event method, and wherein n is the integer more than or equal to 2; Webpage literal scaling arranges module 505, and to be suitable in judged result be under the situation that is, webpage literal scaling is set to the demonstration scaling of web displaying control; Scaling calling module 507 is suitable for reflecting setting and enable the scaling method to call from the convergent-divergent manager object; Touch event method execution module 509 is suitable for carrying out the touch event method of heritable web displaying control.
According to embodiments of the invention, at first, customization touch event method makes up module 501 and inherits the web displaying control, to make up customization touch event method.
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.
According to embodiments of the invention, the touch event method for example can be onTouchEvent method and/or the dispatchTouchEvent method of Android system, the user is to any touch operation of a certain control, the Android system all can trigger touch place director's part of this control, onTouchEvent method and parameter of dispatchTouchEvent method band, be used for describing the situation of the current touch of user, it is the MotionEvent object in the Android system, it is used for describing for example quantity of the current touch point of user, corresponding coordinate, and the state that touches, as " when moving ", " when pressing ", " when unclamping " etc.
According to embodiments of the invention, customization touch event method makes up module 501 and can generate an object, allow it inherit web displaying control, to make up its oneself customization touch event method, for example onTouchEvent method and dispatchTouchEvent method.
Subsequently, touch point judge module 503 judges whether the operation to electronic equipment is to unclamp n the touch point of the n-1 in the touch point to trigger the touch event method, and wherein n is the integer more than or equal to 2.
Situation with n=2 is example,, supposes that the user with the touch screen of two finger touch electronic equipments, when a finger unclamps therein, will trigger touch place director's part method that is.
According to embodiments of the invention, for the Android system, touch point judge module 503 can utilize ACTION_POINTER_UP object or ACTION_POINTER_n_UP object to judge whether to trigger the touch event method for unclamping n the touch point of the n-1 in the touch point.
Next, be judged as under the situation that is at touch point judge module 503, webpage literal scaling arranges the demonstration scaling that module 505 webpage literal scalings are set to the web displaying control.
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, webpage literal scaling arranges module 505 and 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.
According to embodiments of the invention, for reflective operation, the reflex mechanism that the module 505 that arranges webpage literal scaling 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 webpage literal scaling arranges module 505 and can adopt other programming language equally, in a similar manner method or object are become publicly-owned attribute from privately owned attribute, to reach the purpose of reflective operation temporarily.
In addition, for the Android system, webpage literal scaling arranges module 505 can be by obtaining the version number that the Build.VERSION.SDK_INT object obtains the Android system.
According to embodiments of the invention, in the Android system, described literal scaling is to liking the mTextWrapScale object.Webpage literal scaling arranges module 505 and gives described literal scaling object with the value of 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.
Operating system at electronic equipment is Android4.0 or upgrades under the situation of version, webpage literal scaling arranges module 505 and 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.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.
Afterwards, scaling calling module 507 reflects from the convergent-divergent manager object and arranges and enable the scaling method calling, and touch event method execution module 509 is carried out the touch event method of heritable web displaying control.In addition, the judged result at touch point judge module 503 is that touch event method execution module 509 can directly be carried out the touch event method of heritable web displaying control under the situation not.
According to embodiments of the invention, for the Android system, described setting and to enable the scaling method can be setZoomScale method or setNewZoomScale method can comprise and carry out the parameter of transmitting when calling at scaling calling module 507: be set to the demonstration scaling of web displaying control webpage literal scaling, allow text composition (being set to true) and allow to force text composition (being set to true).
After scaling calling module 507 has called setting and has enabled the scaling method, touch event method execution module 509 just can be carried out the touch event method of heritable web displaying control, it is original touch event method, for the Android system, just call onTouchEvent method and the dispatchTouchEvent method of its parent.Like this, just can realize setting type again, making behind the page zoom-in and zoom-out content tiling to the function of whole screen.
Fig. 6 schematically illustrates the block diagram of the device of webpage convergent-divergent on the electronic equipment that comprises each optional module according to an embodiment of the invention.Be described for each optional module of installing 200 below in conjunction with Fig. 6 and top Fig. 4.
As shown in Figure 6, alternatively, according to embodiments of the invention, the device 600 of webpage convergent-divergent can also comprise convergent-divergent processor support judge module 604 on the described electronic equipment, be suitable for arranging before module 605 webpage literal scalings are set to the demonstration scaling of web displaying control at described webpage literal scaling, judge whether the operating system of electronic equipment supports the convergent-divergent handler object.
For the Android system, described convergent-divergent handler object can be the mListener object, should be to liking the module of when carrying out zoom operations at a certain control, calling, 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 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.
Support that at the convergent-divergent processor judge module is judged as under the unsupported situation, webpage literal scaling arranges the demonstration scaling that module 605 can webpage literal scaling be set to the web displaying control, and scaling calling module 607 can reflect from the convergent-divergent manager object and arrange and enable the scaling method calling, and touch event method execution module 609 is carried out the touch event method of heritable web displaying control.
And support that at the convergent-divergent processor judge module is judged as under the situation of support, touch event method execution module 609 can directly be carried out the touch event method of described heritable web displaying control.
As shown in Figure 6, alternatively, according to embodiments of the invention, the device 600 of webpage convergent-divergent can also comprise that enabling widescreen browses object module 604 ' is set on the described electronic equipment, be suitable for arranging before module 605 webpage literal scalings are set to the demonstration scaling of web displaying control at described webpage literal scaling, whether enable widescreen and browse the value of object and be set to false.For the Android system, the described widescreen of whether enabling is browsed liking the setUseWideViewPort object, its value is present in the WebView control and arranges in the module (the WebSettings object in the Android system), browse this operation that object arranges module 604 ' by enabling widescreen, can avoid that the user comes mobile webpage by the screen that touches electronic equipment after amplifying displaying ratio.
Alternatively, according to embodiments of the invention, enable widescreen and browse object and module 604 ' is set also is suitable for reflecting from the convergent-divergent manager object at described scaling calling module 607 and arranges and enable the scaling method with after calling, whether enable widescreen and browse the value of object and be set to true.Browse this operation that object arranges module 604 ' by enabling widescreen, can after literal is set type again, recover to move by touch operation the function of webpage.
In addition, alternatively, according to embodiments of the invention, described touch point judge module 603 is judging to the operation of electronic equipment whether be to unclamp before n the touch point of the n-1 in the touch point trigger the touch event method, whether the quantity that can also judge current touch point is greater than 1 and judge whether webpage supports convergent-divergent, in this twice judgement, if wherein arbitrary time judged result is for denying, just do not do further processing, touch event method execution module 609 is just directly carried out the touch event method of described heritable web displaying control.
Alternatively, described touch point judge module 603 judges whether webpage supports zoom function to realize in the following way: described touch point judge module 603 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 express support for, if false, then zoom function is not supported in expression, finishes this judgement; Described touch point judge module 603 can reflect " 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 described touch point judge module 603 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.
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: inherit the web displaying control, to make up customization touch event method; Whether judgement is to unclamp n the touch point of the n-1 in the touch point to trigger the touch event method to the operation of electronic equipment, and wherein n is the integer more than or equal to 2; Be under the situation that is in judged result, webpage literal scaling is set to the demonstration scaling of web displaying control; Reflection arranges and enables the scaling method to call from the convergent-divergent manager object; And the touch event method of carrying out heritable web displaying control.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, whether be to unclamp n the touch point of the n-1 in the touch point to trigger in the step of touch event method in described judgement to the operation of electronic equipment wherein, utilize ACTION_POINTER_UP object or ACTION_POINTER_n_UP object to judge whether to trigger the touch event method for unclamping n the touch point of the n-1 in the touch point.A4. as each the described method among the A1 to A3, also comprise step: be set at described webpage literal scaling before the step of demonstration scaling of web displaying control, judge whether the operating system of electronic equipment supports the convergent-divergent handler object, under unsupported situation, carry out described webpage literal scaling be set to the web displaying control the demonstration scaling step and described from the convergent-divergent manager object reflection arrange and enable the scaling method with the step of the touch event method of calling and carry out heritable web displaying control; Under situation about supporting, carry out the step of the touch event method of described heritable web displaying control.A5. as each the described method among the A1 to A3, also comprise step: be set at described webpage literal scaling before the step of demonstration scaling of web displaying control, whether enable widescreen and browse the value of object and be set to false; And described from the convergent-divergent manager object reflection arrange and enable the scaling method with the step of calling after, whether enable widescreen and browse the value of object and be set to true.A6. as each the described method among the A1 to A3, wherein described from the convergent-divergent manager object reflection arrange and enable the scaling method with the step of calling in, the parameter of transmitting when calling comprise the demonstration scaling that is set to the web displaying control webpage literal scaling, allow text composition and allow to force text composition.A7. as each the described method among the A1 to A3, 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 literal scaling is to liking the mTextWrapScale object, described touch event method comprises onTouchEvent method and dispatchTouchEvent method, described setting and to enable the scaling method be setZoomScale method or setNewZoomScale method, described whether enable widescreen browse to as if the setUseWideViewPort object.
Embodiments of the invention also disclose the device of webpage convergent-divergent on B8. electronic equipment, comprising: customization touch event method makes up module, is suitable for inheriting the web displaying control, to make up customization touch event method; The touch point judge module is suitable for judging whether the operation to electronic equipment is to unclamp n the touch point of the n-1 in the touch point to trigger the touch event method, and wherein n is the integer more than or equal to 2; Webpage literal scaling arranges module, and being suitable in judged result is under the situation that is, webpage literal scaling is set to the demonstration scaling of web displaying control; The scaling calling module is suitable for reflecting setting and enable the scaling method to call from the convergent-divergent manager object; And touch event method execution module, be suitable for carrying out the touch event method of heritable web displaying control.B9. as the described device of B8, be Android2.3.x or more under the situation of older version in the operating system of electronic equipment wherein, described webpage literal scaling arranges module and 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 webpage literal scaling arranges module and 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.B10. as the described device of B8, wherein said touch point judge module is suitable for utilizing ACTION_POINTER_UP object or ACTION_POINTER_n_UP object to judge whether to trigger the touch event method for unclamping n the touch point of the n-1 in the touch point.B11. as each the described device among the B8 to B10, also comprise: the convergent-divergent processor is supported judge module, be suitable for arranging before module webpage literal scaling is set to the demonstration scaling of web displaying control at described webpage literal scaling, judge whether the operating system of electronic equipment supports the convergent-divergent handler object, under unsupported situation, described webpage literal scaling arranges the demonstration scaling that module webpage literal scaling is set to the web displaying control, and the scaling calling module reflects from the convergent-divergent manager object and arranges and enable the scaling method calling, and touch event method execution module is carried out the touch event method of heritable web displaying control; Under situation about supporting, touch event method execution module is carried out the touch event method of described heritable web displaying control.B12. as each the described device among the B8 to B10, also comprise: enable widescreen and browse object module is set, be suitable for arranging before module webpage literal scaling is set to the demonstration scaling of web displaying control at described webpage literal scaling, whether enabling widescreen browses the value of object and is set to false, and be suitable for reflecting from the convergent-divergent manager object at described scaling calling module and arrange and enable the scaling method with after calling, whether enable widescreen and browse the value of object and be set to true.B13. as each the described device among the B8 to B10, wherein reflect from the convergent-divergent manager object at described scaling calling module and arrange and enable the scaling method when calling, the parameter of transmitting when calling comprise the demonstration scaling that is set to the web displaying control webpage literal scaling, allow text composition and allow to force text composition.B14. as each the described device among the B8 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 literal scaling is to liking the mTextWrapScale object, described touch event method comprises onTouchEvent method and dispatchTouchEvent method, described setting and to enable the scaling method be setZoomScale method or setNewZoomScale method, described whether enable widescreen browse to as if the setUseWideViewPort object.