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

Commit 3e8cc354 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Add account type icon to account info header and change style of

"Saving to"

Screenshots: https://drive.google.com/a/google.com/folderview?id=0BwSNbQ_IWQd2NUFqb21MUm11WU0&usp=sharing

The changes related with "Saving to" (b/25366902) are in:
 - res/layout/editor_account_selector.xml
 - src/com/android/contacts/editor/CompactRawContactsEditorView.java

The changes related with account type icon (b/25189655) are in the
other files. The account type icon is added to account info header
in both full editor and read-only editor.

Bug: 25189655
Bug: 25366902

Change-Id: I4f149f639debd31296da81f6678cda8d01007ea9
parent d26051e0
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -25,12 +25,22 @@
    android:focusable="true"
    >

    <!-- TODO: consider making this a new style, like EditKindIconStyle -->
    <ImageView
        android:id="@android:id/icon"
        android:layout_width="@dimen/editor_kind_icon_size"
        android:layout_height="@dimen/editor_kind_icon_size"
        android:layout_marginEnd="28dp"
        android:layout_gravity="center_vertical"
        />

    <LinearLayout
        android:id="@+id/account_info"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:paddingBottom="24dp"
        android:paddingTop="24dp"
        android:paddingBottom="@dimen/editor_account_header_expandable_top_bottom_padding"
        android:paddingTop="@dimen/editor_account_header_expandable_top_bottom_padding"
        android:orientation="vertical"
        >

+14 −1
Original line number Diff line number Diff line
@@ -40,8 +40,9 @@
        android:layout_weight="1"
        android:layout_gravity="center_vertical"
        android:orientation="vertical"
        android:layout_marginStart="4dp"
        android:layout_marginEnd="48dp"
        style="@android:style/Widget.Material.Spinner.Underlined">
        >

        <TextView
            android:id="@+id/account_type_selector"
@@ -65,4 +66,16 @@

    </LinearLayout>

    <ImageView
        android:src="@drawable/ic_menu_expander_minimized_holo_light"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical|end"
        android:layout_alignParentEnd="true"
        android:paddingStart="@dimen/editor_round_button_padding_left"
        android:paddingEnd="@dimen/editor_round_button_padding_right"
        android:paddingTop="@dimen/editor_round_button_padding_top"
        android:paddingBottom="@dimen/editor_round_button_padding_bottom"/>


</LinearLayout>
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -108,6 +108,12 @@
    <!-- Top margin for the first field of the compact contact editor -->
    <dimen name="editor_compact_first_field_padding">10dp</dimen>

    <!-- Top and bottom padding for the two text views in editor account header expandable -->
    <dimen name="editor_account_header_expandable_top_bottom_padding">24dp</dimen>

    <!-- left padding for the two text views in editor account header expandable -->
    <dimen name="editor_account_header_expandable_left_padding">4dp</dimen>

    <!-- Width and height of the expanded contact photo on the contact detail page -->
    <dimen name="detail_contact_photo_expanded_size">400dip</dimen>

@@ -278,4 +284,5 @@

    <!-- Top margin for "Saving to" account header text field. -->
    <dimen name="compact_editor_account_header_top_margin">3dp</dimen>

</resources>
+1 −1
Original line number Diff line number Diff line
@@ -852,7 +852,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
                EditorUiUtils.getAccountInfoContentDescription(
                        accountInfo.first, selectorTitle));

        mAccountSelector.setOnClickListener(new View.OnClickListener() {
        mAccountSelectorContainer.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                final ListPopupWindow popup = new ListPopupWindow(getContext(), null);
+17 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.contacts.GroupMetaDataLoader;
@@ -77,6 +79,7 @@ public class RawContactEditorView extends BaseRawContactEditorView {
    private View mAccountHeader;
    private TextView mAccountHeaderTypeTextView;
    private TextView mAccountHeaderNameTextView;
    private ImageView mAccountIconImageView;

    private long mRawContactId = -1;
    private boolean mAutoAddToDefaultGroup = true;
@@ -140,6 +143,17 @@ public class RawContactEditorView extends BaseRawContactEditorView {
        mAccountHeader = findViewById(R.id.account_header_container);
        mAccountHeaderTypeTextView = (TextView) findViewById(R.id.account_type);
        mAccountHeaderNameTextView = (TextView) findViewById(R.id.account_name);
        mAccountIconImageView = (ImageView) findViewById(android.R.id.icon);

        // The same header is used by both full editor and read-only editor view. The header is
        // left-aligned with read-only editor view but is not aligned well with full editor. So we
        // need to shift the text in the header a little bit for full editor.
        LinearLayout accountInfoView = (LinearLayout) findViewById(R.id.account_info);
        final int topBottomPaddingDp = (int) getResources().getDimension(R.dimen
                .editor_account_header_expandable_top_bottom_padding);
        final int leftPaddingDp = (int) getResources().getDimension(R.dimen
                .editor_account_header_expandable_left_padding);
        accountInfoView.setPadding(leftPaddingDp, topBottomPaddingDp, 0, topBottomPaddingDp);

        mAccountSelector = findViewById(R.id.account_selector_container);
        mAccountSelectorTypeTextView = (TextView) findViewById(R.id.account_type_selector);
@@ -212,6 +226,9 @@ public class RawContactEditorView extends BaseRawContactEditorView {
        mAccountHeader.setVisibility(mAccountSelector.getVisibility() == View.GONE
                ? View.VISIBLE : View.GONE);

        mAccountIconImageView.setImageDrawable(state.getRawContactAccountType(getContext())
                .getDisplayIcon(getContext()));

        // Show photo editor when supported
        RawContactModifier.ensureKindExists(state, type, Photo.CONTENT_ITEM_TYPE);
        setHasPhotoEditor((type.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null));
Loading