From e331d604d5ab345b06976c0ff7a930930f6b9e41 Mon Sep 17 00:00:00 2001 From: Chiao Cheng Date: Fri, 19 Jul 2013 19:10:55 -0700 Subject: 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 --- src/com/android/incallui/CallButtonFragment.java | 35 ++++++++++++++++++++++++ src/com/android/incallui/CallCardFragment.java | 35 ++++++++++++++++++++++++ src/com/android/incallui/CallHandlerService.java | 11 +++++--- src/com/android/incallui/InCallActivity.java | 7 +++++ 4 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 src/com/android/incallui/CallButtonFragment.java create mode 100644 src/com/android/incallui/CallCardFragment.java (limited to 'src') diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java new file mode 100644 index 00000000..856d186b --- /dev/null +++ b/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/src/com/android/incallui/CallCardFragment.java b/src/com/android/incallui/CallCardFragment.java new file mode 100644 index 00000000..fb60c0b0 --- /dev/null +++ b/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/src/com/android/incallui/CallHandlerService.java b/src/com/android/incallui/CallHandlerService.java index 741701ce..b5f14970 100644 --- a/src/com/android/incallui/CallHandlerService.java +++ b/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/src/com/android/incallui/InCallActivity.java b/src/com/android/incallui/InCallActivity.java index 67fe1ca7..380d4876 100644 --- a/src/com/android/incallui/InCallActivity.java +++ b/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(); -- cgit v1.2.3