Loading res/layout/expanding_entry_card_item.xml +19 −14 Original line number Diff line number Diff line Loading @@ -67,25 +67,30 @@ android:layout_marginEnd="@dimen/expanding_entry_card_item_sub_header_icon_margin_right" android:layout_marginBottom="@dimen/expanding_entry_card_item_sub_header_icon_margin_bottom" /> <TextView <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/text" android:layout_below="@+id/sub_header" android:layout_toEndOf="@+id/icon_text" android:layout_toStartOf="@+id/third_icon" android:textAlignment="viewStart" android:textColor="@color/quickcontact_entry_sub_header_text_color" /> android:layout_toEndOf="@+id/icon" android:orientation="horizontal" android:gravity="center" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/icon_text" android:layout_toEndOf="@+id/icon" android:layout_below="@+id/sub_header" android:layout_marginTop="@dimen/expanding_entry_card_item_text_icon_margin_top" android:layout_marginEnd="@dimen/expanding_entry_card_item_text_icon_margin_right" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/text" android:textAlignment="viewStart" android:textColor="@color/quickcontact_entry_sub_header_text_color" /> </LinearLayout> <ImageView android:id="@+id/third_icon" android:layout_width="@dimen/default_clickable_icon_size" Loading res/layout/quickcontact_content.xml +6 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,12 @@ android:visibility="gone" cardview:cardCornerRadius="@dimen/expanding_entry_card_card_corner_radius" /> <com.android.contacts.quickcontact.ExpandingEntryCardView style="@style/ExpandingEntryCardStyle" android:id="@+id/labels_card" android:visibility="gone" cardview:cardCornerRadius="@dimen/expanding_entry_card_card_corner_radius" /> <com.android.contacts.quickcontact.ExpandingEntryCardView style="@style/ExpandingEntryCardStyle" android:id="@+id/recent_card" Loading res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ <dimen name="expanding_entry_card_item_padding_start">20dp</dimen> <dimen name="expanding_entry_card_item_padding_end">8dp</dimen> <dimen name="expanding_entry_card_item_padding_top">13dp</dimen> <dimen name="expanding_entry_card_item_padding_bottom">16dp</dimen> <dimen name="expanding_entry_card_item_padding_bottom">13dp</dimen> <dimen name="expanding_entry_card_item_image_spacing">27dp</dimen> <!-- Dimensions for a button in ExpandingEntryCardView --> Loading src/com/android/contacts/activities/PeopleActivity.java +37 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ import com.google.common.util.concurrent.Futures; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; /** Loading Loading @@ -140,6 +141,9 @@ public class PeopleActivity extends AppCompatContactsActivity implements private static final String KEY_CONTACTS_VIEW = "contactsView"; private static final String KEY_NEW_GROUP_ACCOUNT = "newGroupAccount"; public static final String ACTION_OPEN_GROUP_FROM_CONTACT = "openGroupFromContact"; public static final String EXTRA_GROUP_ID = "groupId"; private static final long DRAWER_CLOSE_DELAY = 300L; private ContactsIntentResolver mIntentResolver; Loading @@ -157,6 +161,8 @@ public class PeopleActivity extends AppCompatContactsActivity implements private boolean mShouldSwitchToGroupView; private boolean mGroupOpenedFromContact = false; private ContactsView mCurrentView; private CoordinatorLayout mLayoutRoot; Loading Loading @@ -419,12 +425,34 @@ public class PeopleActivity extends AppCompatContactsActivity implements Log.d(Constants.PERFORMANCE_TAG, "PeopleActivity.onCreate finish"); } getWindow().setBackgroundDrawable(null); openProvidedGroupFromContact(getIntent()); } private void openProvidedGroupFromContact(Intent intent) { if (intent == null) { return; } final String action = intent.getAction(); if (Objects.equals(action, ACTION_OPEN_GROUP_FROM_CONTACT)) { long groupId = intent.getLongExtra(EXTRA_GROUP_ID, -1); if (groupId != -1) { onGroupMenuItemClicked(groupId); mGroupOpenedFromContact = true; } } } @SuppressWarnings("MissingSuperCall") // TODO: Fix me @Override protected void onNewIntent(Intent intent) { final String action = intent.getAction(); openProvidedGroupFromContact(intent); if (isGroupOpenedFromContact()) { return; } if (GroupUtil.ACTION_CREATE_GROUP.equals(action)) { mGroupUri = intent.getData(); if (mGroupUri == null) { Loading Loading @@ -802,6 +830,11 @@ public class PeopleActivity extends AppCompatContactsActivity implements return; } if (isGroupOpenedFromContact()) { finish(); return; } // Handle the back event in "second level". if (isGroupView()) { onBackPressedGroupView(); Loading Loading @@ -1246,6 +1279,10 @@ public class PeopleActivity extends AppCompatContactsActivity implements return mCurrentView == ContactsView.GROUP_VIEW; } public boolean isGroupOpenedFromContact() { return mGroupOpenedFromContact; } protected boolean isAssistantView() { return mCurrentView == ContactsView.ASSISTANT; } Loading src/com/android/contacts/model/GroupMembershipTools.java 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019-2023 E FOUNDATION * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.android.contacts.model; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract; public class GroupMembershipTools { public boolean isTypeGroupMembership(String mimeType) { return ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE.equals(mimeType); } public String getGroupTitle(Context context, long groupId) { final Uri groupUri = ContactsContract.Groups.CONTENT_URI; final String[] projection = new String[]{ ContactsContract.Groups._ID, ContactsContract.Groups.TITLE, }; final String selection = ContactsContract.Groups.AUTO_ADD + " = ? AND " + ContactsContract.Groups.FAVORITES + " = ?"; final String[] selectionArgs = new String[]{"0", "0"}; try { Cursor groupCursor = context.getContentResolver().query(groupUri, projection, selection, selectionArgs, null, null); if (groupCursor.moveToFirst()) { do { final int groupIdColumnIndex = groupCursor.getColumnIndex(ContactsContract.Groups._ID); final int groupTitleColumnIndex = groupCursor.getColumnIndex(ContactsContract.Groups.TITLE); if (groupIdColumnIndex == -1 || groupTitleColumnIndex == -1) { groupCursor.close(); return null; } final long id = groupCursor.getLong(groupIdColumnIndex); final String title = groupCursor.getString(groupTitleColumnIndex); if (groupId == id) { groupCursor.close(); return title; } } while (groupCursor.moveToNext()); } groupCursor.close(); return null; } catch (Exception e) { e.printStackTrace(); return null; } } } Loading
res/layout/expanding_entry_card_item.xml +19 −14 Original line number Diff line number Diff line Loading @@ -67,25 +67,30 @@ android:layout_marginEnd="@dimen/expanding_entry_card_item_sub_header_icon_margin_right" android:layout_marginBottom="@dimen/expanding_entry_card_item_sub_header_icon_margin_bottom" /> <TextView <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/text" android:layout_below="@+id/sub_header" android:layout_toEndOf="@+id/icon_text" android:layout_toStartOf="@+id/third_icon" android:textAlignment="viewStart" android:textColor="@color/quickcontact_entry_sub_header_text_color" /> android:layout_toEndOf="@+id/icon" android:orientation="horizontal" android:gravity="center" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/icon_text" android:layout_toEndOf="@+id/icon" android:layout_below="@+id/sub_header" android:layout_marginTop="@dimen/expanding_entry_card_item_text_icon_margin_top" android:layout_marginEnd="@dimen/expanding_entry_card_item_text_icon_margin_right" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/text" android:textAlignment="viewStart" android:textColor="@color/quickcontact_entry_sub_header_text_color" /> </LinearLayout> <ImageView android:id="@+id/third_icon" android:layout_width="@dimen/default_clickable_icon_size" Loading
res/layout/quickcontact_content.xml +6 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,12 @@ android:visibility="gone" cardview:cardCornerRadius="@dimen/expanding_entry_card_card_corner_radius" /> <com.android.contacts.quickcontact.ExpandingEntryCardView style="@style/ExpandingEntryCardStyle" android:id="@+id/labels_card" android:visibility="gone" cardview:cardCornerRadius="@dimen/expanding_entry_card_card_corner_radius" /> <com.android.contacts.quickcontact.ExpandingEntryCardView style="@style/ExpandingEntryCardStyle" android:id="@+id/recent_card" Loading
res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ <dimen name="expanding_entry_card_item_padding_start">20dp</dimen> <dimen name="expanding_entry_card_item_padding_end">8dp</dimen> <dimen name="expanding_entry_card_item_padding_top">13dp</dimen> <dimen name="expanding_entry_card_item_padding_bottom">16dp</dimen> <dimen name="expanding_entry_card_item_padding_bottom">13dp</dimen> <dimen name="expanding_entry_card_item_image_spacing">27dp</dimen> <!-- Dimensions for a button in ExpandingEntryCardView --> Loading
src/com/android/contacts/activities/PeopleActivity.java +37 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ import com.google.common.util.concurrent.Futures; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; /** Loading Loading @@ -140,6 +141,9 @@ public class PeopleActivity extends AppCompatContactsActivity implements private static final String KEY_CONTACTS_VIEW = "contactsView"; private static final String KEY_NEW_GROUP_ACCOUNT = "newGroupAccount"; public static final String ACTION_OPEN_GROUP_FROM_CONTACT = "openGroupFromContact"; public static final String EXTRA_GROUP_ID = "groupId"; private static final long DRAWER_CLOSE_DELAY = 300L; private ContactsIntentResolver mIntentResolver; Loading @@ -157,6 +161,8 @@ public class PeopleActivity extends AppCompatContactsActivity implements private boolean mShouldSwitchToGroupView; private boolean mGroupOpenedFromContact = false; private ContactsView mCurrentView; private CoordinatorLayout mLayoutRoot; Loading Loading @@ -419,12 +425,34 @@ public class PeopleActivity extends AppCompatContactsActivity implements Log.d(Constants.PERFORMANCE_TAG, "PeopleActivity.onCreate finish"); } getWindow().setBackgroundDrawable(null); openProvidedGroupFromContact(getIntent()); } private void openProvidedGroupFromContact(Intent intent) { if (intent == null) { return; } final String action = intent.getAction(); if (Objects.equals(action, ACTION_OPEN_GROUP_FROM_CONTACT)) { long groupId = intent.getLongExtra(EXTRA_GROUP_ID, -1); if (groupId != -1) { onGroupMenuItemClicked(groupId); mGroupOpenedFromContact = true; } } } @SuppressWarnings("MissingSuperCall") // TODO: Fix me @Override protected void onNewIntent(Intent intent) { final String action = intent.getAction(); openProvidedGroupFromContact(intent); if (isGroupOpenedFromContact()) { return; } if (GroupUtil.ACTION_CREATE_GROUP.equals(action)) { mGroupUri = intent.getData(); if (mGroupUri == null) { Loading Loading @@ -802,6 +830,11 @@ public class PeopleActivity extends AppCompatContactsActivity implements return; } if (isGroupOpenedFromContact()) { finish(); return; } // Handle the back event in "second level". if (isGroupView()) { onBackPressedGroupView(); Loading Loading @@ -1246,6 +1279,10 @@ public class PeopleActivity extends AppCompatContactsActivity implements return mCurrentView == ContactsView.GROUP_VIEW; } public boolean isGroupOpenedFromContact() { return mGroupOpenedFromContact; } protected boolean isAssistantView() { return mCurrentView == ContactsView.ASSISTANT; } Loading
src/com/android/contacts/model/GroupMembershipTools.java 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019-2023 E FOUNDATION * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.android.contacts.model; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract; public class GroupMembershipTools { public boolean isTypeGroupMembership(String mimeType) { return ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE.equals(mimeType); } public String getGroupTitle(Context context, long groupId) { final Uri groupUri = ContactsContract.Groups.CONTENT_URI; final String[] projection = new String[]{ ContactsContract.Groups._ID, ContactsContract.Groups.TITLE, }; final String selection = ContactsContract.Groups.AUTO_ADD + " = ? AND " + ContactsContract.Groups.FAVORITES + " = ?"; final String[] selectionArgs = new String[]{"0", "0"}; try { Cursor groupCursor = context.getContentResolver().query(groupUri, projection, selection, selectionArgs, null, null); if (groupCursor.moveToFirst()) { do { final int groupIdColumnIndex = groupCursor.getColumnIndex(ContactsContract.Groups._ID); final int groupTitleColumnIndex = groupCursor.getColumnIndex(ContactsContract.Groups.TITLE); if (groupIdColumnIndex == -1 || groupTitleColumnIndex == -1) { groupCursor.close(); return null; } final long id = groupCursor.getLong(groupIdColumnIndex); final String title = groupCursor.getString(groupTitleColumnIndex); if (groupId == id) { groupCursor.close(); return title; } } while (groupCursor.moveToNext()); } groupCursor.close(); return null; } catch (Exception e) { e.printStackTrace(); return null; } } }