summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-06-13 23:29:46 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-06-12 03:30:50 +0000
commit13cb7d712637a616742996fa998c93888c07e0d9 (patch)
tree74541245ee2668807ef0a1d49d48beb9cd32d6c3
parent00a3d5d576d53b43a46849bf40c43bccde44a9b2 (diff)
parent838fe3f3dee69db20a978f43f2b3bec987527664 (diff)
Merge "Add auto-offset for manual call log entry test screen."
-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();
}
}