Method for constructing stepless sliding arc-shaped zooming broadcast scale control based on Android
By introducing the infinite sliding arc scaling broadcast ruler control into the vehicle broadcast system, the problems of cumbersome operation and insufficient accuracy of the linear sliding scale control are solved, enabling fast, intuitive and precise adjustment of broadcast parameters, and improving the user experience.
Patent Information
- Application Number
- CN202410963253.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-10-08
AI Technical Summary
The linear sliding scale control used in existing vehicle broadcasting systems is cumbersome to operate, inconvenient for precise adjustment, and difficult to achieve ideal accuracy.
The broadcast ruler control design is based on Android's infinite sliding arc zoom. The user adjusts the broadcast parameters by clicking or dragging the control. The control scales according to the direction and distance when sliding, showing the parameter change trend, and automatically adsorbs to the nearest available Select parameters or scale.
It achieves fast, intuitive and precise adjustment of broadcast parameters, improves operating efficiency, reduces the user's cognitive load, and displays parameter change trends through arc zoom effects.
Smart Images

Figure CN118747440A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of vehicle-mounted multimedia, and in particular relates to a method for constructing an Android-based infinitely sliding arc-scaling broadcast ruler control. Background Art
[0002] With the advent of the automobile era, the number of car users has grown rapidly. As an almost irreplaceable in-car media, car radio is also constantly changing with the continuous development of technology. Traditional cars mainly use knobs or buttons to adjust broadcast parameters. Most modern cars are equipped with touch screens, and users can adjust broadcast parameters through the sliding scale on the touch screen. The existing technical solutions mainly use linear sliding scale controls. This control is more intuitive in display, but lacks in ease of operation and accuracy. Specifically, when adjusting parameters of the linear sliding scale control, the user needs to slide back and forth to find the target value, which is cumbersome and easy to operate incorrectly. In addition, due to the limited sliding range, it is difficult for users to achieve ideal accuracy when they need to fine-tune parameters. Summary of the invention
[0003] In view of the problems of inconvenient operation, non-intuitive display and limited accuracy in the prior art, the present invention provides a method for constructing a broadcast scale control with infinite sliding arc scaling based on Android. Users can adjust the broadcast parameters or switch broadcasts by clicking or dragging the control on the screen. The control adopts an infinite sliding design, and users can slide continuously to quickly adjust the parameters; when the user slides the control, the control will scale according to the sliding direction and distance to show the parameter change trend and highlight the currently selected parameters and scale; after the user finishes sliding, it will automatically adsorb to the nearest optional broadcast or scale; in summary, the method realizes fast, intuitive and precise adjustment of broadcast parameters by adopting the design of infinite sliding and arc scaling.
[0004] The present invention is achieved through the following technical solutions:
[0005] The construction method of the infinite sliding arc zoom broadcast ruler control based on Android includes the following contents:
[0006] S1. Initialize the scale list, data list, scale list layout adapter, data list layout adapter, scale list layout manager and data list custom layout manager;
[0007] S2, parameterization settings of scale list and data list;
[0008] S3, draw a scale;
[0009] S31, based on the layout of the scale list layout adapter, drawing the scale list through the scale list layout manager;
[0010] S32. After the ruler list is drawn, the sub-layout of the subscript of the initial position of the ruler is displayed to the top of the visible area through the scrollToPosition method of RecyclerView;
[0011] S33, after calling scrollToPosition to trigger the display change of the ruler list, continue to trigger the callback RecyclerView's sliding listening onScrolled method, traverse all the sub-layouts of the scales within the display range, determine whether the sub-layout of each scale is within the ruler arc position range, and set the offset to form a ruler list;
[0012] S4, draw data list;
[0013] S41, based on the layout of the data list adapter, drawing the data list through the data list custom layout manager;
[0014] S42, drawing the sub-layout at the initial position;
[0015] S43, drawing all sub-layouts above the initial position;
[0016] S44, draw all sub-layouts below the initial position;
[0017] S45, traverse all sub-layouts, and calculate the offset between the traversed sub-layout and the selected position sub-layout given by the UI;
[0018] S5. Drawing is completed and the ruler is displayed to the user.
[0019] Further, in step S2, the parameterized settings of the scale list include: infinite sliding, initial display position and list sliding monitoring; wherein, the initial display position of the scale is obtained according to the following formula: the subscript of the initial position of the scale list = the total scale of the visible area of the page × the customized initial factor (1000) - the number of scales that can be displayed above the selected pointer position.
[0020] Furthermore, in step S2, the parameterized settings of the data list include: infinite sliding, initial display position, sliding zoom effect and sliding monitoring of the list; wherein, the initial display position of the data list is obtained according to the following formula: the subscript of the initial position of the data list = the number of data in the countable area of the page × the total number of data × the custom initial factor (1000).
[0021] Further, in step S33, if it is within the arc position range of the ruler, each scale sub-layout within the arc position range of the ruler is offset by different sizes according to the UI size to form a curved scale; if it is not within the arc position range of the ruler, the offset of the scale sub-layout is set to 0 or a fixed offset to ensure that this part is a linear scale.
[0022] Furthermore, step S42 specifically includes the following contents:
[0023] Add the sublayout at the initial position of the data list to the control; use RecyclerView's measureChildWithMargins to measure the sublayout, get the width and height of the sublayout through getDecoratedMeasuredWidth and getDecoratedMeasuredHeight, and calculate the upper offset, upper offset = (display control height - sublayout height) ÷ 2; draw the sublayout at the initial position based on the calculated upper offset and the width and height of the sublayout.
[0024] Furthermore, step S43 specifically includes the following contents:
[0025] Traversing the sublayout with the subscript of the initial position to the sublayout with the subscript of 0 can display the subscripts of all sublayouts within the visible range of the control, and adding the traversed subscript sublayout to the control; using RecyclerView's measureChildWithMargins to measure the sublayout, get the width and height of the sublayout through getDecoratedMeasuredWidth and getDecoratedMeasuredHeight, and calculate the upper offset, the upper offset = the distance from the sublayout below the sublayout to be drawn (that is, the last drawn sublayout, the first sublayout traversed and the last drawn sublayout is the sublayout at the initial position) to the top of the display space - the height of the sublayout; draw the traversed sublayout according to the calculated upper offset and the width and height of the sublayout.
[0026] Furthermore, step S44 specifically includes the following contents:
[0027] Traversing the sublayout with the subscript of the initial position to the sublayout with the subscript of the last data in the RecyclerView list can display the subscripts of all sublayouts within the visible range of the control, and add the traversed subscript sublayout to the control; use RecyclerView's measureChildWithMargins to measure the sublayout, get the width and height of the sublayout through getDecoratedMeasuredWidth and getDecoratedMeasuredHeight, and calculate the bottom offset, which is the distance from the sublayout above the sublayout to be drawn (that is, the last drawn sublayout, the first sublayout traversed and the last drawn sublayout is the sublayout at the initial position) to the bottom of the real space + the height of the sublayout; draw the traversed subscript sublayout according to the calculated bottom offset and the width and height of the sublayout.
[0028] Furthermore, step S45 specifically includes the following contents:
[0029] If the offset is 0, the sub-layout is not scaled or offset; if the offset is greater than 0, the scaling offset factor is calculated first, scaling offset factor = offset ÷ sub-layout height; if the scaling offset factor is greater than or equal to 1, the sub-layout is scaled and offset using a fixed scaling ratio and offset size; if the scaling offset factor is less than 1, the sub-layout is scaled and offset using the scaling offset factor multiplied by the fixed scaling ratio and offset size.
[0030] Compared with the prior art, the advantages of the present invention are as follows:
[0031] 1. The method for constructing a broadcast scale control with infinite sliding arc zoom based on Android of the present invention can quickly adjust broadcast parameters through continuous sliding operation without repeated sliding, thereby improving operation efficiency;
[0032] 2. The arc zoom effect can intuitively display the changing trend of parameters, reducing the cognitive burden of users;
[0033] 3. You can click the ruler scale or drag the ruler to automatically absorb the nearest valid parameter of the selected parameter for precise adjustment. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.
[0035] Figure 1 Create a flow chart for the control;
[0036] Figure 2 A flowchart for when the user clicks;
[0037] Figure 3 A flowchart for when the user slides. DETAILED DESCRIPTION
[0038] In order to clearly and completely describe the technical solution and its specific working process of the present invention, the specific implementation methods of the present invention are as follows in conjunction with the accompanying drawings of the specification:
[0039] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0040] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0041] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0042] Example 1
[0043] like Figure 1As shown, this embodiment provides a method for constructing a broadcast ruler control with infinite sliding arc zoom based on Android, which specifically includes the following contents:
[0044] S1. Initialize the scale list, data list, scale list layout adapter, data list layout adapter, scale list layout manager and data list custom layout manager;
[0045] S2, parameterization settings of scale list and data list;
[0046] The parameterized settings of the scale list include: infinite sliding, initial display position and list sliding monitoring; wherein, the initial display position of the scale is obtained according to the following formula: the subscript of the initial position of the scale list = the total scale of the visible area of the page × the customized initial factor (1000) - the number of scales that can be displayed above the selected pointer position.
[0047] The parameterized settings of the data list include: infinite sliding, initial display position, sliding zoom effect and sliding monitoring of the list; wherein, the initial display position of the data list is obtained according to the following formula, the subscript of the initial position of the data list = the number of data in the countable area of the page × the total number of data × the custom initial factor (1000).
[0048] S3, draw a scale;
[0049] S31, based on the layout of the scale list layout adapter, drawing the scale list through the scale list layout manager;
[0050] S32. After the ruler list is drawn, the sub-layout of the subscript of the initial position of the ruler is displayed to the top of the visible area through the scrollToPosition method of RecyclerView;
[0051] S33, after calling scrollToPosition to trigger the display change of the ruler list, continue to trigger the callback RecyclerView's sliding listening onScrolled method, traverse all the sub-layouts of the scales within the display range, determine whether the sub-layout of each scale is within the ruler arc position range, and set the offset to form a ruler list;
[0052] If it is within the arc position range of the ruler, each scale sub-layout within the arc position range is offset by different sizes according to the UI size to form an arc-shaped scale; if it is not within the arc position range of the ruler, the offset of the scale sub-layout is set to 0 or a fixed offset to ensure that this part is a linear scale.
[0053] S4, draw data list;
[0054] S41, based on the layout of the data list adapter, drawing the data list through the data list custom layout manager;
[0055] S42, drawing the sub-layout at the initial position;
[0056] Add the sublayout at the initial position of the data list to the control; use RecyclerView's measureChildWithMargins to measure the sublayout, get the width and height of the sublayout through getDecoratedMeasuredWidth and getDecoratedMeasuredHeight, and calculate the upper offset, upper offset = (display space height - sublayout height) ÷ 2; draw the sublayout at the initial position based on the calculated upper offset and the width and height of the sublayout.
[0057] S43, drawing all sub-layouts above the initial position;
[0058] Traversing the sublayout with the subscript of the initial position to the sublayout with the subscript of 0 can display the subscripts of all sublayouts within the visible range of the control, and adding the traversed subscript sublayout to the control; using RecyclerView's measureChildWithMargins to measure the sublayout, get the width and height of the sublayout through getDecoratedMeasuredWidth and getDecoratedMeasuredHeight, and calculate the upper offset, the upper offset = the distance from the sublayout below the sublayout to be drawn (that is, the last drawn sublayout, the first sublayout traversed and the last drawn sublayout is the sublayout at the initial position) to the top of the display space - the height of the sublayout; draw the traversed sublayout according to the calculated upper offset and the width and height of the sublayout.
[0059] S44, draw all sub-layouts below the initial position;
[0060] Traversing the sublayout with the subscript of the initial position to the sublayout with the subscript of the last data in the RecyclerView list can display the subscripts of all sublayouts within the visible range of the control, and add the traversed subscript sublayout to the control; use RecyclerView's measureChildWithMargins to measure the sublayout, getDecoratedMeasuredWidth and getDecoratedMeasuredHeight to get the width and height of the sublayout, and calculate the bottom offset, which is the distance from the sublayout above the sublayout to be drawn (that is, the last drawn sublayout, the first sublayout traversed and the last drawn sublayout is the sublayout at the initial position) to the bottom of the real space + the height of the sublayout; draw the traversed sublayout according to the calculated bottom offset and the width and height of the sublayout.
[0061] S45. Traverse all sub-layouts and calculate the offset of the traversed sub-layout to the selected position sub-layout given by the UI.
[0062] If the offset is 0, the sub-layout is not scaled or offset; if the offset is greater than 0, the scaling offset factor is calculated first, scaling offset factor = offset ÷ sub-layout height; if the scaling offset factor is greater than or equal to 1, the sub-layout is scaled and offset using a fixed scaling ratio and offset size; if the scaling offset factor is less than 1, the sub-layout is scaled and offset using the scaling offset factor multiplied by the fixed scaling ratio and offset size.
[0063] S5. Drawing is completed and the ruler is displayed to the user.
[0064] like Figure 2 As shown, when the user clicks the Android-based infinite sliding arc-shaped zooming broadcast ruler control described in this embodiment, the specific working process is as follows:
[0065] 1) When the user clicks the ruler:
[0066] ①Slide the clicked scale to the selected position;
[0067] ② According to the sliding distance received by the sliding monitor, the data list is controlled to slide the same distance; during the sliding process, the scale list and data list will be continuously redrawn according to the sliding distance until the sliding ends;
[0068] ③ According to the data and scale at the end of the slide, fine-tune the ruler display to ensure that the selected position is the optional data and scale;
[0069] ④After the ruler fine-tuning is completed, the action of clicking the ruler ends and the page becomes static.
[0070] 2) When the user clicks on the data list:
[0071] ①Slide the clicked data sub-layout to the selected position.
[0072] ② According to the sliding distance received by the sliding monitor, control the scale to slide the same distance; the sliding process will continuously redraw the scale list and data list according to the sliding distance until the sliding ends.
[0073] ③ According to the data and scale at the end position of sliding, fine-tune the ruler display to ensure that the selected position is optional data and scale.
[0074] ④After the ruler fine-tuning is completed, the action of clicking the ruler ends and the page becomes static.
[0075] like Figure 3 As shown, when the user slides the Android-based infinite sliding arc-shaped zooming broadcast ruler control described in this embodiment, the specific working process is as follows:
[0076] 1) When the user slides the ruler:
[0077] ① According to the sliding distance received by the sliding monitor, control the data list to slide the same distance; the sliding process will continuously redraw the scale list and data list according to the sliding distance until the sliding ends.
[0078] ② According to the data and scale at the end of the sliding, fine-tune the ruler display to ensure that the selected position is the optional data and scale.
[0079] ③After the ruler fine-tuning is completed, the action of clicking the ruler ends and the page becomes static.
[0080] 2) When the user slides a list of data
[0081] ① According to the sliding distance received by the sliding monitor, the scale is controlled to slide the same distance; during the sliding process, the scale list and data list will be continuously redrawn according to the sliding distance until the sliding ends.
[0082] ② According to the data and scale at the end of the sliding, fine-tune the ruler display to ensure that the selected position is the optional data and scale.
[0083] ③After the ruler fine-tuning is completed, the action of clicking the ruler ends and the page becomes static.
[0084] The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited to the specific details in the above embodiments. Within the technical concept of the present invention, a variety of simple modifications can be made to the technical solution of the present invention, and these simple modifications all belong to the protection scope of the present invention.
[0085] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations.
[0086] In addition, various embodiments of the present invention may be arbitrarily combined, and as long as they do not violate the concept of the present invention, they should also be regarded as the contents disclosed by the present invention.
Claims
1. A method for constructing a broadcast ruler control with infinite sliding arc zoom based on Android, characterized in that: The specific contents include the following: S1. Initialize the scale list, data list, scale list layout adapter, data list layout adapter, scale list layout manager and data list custom layout manager; S2, parameterization settings of scale list and data list; S3, draw a scale; S31, based on the layout of the scale list layout adapter, drawing the scale list through the scale list layout manager; S32. After the ruler list is drawn, the sub-layout of the subscript of the initial position of the ruler is displayed to the top of the visible area through the scrollToPosition method of RecyclerView; S33, after calling scrollToPosition to trigger the display change of the ruler list, continue to trigger the callback RecyclerView's sliding listening onScrolled method, traverse all the sub-layouts of the scales within the display range, determine whether the sub-layout of each scale is within the ruler arc position range, and set the offset to form a ruler list; S4, draw data list; S41, based on the layout of the data list adapter, drawing the data list through the data list custom layout manager; S42, drawing the sub-layout at the initial position; S43, drawing all sub-layouts above the initial position; S44, draw all sub-layouts below the initial position; S45, traverse all sub-layouts, and calculate the offset between the traversed sub-layout and the selected position sub-layout given by the UI; S5. Drawing is completed and the ruler is displayed to the user.
2. The method for constructing an Android-based infinite sliding arc-scaling broadcast ruler control as claimed in claim 1, characterized in that: In step S2, the parameterized settings of the ruler list include: infinite sliding, initial display position and list sliding monitoring; wherein, the initial display position of the ruler is obtained according to the following formula: the subscript of the initial position of the ruler list = the total scale of the visible area of the page × the customized initial factor - the number of scales that can be displayed above the selected pointer position.
3. The method for constructing an Android-based infinite sliding arc-scaling broadcast ruler control as claimed in claim 1, characterized in that: In step S2, the parameterized settings of the data list include: infinite sliding, initial display position, sliding zoom effect and sliding monitoring of the list; wherein, the initial display position of the data list is obtained according to the following formula: the subscript of the initial position of the data list = the number of data in the countable area of the page × the total number of data × the custom initial factor.
4. The method for constructing an Android-based infinite sliding arc-scaling broadcast ruler control as claimed in claim 1, characterized in that: In step S33, if the scale is within the arc position range, each scale sub-layout within the arc position range of the scale is offset by different sizes according to the UI size to form an arc scale; If it is not within the arc position range of the ruler, set the offset of the scale sublayout to 0 or a fixed offset to ensure that this part is a linear ruler.
5. The method for constructing an Android-based infinite sliding arc-scaling broadcast ruler control as claimed in claim 1, characterized in that: Step S42 specifically includes the following contents: Add the sublayout at the initial position of the data list to the control; use RecyclerView's measureChildWithMargins to measure the sublayout, get the width and height of the sublayout through getDecoratedMeasuredWidth and getDecoratedMeasuredHeight, and calculate the upper offset, upper offset = (display control height - sublayout height) ÷ 2; draw the sublayout at the initial position based on the calculated upper offset and the width and height of the sublayout.
6. The method for constructing an Android-based infinite sliding arc-scaling broadcast ruler control as claimed in claim 1, characterized in that: Step S43 specifically includes the following contents: Traversing the sublayout with the initial position index to the sublayout with the index 0 can display the indexes of all sublayouts within the visible range of the control, and adding the traversed sublayout to the control; using RecyclerView's measureChildWithMargins to measure the sublayout, get the width and height of the sublayout through getDecoratedMeasuredWidth and getDecoratedMeasuredHeight, and calculate the upper offset, which is the distance from the sublayout below the sublayout to be drawn to the top of the display space - the height of the sublayout; drawing the traversed sublayout according to the calculated upper offset and the width and height of the sublayout.
7. The method for constructing an Android-based infinite sliding arc-scaling broadcast ruler control as claimed in claim 1, characterized in that: Step S44 specifically includes the following contents: Traversing the sublayout with the index at the initial position to the sublayout with the index of the last data in the RecyclerView list can display the indexes of all sublayouts within the visible range of the control, and add the traversed sublayout to the control; use RecyclerView's measureChildWithMargins to measure the sublayout, get the width and height of the sublayout through getDecoratedMeasuredWidth and getDecoratedMeasuredHeight, and calculate the bottom offset, which is the distance from the sublayout above the sublayout to the bottom of the real space + the height of the sublayout; draw the traversed sublayout according to the calculated bottom offset and the width and height of the sublayout.
8. The method for constructing an Android-based infinite sliding arc-scaling broadcast ruler control as claimed in claim 1, characterized in that: Step S45 specifically includes the following contents: If the offset is 0, the sub-layout is not scaled or offset; if the offset is greater than 0, the scaling offset factor is calculated first, scaling offset factor = offset ÷ sub-layout height; If the scaling offset factor is greater than or equal to 1, the sublayout is scaled and offset using a fixed scaling ratio and offset size; If the scale offset factor is less than 1, the child layout is scaled and offset using the scale offset factor multiplied by the fixed scale and offset sizes.
