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

Commit 22cb663a authored by Flavio Lerda's avatar Flavio Lerda
Browse files

Support scrolling of Updates tab.

This commit changes the Updates tab to use a ListView for its items. The
ListView has an extra header item that overlaps with the carousel tab
(if present), and implements the scrolling which hides part of the
carousel (excluding the tab itself).

The fragment now basically contains only a list view, which will store
all the items, and an optional title (I need to check if that's actually
needed, but for now it is there).

The extra header is implemented with a layout: for those configurations
where there is a carousel, the header contains a placeholder which is
the same size as the carousel; for those configurations where there is
no carousel, the header will be an empty FrameLayout (but in those same
cases, there is a header at the top of the list in the fragment's
layout).

This commit does not take care of making the scrolling work across the
two tabs, e.g., when switching between tabs. I will address those issues
in a follow-up.

Bug: 5119353
Change-Id: I0eb6dcc06d624991ab1f5f8fe1197337ba03286b
parent c0ffb0f0
Loading
Loading
Loading
Loading
+12 −41
Original line number Diff line number Diff line
@@ -14,51 +14,22 @@
     limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
    android:id="@+id/contact_detail_updates_fragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
        android:background="@color/background_social_updates">

        <LinearLayout
    android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="@dimen/detail_update_section_top_padding">
    android:padding="16dip">

    <include
        android:id="@+id/title"
        layout="@layout/contact_detail_kind_title_entry_view" />

            <LinearLayout
                android:id="@+id/update_list"
                android:orientation="vertical"
    <ListView android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
                android:paddingLeft="@dimen/detail_update_section_side_padding"
                android:paddingRight="@dimen/detail_update_section_side_padding" />
        </LinearLayout>

    </ScrollView>
        android:background="@color/background_social_updates"
        android:divider="@null"/>

    <View
        android:id="@+id/alpha_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/black"
        android:alpha=".50"
        android:visibility="gone"/>

    <View
        android:id="@+id/touch_intercept_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent"
        android:visibility="gone"/>

</FrameLayout>
</LinearLayout>
+24 −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.
-->

<!--
  This is a header entry in the contact updates list.
  This is empty because there is no header in this case.
-->
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="0dip"/>
+5 −39
Original line number Diff line number Diff line
@@ -14,52 +14,18 @@
     limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
    android:id="@+id/contact_detail_updates_fragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
    <ListView android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/background_social_updates">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="@dimen/detail_update_section_top_padding">

            <!-- Add a first item that gives us enough space to show the carousel -->
            <view
                class="com.android.contacts.widget.ProportionalLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                ex:ratio="0.66"
                ex:direction="widthToHeight">

                <!-- Put a dummy view here because the ProportionalLayout requires one -->
                <View
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />

            </view>

            <include
                android:id="@+id/title"
                layout="@layout/contact_detail_kind_title_entry_view" />

            <LinearLayout
                android:id="@+id/update_list"
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingLeft="@dimen/detail_update_section_side_padding"
                android:paddingRight="@dimen/detail_update_section_side_padding" />
        </LinearLayout>

    </ScrollView>
        android:background="@color/background_social_updates"
        android:divider="@null"/>

    <View
        android:id="@+id/alpha_overlay"
+35 −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.
-->

<!--
  This is a header entry in the contact updates list.
  Add a first item that gives us enough space to show the carousel
-->
<view
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
    class="com.android.contacts.widget.ProportionalLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ex:ratio="0.66"
    ex:direction="widthToHeight">

    <!-- Put a dummy view here because the ProportionalLayout requires one -->
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</view>
+11 −41
Original line number Diff line number Diff line
@@ -14,51 +14,21 @@
     limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
    android:id="@+id/contact_detail_updates_fragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
        android:background="@color/background_social_updates">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="@dimen/detail_update_section_top_padding">
    android:orientation="vertical">

    <include
        android:id="@+id/title"
        layout="@layout/contact_detail_kind_title_entry_view" />

            <LinearLayout
                android:id="@+id/update_list"
                android:orientation="vertical"
    <ListView android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
                android:paddingLeft="@dimen/detail_update_section_side_padding"
                android:paddingRight="@dimen/detail_update_section_side_padding" />
        </LinearLayout>

    </ScrollView>
        android:background="@color/background_social_updates"
        android:divider="@null"/>

    <View
        android:id="@+id/alpha_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/black"
        android:alpha=".50"
        android:visibility="gone"/>

    <View
        android:id="@+id/touch_intercept_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="?android:attr/selectableItemBackground"
        android:visibility="gone"/>

</FrameLayout>
</LinearLayout>
Loading