通话状态

  • 主机 activity:InCallActivity
  • 根布局:@layout/in_call_activity

来电屏幕

Fragment:IncomingCallFragment

横屏模式下通话期间的拨号键盘屏幕

布局:@layout/ongoing_call_fragment

来电屏幕

图 1. 来电屏幕

组件 [id:]ClassName 属性
background_image:
BackgroundImageView
@config/config_background_image_alpha 1.0
以程序化方式用于联系人头像
@config/config_background_image_error_alpha 1.0
以程序化方式用于联系人字母块。设为 0.0 会隐藏背景颜色。
user_profile_container:
@layout/user_profile_large
不适用 不适用
ringing_call_controller_bar:
RingingCallControllerBarFragment
height @dimen/in_call_controller_bar_height
layout_margintStart
layout_marginEnd
layout_marginBottom
@dimen/in_call_controller_bar_margin
  • 用户个人资料:@layout/user_profile_large
    Component [id:]ClassName 属性
    root: LinearLayout orientation horizontal
    paddingStart
    paddingEnd
    @dimen/in_call_user_profile_margin
    user_profile_avatar: ImageView width in_call_avatar_icon_size
    height in_call_avatar_icon_size
    scaleType fitCenter
    User info: LinearLayout paddingStart @dimen/in_call_margin_between_avatar_and_text
    user_profile_title:TextView textAppearance @style/TextAppearance.InCallUserTitle
    user_profile_phone_number: TextView textAppearance @style/TextAppearance.InCallUserPhoneNumber
    marginTop @dimen/in_call_phone_number_margin_top
    user_profile_call_state: Chronometer textAppearance @style/TextAppearance.InCallState
    marginTop @dimen/in_call_state_margin_top
  • RingingCallControllerBarFragment:@layout/ringing_call_controller_bar_fragment
    Component [id:]ClassName 属性
    root: ConstraintLayout height @dimen/in_call_controller_bar_height
    background @android:color/transparent
    answer_call_button: ImageView width
    height
    @dimen/ringing_call_button_touch_target_size
    background @drawable/dialer_ripple_background
    src @drawable/ic_phone
    tint @color/phone_call
    scaleType center
    answer_call_text: TextView marginStart @dimen/ringing_call_text_margin
    text @string/answer_call
    textAppearance ?android:attr/textAppearanceLarge
    end_call_button: ImageView width
    height
    @dimen/ringing_call_button_touch_target_size
    background @drawable/dialer_ripple_background
    src @drawable/ic_call_end
    tint @color/phone_end_call
    scaleType center
    end_call_text: TextView marginStart @dimen/ringing_call_text_margin
    text @string/decline_call
    textAppearance ?android:attr/textAppearanceLarge
    mid_line: Guideline constraintGuide_percent 0.5

竖屏模式下的来电屏幕

在竖屏模式下,来电屏幕的 @layout/ongoing_call_fragment 与横屏模式相同,但 @layout[-port]/user_profile_large 布局有所不同。

竖屏模式下的来电屏幕

图 2. 竖屏模式下的来电屏幕

  • 用户个人资料:@layout/user_profile_large
    Component [id:]ClassName 属性
    root: LinearLayout orientation vertical
    gravity center
    user_profile_avatar: ImageView width in_call_avatar_icon_size
    height in_call_avatar_icon_size
    scaleType fitCenter
    user_profile_title: TextView textAppearance @style/TextAppearance.InCallUserTitle
    paddingTop @dimen/in_call_margin_between_avatar_and_text
    user_profile_phone_number: TextView textAppearance @style/TextAppearance.InCallUserPhoneNumber
    paddingTop @dimen/in_call_phone_number_margin_top
    user_profile_call_state: Chronometer textAppearance @style/TextAppearance.InCallState
    paddingTop @dimen/in_call_state_margin_top

“正在通话”屏幕

Fragment:OngoingCallFragment

横屏模式

横屏模式下的“正在通话”屏幕

图 3. 横屏模式下的“正在通话”屏幕

Component [id:]ClassName 属性
background_image: BackgroundImageView @config/config_background_image_alpha 1.0
以程序化方式用于联系人头像
@config/config_background_image_error_alpha 1.0
以程序化方式用于联系人字母块。设为 0.0 会隐藏背景颜色。
其他视图的容器:ConstraintLayout background @android:color/transparent
必需值,用于让控制条按钮呈现条纹效果。
incall_dialpad_fragment: InCallDialpadFragment 不适用 请参阅通话期间的拨号键盘
user_profile_container: @layout/user_profile_large 不适用 来电屏幕上的 @layout/user_profile_large 相同。
  • 横屏模式
  • 竖屏模式
