diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-07-19 19:10:55 -0700 |
---|---|---|
committer | Chiao Cheng <chiaocheng@google.com> | 2013-07-22 11:39:09 -0700 |
commit | 550f92b42a5387875d994a9b72050eaec2018649 (patch) | |
tree | 0427af488aae9503077d65d7524ab6a73b389f65 | |
parent | 66b2c28f44344d850202eab63e9f058c0da115f0 (diff) |
Adding call card and buttons to UI.
- Created a fragment for call card and a fragment for UI.
- Adding corresponding button images.
Change-Id: I5facacd3a4346ab9d9ec2a67a2742dc27dbf5583
21 files changed, 505 insertions, 12 deletions
diff --git a/InCallUI/res/drawable-hdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-hdpi/ic_groups_holo_dark.png Binary files differnew file mode 100644 index 000000000..6194506d4 --- /dev/null +++ b/InCallUI/res/drawable-hdpi/ic_groups_holo_dark.png diff --git a/InCallUI/res/drawable-hdpi/picture_unknown.png b/InCallUI/res/drawable-hdpi/picture_unknown.png Binary files differnew file mode 100644 index 000000000..278c1215c --- /dev/null +++ b/InCallUI/res/drawable-hdpi/picture_unknown.png diff --git a/InCallUI/res/drawable-ldrtl-hdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-ldrtl-hdpi/ic_groups_holo_dark.png Binary files differnew file mode 100644 index 000000000..185c55bab --- /dev/null +++ b/InCallUI/res/drawable-ldrtl-hdpi/ic_groups_holo_dark.png diff --git a/InCallUI/res/drawable-ldrtl-hdpi/picture_unknown.png b/InCallUI/res/drawable-ldrtl-hdpi/picture_unknown.png Binary files differnew file mode 100644 index 000000000..3b81ff3e7 --- /dev/null +++ b/InCallUI/res/drawable-ldrtl-hdpi/picture_unknown.png diff --git a/InCallUI/res/drawable-ldrtl-mdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-ldrtl-mdpi/ic_groups_holo_dark.png Binary files differnew file mode 100644 index 000000000..844bed3f0 --- /dev/null +++ b/InCallUI/res/drawable-ldrtl-mdpi/ic_groups_holo_dark.png diff --git a/InCallUI/res/drawable-ldrtl-mdpi/picture_unknown.png b/InCallUI/res/drawable-ldrtl-mdpi/picture_unknown.png Binary files differnew file mode 100644 index 000000000..062faf5f5 --- /dev/null +++ b/InCallUI/res/drawable-ldrtl-mdpi/picture_unknown.png diff --git a/InCallUI/res/drawable-ldrtl-xhdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-ldrtl-xhdpi/ic_groups_holo_dark.png Binary files differnew file mode 100644 index 000000000..38ea395c5 --- /dev/null +++ b/InCallUI/res/drawable-ldrtl-xhdpi/ic_groups_holo_dark.png diff --git a/InCallUI/res/drawable-ldrtl-xhdpi/picture_unknown.png b/InCallUI/res/drawable-ldrtl-xhdpi/picture_unknown.png Binary files differnew file mode 100644 index 000000000..1f57aa1a1 --- /dev/null +++ b/InCallUI/res/drawable-ldrtl-xhdpi/picture_unknown.png diff --git a/InCallUI/res/drawable-mdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-mdpi/ic_groups_holo_dark.png Binary files differnew file mode 100644 index 000000000..fefee322e --- /dev/null +++ b/InCallUI/res/drawable-mdpi/ic_groups_holo_dark.png diff --git a/InCallUI/res/drawable-mdpi/picture_unknown.png b/InCallUI/res/drawable-mdpi/picture_unknown.png Binary files differnew file mode 100644 index 000000000..cc5dd09a6 --- /dev/null +++ b/InCallUI/res/drawable-mdpi/picture_unknown.png diff --git a/InCallUI/res/drawable-xhdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-xhdpi/ic_groups_holo_dark.png Binary files differnew file mode 100644 index 000000000..470ca2795 --- /dev/null +++ b/InCallUI/res/drawable-xhdpi/ic_groups_holo_dark.png diff --git a/InCallUI/res/drawable-xhdpi/picture_unknown.png b/InCallUI/res/drawable-xhdpi/picture_unknown.png Binary files differnew file mode 100644 index 000000000..b8ee922fd --- /dev/null +++ b/InCallUI/res/drawable-xhdpi/picture_unknown.png diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml new file mode 100644 index 000000000..1c2e7c7b2 --- /dev/null +++ b/InCallUI/res/layout/call_button_fragment.xml @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2013 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<!-- In-call onscreen touch UI elements, used on some platforms. + + This layout is a fullscreen overlay, drawn on top of the + non-touch-sensitive parts of the in-call UI (i.e. the call card). + + The top-level View here is a InCallTouchUi (FrameLayout) with 2 children: + (1) inCallControls: the widgets visible while a regular call (or calls) is in progress + (2) incomingCallWidget: the UI displayed while an incoming call is ringing + In usual cases, one of these is visible at any given moment. + One exception is when incomingCallWidget is fading-out. At that moment, we show + inCallControls beneath incomingCallWidget for smoother transition. + --> + +<!-- Main cluster of onscreen buttons on the lower part of the screen. --> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/bottomButtons" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true"> + + <!-- Row 1, the "extra button row": A couple of relatively rare + buttons used only in certain call states. + Most of the time this whole row is GONE. + For now, at least, there's only ever one button visible here + at a time, so this can be a simple FrameLayout. --> + <ViewStub android:id="@+id/extraButtonRow" + android:layout="@layout/extra_button_row" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + + <!-- Row 2: The "End call" button. --> + <ImageButton android:id="@+id/endButton" + style="@style/InCallEndButton" + android:layout_width="match_parent" + android:src="@drawable/ic_dial_end_call" + android:background="@drawable/end_call_background" + android:contentDescription="@string/onscreenEndCallText"/> + + <!-- Row 3: The main batch of in-call buttons: + Dialpad / Audio mode / Mute / Hold / Add call + Visible in all states except while an incoming call is + ringing. --> + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/dialpad_background" + android:paddingStart="@dimen/button_cluster_side_padding" + android:paddingEnd="@dimen/button_cluster_side_padding" + > + + <!-- This row has either 4 or 5 buttons, depending on + whether the device supports "Hold" (i.e. 4 buttons on + CDMA devices, 5 buttons on GSM devices.) The buttons + are interspersed with 'layout_weight="1"' placeholder + views so that they'll be spaced evenly in both cases. + + But note there are a couple of *pairs* of buttons that share a + single "slot", namely Hold/Swap and Add/Merge. For these, the + code in InCallTouchUi is responsible for making sure that at any + point exactly one of the pair is VISIBLE and the other is + GONE. --> + + <!-- Separator between left padding and 1st button --> + <View style="@style/VerticalSeparator"/> + + <!-- "Dialpad" --> + <!-- This is a "compound button": it has checked and unchecked states. --> + <ToggleButton android:id="@+id/dialpadButton" + style="@style/InCallCompoundButton" + android:background="@drawable/btn_compound_dialpad" + android:contentDescription="@string/onscreenShowDialpadText" + /> + + <!-- Separator between 1st and 2nd button --> + <View style="@style/VerticalSeparator"/> + + <!-- "Audio mode" --> + <!-- This is a multi-mode button that can behave either like a + simple "compound button" with two states *or* like an + action button that brings up a popup menu; see + btn_compound_audio.xml and InCallTouchUi.updateAudioButton() + for the full details. --> + <ToggleButton android:id="@+id/audioButton" + style="@style/InCallCompoundButton" + android:background="@drawable/btn_compound_audio" + android:contentDescription="@string/onscreenAudioText" + /> + + <!-- Separator between 2nd and 3rd button --> + <View style="@style/VerticalSeparator"/> + + <!-- "Mute" --> + <!-- This is a "compound button": it has checked and unchecked states. --> + <ToggleButton android:id="@+id/muteButton" + style="@style/InCallCompoundButton" + android:background="@drawable/btn_compound_mute" + android:contentDescription="@string/onscreenMuteText" + /> + + <!-- Separator between 3rd and 4th button --> + <View style="@style/VerticalSeparator"/> + + <!-- This slot is either "Hold" or "Swap", depending on + the state of the call. One or the other of these + must always be set to GONE. --> + <!-- "Hold" --> + <!-- This is a "compound button": it has checked and unchecked states. --> + <ToggleButton android:id="@+id/holdButton" + style="@style/InCallCompoundButton" + android:background="@drawable/btn_compound_hold" + android:contentDescription="@string/onscreenHoldText" + /> + <!-- "Swap" (or "Manage calls" in some CDMA states) --> + <ImageButton android:id="@+id/swapButton" + style="@style/InCallButton" + android:src="@drawable/ic_incall_switch_holo_dark" + android:contentDescription="@string/onscreenSwapCallsText" + /> + + <!-- Separator between 4th and 5th button (if 5th exists) --> + <View android:id="@+id/holdSwapSpacer" + style="@style/VerticalSeparator"/> + + <!-- This slot is either "Add" or "Merge", depending on + the state of the call. One or the other of these + must always be set to GONE. --> + <!-- "Add Call" --> + <ImageButton android:id="@+id/addButton" + style="@style/InCallButton" + android:src="@drawable/ic_add_contact_holo_dark" + android:contentDescription="@string/onscreenAddCallText" + /> + <!-- "Merge calls" --> + <!-- This button is used only on GSM devices, where we know + that "Add" and "Merge" are never available at the same time. + The "Merge" button for CDMA devices is "cdmaMergeButton" above. --> + <ImageButton android:id="@+id/mergeButton" + style="@style/InCallButton" + android:src="@drawable/ic_merge_holo_dark" + android:contentDescription="@string/onscreenMergeCallsText" + /> + + <!-- Separator between 5th and 6th button (if 6th exists) --> + <View android:id="@+id/videoCallSpacer" + style="@style/VerticalSeparator"/> + + <!-- This button is use for converting an ongoing call into a video call. --> + <ImageButton android:id="@+id/videoCallButton" + style="@style/InCallButton" + android:src="@drawable/ic_videocall_holo_dark" + android:contentDescription="@string/onscreenVideoCallText" + /> + + <!-- Separator between 4th (or 5th) button and right padding --> + <View style="@style/VerticalSeparator"/> + + </LinearLayout> + +</LinearLayout> diff --git a/InCallUI/res/layout/call_card_fragment.xml b/InCallUI/res/layout/call_card_fragment.xml new file mode 100644 index 000000000..688563de2 --- /dev/null +++ b/InCallUI/res/layout/call_card_fragment.xml @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2013 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="0dp" + android:layout_weight="1"> + + <!-- Contact photo for primary call info --> + <ImageView android:id="@+id/photo" + android:layout_alignParentStart="true" + android:layout_alignParentTop="true" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="top|center_horizontal" + android:scaleType="centerCrop" + android:contentDescription="@string/contactPhoto" + android:src="@drawable/picture_unknown"/> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <!-- "Call Banner" for primary call, the foregound or ringing call. + The "call banner" is a block of info about a single call, + including the contact name, phone number, call time counter, + and other status info. This info is shown as a "banner" + overlaid across the top of contact photo. --> + <GridLayout android:id="@+id/primary_call_banner" + style="@style/PrimaryCallInfoPrimaryCallBanner" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="@dimen/call_banner_height" + android:background="@color/incall_call_banner_background" + android:paddingStart="@dimen/call_banner_side_padding" + android:paddingEnd="@dimen/call_banner_side_padding" + android:paddingTop="@dimen/call_banner_top_bottom_padding" + android:paddingBottom="@dimen/call_banner_top_bottom_padding" + > + + <!-- Name (or the phone number, if we don't have a name to display). --> + <TextView android:id="@+id/name" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="@color/incall_call_banner_text_color" + android:singleLine="true" + android:textAlignment="viewStart" + android:layout_column="0" + android:layout_row="0" + android:layout_columnSpan="2" + android:layout_gravity="fill"/> + + <!-- Label (like "Mobile" or "Work", if present) and phone number, side by side --> + <TextView android:id="@+id/phoneNumber" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_text_color" + android:singleLine="true" + android:textDirection="ltr" + android:layout_column="0" + android:layout_row="1" + android:layout_gravity="fill"/> + + <TextView android:id="@+id/label" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_text_color" + android:textAllCaps="true" + android:singleLine="true" + android:paddingStart="6dp" + android:layout_column="1" + android:layout_row="1" + android:layout_gravity="fill"/> + + <!-- Call type indication: a special label and/or branding + for certain kinds of calls (like "Internet call" for a SIP call.) --> + <TextView android:id="@+id/callTypeLabel" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_text_color" + android:maxLines="1" + android:layout_column="0" + android:layout_row="2" + android:layout_columnSpan="2" + android:ellipsize="end" + android:layout_gravity="fill"/> + + <!-- Elapsed time indication for a call in progress. --> + <TextView android:id="@+id/elapsedTime" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="@color/incall_call_banner_text_color" + android:singleLine="true" + android:visibility="invisible" + android:layout_column="2" + android:layout_row="0" + android:layout_rowSpan="3" + android:layout_gravity="fill" + android:gravity="end|center_vertical"/> + </GridLayout> + <!-- End of call_banner --> + + + <!-- The "call state label": In some states, this shows a special + indication like "Dialing" or "Incoming call" or "Call ended". + It's unused for the normal case of an active ongoing call. --> + <TextView android:id="@+id/callStateLabel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="@dimen/provider_info_top_bottom_padding" + android:paddingBottom="@dimen/provider_info_top_bottom_padding" + android:paddingStart="@dimen/call_banner_side_padding" + android:paddingEnd="@dimen/call_banner_side_padding" + android:gravity="end" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/incall_call_banner_text_color" + android:textAllCaps="true" + android:background="@color/incall_secondary_info_background" + android:singleLine="true" + android:ellipsize="end"/> + + </LinearLayout> + + +</FrameLayout>
\ No newline at end of file diff --git a/InCallUI/res/layout/extra_button_row.xml b/InCallUI/res/layout/extra_button_row.xml new file mode 100644 index 000000000..79c11366d --- /dev/null +++ b/InCallUI/res/layout/extra_button_row.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2013 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/dialpad_background_opaque"> + <!-- The buttons here have a text label floating off to the side + (which is necessary because these buttons are used only in + a few rare states, and the meaning of the icon might not be + obvious.) The entire row (button + text) is clickable. --> + + <!-- "Manage conference" --> + <!-- This button is used only on GSM devices, during a conference call. --> + <LinearLayout android:id="@+id/manageConferenceButton" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="@dimen/button_cluster_side_padding" + android:paddingEnd="@dimen/button_cluster_side_padding" + android:background="?android:attr/selectableItemBackground"> + <!-- The entire LinearLayout here is clickable, so we don't + care about clicks on the ImageButton itself. --> + <ImageButton android:id="@+id/manageConferenceButtonImage" + android:clickable="false" + style="@style/InCallExtraRowButton" + android:src="@drawable/ic_groups_holo_dark" + android:contentDescription="@string/onscreenManageConferenceText" /> + <TextView android:id="@+id/manageConferenceButtonLabel" + style="@style/InCallExtraRowButtonLabel" + android:text="@string/onscreenManageConferenceText" /> + </LinearLayout> + + <!-- CDMA-specific "Merge" --> + <!-- This button is used only on CDMA devices, where we can't use + the Merge button in the main button row (because the "Add Call" + button might need to be enabled at the same time.) --> + <LinearLayout android:id="@+id/cdmaMergeButton" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="@dimen/button_cluster_side_padding" + android:paddingEnd="@dimen/button_cluster_side_padding" + android:background="?android:attr/selectableItemBackground"> + <!-- The entire LinearLayout here is clickable, so we don't + care about clicks on the ImageButton itself. --> + <ImageButton android:id="@+id/cdmaMergeButtonImage" + android:clickable="false" + style="@style/InCallExtraRowButton" + android:src="@drawable/ic_merge_holo_dark" + android:contentDescription="@string/onscreenMergeCallsText" /> + <TextView android:id="@+id/cdmaMergeButtonLabel" + style="@style/InCallExtraRowButtonLabel" + android:text="@string/onscreenMergeCallsText" /> + </LinearLayout> + +</FrameLayout> diff --git a/InCallUI/res/layout/incall_screen.xml b/InCallUI/res/layout/incall_screen.xml index d9f7bdfc8..403a17cc8 100644 --- a/InCallUI/res/layout/incall_screen.xml +++ b/InCallUI/res/layout/incall_screen.xml @@ -16,13 +16,20 @@ <!-- In-call Phone UI; see InCallActivity.java. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:id="@+id/main"> - - <View android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#ddd"/> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/main"> + + <LinearLayout android:id="@+id/in_call_and_button_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <!-- Call card fragment will be added here. --> + <!-- Call button fragment will be added here. --> + + </LinearLayout> + + <!-- Glowpad fragment will be added here to overlay. --> </FrameLayout> diff --git a/InCallUI/res/values/styles.xml b/InCallUI/res/values/styles.xml index c86e570b8..415db361d 100644 --- a/InCallUI/res/values/styles.xml +++ b/InCallUI/res/values/styles.xml @@ -81,6 +81,27 @@ <item name="android:layout_weight">1</item> </style> + <!-- Buttons in extra button row. --> + <style name="InCallExtraRowButton"> + <item name="android:layout_width">@dimen/extra_row_button_width</item> + <item name="android:layout_height">@dimen/extra_row_button_height</item> + <item name="android:background">@null</item> + </style> + + <!-- Text label drawn alongside buttons in the "extra button row" of + the in-call onscreen touch UI. --> + <style name="InCallExtraRowButtonLabel"> + <item name="android:textAppearance">?android:attr/textAppearanceSmall</item> + <item name="android:textColor">@color/incall_call_banner_text_color</item> + <item name="android:textAllCaps">true</item> + <item name="android:textStyle">bold</item> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:layout_gravity">center_vertical</item> + <item name="android:layout_marginStart">5dip</item> + <item name="android:layout_marginEnd">5dip</item> + </style> + <style name="InCallAnimationStyle" parent="@*android:style/Animation.Holo.Activity"> <!-- Suppress task-to-task animation happening during the transition from OutgoingCallBroadcaster (and SipOptionHandler) to InCallActivity. diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java new file mode 100644 index 000000000..856d186bc --- /dev/null +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.incallui; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +/** + * Fragment for call control buttons + */ +public class CallButtonFragment extends Fragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(R.layout.call_button_fragment, container, false); + } +} diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java new file mode 100644 index 000000000..fb60c0b03 --- /dev/null +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.incallui; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +/** + * Fragment for call card. + */ +public class CallCardFragment extends Fragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(R.layout.call_card_fragment, container, false); + } +} diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java index 741701ce5..b5f149704 100644 --- a/InCallUI/src/com/android/incallui/CallHandlerService.java +++ b/InCallUI/src/com/android/incallui/CallHandlerService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Android Open Source Project + * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License. + * limitations under the License */ package com.android.incallui; @@ -68,8 +68,11 @@ public class CallHandlerService extends Service { // TODO(klp): Not sure if static call is ok. Might need to switch to normal service binding. public static void answerCall(int callId) { - Preconditions.checkState(mCallCommandService != null); - + //Preconditions.checkState(mCallCommandService != null); + // TODO(klp): enable fail fast later. + if (mCallCommandService == null) { + return; + } try { mCallCommandService.answerCall(callId); } catch (RemoteException e) { diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 67fe1ca70..380d48764 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -61,8 +61,15 @@ public class InCallActivity extends Activity { @Override protected void onResume() { logD("onResume()..."); + + // TODO(klp): create once and reset when needed. final AnswerFragment answerFragment = new AnswerFragment(); + final CallCardFragment callCardFragment = new CallCardFragment(); + final CallButtonFragment callButtonFragment = new CallButtonFragment(); final FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); + fragmentTransaction.add(R.id.in_call_and_button_container, callCardFragment); + fragmentTransaction.add(R.id.in_call_and_button_container, callButtonFragment); + fragmentTransaction.add(R.id.main, answerFragment); fragmentTransaction.commit(); super.onResume(); |