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

Commit da71919d authored by Brian Attwell's avatar Brian Attwell
Browse files

Material design readonly editor

The readonly edit screen is a strange beast. At most, it
only shows fields for phones, emails, photos and
names even if more data is available. This CL updates
the appearance of these fields.

Bug: 18004959
Change-Id: I25847483cef36bb4c98f4b169970344b90e63add
parent 5daa38f7
Loading
Loading
Loading
Loading
+59 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->

<!-- A readonly version of item_photo_editor.xml shown in the readonly raw contact editor. -->
<view class="com.android.contacts.editor.PhotoEditorView"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/kind_icon"
        android:src="@drawable/ic_camera_alt_black_24dp"
        android:layout_marginTop="8dp"
        android:contentDescription="@string/photo_section"
        style="@style/EditKindIconStyle" />

    <!-- Needs 10dp of top padding, in order get a total of 32dp of padding between this view
        and the previous DataKindSection. Note that EditTexts in other editor.xml files have this
        padding built in. Similarly, we need to add 4dp of start margin to make up for the padding
        that an EditText would have in this image's place. -->
    <ImageView
        android:id="@+id/photo"
        android:layout_width="72dip"
        android:layout_height="72dip"
        android:cropToPadding="true"
        android:scaleType="centerCrop"
        android:layout_marginTop="10dp"
        android:layout_marginStart="4dp"
        android:contentDescription="@string/description_contact_photo"
        android:layout_marginBottom="@dimen/editor_padding_below_photo"
        android:gravity="start" />


    <!-- Don't explicitly set the layout_height in case we need to rely on text wrapping.
        For one line, we can expect the height to be 32dp with 16dp text size. -->
    <RadioButton
        android:id="@+id/primary_checkbox"
        android:layout_marginStart="12dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/editor_delete_button_width"
        android:layout_marginTop="10dp"
        android:textSize="@dimen/editor_form_text_size"
        android:text="@string/primary_photo" />
</view>
+27 −35
Original line number Diff line number Diff line
@@ -18,50 +18,42 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <include
        android:id="@+id/kind_title_layout"
        layout="@layout/edit_kind_title" />
    android:layout_marginEnd="@dimen/editor_delete_button_width"
    android:layout_marginBottom="@dimen/editor_padding_between_editor_views"
    android:orientation="horizontal">

    <!-- Shown only when id/kind_title_layout is hidden, dividing a previous item and this item. -->
    <View
        android:id="@+id/divider"
        android:layout_width="match_parent"
        android:layout_height="1px"
        android:layout_marginLeft="8dip"
        android:layout_marginRight="8dip"
        android:layout_marginStart="8dip"
        android:layout_marginEnd="8dip"
        android:background="@color/secondary_header_separator_color" />
    <ImageView
        android:id="@+id/kind_icon"
        style="@style/EditKindIconStyle" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:minHeight="@dimen/editor_min_line_item_height"
        android:layout_marginLeft="16dip"
        android:layout_marginRight="16dip"
        android:layout_marginStart="16dip"
        android:layout_marginEnd="16dip"
        android:orientation="horizontal">
        <TextView
        android:orientation="vertical">

        <EditText
            android:id="@+id/data"
            android:layout_width="0px"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_gravity="center_vertical"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:minHeight="@dimen/editor_min_line_item_height"
            android:textSize="@dimen/editor_form_text_size"
            android:textColor="?android:attr/textColorSecondary"
            android:singleLine="true"/>
        <TextView
            android:singleLine="true"
            android:saveEnabled="false"
            android:enabled="false"/>

        <EditText
            android:id="@+id/type"
            android:layout_width="wrap_content"
            android:layout_width="@dimen/editor_type_label_width"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textSize="@dimen/editor_form_text_size"
            android:textColor="?android:attr/textColorSecondary"
            android:textAllCaps="true"
            android:singleLine="true"/>
            android:minHeight="@dimen/editor_min_line_item_height"
            android:singleLine="true"
            android:saveEnabled="false"
            android:enabled="false"/>

    </LinearLayout>

</LinearLayout>
 No newline at end of file
+28 −23
Original line number Diff line number Diff line
@@ -19,46 +19,51 @@
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingTop="@dimen/editor_padding_top"
    android:paddingBottom="32dip">
    android:paddingTop="@dimen/editor_padding_top">

    <include
        layout="@layout/editor_account_header" />

    <!-- Want 16dp of apparent top padding. Since EditText has 10dp of inset/padding built in,
        only set marginTop=6dp. -->
    <LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:orientation="horizontal"
        android:paddingTop="8dip"
        android:paddingLeft="16dip"
        android:paddingStart="16dip">
        android:layout_height="wrap_content"
        android:minHeight="@dimen/editor_min_line_item_height"
        android:layout_marginBottom="@dimen/editor_padding_between_editor_views"
        android:layout_marginTop="6dp"
        android:orientation="horizontal">

        <TextView android:id="@+id/read_only_name"
            android:layout_width="0dip"
        <ImageView
            android:id="@+id/kind_icon"
            android:src="@drawable/ic_person_black_24dp"
            android:contentDescription="@string/header_name_entry"
            style="@style/EditKindIconStyle" />

        <EditText
            android:id="@+id/read_only_name"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:layout_marginRight="@dimen/editor_delete_button_width"
            android:singleLine="true"
            android:ellipsize="end"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="?android:attr/textColorSecondary" />
            android:textSize="@dimen/editor_form_text_size"
            android:textColor="?android:attr/textColorSecondary"
            android:enabled="false"/>

    </LinearLayout>

    <include
        android:id="@+id/edit_photo"
            android:layout_marginRight="8dip"
            android:layout_marginEnd="8dip"
            layout="@layout/item_photo_editor" />

    </LinearLayout>
        layout="@layout/item_photo_editor_readonly" />

    <Button
        android:id="@+id/button_edit_externally"
        android:text="@string/edit_contact"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="13dip"
        android:layout_marginBottom="13dip"
        android:layout_marginLeft="13dip"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="@dimen/editor_padding_below_photo"
        android:layout_marginEnd="13dip"
        android:layout_marginStart="13dip"/>

    <LinearLayout android:id="@+id/sect_general"
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
    <ImageView
        android:id="@+id/kind_icon"
        android:src="@drawable/ic_person_black_24dp"
        android:contentDescription="@string/header_name_entry"
        style="@style/EditKindIconStyle" />

    <include
+3 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@
    <!-- Minimum height of a row in the Editor -->
    <dimen name="editor_min_line_item_height">48dip</dimen>

    <!-- Width of the delete button (X) in the raw contact editor -->
    <dimen name="editor_delete_button_width">48dp</dimen>

    <!-- The height and width of the delete button should be the same size as an editor row -->
    <dimen name="editor_delete_button_size">@dimen/editor_min_line_item_height</dimen>

Loading