onhold_user_profile: OnHoldCallUserProfileFragment height @dimen/onhold_user_info_height
layout_marginTop @dimen/onhold_profile_margin_y
layout_marginStart
layout_marginEnd
@dimen/onhold_profile_margin_x
ongoing_call_control_bar: OnGoingCallControllerBarFragment layout_marginBottom @dimen/in_call_controller_bar_margin
layout_marginHorizontal @dimen/in_call_controller_bar_margin
  • OnHoldCallUserProfileFragment:@layout/onhold_user_profile
    组件 [id:]ClassName 属性
    root: CardView android:elevation @dimen/dialer_card_elevation
    cardBackgroundColor @color/onhold_call_background
    cardCornerRadius @dimen/onhold_profile_corner_radius
    swap_calls_view: ConstraintLayout background ?android:attr/selectableItemBackground
    guideline: Guideline layout_constraintGuide_begin @dimen/onhold_profile_guideline
    icon: ImageView width
    height
    @dimen/avatar_icon_size
    scaleType centerCrop
    layout_marginStart @dimen/onhold_profile_avatar_margin
    title: TextView textAppearance ?android:attr/textAppearanceLarge
    text: TextView text @string/onhold_call_label
    textAppearance ?android:attr/textAppearanceSmall
    swap_call_button: ImageView src @drawable/ic_swap_calls
    tint @color/secondary_icon_color
    scaleType center
    paddingLeft
    paddingRight
    @dimen/swap_call_button_margin
  • OnGoingCallControllerBarFragment:@layout/on_going_call_controller_bar_fragment
    Component [id:]ClassName 属性
    root: ConstraintLayout height @dimen/in_call_controller_bar_height
    mute_button: ImageView width
    height
    @dimen/in_call_button_size
    scaleType center
    src @drawable/ic_mute_activatable
    background @drawable/dialer_ripple_background
    toggle_dialpad_button: ImageView width
    height
    @dimen/in_call_button_size
    scaleType center
    src @drawable/ic_dialpad_activatable
    background @drawable/dialer_ripple_background
    end_call_button: ImageView style @style/DialpadPrimaryButton
    src @drawable/ic_call_end_button
    voice_channel_view: LinearLayout orientation vertical
    voice_channel_button: ImageView width
    height
    @dimen/in_call_button_size
    scaleType center
    src @drawable/ic_audio_route_vehicle_activatable
    background @drawable/dialer_ripple_background
    voice_channel_text: TextView visibility gone
    pause_button: ImageView width
    height
    @dimen/in_call_button_size
    scaleType center
    src @drawable/ic_pause_activatable
    background @drawable/dialer_ripple_background

竖屏模式下的“正在通话”屏幕

图 4. 竖屏模式下的“正在通话”屏幕

竖屏模式与横屏模式的布局相同,但 @layout/user_profile_large 布局有所不同。另请参阅竖屏模式下的来电屏幕

通话期间的拨号键盘

Fragment:InCallDialpadFragment

横屏模式

布局:@layout/incall_dialpad_fragment

横屏模式下通话期间的拨号键盘屏幕

图 5. 横屏模式下通话期间的拨号键盘屏幕

组件 [id:]ClassName 属性
divider: Guideline layout_constraintGuide_percent 0.5
dialpad_fragment: KeypadFragment 不适用 请参阅拨号键盘
dialpad_info_boundaries: View height dialpad_fragment 相同
layout_constraintDimensionRatio W, 1:1
call_state: Chronometer layout_width match_parent,可避免在文本更新时重新绘制整个视图
textAppearance @style/TextAppearance.InCallState
marginBottom @dimen/call_state_padding
title: TextView textAppearance @style/TextAppearance.DialNumber

竖屏模式下通话期间的拨号键盘

布局:@layout[-port]/incall_dialpad_fragment

竖屏模式下通话期间的拨号键盘屏幕

图 6. 竖屏模式下通话期间的拨号键盘屏幕

组件 [id:]ClassName 属性
dialpad_fragment: KeypadFragment layout_marginTop @dimen/keypad_margin
call_state: Chronometer layout_width match_parent,可避免在文本更新时重新绘制整个视图
gravity center
textAppearance @style/TextAppearance.InCallState
marginStart
marginEnd
@dimen/dialpad_info_edge_padding_size
title: TextView gravity 结束时,宽度会设为 wrap_content 以居中显示拨出的号码,并在通话开始时淡出。
textAppearance @style/TextAppearance.DialNumber
marginStart
marginEnd
@dimen/dialpad_info_edge_padding_size

KeypadFragment:请参阅拨号键盘