summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-06-13 16:06:55 -0700
committerTyler Gunn <tgunn@google.com>2014-06-13 16:07:58 -0700
commit838fe3f3dee69db20a978f43f2b3bec987527664 (patch)
treed85b05856c027502f0eae5f9a30f44136589b4dc
parent3307fdc5e84e456370e7630e4fe0300aba59cd26 (diff)
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
-rw-r--r--tests/res/layout/fill_call_log_test.xml19
-rw-r--r--tests/res/values/donottranslate_strings.xml1
-rw-r--r--tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java14
3 files changed, 34 insertions, 0 deletions
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"
/>
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="left"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/delta_after_add"
+ />
+ <EditText
+ android:id="@+id/delta_after_add"
+ android:layout_width="90dp"
+ android:layout_height="wrap_content"
+ android:text="-1"
+ android:inputType="number"
+ />
+ </LinearLayout>
</LinearLayout>
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 @@
<string name="presentation_restricted">Restricted</string>
<string name="presentation_unknown">Unknown</string>
<string name="presentation_payphone">Payphone</string>
+ <string name="delta_after_add">Offset call time after add (min): </string>
</resources>
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();
}
}