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

Commit f5dfea4a authored by Walter Jang's avatar Walter Jang
Browse files

Add a multi account KindSectionView (E4)

* This allows us to treat all kinds (i.e. mime types) the
  same (except for name and photo).
* We can also set the icons and add empty editors naturally
  (w/o checking if the kind section is the last on in the list)
* Finally, we can also expand to the full editor in place now

Bug 23589603

Change-Id: Ibdecd8a9ef33cd1db70ffd9fd17e7883555d1fa4
parent 363d3fd7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@

<com.android.contacts.editor.CompactRawContactsEditorView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/editors"
        android:id="@+id/raw_contacts_editor_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/background_primary"
+3 −26
Original line number Diff line number Diff line
@@ -25,34 +25,11 @@
            android:orientation="vertical"/>

    <LinearLayout
            android:id="@+id/phonetic_names"
            android:id="@+id/kind_section_views"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"/>

    <LinearLayout
            android:id="@+id/nicknames"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"/>

    <LinearLayout
            android:id="@+id/phone_numbers"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"/>

    <LinearLayout
            android:id="@+id/emails"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"/>

    <LinearLayout
            android:id="@+id/other"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"/>
            android:orientation="vertical"
            android:animateLayoutChanges="true"/>

    <LinearLayout
            style="@style/SelectableItem"
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
        android:fillViewport="true">

    <com.android.contacts.editor.CompactRawContactsEditorView
            android:id="@+id/editors"
            android:id="@+id/raw_contacts_editor_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
+36 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2015 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- The body surrounding all editors for a specific kind -->

<com.android.contacts.editor.CompactKindSectionView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

    <ImageView
            android:id="@+id/kind_icon"
            style="@style/EditKindIconStyle" />

    <LinearLayout
            android:id="@+id/kind_editors"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" />

</com.android.contacts.editor.CompactKindSectionView>
 No newline at end of file
+1 −25
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl

        final View view = inflater.inflate(
                R.layout.compact_contact_editor_fragment, container, false);
        mContent = (LinearLayout) view.findViewById(R.id.editors);
        mContent = (LinearLayout) view.findViewById(R.id.raw_contacts_editor_view);
        return view;
    }

@@ -349,30 +349,6 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl
        }
    }

    @Override
    public void onExpandEditor() {
        // Determine if this is an insert (new contact) or edit
        final boolean isInsert = isInsert(getActivity().getIntent());

        if (isInsert) {
            // For inserts, prevent any changes from being saved when the base fragment is destroyed
            mStatus = Status.CLOSING;
        } else if (hasPendingRawContactChanges()) {
            // Save whatever is in the form
            save(SaveMode.CLOSE, /* backPressed =*/ false);
        }

        // Prepare an Intent to start the expanded editor
        final Intent intent = isInsert
                ? EditorIntents.createInsertContactIntent(mState, getDisplayName(),
                        getPhoneticName(), mUpdatedPhotos, mNewLocalProfile)
                : EditorIntents.createEditContactIntent(mLookupUri, getMaterialPalette(),
                        mPhotoId, mNameId);
        ImplicitIntentsUtil.startActivityInApp(getActivity(), intent);

        getActivity().finish();
    }

    @Override
    public void onNameFieldChanged(long rawContactId, ValuesDelta valuesDelta) {
        final Activity activity = getActivity();
Loading