Merge "Add custom call type affordance to TestActivity." into ub-contactsdialer-a-dev
diff --git a/tests/res/layout/fill_call_log_test.xml b/tests/res/layout/fill_call_log_test.xml
index e34125c..43f475b 100644
--- a/tests/res/layout/fill_call_log_test.xml
+++ b/tests/res/layout/fill_call_log_test.xml
@@ -59,7 +59,7 @@
         android:text="@string/add_custom_entry"
         />
     <LinearLayout
-        android:orientation="horizontal"
+        android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="left"
@@ -92,6 +92,18 @@
                 android:layout_height="wrap_content"
                 android:text="@string/call_type_voicemail"
                 android:textSize="9sp" />
+            <RadioButton
+                android:id="@+id/call_type_custom"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Custom"
+                android:textSize="9sp" />
+            <EditText
+                android:id="@+id/call_type_custom_text"
+                android:layout_width="90dp"
+                android:layout_height="wrap_content"
+                android:text=""
+                android:inputType="number" />
         </RadioGroup>
         <CheckBox
             android:id="@+id/call_type_video"
diff --git a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
index 1cfdc28..aa2d265 100644
--- a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
+++ b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
@@ -42,6 +42,7 @@
 import android.telecom.TelecomManager;
 import android.text.format.DateFormat;
 import android.util.Log;
+import android.view.MotionEvent;
 import android.view.View;
 import android.widget.Button;
 import android.widget.CheckBox;
@@ -80,6 +81,8 @@
     private RadioButton mCallTypeMissed;
     private RadioButton mCallTypeOutgoing;
     private RadioButton mCallTypeVoicemail;
+    private RadioButton mCallTypeCustom;
+    private EditText mCustomCallTypeTextView;
     private CheckBox mCallTypeVideo;
     private RadioButton mPresentationAllowed;
     private RadioButton mPresentationRestricted;
@@ -134,6 +137,8 @@
         mCallTypeMissed = (RadioButton) findViewById(R.id.call_type_missed);
         mCallTypeOutgoing = (RadioButton) findViewById(R.id.call_type_outgoing);
         mCallTypeVoicemail = (RadioButton) findViewById(R.id.call_type_voicemail);
+        mCallTypeCustom = (RadioButton) findViewById(R.id.call_type_custom);
+        mCustomCallTypeTextView = (EditText) findViewById(R.id.call_type_custom_text);
         mCallTypeVideo = (CheckBox) findViewById(R.id.call_type_video);
         mPresentationAllowed = (RadioButton) findViewById(R.id.presentation_allowed);
         mPresentationPayphone = (RadioButton) findViewById(R.id.presentation_payphone);
@@ -146,6 +151,14 @@
         mAccount0 = (RadioButton) findViewById(R.id.account0);
         mAccount1 = (RadioButton) findViewById(R.id.account1);
 
+        mCustomCallTypeTextView.setOnTouchListener(new View.OnTouchListener() {
+            @Override
+            public boolean onTouch(View v, MotionEvent event) {
+                mCallTypeCustom.toggle();
+                return false;
+            }
+        });
+
         // Use the current time as the default values for the picker
         final Calendar c = Calendar.getInstance();
         mCallTimeHour = c.get(Calendar.HOUR_OF_DAY);
@@ -386,6 +399,8 @@
             return Calls.OUTGOING_TYPE;
         } else if (mCallTypeVoicemail.isChecked()) {
             return Calls.VOICEMAIL_TYPE;
+        } else if (mCallTypeCustom.isChecked()) {
+            return Integer.parseInt(mCustomCallTypeTextView.getText().toString());
         } else {
             return Calls.MISSED_TYPE;
         }