Merge "Change SharedPreference keys for feature discovery promo" into ub-contactsdialer-h-dev
diff --git a/res/layout/item_read_only_field.xml b/res/layout/item_read_only_field.xml
index e5444a4..8c77eee 100644
--- a/res/layout/item_read_only_field.xml
+++ b/res/layout/item_read_only_field.xml
@@ -16,9 +16,10 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/read_only_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginEnd="@dimen/editor_delete_button_width"
+ android:focusableInTouchMode="true"
android:layout_marginBottom="@dimen/editor_padding_between_read_only_editor_views"
android:orientation="horizontal">
@@ -41,9 +42,7 @@
android:textSize="@dimen/editor_form_text_size"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
- android:saveEnabled="false"
- android:textAlignment="viewStart"
- android:enabled="false"/>
+ android:textAlignment="viewStart"/>
<TextView
android:id="@+id/type"
@@ -52,9 +51,7 @@
android:textSize="@dimen/editor_form_text_size"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
- android:saveEnabled="false"
- android:textAlignment="viewStart"
- android:enabled="false"/>
+ android:textAlignment="viewStart"/>
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 250870f..05d6274 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -724,7 +724,7 @@
<!-- Title of the editor activity when creating a new contact. The char
limit is short and cannot be increased, since this needs to be displayed in a single line
at a pre-determined text size. [CHAR LIMIT=20] -->
- <string name="contact_editor_title_new_contact">Add new contact</string>
+ <string name="contact_editor_title_new_contact">Create new contact</string>
<!-- Title of the editor activity when editing a contact that already exists. The char
limit is short and cannot be increased, since this needs to be displayed in a single line
@@ -759,7 +759,7 @@
<!-- Content description for the button that adds a new contact
[CHAR LIMIT=NONE] -->
- <string name="action_menu_add_new_contact_button">add new contact</string>
+ <string name="action_menu_add_new_contact_button">Create new contact</string>
<!-- Button Label to see more on an ExpandingEntryCardView [CHAR LIMIT=40] -->
<string name="expanding_entry_card_view_see_more">See more</string>
<!-- Button Label to see less on an ExpandingEntryCardView [CHAR LIMIT=40] -->
@@ -848,8 +848,14 @@
<!-- Button to expand the contact editor to show all available input fields. [CHAR LIMIT=60] -->
<string name="editor_more_fields">More fields</string>
- <!-- Content description for the contact editor photo overlay which, when clicked, shows a dialog with the options for changing the contact photo. [CHAR LIMIT=30] -->
- <string name="editor_change_photo_content_description">Change photo</string>
+ <!-- Content description for the contact editor photo overlay which, when clicked, shows a dialog with the options for changing the contact photo. [CHAR LIMIT=NONE] -->
+ <string name="editor_change_photo_content_description">Change contact photo</string>
+
+ <!-- Content description for the contact editor photo overlay which, when clicked, shows a dialog with the options for adding a contact photo. [CHAR LIMIT=NONE] -->
+ <string name="editor_add_photo_content_description">Add contact photo</string>
+
+ <!-- Accessibility content description, describes the image as being the photo for the contact the user is viewing. [CHAR LIMIT=NONE] -->
+ <string name="editor_contact_photo_content_description">Contact photo</string>
<!-- Toast message displayed when the editor fails to load for a contacts. [CHAR LIMIT=NONE] -->
<string name="editor_failed_to_load">Failed to open editor.</string>
diff --git a/src/com/android/contacts/SimImportFragment.java b/src/com/android/contacts/SimImportFragment.java
index 09bc4de..a873842 100644
--- a/src/com/android/contacts/SimImportFragment.java
+++ b/src/com/android/contacts/SimImportFragment.java
@@ -259,11 +259,6 @@
updateSelectedCount();
}
- @Override
- public void onSelectedContactsChangedViaCheckBox() {
- updateSelectedCount();
- }
-
private void updateSelectedCount() {
final int selectedCount = mAdapter.getSelectedContactIds().size();
if (selectedCount == 0) {
diff --git a/src/com/android/contacts/common/list/MultiSelectEntryContactListAdapter.java b/src/com/android/contacts/common/list/MultiSelectEntryContactListAdapter.java
index b08e367..1a18f46 100644
--- a/src/com/android/contacts/common/list/MultiSelectEntryContactListAdapter.java
+++ b/src/com/android/contacts/common/list/MultiSelectEntryContactListAdapter.java
@@ -20,7 +20,6 @@
import android.database.Cursor;
import android.provider.ContactsContract;
import android.view.View;
-import android.view.View.OnClickListener;
import android.widget.CheckBox;
import com.android.contacts.group.GroupUtil;
@@ -35,13 +34,12 @@
private SelectedContactsListener mSelectedContactsListener;
private DeleteContactListener mDeleteContactListener;
- private TreeSet<Long> mSelectedContactIds = new TreeSet<Long>();
+ private TreeSet<Long> mSelectedContactIds = new TreeSet<>();
private boolean mDisplayCheckBoxes;
private final int mContactIdColumnIndex;
public interface SelectedContactsListener {
void onSelectedContactsChanged();
- void onSelectedContactsChangedViaCheckBox();
}
public interface DeleteContactListener {
@@ -149,18 +147,17 @@
return cursor.getLong(getContactColumnIdIndex());
}
return 0;
- }
+ }
@Override
protected void bindView(View itemView, int partition, Cursor cursor, int position) {
super.bindView(itemView, partition, cursor, position);
final ContactListItemView view = (ContactListItemView) itemView;
bindViewId(view, cursor, getContactColumnIdIndex());
- bindCheckBox(view, cursor, position, partition == ContactsContract.Directory.DEFAULT);
+ bindCheckBox(view, cursor, partition == ContactsContract.Directory.DEFAULT);
}
- private void bindCheckBox(ContactListItemView view, Cursor cursor, int position,
- boolean isLocalDirectory) {
+ private void bindCheckBox(ContactListItemView view, Cursor cursor, boolean isLocalDirectory) {
// Disable clicking on all contacts from remote directories when showing check boxes. We do
// this by telling the view to handle clicking itself.
view.setClickable(!isLocalDirectory && mDisplayCheckBoxes);
@@ -173,24 +170,7 @@
final CheckBox checkBox = view.getCheckBox();
final long contactId = cursor.getLong(mContactIdColumnIndex);
checkBox.setChecked(mSelectedContactIds.contains(contactId));
+ checkBox.setClickable(false);
checkBox.setTag(contactId);
- checkBox.setOnClickListener(mCheckBoxClickListener);
}
-
- private final OnClickListener mCheckBoxClickListener = new OnClickListener() {
- @Override
- public void onClick(View v) {
- final CheckBox checkBox = (CheckBox) v;
- final Long contactId = (Long) checkBox.getTag();
- if (checkBox.isChecked()) {
- mSelectedContactIds.add(contactId);
- } else {
- mSelectedContactIds.remove(contactId);
- }
- notifyDataSetChanged();
- if (mSelectedContactsListener != null) {
- mSelectedContactsListener.onSelectedContactsChangedViaCheckBox();
- }
- }
- };
}
diff --git a/src/com/android/contacts/editor/PhotoEditorView.java b/src/com/android/contacts/editor/PhotoEditorView.java
index 5283009..1e727df 100644
--- a/src/com/android/contacts/editor/PhotoEditorView.java
+++ b/src/com/android/contacts/editor/PhotoEditorView.java
@@ -116,10 +116,13 @@
mPhotoIcon.setVisibility(View.GONE);
mPhotoIconOverlay.setVisibility(View.GONE);
mPhotoTouchInterceptOverlay.setClickable(false);
+ mPhotoTouchInterceptOverlay.setContentDescription(getContext().getString(
+ R.string.editor_contact_photo_content_description));
} else {
mPhotoIcon.setVisibility(View.VISIBLE);
mPhotoIconOverlay.setVisibility(View.VISIBLE);
mPhotoTouchInterceptOverlay.setOnClickListener(this);
+ updatePhotoDescription();
}
}
@@ -208,13 +211,21 @@
private void setPhoto(Bitmap bitmap) {
mPhotoImageView.setImageBitmap(bitmap);
mIsNonDefaultPhotoBound = true;
+ updatePhotoDescription();
}
private void setDefaultPhoto(MaterialPalette materialPalette) {
mIsNonDefaultPhotoBound = false;
+ updatePhotoDescription();
EditorUiUtils.setDefaultPhoto(mPhotoImageView, getResources(), materialPalette);
}
+ private void updatePhotoDescription() {
+ mPhotoTouchInterceptOverlay.setContentDescription(getContext().getString(
+ mIsNonDefaultPhotoBound
+ ? R.string.editor_change_photo_content_description
+ : R.string.editor_add_photo_content_description));
+ }
/**
* Binds a full size photo loaded from the given Uri.
*/
@@ -222,6 +233,7 @@
EditorUiUtils.loadPhoto(ContactPhotoManager.getInstance(getContext()),
mPhotoImageView, photoUri);
mIsNonDefaultPhotoBound = true;
+ updatePhotoDescription();
}
/**
diff --git a/src/com/android/contacts/editor/RawContactEditorView.java b/src/com/android/contacts/editor/RawContactEditorView.java
index 8df7c37..8e177e4 100644
--- a/src/com/android/contacts/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/editor/RawContactEditorView.java
@@ -685,10 +685,8 @@
private void bindData(Drawable icon, String iconContentDescription, CharSequence data,
CharSequence type, boolean isFirstEntry, boolean forceLTR) {
- final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
- final View field = inflater.inflate(R.layout.item_read_only_field, mKindSectionViews,
- false);
+ final View field = mLayoutInflater.inflate(R.layout.item_read_only_field, mKindSectionViews,
+ /* attachToRoot */ false);
if (isFirstEntry) {
final ImageView imageView = (ImageView) field.findViewById(R.id.kind_icon);
imageView.setImageDrawable(icon);
@@ -749,8 +747,7 @@
// Set the content description
mAccountHeaderContainer.setContentDescription(
- EditorUiUtils.getAccountInfoContentDescription(primaryText,
- secondaryText));
+ EditorUiUtils.getAccountInfoContentDescription(secondaryText, primaryText));
}
private void addAccountSelector(final RawContactDelta rawContactDelta) {
diff --git a/src/com/android/contacts/list/MultiSelectContactsListFragment.java b/src/com/android/contacts/list/MultiSelectContactsListFragment.java
index 10e9370..7a6a64a 100644
--- a/src/com/android/contacts/list/MultiSelectContactsListFragment.java
+++ b/src/com/android/contacts/list/MultiSelectContactsListFragment.java
@@ -115,16 +115,6 @@
}
@Override
- public void onSelectedContactsChangedViaCheckBox() {
- if (getAdapter().getSelectedContactIds().size() == 0) {
- // Last checkbox has been unchecked. So we should stop displaying checkboxes.
- mCheckBoxListListener.onStopDisplayingCheckBoxes();
- } else {
- onSelectedContactsChanged();
- }
- }
-
- @Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
@@ -403,8 +393,8 @@
if (accountType instanceof GoogleAccountType) {
accountFilterHeaderIcon.getLayoutParams().height = getResources()
.getDimensionPixelOffset(R.dimen.contact_browser_list_header_icon_size);
- accountFilterHeaderIcon.getLayoutParams().width =
- accountFilterHeaderIcon.getLayoutParams().height;
+ accountFilterHeaderIcon.getLayoutParams().width = getResources()
+ .getDimensionPixelOffset(R.dimen.contact_browser_list_header_icon_size);
setMargins(accountFilterHeaderIcon,
getResources().getDimensionPixelOffset(
@@ -414,8 +404,8 @@
} else {
accountFilterHeaderIcon.getLayoutParams().height = getResources()
.getDimensionPixelOffset(R.dimen.contact_browser_list_header_icon_size_alt);
- accountFilterHeaderIcon.getLayoutParams().width =
- accountFilterHeaderIcon.getLayoutParams().height;
+ accountFilterHeaderIcon.getLayoutParams().width = getResources()
+ .getDimensionPixelOffset(R.dimen.contact_browser_list_header_icon_size_alt);
setMargins(accountFilterHeaderIcon,
getResources().getDimensionPixelOffset(
diff --git a/src/com/android/contacts/list/MultiSelectEmailAddressesListFragment.java b/src/com/android/contacts/list/MultiSelectEmailAddressesListFragment.java
index 956e473..64489a0 100644
--- a/src/com/android/contacts/list/MultiSelectEmailAddressesListFragment.java
+++ b/src/com/android/contacts/list/MultiSelectEmailAddressesListFragment.java
@@ -53,11 +53,6 @@
}
@Override
- public void onSelectedContactsChangedViaCheckBox() {
- onSelectedContactsChanged();
- }
-
- @Override
public void onCreateOptionsMenu(Menu menu, final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.items_multi_select, menu);
diff --git a/src/com/android/contacts/list/MultiSelectPhoneNumbersListFragment.java b/src/com/android/contacts/list/MultiSelectPhoneNumbersListFragment.java
index 751449b..96a1de6 100644
--- a/src/com/android/contacts/list/MultiSelectPhoneNumbersListFragment.java
+++ b/src/com/android/contacts/list/MultiSelectPhoneNumbersListFragment.java
@@ -53,11 +53,6 @@
}
@Override
- public void onSelectedContactsChangedViaCheckBox() {
- onSelectedContactsChanged();
- }
-
- @Override
public void onCreateOptionsMenu(Menu menu, final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.items_multi_select, menu);