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

Commit fd43cdde authored by Flavio Lerda's avatar Flavio Lerda
Browse files

Layout for Updates with multiple images.

Use a table layout to arrange images in the updates: if the number of
images is even (including no images), the text is placed on its own row.
Otherwise, the text is added together with the last image.

Bug: 5123875
Change-Id: I372a15a3d384fbea79a1cd9f225db3f05996f5d4
parent 485f5eb5
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -19,16 +19,16 @@
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
    <TableLayout
        android:id="@+id/stream_item_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/detail_update_section_item_vertical_padding"
        android:paddingBottom="@dimen/detail_update_section_item_vertical_padding"
        android:paddingBottom="@dimen/detail_update_section_item_last_row_extra_vertical_padding"
        android:paddingLeft="@dimen/detail_update_section_item_horizontal_padding"
        android:paddingRight="@dimen/detail_update_section_item_horizontal_padding"
        android:background="@drawable/list_selector"
        android:orientation="vertical" />
        />

    <View
        android:id="@+id/horizontal_divider"
@@ -37,4 +37,5 @@
        android:layout_marginLeft="@dimen/detail_update_section_side_padding"
        android:layout_marginRight="@dimen/detail_update_section_side_padding"
        android:background="?android:attr/dividerHorizontal" />

</LinearLayout>
+77 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->

<TableRow
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
    android:paddingBottom="@dimen/detail_update_section_between_items_vertical_padding">

    <view
        class="com.android.contacts.widget.ProportionalLayout"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_marginRight="@dimen/detail_update_section_between_items_horizontal_padding"
        android:layout_weight="1"
        ex:ratio="1"
        ex:direction="widthToHeight">
        <ImageView
            android:id="@+id/stream_item_first_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </view>

    <view
        class="com.android.contacts.widget.ProportionalLayout"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        ex:ratio="1"
        ex:direction="widthToHeight">
        <LinearLayout
            android:id="@+id/stream_item_second_text"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView android:id="@+id/stream_item_html"
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_weight="1"
                android:textSize="16sp"
                android:textColor="?android:attr/textColorPrimary" />

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <TextView android:id="@+id/stream_item_attribution"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:textColor="?android:attr/textColorSecondary" />

                <TextView android:id="@+id/stream_item_comments"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/detail_update_section_attribution_comments_padding"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:textColor="?android:attr/textColorSecondary" />
            </LinearLayout>

        </LinearLayout>
    </view>

</TableRow>
+8 −8
Original line number Diff line number Diff line
@@ -15,15 +15,16 @@
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="@dimen/detail_update_section_between_items_vertical_padding">

    <TextView android:id="@+id/stream_item_html"
        android:layout_width="wrap_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        android:textColor="@color/social_update_text_color" />
        android:textColor="?android:attr/textColorPrimary" />

    <LinearLayout
        android:orientation="horizontal"
@@ -33,14 +34,13 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/social_update_attribution_color" />
            android:textColor="?android:attr/textColorSecondary" />

        <TextView android:id="@+id/stream_item_comments"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="4dip"
            android:layout_marginLeft="@dimen/detail_update_section_attribution_comments_padding"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/social_update_comments_color" />
            android:textColor="?android:attr/textColorSecondary" />
    </LinearLayout>

</LinearLayout>
+49 −0
Original line number Diff line number Diff line
@@ -14,19 +14,36 @@
     limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
<TableRow
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
    android:paddingBottom="@dimen/detail_update_section_between_items_vertical_padding">

    <FrameLayout android:id="@+id/stream_pair_first"
    <view
        class="com.android.contacts.widget.ProportionalLayout"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1" />
        android:layout_marginRight="@dimen/detail_update_section_between_items_horizontal_padding"
        android:layout_weight="1"
        ex:ratio="1"
        ex:direction="widthToHeight">
        <ImageView
            android:id="@+id/stream_item_first_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </view>

    <FrameLayout android:id="@+id/stream_pair_second"
        android:paddingLeft="@dimen/detail_update_section_internal_padding"
    <view
        class="com.android.contacts.widget.ProportionalLayout"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1" />
</LinearLayout>
 No newline at end of file
        android:layout_weight="1"
        ex:ratio="1"
        ex:direction="widthToHeight">
        <ImageView
            android:id="@+id/stream_item_second_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </view>

</TableRow>
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
    <dimen name="shortcut_icon_size">64dip</dimen>
    <dimen name="list_section_height">37dip</dimen>
    <dimen name="detail_update_section_item_vertical_padding">32dip</dimen>
    <dimen name="detail_update_section_item_last_row_extra_vertical_padding">16dip</dimen>
    <dimen name="search_view_width">400dip</dimen>
    <!-- Center vertically -->
    <dimen name="quick_contact_top_position">-1px</dimen>
Loading