Merge "Fixed contact button in send to labels" 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 f20a54c..a50c155 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -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/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/editor/GroupMembershipView.java b/src/com/android/contacts/editor/GroupMembershipView.java
index a76e408..a2bd2e9 100644
--- a/src/com/android/contacts/editor/GroupMembershipView.java
+++ b/src/com/android/contacts/editor/GroupMembershipView.java
@@ -17,6 +17,7 @@
package com.android.contacts.editor;
import android.app.Activity;
+import android.app.FragmentManager;
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
@@ -161,6 +162,18 @@
private boolean mDefaultGroupVisibilityKnown;
private boolean mDefaultGroupVisible;
private boolean mCreatedNewGroup;
+ private GroupNameEditDialogFragment mGroupNameEditDialogFragment;
+ private GroupNameEditDialogFragment.Listener mListener =
+ new GroupNameEditDialogFragment.Listener() {
+ @Override
+ public void onGroupNameEditCancelled() {
+ }
+
+ @Override
+ public void onGroupNameEditCompleted(String name) {
+ mCreatedNewGroup = true;
+ }
+ };
private String mNoGroupString;
private int mPrimaryTextColor;
@@ -185,6 +198,15 @@
setFocusableInTouchMode(true);
}
+ private void setGroupNameEditDialogFragment() {
+ final FragmentManager fragmentManager = ((Activity) getContext()).getFragmentManager();
+ mGroupNameEditDialogFragment = (GroupNameEditDialogFragment)
+ fragmentManager.findFragmentByTag(TAG_CREATE_GROUP_FRAGMENT);
+ if (mGroupNameEditDialogFragment != null) {
+ mGroupNameEditDialogFragment.setListener(mListener);
+ }
+ }
+
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
@@ -240,6 +262,7 @@
mDefaultGroupVisibilityKnown = false;
mCreatedNewGroup = false;
updateView();
+ setGroupNameEditDialogFragment();
}
private void updateView() {
@@ -453,24 +476,12 @@
private void createNewGroup() {
UiClosables.closeQuietly(mPopup);
mPopup = null;
-
- final GroupNameEditDialogFragment dialog =
- GroupNameEditDialogFragment.newInstanceForCreation(
- new AccountWithDataSet(mAccountName, mAccountType, mDataSet), null);
-
- // If the device is rotated after the dialog is shown, the listener will become null,
- // so that the popup from GroupMembershipView will not be shown.
- dialog.setListener(new GroupNameEditDialogFragment.Listener() {
- @Override
- public void onGroupNameEditStarted(String groupName) {
- mCreatedNewGroup = true;
- }
- @Override
- public void onGroupNameEditCancelled() { }
- });
- dialog.show(
+ mGroupNameEditDialogFragment =
+ GroupNameEditDialogFragment.newInstanceForCreation(
+ new AccountWithDataSet(mAccountName, mAccountType, mDataSet), null);
+ mGroupNameEditDialogFragment.setListener(mListener);
+ mGroupNameEditDialogFragment.show(
((Activity) getContext()).getFragmentManager(),
TAG_CREATE_GROUP_FRAGMENT);
}
-
}
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/group/GroupNameEditDialogFragment.java b/src/com/android/contacts/group/GroupNameEditDialogFragment.java
index 544dd87..da76c68 100644
--- a/src/com/android/contacts/group/GroupNameEditDialogFragment.java
+++ b/src/com/android/contacts/group/GroupNameEditDialogFragment.java
@@ -67,15 +67,15 @@
/** Callbacks for hosts of the {@link GroupNameEditDialogFragment}. */
public interface Listener {
- void onGroupNameEditStarted(String name);
void onGroupNameEditCancelled();
+ void onGroupNameEditCompleted(String name);
public static final Listener None = new Listener() {
@Override
- public void onGroupNameEditStarted(String name) { }
+ public void onGroupNameEditCancelled() { }
@Override
- public void onGroupNameEditCancelled() { }
+ public void onGroupNameEditCompleted(String name) { }
};
}
@@ -126,6 +126,7 @@
} else {
mGroupName = savedInstanceState.getString(ARG_GROUP_NAME);
}
+
mGroupId = args.getLong(ARG_GROUP_ID, NO_GROUP_ID);
mIsInsert = args.getBoolean(ARG_IS_INSERT, true);
mAccount = getArguments().getParcelable(ARG_ACCOUNT);
@@ -252,7 +253,7 @@
name, getActivity().getClass(), callbackAction);
}
ContactSaveService.startService(getActivity(), serviceIntent);
- getListener().onGroupNameEditStarted(name);
+ getListener().onGroupNameEditCompleted(mGroupName);
dismiss();
}
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();
}