Loading res/layout/compact_account_info.xml +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ android:minHeight="@dimen/editor_min_line_item_height" android:orientation="horizontal" android:background="?android:attr/selectableItemBackground" android:layout_marginBottom="@dimen/compact_editor_name_top_margin" android:visibility="gone" > Loading res/layout/editor_account_selector.xml +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ android:layout_width="match_parent" android:minHeight="@dimen/editor_min_line_item_height" android:orientation="horizontal" android:layout_marginBottom="@dimen/compact_editor_name_top_margin" android:visibility="gone" > <ImageView Loading res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -261,4 +261,7 @@ <!-- Width of padding between columns of photos in photo picker --> <dimen name="photo_picker_column_padding_width">1dp</dimen> <!-- Margin between name field and whatever fields are above it. --> <dimen name="compact_editor_name_top_margin">8dp</dimen> </resources> res/values/strings.xml +4 −1 Original line number Diff line number Diff line Loading @@ -774,7 +774,10 @@ <string name="compact_editor_account_selector_title">Saving to</string> <!-- Label for the linked contacts selector which indicates the number of raw contacts which have been linked together into the aggregate being viewed. [CHAR LIMIT=40] --> <string name="compact_editor_linked_contacts_selector_title">Linked contacts (<xliff:g id="count">%d</xliff:g>)</string> <plurals name="compact_editor_linked_contacts_selector_title"> <item quantity="one">Linked contact</item> <item quantity="other">Linked contacts (<xliff:g id="count">%d</xliff:g>)</item> </plurals> <!-- Quick contact display name with phonetic name --> <string name="quick_contact_display_name_with_phonetic"><xliff:g id="display_name">%s</xliff:g> (<xliff:g id="phonetic_name">%s</xliff:g>)</string> Loading src/com/android/contacts/editor/CompactRawContactsEditorView.java +52 −10 Original line number Diff line number Diff line Loading @@ -756,27 +756,69 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O if (accounts.size() > 1) { addAccountSelector(accountInfo, rawContactDelta); } else { addAccountHeader(accountInfo); addAccountHeader(accountInfo, rawContactDeltas); } } else { addAccountHeader(accountInfo); addAccountHeader(accountInfo, rawContactDeltas); } // The raw contact selector should only display linked raw contacts that can be edited in // the full editor (i.e. they are not newly created raw contacts) Collections.sort(rawContactDeltas, new RawContactDeltaComparator(getContext())); final RawContactAccountListAdapter adapter = new RawContactAccountListAdapter(getContext(), rawContactDeltas); if (adapter.getCount() > 1) { final String accountsSummary = getResources().getString( R.string.compact_editor_linked_contacts_selector_title, adapter.getCount()); final RawContactAccountListAdapter adapter = new RawContactAccountListAdapter(getContext(), getRawContactDeltaListForSelector(rawContactDeltas)); if (adapter.getCount() > 0) { final String accountsSummary = getResources().getQuantityString( R.plurals.compact_editor_linked_contacts_selector_title, adapter.getCount(), adapter.getCount()); addRawContactAccountSelector(accountsSummary, adapter); } } private void addAccountHeader(Pair<String,String> accountInfo) { private RawContactDeltaList getRawContactDeltaListForSelector( RawContactDeltaList rawContactDeltas) { // Sort raw contacts so google accounts come first Collections.sort(rawContactDeltas, new RawContactDeltaComparator(getContext())); final RawContactDeltaList result = new RawContactDeltaList(); for (RawContactDelta rawContactDelta : rawContactDeltas) { if (rawContactDelta.isVisible() && rawContactDelta.getRawContactId() > 0) { // Only add raw contacts that can be opened in the editor result.add(rawContactDelta); } } // Don't return a list of size 1 that would just open the raw contact being edited // in the compact editor in the full editor if (result.size() == 1 && result.get(0).getRawContactAccountType( getContext()).areContactsWritable()) { result.clear(); return result; } return result; } // Returns true if there're multiple writable and no read only, or there're both writable and // read only. For ME profile, return false if there's a read only contact and unsaved local one. private boolean shouldHideAccountHeader(RawContactDeltaList rawContactDeltas) { int writable = 0; int readonly = 0; for (RawContactDelta rawContactDelta : rawContactDeltas) { if (rawContactDelta.isVisible() && rawContactDelta.getRawContactId() > 0) { if (rawContactDelta.getRawContactAccountType(getContext()).areContactsWritable()) { writable++; } else { readonly++; } } } return (writable > 1 || (writable > 0 && readonly > 0)); } private void addAccountHeader(Pair<String,String> accountInfo, RawContactDeltaList rawContactDeltas) { mAccountHeaderContainer.setVisibility(View.VISIBLE); if (shouldHideAccountHeader(rawContactDeltas)) { mAccountHeaderContainer.setVisibility(View.GONE); } // Set the account name final String accountName = TextUtils.isEmpty(accountInfo.first) Loading Loading
res/layout/compact_account_info.xml +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ android:minHeight="@dimen/editor_min_line_item_height" android:orientation="horizontal" android:background="?android:attr/selectableItemBackground" android:layout_marginBottom="@dimen/compact_editor_name_top_margin" android:visibility="gone" > Loading
res/layout/editor_account_selector.xml +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ android:layout_width="match_parent" android:minHeight="@dimen/editor_min_line_item_height" android:orientation="horizontal" android:layout_marginBottom="@dimen/compact_editor_name_top_margin" android:visibility="gone" > <ImageView Loading
res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -261,4 +261,7 @@ <!-- Width of padding between columns of photos in photo picker --> <dimen name="photo_picker_column_padding_width">1dp</dimen> <!-- Margin between name field and whatever fields are above it. --> <dimen name="compact_editor_name_top_margin">8dp</dimen> </resources>
res/values/strings.xml +4 −1 Original line number Diff line number Diff line Loading @@ -774,7 +774,10 @@ <string name="compact_editor_account_selector_title">Saving to</string> <!-- Label for the linked contacts selector which indicates the number of raw contacts which have been linked together into the aggregate being viewed. [CHAR LIMIT=40] --> <string name="compact_editor_linked_contacts_selector_title">Linked contacts (<xliff:g id="count">%d</xliff:g>)</string> <plurals name="compact_editor_linked_contacts_selector_title"> <item quantity="one">Linked contact</item> <item quantity="other">Linked contacts (<xliff:g id="count">%d</xliff:g>)</item> </plurals> <!-- Quick contact display name with phonetic name --> <string name="quick_contact_display_name_with_phonetic"><xliff:g id="display_name">%s</xliff:g> (<xliff:g id="phonetic_name">%s</xliff:g>)</string> Loading
src/com/android/contacts/editor/CompactRawContactsEditorView.java +52 −10 Original line number Diff line number Diff line Loading @@ -756,27 +756,69 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O if (accounts.size() > 1) { addAccountSelector(accountInfo, rawContactDelta); } else { addAccountHeader(accountInfo); addAccountHeader(accountInfo, rawContactDeltas); } } else { addAccountHeader(accountInfo); addAccountHeader(accountInfo, rawContactDeltas); } // The raw contact selector should only display linked raw contacts that can be edited in // the full editor (i.e. they are not newly created raw contacts) Collections.sort(rawContactDeltas, new RawContactDeltaComparator(getContext())); final RawContactAccountListAdapter adapter = new RawContactAccountListAdapter(getContext(), rawContactDeltas); if (adapter.getCount() > 1) { final String accountsSummary = getResources().getString( R.string.compact_editor_linked_contacts_selector_title, adapter.getCount()); final RawContactAccountListAdapter adapter = new RawContactAccountListAdapter(getContext(), getRawContactDeltaListForSelector(rawContactDeltas)); if (adapter.getCount() > 0) { final String accountsSummary = getResources().getQuantityString( R.plurals.compact_editor_linked_contacts_selector_title, adapter.getCount(), adapter.getCount()); addRawContactAccountSelector(accountsSummary, adapter); } } private void addAccountHeader(Pair<String,String> accountInfo) { private RawContactDeltaList getRawContactDeltaListForSelector( RawContactDeltaList rawContactDeltas) { // Sort raw contacts so google accounts come first Collections.sort(rawContactDeltas, new RawContactDeltaComparator(getContext())); final RawContactDeltaList result = new RawContactDeltaList(); for (RawContactDelta rawContactDelta : rawContactDeltas) { if (rawContactDelta.isVisible() && rawContactDelta.getRawContactId() > 0) { // Only add raw contacts that can be opened in the editor result.add(rawContactDelta); } } // Don't return a list of size 1 that would just open the raw contact being edited // in the compact editor in the full editor if (result.size() == 1 && result.get(0).getRawContactAccountType( getContext()).areContactsWritable()) { result.clear(); return result; } return result; } // Returns true if there're multiple writable and no read only, or there're both writable and // read only. For ME profile, return false if there's a read only contact and unsaved local one. private boolean shouldHideAccountHeader(RawContactDeltaList rawContactDeltas) { int writable = 0; int readonly = 0; for (RawContactDelta rawContactDelta : rawContactDeltas) { if (rawContactDelta.isVisible() && rawContactDelta.getRawContactId() > 0) { if (rawContactDelta.getRawContactAccountType(getContext()).areContactsWritable()) { writable++; } else { readonly++; } } } return (writable > 1 || (writable > 0 && readonly > 0)); } private void addAccountHeader(Pair<String,String> accountInfo, RawContactDeltaList rawContactDeltas) { mAccountHeaderContainer.setVisibility(View.VISIBLE); if (shouldHideAccountHeader(rawContactDeltas)) { mAccountHeaderContainer.setVisibility(View.GONE); } // Set the account name final String accountName = TextUtils.isEmpty(accountInfo.first) Loading