Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccacb01c authored by Walter Jang's avatar Walter Jang Committed by Android (Google) Code Review
Browse files

Merge "Address various groups TODOs and small bug fixes"

parents 98f7e4fc 72f9988a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@
        android:layout_marginLeft="4dp"
        android:layout_marginRight="4dp"
        android:layout_marginTop="16dp"
        android:hint="@string/group_name_dialog_hint"
        android:inputType="textCapWords|textNoSuggestions"
        android:singleLine="true"
        android:maxLength="40"/>
</LinearLayout>
 No newline at end of file
+2 −4
Original line number Diff line number Diff line
@@ -24,10 +24,8 @@
        contacts:showAsAction="ifRoom" />

    <item
        android:id="@+id/menu_edit_group"
        android:icon="@drawable/ic_create_24dp"
        android:title="@string/menu_editGroup"
        contacts:showAsAction="ifRoom" />
        android:id="@+id/menu_rename_group"
        android:title="@string/menu_renameGroup"/>

    <item
        android:id="@+id/menu_delete_group"
+11 −2
Original line number Diff line number Diff line
@@ -134,6 +134,9 @@
    <!-- Menu item that edits the currently selected label [CHAR LIMIT=30] -->
    <string name="menu_editGroup">Edit</string>

    <!-- Menu item to rename the currently selected label [CHAR LIMIT=30] -->
    <string name="menu_renameGroup">Rename label</string>

    <!-- Menu item that deletes the currently selected label [CHAR LIMIT=30] -->
    <string name="menu_deleteGroup">Delete label</string>

@@ -326,6 +329,9 @@
    <!-- Toast displayed when a label is saved [CHAR LIMIT=30] -->
    <string name="groupSavedToast">Label saved</string>

    <!-- Toast displayed when a label name is delted. [CHAR LIMIT=50] -->
    <string name="groupDeletedToast">Label deleted</string>

    <!-- Toast displayed when a label name is updated. [CHAR LIMIT=50] -->
    <string name="groupCreatedToast">Label created</string>

@@ -429,10 +435,13 @@
    <string name="dialog_new_group_account">Choose account</string>

    <!-- Title for the create new label dialog. CHAR LIMIT=40] -->
    <string name="insert_group_dialog_title">Create label</string>
    <string name="group_name_dialog_insert_title">Create label</string>

    <!-- Title for the update label dialog. CHAR LIMIT=40] -->
    <string name="update_group_dialog_title">Update label</string>
    <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>

    <!-- 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>
+18 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.provider.ContactsContract.Profile;
import android.provider.ContactsContract.RawContacts;
import android.provider.ContactsContract.RawContactsEntity;
import android.support.v4.os.ResultReceiver;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;

@@ -777,10 +778,19 @@ public class ContactSaveService extends IntentService {
    /**
     * Creates an intent that can be sent to this service to delete a group.
     */
    public static Intent createGroupDeletionIntent(Context context, long groupId) {
    public static Intent createGroupDeletionIntent(Context context, long groupId,
            Class<? extends Activity> callbackActivity, String callbackAction) {
        Intent serviceIntent = new Intent(context, ContactSaveService.class);
        serviceIntent.setAction(ContactSaveService.ACTION_DELETE_GROUP);
        serviceIntent.putExtra(ContactSaveService.EXTRA_GROUP_ID, groupId);

        // Callback intent will be invoked by the service once the group is updated
        if (callbackActivity != null && !TextUtils.isEmpty(callbackAction)) {
            final Intent callbackIntent = new Intent(context, callbackActivity);
            callbackIntent.setAction(callbackAction);
            serviceIntent.putExtra(ContactSaveService.EXTRA_CALLBACK_INTENT, callbackIntent);
        }

        return serviceIntent;
    }

@@ -793,6 +803,13 @@ public class ContactSaveService extends IntentService {

        getContentResolver().delete(
                ContentUris.withAppendedId(Groups.CONTENT_URI, groupId), null, null);

        final Intent callbackIntent = intent.getParcelableExtra(EXTRA_CALLBACK_INTENT);
        if (callbackIntent != null) {
            final Uri groupUri = ContentUris.withAppendedId(Groups.CONTENT_URI, groupId);
            callbackIntent.setData(groupUri);
            deliverCallback(callbackIntent);
        }
    }

    /**
+7 −4
Original line number Diff line number Diff line
@@ -28,6 +28,11 @@ import android.provider.ContactsContract.Groups;
 */
public final class GroupListLoader extends CursorLoader {

    public final static String DEFAULT_SELECTION =
            Groups.ACCOUNT_TYPE + " NOT NULL AND " +
                    Groups.ACCOUNT_NAME + " NOT NULL AND " + Groups.AUTO_ADD + "=0 AND " +
                    Groups.FAVORITES + "=0 AND " + Groups.DELETED + "=0";

    private final static String[] COLUMNS = new String[] {
        Groups.ACCOUNT_NAME,
        Groups.ACCOUNT_TYPE,
@@ -50,11 +55,9 @@ public final class GroupListLoader extends CursorLoader {
        super(context,
                GROUP_LIST_URI,
                COLUMNS,
                Groups.ACCOUNT_TYPE + " NOT NULL AND " +
                        Groups.ACCOUNT_NAME + " NOT NULL AND " + Groups.AUTO_ADD + "=0 AND " +
                        Groups.FAVORITES + "=0 AND " + Groups.DELETED + "=0",
                DEFAULT_SELECTION,
                null,
                Groups.ACCOUNT_TYPE + ", " + Groups.ACCOUNT_NAME + ", " + Groups.DATA_SET + ", " +
                Groups.TITLE + " COLLATE LOCALIZED ASC");
                Groups.TITLE + " COLLATE NOCASE ASC");
    }
}
Loading