Merge "Small UI changes from UX feedback" into nyc-dev
diff --git a/res/layout/view_activity_layout.xml b/res/layout/view_activity_layout.xml
index 58e0388..cb6b7dd 100644
--- a/res/layout/view_activity_layout.xml
+++ b/res/layout/view_activity_layout.xml
@@ -43,11 +43,14 @@
android:id="@+id/personal_card_small"
android:layout_width="wrap_content"
android:layout_height="19dp"
- android:layout_marginBottom="18dp"
android:layout_marginLeft="72dp"
android:layout_marginTop="1dp"
android:textColor="#FFFFFF"
android:textSize="14sp" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="18dp"></LinearLayout>
</LinearLayout>
<include layout="@layout/tabs"/>
</LinearLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e81fb03..031a217 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -80,16 +80,26 @@
<item>@string/hh</item>
<item>@string/unknown_blood_type</item>
</string-array>
+ <!-- Blood type values. Do not translate -->
<string-array name="blood_type_values">
- <item>@string/oplus</item>
- <item>@string/ominus</item>
- <item>@string/aplus</item>
- <item>@string/aminus</item>
- <item>@string/bplus</item>
- <item>@string/bminus</item>
- <item>@string/abplus</item>
- <item>@string/abminus</item>
- <item>@string/hh</item>
+ <!-- Do not translate -->
+ <item>0+</item>
+ <!-- Do not translate -->
+ <item>O-</item>
+ <!-- Do not translate -->
+ <item>A+</item>
+ <!-- Do not translate -->
+ <item>A-</item>
+ <!-- Do not translate -->
+ <item>B+</item>
+ <!-- Do not translate -->
+ <item>B-</item>
+ <!-- Do not translate -->
+ <item>AB+</item>
+ <!-- Do not translate -->
+ <item>AB-</item>
+ <!-- Do not translate -->
+ <item>H/H</item>
<item></item>
</string-array>
<!-- Content descriptions for the blood types, used for talkback. -->
@@ -146,9 +156,12 @@
<item>@string/no</item>
<item>@string/unknown_organ_donor</item>
</string-array>
+ <!-- Organ donor values. Do not translate -->
<string-array name="organ_donor_values">
- <item>@string/yes</item>
- <item>@string/no</item>
+ <!-- Do not translate -->
+ <item>Yes</item>
+ <!-- Do not translate -->
+ <item>No</item>
<item></item>
</string-array>
<!-- The title of the emergency contacts preference. [CHAR_LIMIT=40] -->
diff --git a/res/xml/edit_emergency_info.xml b/res/xml/edit_emergency_info.xml
index 219ce02..dff7761 100644
--- a/res/xml/edit_emergency_info.xml
+++ b/res/xml/edit_emergency_info.xml
@@ -41,6 +41,7 @@
android:entryValues="@array/blood_type_values"
android:icon="@drawable/ic_bloodtype_black_24dp"
android:key="blood_type"
+ android:defaultValue=""
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="@string/unknown_blood_type"
@@ -71,6 +72,7 @@
android:entryValues="@array/organ_donor_values"
android:icon="@drawable/ic_heart_black_24dp"
android:key="organ_donor"
+ android:defaultValue=""
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="@string/unknown_organ_donor"
diff --git a/src/com/android/emergency/preferences/AutoCompleteEditTextPreference.java b/src/com/android/emergency/preferences/AutoCompleteEditTextPreference.java
index 3ec2b45..96cf217 100644
--- a/src/com/android/emergency/preferences/AutoCompleteEditTextPreference.java
+++ b/src/com/android/emergency/preferences/AutoCompleteEditTextPreference.java
@@ -16,6 +16,7 @@
package com.android.emergency.preferences;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.graphics.Rect;
@@ -25,16 +26,17 @@
import android.preference.DialogPreference;
import android.text.TextUtils;
import android.util.AttributeSet;
+import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window;
import android.view.WindowManager;
-import android.widget.ArrayAdapter;
+import android.view.inputmethod.EditorInfo;
import android.widget.AutoCompleteTextView;
+import android.widget.TextView;
import com.android.emergency.R;
-import com.android.emergency.ReloadablePreferenceInterface;
/**
* Almost a copy of EditTextPreference that shows a {@link AutoCompleteTextView} instead of the
@@ -65,6 +67,18 @@
* We reset the enabled state.
*/
mAutoCompleteTextView.setEnabled(true);
+
+ mAutoCompleteTextView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+ @Override
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+ if (actionId == EditorInfo.IME_ACTION_DONE) {
+ onClick(getDialog(), DialogInterface.BUTTON_POSITIVE);
+ getDialog().dismiss();
+ return true;
+ }
+ return false;
+ }
+ });
setDialogLayoutResource(R.layout.preference_dialog_autocomplete_edittext);
}
diff --git a/src/com/android/emergency/preferences/BloodTypeListPreference.java b/src/com/android/emergency/preferences/BloodTypeListPreference.java
index aed5e89..69a5328 100644
--- a/src/com/android/emergency/preferences/BloodTypeListPreference.java
+++ b/src/com/android/emergency/preferences/BloodTypeListPreference.java
@@ -42,10 +42,11 @@
@Override
public CharSequence getSummary() {
final String value = getValue();
- if (TextUtils.isEmpty(value)) {
+ int index = findIndexOfValue(value);
+ if (index < 0) {
return super.getSummary();
} else {
- return createAccessibleSequence(value, mContentDescriptions[findIndexOfValue(value)]);
+ return createAccessibleSequence(getEntries()[index], mContentDescriptions[index]);
}
}
diff --git a/src/com/android/emergency/preferences/DatePreference.java b/src/com/android/emergency/preferences/DatePreference.java
index 9dc05b9..20d86d2 100644
--- a/src/com/android/emergency/preferences/DatePreference.java
+++ b/src/com/android/emergency/preferences/DatePreference.java
@@ -52,6 +52,7 @@
/** Creates a new instance initialized with {@code context} and {@code attrs}. */
public DatePreference(Context context, AttributeSet attrs) {
super(context, attrs);
+ mDateTimeMillis = DEFAULT_UNSET_VALUE;
final Calendar calendar = Calendar.getInstance();
mDatePickerDialog = new DatePickerDialog(
context,
diff --git a/src/com/android/emergency/preferences/EmergencyEditTextPreference.java b/src/com/android/emergency/preferences/EmergencyEditTextPreference.java
index 1cc1db7..a34d8e3 100644
--- a/src/com/android/emergency/preferences/EmergencyEditTextPreference.java
+++ b/src/com/android/emergency/preferences/EmergencyEditTextPreference.java
@@ -19,6 +19,8 @@
import android.preference.EditTextPreference;
import android.text.TextUtils;
import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
import com.android.emergency.ReloadablePreferenceInterface;
@@ -28,6 +30,8 @@
public class EmergencyEditTextPreference extends EditTextPreference
implements ReloadablePreferenceInterface {
+ private static final int MAX_LINES = 50;
+
public EmergencyEditTextPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -47,4 +51,12 @@
String text = getText();
return TextUtils.isEmpty(text) ? super.getSummary() : text;
}
+
+ @Override
+ protected void onBindView(View view) {
+ super.onBindView(view);
+ final TextView summaryView = (TextView) view.findViewById(
+ com.android.internal.R.id.summary);
+ summaryView.setMaxLines(MAX_LINES);
+ }
}
diff --git a/src/com/android/emergency/preferences/EmergencyListPreference.java b/src/com/android/emergency/preferences/EmergencyListPreference.java
index 24ca9b7..94539fc 100644
--- a/src/com/android/emergency/preferences/EmergencyListPreference.java
+++ b/src/com/android/emergency/preferences/EmergencyListPreference.java
@@ -44,11 +44,11 @@
@Override
public CharSequence getSummary() {
- final CharSequence value = getValue();
- if (TextUtils.isEmpty(value)) {
+ final CharSequence entry = getEntry();
+ if (TextUtils.isEmpty(entry)) {
return super.getSummary();
} else {
- return value;
+ return entry;
}
}
}