From 838fe3f3dee69db20a978f43f2b3bec987527664 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 13 Jun 2014 16:06:55 -0700 Subject: Add auto-offset for manual call log entry test screen. Added ability to auto-offset the next call date/time to be manually added to the call log. This helps when you want to add a number of repeated calls but offset them by a short time (eg 1 minute). Change-Id: I66a59df47e17b99a008ca289c641301eda460b5e --- tests/res/layout/fill_call_log_test.xml | 19 +++++++++++++++++++ tests/res/values/donottranslate_strings.xml | 1 + .../dialer/tests/calllog/FillCallLogTestActivity.java | 14 ++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/tests/res/layout/fill_call_log_test.xml b/tests/res/layout/fill_call_log_test.xml index 6de9b9119..9b89e4a55 100644 --- a/tests/res/layout/fill_call_log_test.xml +++ b/tests/res/layout/fill_call_log_test.xml @@ -183,4 +183,23 @@ android:text="@string/addToCallLogButton" android:onClick="addManualEntry" /> + + + + diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml index bdeb3043d..25c3a5a71 100644 --- a/tests/res/values/donottranslate_strings.xml +++ b/tests/res/values/donottranslate_strings.xml @@ -50,4 +50,5 @@ Restricted Unknown Payphone + Offset call time after add (min): diff --git a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java index 3a1682e79..1e5c25742 100644 --- a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java +++ b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java @@ -37,6 +37,7 @@ import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.DatePicker; +import android.widget.EditText; import android.widget.ProgressBar; import android.widget.RadioButton; import android.widget.TextView; @@ -75,6 +76,7 @@ public class FillCallLogTestActivity extends Activity { private TextView mCallDate; private TextView mCallTime; private TextView mPhoneNumber; + private EditText mOffset; private int mCallTimeHour; private int mCallTimeMinute; @@ -124,6 +126,7 @@ public class FillCallLogTestActivity extends Activity { mCallTime = (TextView) findViewById(R.id.call_time); mCallDate = (TextView) findViewById(R.id.call_date); mPhoneNumber = (TextView) findViewById(R.id.phone_number); + mOffset = (EditText) findViewById(R.id.delta_after_add); // Use the current time as the default values for the picker final Calendar c = Calendar.getInstance(); @@ -469,5 +472,16 @@ public class FillCallLogTestActivity extends Activity { Calls.addCall(null, this, mPhoneNumber.getText().toString(), getManualPresentation(), getManualCallType(), dateTime.getTimeInMillis(), RNG.nextInt(60 * 60)); + // Subtract offset from the call date/time and store as new date/time + int offset = Integer.parseInt(mOffset.getText().toString()); + + dateTime.add(Calendar.MINUTE, offset); + mCallDateYear = dateTime.get(Calendar.YEAR); + mCallDateMonth = dateTime.get(Calendar.MONTH); + mCallDateDay = dateTime.get(Calendar.DAY_OF_MONTH); + mCallTimeHour = dateTime.get(Calendar.HOUR_OF_DAY); + mCallTimeMinute = dateTime.get(Calendar.MINUTE); + setDisplayDate(); + setDisplayTime(); } } -- cgit v1.2.3