Home | History | Annotate | Download | only in layout
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <!-- Copyright (C) 2007 The Android Open Source Project
      3 
      4      Licensed under the Apache License, Version 2.0 (the "License");
      5      you may not use this file except in compliance with the License.
      6      You may obtain a copy of the License at
      7 
      8           http://www.apache.org/licenses/LICENSE-2.0
      9 
     10      Unless required by applicable law or agreed to in writing, software
     11      distributed under the License is distributed on an "AS IS" BASIS,
     12      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13      See the License for the specific language governing permissions and
     14      limitations under the License.
     15 -->
     16 
     17 <view class="com.android.contacts.editor.PhotoEditorView"
     18     xmlns:android="http://schemas.android.com/apk/res/android"
     19     android:layout_width="wrap_content"
     20     android:layout_height="wrap_content"
     21     android:orientation="horizontal" >
     22 
     23     <ImageView
     24         android:id="@+id/kind_icon"
     25         android:src="@drawable/ic_camera_alt_black_24dp"
     26         android:layout_marginTop="13dp"
     27         android:contentDescription="@string/header_photo_entry"
     28         style="@style/EditKindIconStyle" />
     29 
     30     <!-- Needs 10dp of top padding, in order get a total of 32dp of padding between this view
     31         and the previous DataKindSection. Note that EditTexts in other editor.xml files have this
     32         padding built in. Similarly, we need to add 4dp of start margin to make up for the padding
     33         that an EditText would have in this image's place. -->
     34     <ImageView
     35         android:id="@+id/photo"
     36         android:layout_width="72dip"
     37         android:layout_height="72dip"
     38         android:cropToPadding="true"
     39         android:scaleType="centerCrop"
     40         android:layout_marginTop="15dp"
     41         android:layout_marginStart="4dp"
     42         android:contentDescription="@string/description_contact_photo"
     43         android:layout_marginBottom="@dimen/editor_padding_below_photo"
     44         android:gravity="start" />
     45 
     46     <!-- We want 16dp for the effective marginStart. So we set 12dp, since the private
     47         @android:dimen/control_inset_material already includes 4dp of padding. -->
     48     <LinearLayout
     49         android:orientation="vertical"
     50         android:layout_width="wrap_content"
     51         android:layout_height="wrap_content"
     52         android:layout_marginStart="12dp" >
     53 
     54         <!-- The values applied to this button are complicated:
     55             1) We want 16dp internal padding in the button. The background drawable is inset
     56             by private @android:dimen/button_inset_horizontal_material=4dp. Therefore,
     57             we need paddingStart/End of 20dp.
     58             2) In order to leave enough room for the 32dp RadioButton, this can only be 46dp.
     59             This is 2dp less than the default touch target size.
     60             3) This button will appear to be offset by the private
     61             @android:dimen/button_inset_vertical_material amount. Therefore, in order to achieve
     62             15dp of apparent top margin, we only need to apply 9dp. -->
     63         <Button
     64             android:id="@+id/change_button"
     65             android:layout_width="wrap_content"
     66             android:layout_height="46dp"
     67             android:textSize="@dimen/editor_form_text_size"
     68             android:textColor="@color/primary_text_color"
     69             android:layout_marginTop="9dp"
     70             android:paddingStart="20dp"
     71             android:paddingEnd="20dp"
     72             android:text="@string/change_photo" />
     73 
     74         <!-- Don't explicitly set the layout_height in case we need to rely on text wrapping.
     75             For one line, we can expect the height to be 32dp with 16dp text size. -->
     76         <RadioButton
     77             android:id="@+id/primary_checkbox"
     78             android:layout_width="wrap_content"
     79             android:layout_height="wrap_content"
     80             android:layout_marginEnd="48dp"
     81             android:textSize="@dimen/editor_form_text_size"
     82             android:text="@string/primary_photo" />
     83     </LinearLayout>
     84 </view>
     85