For mobile phone OEM/ODM manufacturers, customization is essential, international manufacturers such as three lost, LG and so on, will be the original Android customized. We bought the phone, the system is customized, which is very different from Google Android Aosp, these differences are manufacturers want to make the difference. The following are some of the Glowpadview customized notes, afraid to forget to check again later.
Glowpadview is the control used to implement a sliding listening control that is subordinate to the Incallscreen interface, that is, we call or answer the phone interface, in the previous article also mentioned about the Incallscreen interface UI detailed analysis, interested children shoes can be picked up to see.
recently need to do some customization on sliding listening, we know that Android native support calls swipe answer/reject/SMS reply three ways to implement the effect of the control on Android 4.2 Called Glowpadview.java, the previous version is called Multiwaveview.java. On Android 4.2, Google has made some changes to this piece, such as removing the water ripple on the 4.0 animation, the slide no longer show the circle, instead of a small white dot, with a face inside called Pointcloud. There was an open source project on GitHub that was extracted from the animated effect on 4.2, which is useful for devices like porting the effect to 4.2.
code Location: Sourcecode/packages/app/phone, the slide-listen control layout looks like this:
1 <Com.android.internal.widget.multiwaveview.GlowPadView2 Android:id= "@+id/incomingcallwidget"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Wrap_content"5 android:layout_gravity= "Center|bottom"6 Android:layout_margintop= "20dip"7 Android:layout_marginbottom= " -110dip"8 Android:background= "@android: Color/black"9 android:visibility= "Gone"Ten android:gravity= "Top" One A Prvandroid:targetdrawables= "@array/incoming_call_widget_3way_targets" - prvandroid:targetdescriptions= "@array/incoming_call_widget_3way_target_descriptions" - prvandroid:directiondescriptions= "@array/incoming_call_widget_3way_direction_descriptions" the prvandroid:handledrawable= "@drawable/ic_in_call_touch_handle" - Prvandroid:innerradius= "@*android:dimen/glowpadview_inner_radius" - Prvandroid:outerradius= "@*android:dimen/glowpadview_target_placement_radius" - prvandroid:outerringdrawable= "@*android:drawable/ic_lockscreen_outerring" + Prvandroid:snapmargin= "@*android:dimen/glowpadview_snap_margin" - prvandroid:vibrationduration= " the" + Prvandroid:feedbackcount= "1" A Prvandroid:glowradius= "@*android:dimen/glowpadview_glow_radius" at prvandroid:pointdrawable= "@*android:drawable/ic_lockscreen_glowdot" - />
Noun Explanation:
1. Targetdrawables
The call answering control has three processing events by default: Answer, reject, SMS reply. The actual contents of the @arrary/incoming_call_widget_3way_targets here are as follows:
1 <Arrayname= "Incoming_call_widget_3way_targets">2 <Item>@drawable/ic_lockscreen_answer</Item>3 <Item>@drawable/ic_lockscreen_text</Item>4 <Item>@drawable/ic_lockscreen_decline</Item>5 <Item>@null</Item>"6 </Array>
2. Targetdescriptions
The description text corresponding to the answer control. The contents are as follows:
1 <Arrayname= "Incoming_call_widget_3way_target_descriptions">2 <Item>@string/description_target_answer</Item>3 <Item>@string/description_target_send_sms</Item>4 <Item>@string/description_target_decline</Item>5 <Item>@null</Item>"6 </Array>
3. Directiondescriptions
The description of the direction of the sliding listening control is as follows:
1 <Arrayname= "Incoming_call_widget_3way_direction_descriptions">2 <Item>@*android:string/description_direction_right</Item>3 <Item>@*android:string/description_direction_up</Item>4 <Item>@*android:string/description_direction_left</Item>5 <Item>@null</Item>6 </Array>
4. Handledrawable
This is the picture resource with a small circle in the middle.
5. Innerradius
The radius size of the inner circle. The inner circle mentioned here is not what we see, which corresponds to the outer circle referred to later. When the incoming call there will be a small white dot from the center outward diffusion of animation, where the starting point is from Innerradius.
6. Outerradius
The RADIUS size of the outer circle. Corresponding to the front of the inner circle, are used to assist the display of small white dots animation, the outer circle is the animation's cutoff point, the inner circle is the starting point.
7. outerringdrawable
Outer boundary of the circle. This is drawn through the shape configuration. The code is as follows:
1 <Shapexmlns:android= "Http://schemas.android.com/apk/res/android"2 Android:shape= "Oval"3 >4 <sizeAndroid:height= "@dimen/keyguard_lockscreen_outerring_diameter"5 Android:width= "@dimen/keyguard_lockscreen_outerring_diameter" />6 <SolidAndroid:color= "#00000000" />7 <StrokeAndroid:color= "#1affffff"Android:width= "2DP" />8 </Shape>
We have not seen this line on Android 4.2, but by changing the color value of solid and the color value of stroke Lee, we can show it in Android4.0. Set the boundary line conducive to the prevention of targets, after all, the width and height have, the location of natural easy to draw, but also easy to control.
8. Snapmargin
The trigger condition is reached as far away from Target. That is, when the call, if we click on the middle of the button and gradually to the receiving side of the slide, when the slide to a certain position, will automatically change the status of the answer button, the picture will also change. The snapmargin here is used to judge the distance between our fingers and target.
9. Vibrationduration
The vibration lasts for a long time.
Ten. Feedbackcount
The number of times the animation occurred. That is, when the call, small white dots from the inside out of the spread, this effect only once. Why do you have this parameter here? Because at the time of Android 4.0, there is no small white spot, only the ripples, and this value is also the default is 3, we can see the call will blink 3 ripples, Android 4.2 on its basis modified, but in order to retain the original structure, so there is no drastic deletion of the code.
Glowradius.
This is the halo radius. That is, when we press and move, the small white dots that follow our fingers move. In 4.0 is handledrawable will follow the move, 4.2 but after the departure ontouchevent, Handledrawable will disappear, replaced by a small circle of small white spots, that is, the halo radius here.
Pointdrawable.
This is the resource of the little white spot.
The illustration shows the following: