Merge "Fix rotation losing track of new group creation." 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/menu/people_options.xml b/res/menu/people_options.xml
index a2402b9..10a47ba 100644
--- a/res/menu/people_options.xml
+++ b/res/menu/people_options.xml
@@ -18,7 +18,7 @@
<item
android:id="@+id/menu_search"
android:icon="@drawable/ic_ab_search"
- android:title="@string/menu_search"
+ android:title="@string/hint_findContacts"
contacts:showAsAction="ifRoom" />
<item
diff --git a/res/menu/search_menu.xml b/res/menu/search_menu.xml
index 89068d0..6ed7178 100644
--- a/res/menu/search_menu.xml
+++ b/res/menu/search_menu.xml
@@ -18,6 +18,6 @@
<item
android:id="@+id/menu_search"
android:icon="@drawable/ic_ab_search"
- android:title="@string/menu_search"
+ android:title="@string/hint_findContacts"
contacts:showAsAction="always" />
</menu>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 250870f..a50c155 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>
@@ -1677,9 +1683,6 @@
<!-- Toast indicating that no visible contact to share [CHAR LIMIT=NONE] -->
<string name="no_contact_to_share">There are no contacts to share.</string>
- <!-- Menu item to search contacts -->
- <string name="menu_search">Search</string>
-
<!-- The menu item to filter the list of contacts displayed -->
<string name="menu_contacts_filter">Contacts to display</string>
@@ -1695,12 +1698,7 @@
<!-- Query hint displayed inside the search field [CHAR LIMIT=64] -->
<string name="hint_findContacts">Search contacts</string>
- <!-- The description text for the favorites tab.
-
- Note: AccessibilityServices use this attribute to announce what the view represents.
- This is especially valuable for views without textual representation like ImageView.
-
- [CHAR LIMIT=NONE] -->
+ <!-- The content description text for star icon in contacts list [CHAR LIMIT=30] -->
<string name="contactsFavoritesLabel">Favorites</string>
<!-- Displayed at the top of the contacts showing the zero total number of contacts visible when "All contacts" is selected [CHAR LIMIT=64]-->
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/activity/LicenseActivity.java b/src/com/android/contacts/common/activity/LicenseActivity.java
index 71bcd84..9e86ee8 100644
--- a/src/com/android/contacts/common/activity/LicenseActivity.java
+++ b/src/com/android/contacts/common/activity/LicenseActivity.java
@@ -17,8 +17,8 @@
import com.android.contacts.common.R;
-import android.app.ActionBar;
-import android.app.Activity;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.webkit.WebView;
@@ -26,7 +26,7 @@
/**
* Displays the licenses for all open source libraries.
*/
-public class LicenseActivity extends Activity {
+public class LicenseActivity extends AppCompatActivity {
private static final String LICENSE_FILE = "file:///android_asset/licenses.html";
private WebView mWebView;
@@ -36,7 +36,7 @@
setContentView(R.layout.licenses);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.loadUrl(LICENSE_FILE);
- final ActionBar actionBar = getActionBar();
+ final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
}
diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java
index 6e742a3..d20c6e8 100644
--- a/src/com/android/contacts/common/list/ContactListItemView.java
+++ b/src/com/android/contacts/common/list/ContactListItemView.java
@@ -1035,7 +1035,7 @@
headerImageView.setImageTintList(ColorStateList.valueOf(getResources()
.getColor(R.color.material_star_pink)));
headerImageView.setContentDescription(
- getContext().getString(R.string.list_filter_all_starred));
+ getContext().getString(R.string.contactsFavoritesLabel));
headerImageView.setVisibility(View.VISIBLE);
addView(headerImageView);
}
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);
diff --git a/src/com/android/contacts/util/SharedPreferenceUtil.java b/src/com/android/contacts/util/SharedPreferenceUtil.java
index 14f5494..3d138fb 100644
--- a/src/com/android/contacts/util/SharedPreferenceUtil.java
+++ b/src/com/android/contacts/util/SharedPreferenceUtil.java
@@ -36,14 +36,14 @@
public static final String PREFERENCE_KEY_GLOBAL_SYNC_OFF_DISMISSES =
"num-of-dismisses-auto-sync-off";
- private static final String PREFERENCE_KEY_HAMBURGER_PROMO_DISPLAYED_BEFORE =
- "hamburgerPromoDisplayedBefore";
+ private static final String PREFERENCE_KEY_HAMBURGER_PROMO_DISPLAYED =
+ "hamburgerPromoDisplayed";
- private static final String PREFERENCE_KEY_HAMBURGER_MENU_CLICKED_BEFORE =
- "hamburgerMenuClickedBefore";
+ private static final String PREFERENCE_KEY_HAMBURGER_MENU_CLICKED =
+ "hamburgerMenuClicked";
- private static final String PREFERENCE_KEY_HAMBURGER_PROMO_TRIGGER_ACTION_HAPPENED_BEFORE =
- "hamburgerPromoTriggerActionHappenedBefore";
+ private static final String PREFERENCE_KEY_HAMBURGER_PROMO_TRIGGER_ACTION_HAPPENED =
+ "hamburgerPromoTriggerActionHappened";
private static final String PREFERENCE_KEY_IMPORTED_SIM_CARDS =
"importedSimCards";
@@ -62,34 +62,34 @@
public static boolean getHamburgerPromoDisplayedBefore(Context context) {
return getSharedPreferences(context)
- .getBoolean(PREFERENCE_KEY_HAMBURGER_PROMO_DISPLAYED_BEFORE, false);
+ .getBoolean(PREFERENCE_KEY_HAMBURGER_PROMO_DISPLAYED, false);
}
public static void setHamburgerPromoDisplayedBefore(Context context) {
getSharedPreferences(context).edit()
- .putBoolean(PREFERENCE_KEY_HAMBURGER_PROMO_DISPLAYED_BEFORE, true)
+ .putBoolean(PREFERENCE_KEY_HAMBURGER_PROMO_DISPLAYED, true)
.apply();
}
public static boolean getHamburgerMenuClickedBefore(Context context) {
return getSharedPreferences(context)
- .getBoolean(PREFERENCE_KEY_HAMBURGER_MENU_CLICKED_BEFORE, false);
+ .getBoolean(PREFERENCE_KEY_HAMBURGER_MENU_CLICKED, false);
}
public static void setHamburgerMenuClickedBefore(Context context) {
getSharedPreferences(context).edit()
- .putBoolean(PREFERENCE_KEY_HAMBURGER_MENU_CLICKED_BEFORE, true)
+ .putBoolean(PREFERENCE_KEY_HAMBURGER_MENU_CLICKED, true)
.apply();
}
public static boolean getHamburgerPromoTriggerActionHappenedBefore(Context context) {
return getSharedPreferences(context)
- .getBoolean(PREFERENCE_KEY_HAMBURGER_PROMO_TRIGGER_ACTION_HAPPENED_BEFORE, false);
+ .getBoolean(PREFERENCE_KEY_HAMBURGER_PROMO_TRIGGER_ACTION_HAPPENED, false);
}
public static void setHamburgerPromoTriggerActionHappenedBefore(Context context) {
getSharedPreferences(context).edit()
- .putBoolean(PREFERENCE_KEY_HAMBURGER_PROMO_TRIGGER_ACTION_HAPPENED_BEFORE, true)
+ .putBoolean(PREFERENCE_KEY_HAMBURGER_PROMO_TRIGGER_ACTION_HAPPENED, true)
.apply();
}