Merge "Import translations. DO NOT MERGE"
diff --git a/res/layout/group_name_edit_dialog.xml b/res/layout/group_name_edit_dialog.xml
index 8e8ddd2..381d1d8 100644
--- a/res/layout/group_name_edit_dialog.xml
+++ b/res/layout/group_name_edit_dialog.xml
@@ -31,7 +31,7 @@
android:layout_marginRight="4dp"
android:layout_marginTop="16dp"
android:hint="@string/group_name_dialog_hint"
- android:inputType="textCapWords|textNoSuggestions"
+ android:inputType="text"
android:singleLine="true"
android:maxLength="@integer/group_name_max_length"/>
</LinearLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5c9be9f..3555325 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -441,8 +441,8 @@
<!-- Title for the update label dialog. CHAR LIMIT=40] -->
<string name="group_name_dialog_update_title">Rename label</string>
- <!-- Hint for the label name input field on the insert and update label dialogs [CHAR LIMIT=30] -->
- <string name="group_name_dialog_hint">Label name</string>
+ <!-- Hint for the label name input field on the insert and update label dialogs [CHAR LIMIT=15] -->
+ <string name="group_name_dialog_hint">Label</string>
<!-- Generic action string for starting an audio chat. Used by AccessibilityService to announce the purpose of the view. [CHAR LIMIT=NONE] -->
<string name="audio_chat">Voice chat</string>
@@ -510,7 +510,7 @@
<string name="event_edit_field_hint_text">Date</string>
<!-- The button to add an label field to a contact in the Raw Contact Editor [CHAR LIMIT=15] -->
- <string name="group_edit_field_hint_text">Label name</string>
+ <string name="group_edit_field_hint_text">Label</string>
<!-- Button used for changing a photo in the Raw Contact Editor [CHAR LIMIT=15] -->
<string name="change_photo">Change</string>
@@ -652,8 +652,8 @@
<!-- Label to instruct the user to type in a contact's name to add the contact as a member of the current group. [CHAR LIMIT=64] -->
<string name="enter_contact_name">Search contacts</string>
- <!-- Hint text in the label name box in the edit label view. [CHAR LIMIT=20]-->
- <string name="group_name_hint">Label\'s name</string>
+ <!-- Title of edit label view [CHAR LIMIT=20]-->
+ <string name="title_edit_group">Edit Label</string>
<!-- Header label in the contact editor for a profile that is local to the device only (and not associated with any account) [CHAR LIMIT=25] -->
<string name="local_profile_title">My local profile</string>
diff --git a/src/com/android/contacts/ContactsDrawerActivity.java b/src/com/android/contacts/ContactsDrawerActivity.java
index 4254a64..e4f8010 100644
--- a/src/com/android/contacts/ContactsDrawerActivity.java
+++ b/src/com/android/contacts/ContactsDrawerActivity.java
@@ -245,6 +245,13 @@
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "Received group URI " + groupUri);
Toast.makeText(this, R.string.groupCreatedToast, Toast.LENGTH_SHORT).show();
startActivity(GroupUtil.createViewGroupIntent(this, groupUri, /* title */ null));
+ if (this instanceof GroupMembersActivity) {
+ // If we created a group while viewing the members of an existing group (i.e.
+ // while on GroupMembersActivity), finish the current GroupMembersActivity so that
+ // hitting back from the new GroupMembersActivity that was just stared will open
+ // the all contacts list. See b/30047708.
+ finish();
+ }
} else {
super.onNewIntent(newIntent);
}
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index 3723d52..669735c 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -21,7 +21,6 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
-import android.graphics.Color;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.content.ContextCompat;
@@ -509,6 +508,13 @@
textView.setText(String.valueOf(selectionCount));
}
+ public void setActionBarTitle(String title) {
+ final TextView textView =
+ (TextView) mSelectionContainer.findViewById(R.id.selection_count_text);
+ textView.setVisibility(View.VISIBLE);
+ textView.setText(title);
+ }
+
private void updateStatusBarColor() {
if (!CompatUtils.isLollipopCompatible()) {
return; // we can't change the status bar color prior to Lollipop
diff --git a/src/com/android/contacts/activities/GroupMembersActivity.java b/src/com/android/contacts/activities/GroupMembersActivity.java
index b75295d..4d58033 100644
--- a/src/com/android/contacts/activities/GroupMembersActivity.java
+++ b/src/com/android/contacts/activities/GroupMembersActivity.java
@@ -498,6 +498,7 @@
if (mMembersFragment != null) {
if (mIsEditMode) {
mMembersFragment.displayDeleteButtons(true);
+ mActionBarAdapter.setActionBarTitle(getString(R.string.title_edit_group));
} else {
mMembersFragment.displayCheckBoxes(true);
}
@@ -545,7 +546,11 @@
@Override
public void onSelectedContactIdsChanged() {
- mActionBarAdapter.setSelectionCount(mMembersFragment.getSelectedContactIds().size());
+ if (mIsEditMode) {
+ mActionBarAdapter.setActionBarTitle(getString(R.string.title_edit_group));
+ } else {
+ mActionBarAdapter.setSelectionCount(mMembersFragment.getSelectedContactIds().size());
+ }
}
@Override
diff --git a/src/com/android/contacts/group/GroupNameEditDialogFragment.java b/src/com/android/contacts/group/GroupNameEditDialogFragment.java
index d3c518e..5d7bcb8 100644
--- a/src/com/android/contacts/group/GroupNameEditDialogFragment.java
+++ b/src/com/android/contacts/group/GroupNameEditDialogFragment.java
@@ -27,6 +27,7 @@
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
+import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
@@ -98,6 +99,7 @@
.setNegativeButton(android.R.string.cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
+ hideInputMethod();
getListener().onGroupNameEditCancelled();
dismiss();
}
@@ -111,6 +113,8 @@
// Disable the create button when the name is empty
final AlertDialog alertDialog = builder.create();
+ alertDialog.getWindow().setSoftInputMode(
+ WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
@@ -123,6 +127,7 @@
mGroupNameEditText.setSelection(
mGroupName.length() > maxLength ? maxLength : mGroupName.length());
}
+ showInputMethod(mGroupNameEditText);
final Button createButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
createButton.setEnabled(!TextUtils.isEmpty(getGroupName()));
@@ -140,10 +145,9 @@
createButton.setEnabled(!TextUtils.isEmpty(s));
}
});
-
- showInputMethod(mGroupNameEditText);
}
});
+
return alertDialog;
}
@@ -168,6 +172,14 @@
}
}
+ private void hideInputMethod() {
+ final InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
+ Context.INPUT_METHOD_SERVICE);
+ if (imm != null && mGroupNameEditText != null) {
+ imm.hideSoftInputFromWindow(mGroupNameEditText.getWindowToken(), /* flags */ 0);
+ }
+ }
+
private Listener getListener() {
if (!(getActivity() instanceof Listener)) {
throw new ClassCastException(getActivity() + " must implement " +
diff --git a/src/com/android/contacts/interactions/GroupNameDialogFragment.java b/src/com/android/contacts/interactions/GroupNameDialogFragment.java
index 7875ee5..5efccfc 100644
--- a/src/com/android/contacts/interactions/GroupNameDialogFragment.java
+++ b/src/com/android/contacts/interactions/GroupNameDialogFragment.java
@@ -23,6 +23,7 @@
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
+import android.text.InputType;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
@@ -36,6 +37,7 @@
/**
* A common superclass for creating and renaming groups.
*/
+// TODO: consolidate it with GroupNameEditDialogFragment
public abstract class GroupNameDialogFragment extends DialogFragment {
protected abstract int getTitleResourceId();
protected abstract void initializeGroupLabelEditText(EditText editText);
@@ -49,6 +51,7 @@
final EditText editText = (EditText) view.findViewById(R.id.group_label);
final int maxLength = getResources().getInteger(R.integer.group_name_max_length);
editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxLength) });
+ editText.setInputType(InputType.TYPE_CLASS_TEXT);
initializeGroupLabelEditText(editText);
builder.setTitle(getTitleResourceId());